Hey guys,
This is my first question to Kirupa.com
Here’s my function:
[AS]
leftBnd = 100;
rightBnd = 730;
topBnd = 15;
lowBnd = 360;
insertMovie = function(swf){
with(_root){
emptyClip.unloadMovie();
emptyClip._visible = false;
emptyClip.loadMovie(swf);
trace("width: " + emptyClip._width);
trace("height: " + emptyClip._height);
xpos = (rightBnd-leftBnd)-emptyClip._width;
xpos = (xpos/2) + leftBnd;
trace("x: " + xpos);
ypos = (lowBnd-topBnd)-emptyClip._height;
ypos = (ypos/2) + topBnd;
trace("y: " + xpos);
emptyClip._x = xpos;
emptyClip._y = ypos;
emptyClip._visible = true;
}
}
[/AS]
Now, the first time this function is executed I get 0 and 0 for the emptyClip’s width and height even though it has run loadMovie(). Why is this? I would think that it would return the width and height of the newly loaded movie… because of this erroneous width and height the movie doesn’t center correctly unless the function is run twice to load the same movie.
The second time it is run it returns the w and h of the first loaded movie…
the third time it returns the w and h of the second movie, etc, etc.
Any help?
thanks
georges