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!

How do I get the value of a dynamically loaded movie clip?

Status
Not open for further replies.

jbezzina

MIS
May 4, 2004
46
MT
I am loading a jpg in _level20

I am trying to get the _width and _height values but I cannot. Here is the code. Can I use getProperty for this?

Thanks,


var myMCL:Object = new MovieClipLoader();

for (b=1; b<21; b++) {
this.button.onRelease = function() {
myMCL.loadMovie("gallery/photo10.jpg", 20);
picWidth = myMCL._width;
picHeight = myMCL._height;
trace(picWidth);
trace(picHeight);
};
}
[/color red]
 
You can't trace anything before the picture is fully loaded!
 
I do not need to read any values before it is loaded, I can wait for it to load before I do anything with it.
 
myMCL.loadMovie("gallery/photo10.jpg", 20);

Do you really think that this line loads a .jpg on level 20?

It's not!

That said...

picWidth = myMCL._width;
picHeight = myMCL._height;
trace(picWidth);
trace(picHeight);

...Should work fine, once the .jpg is fully loaded, but certainely not on the same actionscript as the loadMovie action itself.
Move that code a few frames after the picture is loaded, and the trace should work then!




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top