|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
centering MovieClip on loadMovie()
Hey guys,
Here's my function: 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; } } 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 |
|
#2
|
|||
|
|||
|
You need to load the SWF before you start to run the function to get the width, etc. Easiest solution would probably be to split this function in two.
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > centering MovieClip on loadMovie() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|