Copy link to clipboard
Copied
I have this code:
var arr: Array;
arr = new Array(blue, brown, green, pink, red);
var type: arr[0] = new arr[0];
(blue, brown, green, pink and red are MovieClips)
And I get this error:
Syntax error: Expecting semicolon before leftbracket.
What exactly is wrong?
You can't use arr[0] for the type.
Maybe you can try:
var type:* = new arr[0] as arr[0];
Copy link to clipboard
Copied
You can't use arr[0] for the type.
Maybe you can try:
var type:* = new arr[0] as arr[0];
Copy link to clipboard
Copied
It seems to be working very good. Thanks.
Copy link to clipboard
Copied
Note that this is what Interfaces are for. So you get type information without being tied to a specific implementation.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more