PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[RESOLVED] loop + variable naming questiom
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] loop + variable naming questiom

  1. #1
    AS3 N00B
    Join Date
    Feb 2002
    Location
    NYC
    Posts
    308

    resolved [RESOLVED] loop + variable naming questiom

    Actionscript Code:
    function newsListLoad(evt:Event) {
        var i:int = 0;
        var count:int = 4;

        while(i<count){
            i++;
            testSubject = evt.target.data.["newsID"+i];
        }
    }

    ok the part i need help is on Line 7 at the very end, I want to target data using "i" as part of the name but I'm unsure how to do it with a loop.
    -Neo

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    if you mean that data has newsID1, newsID2, etc properties, then you almost have it. The bracket syntax for accessing properties is an alternative to the dot syntax. You are trying to use both. Just remove the dot between data and the opening [.

  3. #3
    AS3 N00B
    Join Date
    Feb 2002
    Location
    NYC
    Posts
    308
    your awesome!

    i totally forgot about that. thanks again!
    -Neo

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