views:

16

answers:

1

i'm linked a MovieClip class object to my project, and i will programatically add it to the display list. is there a difference between defining the variable's data type and not doing so? neither produce a runtime error.

//var datatype
var rectangle:Block = new Block();
addChild(rectangle);

//no var datatype
var rectangle = new Block();
addChild(rectangle);
+1  A: 

In ActionScript, it doesn't make much of a difference, AS isn't very strict in these situations. But it is a best-practice to set the datatype, and it allows the IDE to give code-hints.

Pbirkoff
in ActionScript 3.0 it can improve performance.
Allan