You can't easily talk to AS2 SWFs from AS3.  There are some third party 
solutions.  Google for as3interface or as2interface (I can't remember the name 
right now).

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 rob
Sent: Friday, November 13, 2009 3:20 AM
To: [email protected]
Subject: [flexcoders] Re: Problem with SWFLoader content height and width



Hi,

The SWFs are actually AS2 and created in Flash, not flex. They are out of our 
control so we can't assume they are anything specific.

I tried adding a listener for applicationComplete but didn't get offered that 
option from flex builder (swfloader.content.addEventListener(...)) I did get on 
enter frame though, so was thinking I could add a listener for that, and let it 
run a couple frames before assuming it's ready?

I am not sure this will be the same with AS2 SWFs though?

Will be interesting to hear your thoughts :)

Rob

--- In [email protected]<mailto:flexcoders%40yahoogroups.com>, "Alex 
H" <aha...@...> wrote:
>
> Flex SWFs have 2 frames. The preloader frame's size is based on the 
> Application tag. If you don't set a width/height, you get 500x375. The 
> complete event fires when all the bytes are downloaded but may be handled 
> before the Application frame has had a chance to run. Depending on how the 
> Application finally lays out it could take several more frames to decide on 
> its final size. Usually, we recommend catching the complete event then adding 
> a listener to swfloader.content for "applicationComplete". The child app will 
> be fully baked by the time you get that event.
>
> --- In [email protected]<mailto:flexcoders%40yahoogroups.com>, "rob" 
> <rob_mcmichael@> wrote:
> >
> > I have a complete event on two swfLoaders.
> >
> > Once both of the swf loaders have dispatched their complete events I call a 
> > method to calculate their content's width and height.
> >
> > Something like this:
> >
> > myWidth = mySwfLoader.contentWidth;
> > myWidth += mySwfLoader2.contentWidth;
> >
> > I get an intermittent problem where the content width and height are 
> > reported incorrectly. If I call the method manually later, from a button, 
> > then they always report correctly, even if they have previously reported 
> > incorrectly.
> >
> > Therefore I have assumed that at the point the complete event dispatched by 
> > the SWFLoader, it hasn't calculated it's contents height and width. 
> > Sometimes my method must be asking for this value before it's calculated.
> >
> > My question is if this is a known problem, and if there is another event I 
> > should be waiting for. I don't want to set a time out, to allow for the 
> > content height and with to be calculated.
> >
> > Please let me know if there is another event dispatched by the SWFLoader, I 
> > have tried all the non inherited ones, but with no joy :(
> >
> > Thanks
> >
> > Rob
> >
>

Reply via email to