A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: variable advice needed

  1. #1
    Senior Member
    Join Date
    Oct 2002
    Location Location

    variable advice needed

    You'd think i'd know this by now... anyway, i'm making a game whose game variables change depending on the round (let's say during round 2, var timer2 = 100, during round 3, var timer3 = 140) i have numerous variables that will change like this.

    So ok, i have an MC that at the beginning of the round finds out what round we're in (let's say var theRound = 3; for the example) I want to set the generic variable "timeRemaining" to the value of "timer3" using "theRound"

    so how do i do this? I'm imagining something like:

    timeRemaining = "timer" + (theRound)

    am i close? thanks.... ku (C8;

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Los Angeles
    Assuming all these variables are attached to the _root timeline, you can do this:

    timeRemaining = _root["timer" + theRound];

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