A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Assigning names to dynamically duplicate MCs

  1. #1
    Learn more, know less.
    Join Date
    Jul 2004
    Posts
    169

    Assigning names to dynamically duplicate MCs

    I would like to create a script that will duplicate MCs at run time and give each copy a specific set of coordinates.

    I haven't written the script yet, but plan to do a for loop that will

    1) Duplicate an existing MC
    2) Assign it a name
    3) Create a variable with target coordinates to move to


    It's #2 that I'm not sure of...any suggestions?

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Make an images folder with images in it. Change the names in the txt file to your image names. This is just to show you how it works.

    Enjoy.

    And don't ask.
    Attached Files Attached Files

  3. #3
    Learn more, know less.
    Join Date
    Jul 2004
    Posts
    169

    Not exactly...

    Thanks, that was helpful, but not exactly what I meant. I've only really been scripting for a couple months though, so I always enjoy seeing new syntax.

    Ok, what I want to do is have a single MC on the stage at run time, and then execute code that will duplicate that MC, without changing it, multiple times. The copies would have exactly same contents as the original and all of the MCs would be on stage at the same time. However each new copy of the original needs its own unique instance name (preferably in numerical sequences like newClip1, newClip2, etc.).

    How might I accomplish that? I don't know the syntax for assigning instance names dynamically (or at all, for that matter).

    As an alternative solution, if there is a way to send instructions to all of the copies as a group, that would be of interest as well.

    Thanks.
    Last edited by JoelTHE; 02-13-2005 at 11:41 AM.

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Try this...
    Attached Files Attached Files

  5. #5
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    However each new copy of the original needs its own unique instance name
    Which is what the code in my example does.

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    So does mine!

  7. #7
    Learn more, know less.
    Join Date
    Jul 2004
    Posts
    169

    Thanks!

    OldNewbie, your code is amazingly concise. That's exactly what I wanted, thanks a lot!

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