all groups > flash actionscript > march 2005 >
You're in the

flash actionscript

group:

movie clip width


movie clip width Andy Petroski
3/18/2005 9:31:07 PM
flash actionscript:
I'm dynamically loading a movie clip and want to get the width of the movie
clip after it's loaded. I'm having difficulty doing so with the following
action script:

eval("image" +
pos).loadMovie(["http://www.all-health.com/logos/logo_images/" +
eval("dataReceiver.Logo" + i)])
trace("movieclip: " + eval("image" + pos))
trace("imagepath: " + ["http://www.all-health.com/logos/logo_images/" +
eval("dataReceiver.Logo" + i)])
trace("width: " + eval("image" + pos)._width)

Everything's loading, but width returns 0. Any thoughts on how to get the
width of the dynamically loaded movie clip? BTW, I'm using Flash MX in
Windows XP.

Re: movie clip width Byron Canfield
3/22/2005 11:35:09 PM
That is because you are querying for the width before the image (or movie)
has loaded. Simply issuing the loadMovie command does not instantly load the
movie. Loading takes time -- far more time that executing the next line of
code (the next line of code does not wait to execute until the movie is
loaded -- Flash just goes right on ahead and executes everything in the
frame). You must explicitly text for load completion by any one of the many
methods details in literally hundreds of threads here.

--
--------
Reality will not be altered to comply with preconceived notions.

Byron "Barn" Canfield
Flash example files: http://www.canfieldstudios.com

AddThis Social Bookmark Button