I'm creating a MovieClip subclass (let's call it MyClip
) that I want to use for several library assets. I'll be instantiating these movie clips from ActionScript code. MyClip
has a constructor parameter that allows it to set the initial values of certain properties.
Since I want to use it for multiple library assets, the logical way to do it seems to specify it in the "Base Class" text box in the "Symbol Properties" dialog. The problem is that the auto-generated subclasses don't have the constructor with the parameter. Instead, Flash tries to generate them with a default constructor only, which also fails because MyClip
doesn't have a default constructor.
Is there any way around this, apart from deferring property initialization to a normal method?
Edit: I haven't been clear enough, I'll try to clarify here. If this is the MyClip
class:
public class MyClip extends MovieClip
{
private var someValue : Number;
public function MyClip(someValue : Number)
{
this.someValue = someValue;
}
}
and I specified MyClip
as base class for symbol MyClipA in the library, I would ideally like to be able to do clip = new MyClipA(17);
without having to write the MyClipA
class myself.