Application.application should work also.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Alain Thibodeau
Sent: Tuesday, March 10, 2009 3:31 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] calling a function from swf

 

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!

 

  _____  

Be smarter than spam. See how smart SpamGuard is at giving junk email the
boot with the  <http://ca.promos.yahoo.com/newmail/overview2/> All-new
Yahoo! Mail 



Reply via email to