Extending a class defined in a SWF asset file


#1

In Animate/Flash using actionscript 3, I can write a class definition for a symbol stored in a SWF file and its Export for Actionscript is checked. For example if there’s a symbol in the SWF file linked to the name MyClip I can write this class:

package;
import flash.display.MovieClip;
class MyClip extends MovieClip
{
var myClip:MyClip;
public function new()
{
super();
this.gotoAndStop(1);
}
}

If I do that in OpenFl, and then try to use the MyClip class, nothing appears. Same with any class I define in the SWF files.

Is the an aspect of Animate/Flash that OpenFl doesn’t duplicate or is there a way to do this?


#2

Hi Drmeizie,
No it’s not done that way in Open FL.

Please check this tutorial:
http://www.openfl.org/learn/haxelib/tutorials/using-swf-assets/


#3

I think it may be possible to do this, but it’s easier if you generate automatic classes, then extend those, like MyCustomClass extends SWFMySymbol and instantiate that