Archive for October, 2010

h1

Calling parent-functions from a loaded SWF

October 1, 2010

If you’re loading an external SWF-file into your Main-SWF (or any other swf), the external SWF cannot call any self-made function you defined in your main by simple write: this.parent.functionName().
The compiler throws an error, saying that he can’t find a method with that name in flash.display:DisplayObjectContainer.

You can avoid this by typecasting the parent as an Object like this:

var fooObject:Object = this.parent as Object;

Now you can call methods from the parent-class: fooObject.functionName();

Follow

Get every new post delivered to your Inbox.