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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resizing a swf movie loaded with loadMovie 1

Status
Not open for further replies.

peterworth

Programmer
Aug 18, 2004
80
GB
hi,

the following gives some funny behaviour:

loadMovie("li.swf","rect_mc");
rect_mc._width = 50;
rect_mc._height = 50;

button_mc.onRelease = function() {
rect_mc._width = 50;
rect_mc._height = 50;
}

the first alteration to _width and _height make the movie a particular size, then when the button is pressed, the movie is made even smaller, but it should be the same (always 50pixels x 50pixels)

any idea why it happens? i have a bigger project where this behaviour is causing some issues.

thanks.
 
loadMovie is not synchronous, so you are basically changing the size of the MovieClip BEFORE it finishes loading the external SWF. If you do that then the external SWF inherits the SCALE of your MovieClip, not the size of your MovieClip. Therefore your MovieClip will not end up with 50px x 50px, but it will end up with (Size of external SWF)x(50px x 50px)/(Original MovieClip size).

You should use MovieClipLoader class.
Code:
var lo = new Object();
var mcl = new MovieClipLoader();
mcl.addListener(lo);
lo.onLoadInit = function() {
	rect_mc._width = 50;
	rect_mc._height = 50;
};
mcl.loadClip("li.swf", rect_mc);

button_mc.onRelease = function() {
	rect_mc._width = 50;
	rect_mc._height = 50;
};


Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top