I don't think there is a way to force SWFLoader to know its width when it 
dispatches the COMPLETE event.  That event means the bytes are downloaded, but 
they may not be fully consumed yet.  However, it should be available on the 
UPDATE_COMPLETE that follows the COMPLETE event.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Jamie S
Sent: Thursday, June 18, 2009 6:05 PM
To: [email protected]
Subject: Re: [flexcoders] my SWFLoader wont give me the correct width and height





That sorta works. It's a way of getting notified when the properties
do finally get updated . But i still have to do if( swfLoader.width
!=0 && swfLoader.height != 0 ){ ... }. And since I really only need to
run that piece of code once, I would have to remove the listener after
the code successfully gets executed.

I still don't understand why calling swfLoader.validateNow() does not
work when I try to call it in the 'complete' handler.

Jamie

On Thu, Jun 18, 2009 at 5:29 PM, Gordon 
Smith<[email protected]<mailto:gosmith%40adobe.com>> wrote:
>
>
> Try checking the values in an "updateComplete" handler.
>
>
>
> Gordon Smith
>
> Adobe Flex SDK Team
>
>
>
> From: [email protected]<mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] On
> Behalf Of Jamie S
> Sent: Thursday, June 18, 2009 3:27 PM
> To: [email protected]<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] my SWFLoader wont give me the correct width and height
>
>
>
>
> I'm using a SWFLoader to load in an image and i have a handler
> function for COMPLETE. In this load complete handler, i'm trying to
> get the size of the SWFLoader instance by using swfLoader.width,
> swfLoader.height but it always gives me 0. if I set a breakpoint, i
> can see that the $width and $height protected properties are correct
> but no matter what I do I can't get the public width and height
> properties to update. i've tried using validateNow(),
> invalidateSize(), validateSize() and whatever else I can think of but
> the width and hight are still always 0. And I noticed that if i check
> the width and height at some later point in the program, the values
> are correct.
>
> Does anybody know how to force SWFLoader to update its width and height?
>
> Jamie
>
>

Reply via email to