15th Jun 2009
Flash Tips : Calling functions from loaded swf
So your trying to call a function on the parent timeline from a loaded swf. In as2 this was pretty easy, as you could directly call to the parent.function(). In as3 its a little different because of the way the new movieclip objects are handled… but dont worry.. we have the solution.
In the following example.. lets say you have loaded a movie clip through action script from your library. something like
var myMovie = new movieInstance();
stage.addChild(myMovie);
Now lets assume you are trying to call a function when this loaded movie stops playing on the last frame.
if(this.parent.parent != null){
var parentObj:Object = this.parent as Object;
parentObj.function();
}
this.parent can be adjusted to set the depth of the parent you are trying to access. parentObj.function is the name of the function you are trying to access.
If you have any questions, just post, and we will be happy to assist.

Leave a Reply