Wait for the clip to be completely loaded before you check it's width.

Jason Merrill
Bank of America     Instructional Technology & Media   ·   GCIB & Staff Support 
L&LD

Interested in Flash Platform technologies?  Join the Bank of America Flash 
Platform Developer Community 
Interested in innovative ideas in Learning?  Check out the Innovative Learning 
Blog and subscribe.






-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of William Adams
Sent: Friday, December 12, 2008 2:27 PM
To: Flash Coders List
Subject: [Flashcoders] getting the width of a movieclip

Given the code:

var firstImage:Loader = new Loader();
var empty_mc:MovieClip=new MovieClip();
var url:URLRequest = new URLRequest();

addChild(empty_mc);
url = new URLRequest("test.jpg");
firstImage.load(url);
firstImage.x = 10;
firstImage.y = 10;
empty_mc.addChild(firstImage);

why does

trace (empty_mc.width);

yield 0?

and what do I have to do to get the image centered along the lines of:

empty_mc.x = 70-(empty_mc.width/2);

Thanks!

William


-- 
William Adams
senior graphic designer
Fry Communications


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to