Tag Archive for 'parameters'

ActionScript. Constructor parameters when extending MovieClip class, Flash AS2 vs. AS3

Constructor is a method which is called when an object of a class is instanced.
Like in any programming language, in actionscript constructor must have the same name the class has.

Constructor, as a function, may take any number of parameters.
Which is very handy to pass to initialize the objects.
I would recommend using constructor parameters over calling any additional initializing methods.

Here is a good example of using constructors in ActionScript:

var myPoint:Point = new Point(0,0);

And I can give you a lot of such examples.

However, this article is about a particular case, passing parameters to a constructor of your class, which is inherited from (extends) MovieClip.