Regarding exporting a movieclip asset in the library, to be used as a class through actionscript, say you have this class (taken from the help example) for a Circle movieclip in the library:
package
{
import flash.display.MovieClip;
public class Circle extends MovieClip
{
public function Circle()
{
}
public function getArea():Number
{
return Math.PI * Math.pow((width / 2), 2);
}
}
}
Now I want the Circle() constructor to take a parameter (so replaced the function with another one which takes a parameter).
public function Circle(x:Number)
{
trace(x);
}
This has been causing me problems. In the linkage settings, when I chose the Class: DefaultCircle , and Base Class: Circle ,
and in the maintimeline I put something like var myCircle = new DefaultCircle(1) it gives this error:
1136: Incorrect number of arguments. Expected 0.
It basically does not want to take any other parameters for the constructor. It only works when I set the linkage settings to
Class: Circle , and Base Class: flash.display.MovieClip , and change the code in the maintimeline to var myCircle = new
Circle(1) . In this case it works. I want to know why the first scenario doesnt work!
Thanks!