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!