Welcome to TalkGraphics.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    Hello,

    I'm having trouble setting a variable based on a combination of strings and
    another variable. I have several dynamically duplicated movie clips with
    instance names of "qTotalCount_"+i. Inside these movie clips is a variable
    named "qCount". I need to draw the value from "qTotalCount[i].qCount"
    based on the value of a variable named "_root.ID" to set the value of
    another variable called "QuestionTotal". Lets say the instance names are as
    follows:

    ***Movie Clip Variable Values ***
    qTotal1.qCount - value of 1
    qTotal2.qCount - value of 5
    qTotal3.qCount - value of 7

    ***ID value***
    _root.ID - value of 3

    Based on this, I need to set the variable QuestionTotal = qTotal3.qCount.
    I've ran traces on all the movie clips and variables and they are all
    correct. Below is the code that I've been working with but it's not
    working.

    QuestionTotal = _root["qTotalCount_"+_root.ID+".qCount"];
    trace(QuestionTotal);


    Thanks in advance for any help on this matter.

    Scott
    IP

  2. #2
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    A really kind person on the Macromedia Flash Action Script Newsgroup gave me the answer to my question. The proper syntax for this script is:

    QuestionTotal = _root["qTotalCount_"+_root.ID].qCount;
    trace(QuestionTotal);

    Scott
    IP

  3. #3
    Join Date
    Mar 2003
    Posts
    6

    Default

    Concatination i guess,
    remember to seperate strings from vars.
    and u should be OK.
    IP

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •