A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: building varibles using the String comand.

  1. #1
    Watch Your Head. GooseBump's Avatar
    Join Date
    Apr 2003
    Location
    The Resturant at the end of the Universe
    Posts
    431

    building varibles using the String comand.

    I'm working with flash 5.

    Is there a way to build a variable using the string command when seting it's value? For example I have the following variables:

    vnumber1
    vnumber2
    vnumber3

    whichv

    when I click a button it does the following:

    on (release){
    _root.whichv = 2;
    }

    I then have a movie clip looping in the background that says:

    String("_root.vnumber" + _root.whichv) = "test 2"

    however this doesn't seem to work...

    any clues?

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hi,

    code:

    _root.whichv = 2;
    _root["vnumber" + _root.whichv] = "test 2";
    trace(_root.vnumber2); // displays test 2


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