-
what are "[]" square brackets used for???
Hi Everyone,
I have kind of a silly question.
I am kinda new to as3 and I have seen []
the square brackets used when trying to access array index but I have also seen some people use it in other places. I was just wondering what its exact function was.
If anyone is kind enough to explain this or if possible give a simple example, I would be really grateful.
-
You are correct that [] is used for array and Vector access. http://help.adobe.com/en_US/FlashPla...l#array_access
It is also used to declare a literal array such as ["first", "second", "third"].
It is also used for property lookup by string:
Code:
var o:object = {someprop: "someval"};
trace(o["someprop"]);
trace(o.someprop);
It is also used for Dictionary access
Code:
var d:Dictionary = new Dictionary();
d[someobj] = someotherobject;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|