0
Explorer
,
/t5/animate-discussions/as3-variable-type-definition/td-p/6338997
Jul 18, 2014
Jul 18, 2014
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?
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Explorer
,
Jul 18, 2014
Jul 18, 2014
You can't use arr[0] for the type.
Maybe you can try:
var type:* = new arr[0] as arr[0];
Explorer
,
/t5/animate-discussions/as3-variable-type-definition/m-p/6338998#M148526
Jul 18, 2014
Jul 18, 2014
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];
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
gibsy
AUTHOR
Explorer
,
/t5/animate-discussions/as3-variable-type-definition/m-p/6338999#M148527
Jul 18, 2014
Jul 18, 2014
Copy link to clipboard
Copied
It seems to be working very good. Thanks.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guide
,
LATEST
/t5/animate-discussions/as3-variable-type-definition/m-p/6339000#M148528
Jul 18, 2014
Jul 18, 2014
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

