Thanks for the example, Tracy.
That helped me, too.  I was able to move my event listening and 
dispatching away from the loaded systemManager and onto the loaded 
application.

LT 

--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> Here is a complete example:
> 
> http://www.cflex.net/showFileDetails.cfm?ObjectID=690
> 
>  
> 
> Tracy
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] 
On
> Behalf Of lagos_tout
> Sent: Friday, October 31, 2008 4:45 PM
> To: [email protected]
> Subject: [flexcoders] Re: SWFLoader: access its contents right away
> 
>  
> 
> Wow, I messed up on that.
> 
> Instead of --
> 
> > //broadcast events that parent.swf can respond to.
> > systemManager.dispatch(new Event("myChild"));
> 
> use --
> 
> //broadcast events that parent.swf can respond to.
> systemManager.dispatch(new Event("myEventName"));
> 
> --- In [email protected] 
<mailto:flexcoders%40yahoogroups.com>
> , "lagos_tout" <lagos.tout@> wrote:
> >
> > Hi,
> > 
> > I recently did something like this. But it was more complicated
> because
> > I was loading a swf from a different domain from it's parent. I 
needed
> > to attach an event handler to the swf when SWFLoader was done 
loading.
> 
> > Then at some point, the loaded swf would broadcast an event, and 
the
> > parent swf would be able to respond.
> > 
> > Contrary to what the last poster said, I think you should consider
> > listening for the Event.INIT, not Event.Complete broadcast by your
> > SWFLoader. To determine which one you need, check descriptions of
> these
> > two events in the Flex 3 Language Reference. Here's the meat of 
it:
> > 
> > INIT is broadcast when the properties and methods of a loaded SWF 
file
> > are accessible.
> > COMPLETE is broadcast when content loading is complete.
> > 
> > So, if you need to be able to access child movie clips, I'd say 
use
> > INIT.
> > 
> > Here's some code. Please note that both parent and child are Flex
> > applications, yielding parent.swf and child.swf.
> > 
> > In parent.swf:
> > 
> > mySwfLoader:SWFLoader = new SWFLoader();
> > mySwfLoader.addEventListener(Event.INIT, onInit);
> > function onInit(event:Event):void
> > {
> > mySwfLoader.content.addEventListener("myEventName",
> > onMyEventHandler);
> > }
> > function onMyEventHandler(event:Event):void
> > {
> > //do something
> > }
> > 
> > In child.swf:
> > 
> > //broadcast events that parent.swf can respond to.
> > systemManager.dispatch(new Event("myChild"));
> > 
> > I found that when loading a Flex generated child.swf,
> > mySwfLoader.content is a reference to the child.swf's 
systemManager
> > property. So in order to broadcast events from my loaded swf, you
> > needed to dispatch the event using the child application's
> systemManager
> > property. Hence the last line of code.
> > 
> > Hope that helps.
> > 
> > LT
> > 
> > --- In [email protected]
> <mailto:flexcoders%40yahoogroups.com> , Alex Harui <aharui@> wrote:
> > >
> > > The "complete" event tells you when the load is complete. All
> > SWFLoader loads from the network are asynchronous. You'll always 
have
> > to wait to access the data
> > >
> > > From: [email protected]
> <mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected] 
<mailto:flexcoders%40yahoogroups.com>
> ]
> > On Behalf Of Ignasi Lirio
> > > Sent: Thursday, October 30, 2008 2:36 PM
> > > To: [email protected] 
<mailto:flexcoders%40yahoogroups.com>
> 
> > > Subject: [flexcoders] SWFLoader: access its contents right away
> > >
> > >
> > > Hi all,
> > >
> > > I am new in this group, so hello to everyone :-)
> > >
> > > I want to discuss here about SWFLoader component in Flex 3, and 
how
> to
> > > access their contents... programatically.
> > >
> > > Just for short:
> > >
> > > I have an existing, empty SWFLoader object in my MXML code.
> > >
> > > After some time, I just want to populate it using 
SWFLoader.load()
> > > method with an external SWF movie, that has child MovieClips 
inside.
> > >
> > > Right after call the .load() method, I am insterested (in the 
same
> > > function) to access its children to move positions, etc. So, if 
I do
> > > something like:
> > >
> > > var myloader:SWFLoader= this.swfload;
> > >
> > > and then
> > >
> > > myloader.load("shelf2.swf");
> > >
> > > and then
> > >
> > > myloader.content["s2"].alpha=0.3;
> > >
> > > It does not work at all. I tried myloader.addEventListener(...) 
with
> > > several events, does not work.
> > >
> > > The only way was to put that "myloader.content["s2"].alpha..."
> inside
> > > a setTimeout function, to allow SWFLoader to take some time to 
load.
> > > But you agree with me that this is so dirty.
> > >
> > > any ideas? Thanks to everyone!
> > >
> >
>



Reply via email to