Thanks Adrian! that will do the trick. 
In the meantime, I also found another way, not as elegant as yours

//inside the fla
var myParent = loaderInfo.loader.parent.parent;
 myParent.doSomething('do it');

thanks again




________________________________
From: Adrian Williams <adri...@familytreedna.com>
To: flexcoders@yahoogroups.com
Sent: Tuesday, March 10, 2009 2:45:30 PM
Subject: Re: [flexcoders] calling a function from swf


This is pretty straightforward. We do a lot of this in our dashboard app where 
we have a function called registerSWF( ).  This helps us keep tabs on all the 
swf objects that are loaded on the dash.

            private var registeredSWF: ArrayCollection = new ArrayCollection( );
            public function registerSWF( swf:Object) :void
            {
                registeredSWF. addItem(swf) ;
            }

Each child swf calls this functions when they load:

                application. registerSWF( this);                

Then, when we need to access a function from within the child swf, we pull it 
from the AC (so we can reference it) and directly call the function:

                for each (var swf:Object in registeredSWF)
                {
                    swf.someFunction( vars);
                }

Keep in mind that the function in your child swf must be in the public scope or 
the parent app cannot see it.

HTH,
Adrian


thibodeau.alain wrote: 
Hi all,
I am thinking this is simple, but I cannot find the proper way of doing this. 

I have a flex application that loads a swf file. I want to be able to call a 
function that is in the flex application from the swf file. 

>From my fla I tried calling _root, Application. application, _parent... 

Anyone know how I can do this ?

thanks!





      __________________________________________________________________
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! 
Canada Messenger at http://ca.beta.messenger.yahoo.com/

Reply via email to