A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Feb 2001
    Posts
    27

    Using strings in paths

    I have a for loop which duplicates a movieclip called "mc" in the root. mc has a text field called "tf" inside and I want to load the different texts that I get from an external file to every different copy of the MC "mc". I have written a code but it seems not to work.. Can you help me?

    -----
    for(i=0; i<Number(loadVarsText.num);i++) {
    // num is the number of variables
    duplicateMovieClip(mc,"mc"+i,i+1);
    lev = "_level"+(i+1);
    mec = "mc"+i;
    v = "var"+i;
    eval(lev).eval(mec).tf.text = loadVarsText.eval(v);
    setProperty("mc"+i,_x,100);
    setProperty("mc"+i, _y,i*15);
    }
    -----

    Thanx..

  2. #2
    What part doesnt work ?
    loading the diffrent texts in the the mc's ?
    or duplicating the mc's ?
    a example might help to understand the problem
    (¯`·._ (¯`·._--={NoStalGicA}=--_.·`¯) _.·`¯)

  3. #3
    Junior Member
    Join Date
    Feb 2001
    Posts
    27
    in fact I don`t know which part does not work. I think the eval(..) part doesnot work. This is the only code that I use..

  4. #4
    Junior Member
    Join Date
    Feb 2001
    Posts
    27
    The eval functions return "undefined"...

  5. #5
    Senior Member
    Join Date
    May 2003
    Posts
    157
    I'm not 100% sure of what your code was trying to do so I adapted it a bit to make it more simple but hopefully you'll still get the idea:

    for(i=0; i<10;i++) {
    duplicateMovieClip(mc,"mc"+i,i+1);
    mec = eval("mc"+i);
    mec.tf = i;
    setProperty("mc"+i,_x,100);
    setProperty("mc"+i, _y,i*50);
    }
    Attached Files

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