A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: targeting with variables

  1. #1
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Hi...

    I have multiple movie clips, named in numeric sequence-MC1, MC2, etc...I would like to use a loop counter to target these, but I don't know the correct F5 syntax for targeting movieclips by concatenating a string name and a variable number...

    In F4 it would be:

    Set Variable ("i"=1)
    Loop While (i<=6)
    Begin Tell Target ("/MC" & i)
    Go To and Stop (5)
    End Tell Target
    Set Variable ("i"=i+1)
    End Loop

    Can someone help me translate this into F5? Gracias...

    K.




  2. #2
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    Hi k,
    I don't know if this is the correct syntax, but it works.

    i ++
    if (i<20) {
    MC.duplicateMovieClip("MC"+i, i);
    }

    K

  3. #3
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Hi...

    Uh...thanks, but not quite what I'm looking for...I need to know how to target an existing clip by using part of the name plus a variable...

    The target paths would be something like:

    _root.parentclip.child1.gotoAndStop(1)
    _root.parentclip.child2.gotoAndStop(1)
    etc...

    for about a half-dozen individual clips.

    I've been trying to use something like:

    i = 1;
    while (i<=6) {
    with (_root.parentclip.child add i) {
    gotoAndStop (1);
    }
    i = i+1;
    }

    This doesn't work though...Can anyone help out? TIA...

    K.

  4. #4
    I think this would work:

    Code:
    for (i=1;i<6;i++) {
    _root.parentclip[child +i].gotoAndStop(1);
    }
    that should work... but i havn't tested it out

  5. #5
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Thanks!

    The only change I had to make was putting quotes around the word "child"...

    K.

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