A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Simple question bout for loops

Threaded View

  1. #1
    Mind Chaos
    Join Date
    Oct 2006
    Posts
    96

    Simple question bout for loops

    Ok, so I have 3 objects, named "platform" and then a number, from 1 to 3 ish. On the stage they are platform_mc1 - 3.

    Using for loops to control them all at once is working fine as long as I set the array manually, but when I try to automate it a little more it runs into a problem...no idea why....

    So what I'm doing is this:

    Code:
    var platform:Array = []
    for (i=1; i<3; i++){
    	platform[i] = platform_mc+i
    }
    But it's giving me problems...I don't see why. Here's the way I see it...

    -Declare array named platform, set it to empty.

    -For as long as i, which starts at 1 and increases by one each time, is less than 3, then concatenate the prefix (platform_mc) to an increasing number (thus being platform_mc1 and so forth), and throw it in the list (platform) at the index of i.


    What's wrong here??


    Also the error is : Access of undefined property platform_mc

    Thanks
    Last edited by Sy Mercade; 11-11-2011 at 08:19 PM.
    [Don Kanonji]
    *crosses arms* WAAAAAAAAHAHAHAHAAHAHAHA!!!!!
    [/Don Kanonji]

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