Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 simple questions on MovieClipLoader

Status
Not open for further replies.

jbezzina

MIS
May 4, 2004
46
MT
I am loading a small picture into a Movie Clip using the following script:

var MCloader:MovieClipLoader = new MovieClipLoader() ;
MCloader.loadClip("pictures/small_picture.jpg", this.FrameWindow) ; //FrameWindow is the instance name

Picture loads but:

- How can I prevent it from filling in the full size of the Movie Clip?

- How can I control it's alignment?

Thanks !!! ;)
 
The receiving movie clip should be width:0 height:0. Then the clip should just resize to the image.

Add listener to your movieClipLoader.

Code:
var MCloader:MovieClipLoader = new MovieClipLoader() ;
MCloader.loadClip("pictures/small_picture.jpg", this.FrameWindow) ; //FrameWindow is the instance name

myListener = newObject();
myListener.onLoadComplete() = function(){
	this.FrameWindow._x = 0; //set 0 to whatever you want the x coordinate to be
	this.FrameWindow._y = 0; //set 0 to whatever you want the x coordinate to be
	// you can also adjust the size of the image (image quality will suffer)
	this.FrameWindow._xscale = 50;
	this.FrameWindow._yscale = 50;
}
MCloader.addListener(myListener);

Hope it helps!

Wow JT that almost looked like you knew what you were doing!
 
Thanks , but:

_________________________________________________________
**Error** Scene=Scene 1, layer=action, frame=1:Line 5: Left side of assignment operator must be variable or property.
myListener.onLoadComplete() = function(){

Total ActionScript Errors: 1 Reported Errors: 1
_________________________________________________________

Can you please take a look :) ?

Thanks,

John
 
I don't have MX 2004 on the machine I am on right now, but my guess would be that you need to remove the () from the onLoadComplete side of the line. I took that syntax right out of the help, but it looked a bit suspiscious to me... now I know why.

Code:
myListener.onLoadComplete = function(){

If that doesn't work let me know. I'll take a look in the morning.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top