A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: what are "[]" square brackets used for???

  1. #1
    Junior Member
    Join Date
    Sep 2010

    Question 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.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Austin, TX
    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:
    var o:object = {someprop: "someval"};
    It is also used for Dictionary access
    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

Click Here to Expand Forum to Full Width

HTML5 Development Center