A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Variable for variable

  1. #1
    Senior Member
    Join Date
    Jul 2010
    Posts
    111

    Variable for variable

    Hi! I want to make a variable for a variable, so I have a range of variables.

    For instance, I want it to be like:

    var Number=1

    while(Number<5){
    Variable(Number)=Number
    }

    So I would end up with:

    Variable1=1
    Variable2=2
    Variable3=3
    Variable4=4
    Variable5=5

    I dont know the syntax. Why dont I know this?!

    Thank you for your help!

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Actionscript Code:
    for(i=1;i<6;i++){
        _root["Variable"+i] = i;
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    Can't you just use an array?

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