A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: repeating actionscript...

  1. #1
    Junior Member
    Join Date
    Feb 2002
    Posts
    8
    I have a script that duplicates movie clips, but I want to have the user specify how many clips are duplicated, how do I do this?
    there will be an input text box for the variable of how many clips to duplicate...

    HELP ME!!!!!



  2. #2
    Junior Member
    Join Date
    Jul 2002
    Posts
    29
    for(i=0; i<userinputvariable; i++){
    myMC.duplicateMovieClip(name+i, depth+i);
    }

  3. #3
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    iNumber is the number from your input box

    put this in an event (button press or something)

    Code:
    for (i = 0; i < iNumber; i++) {
         // duplicate movie here
         trace ("Movie Duplicated " + iNumber + " Times");
    }

  4. #4
    Junior Member
    Join Date
    Feb 2002
    Posts
    8
    thanks all, I will give it a try...

  5. #5
    Junior Member
    Join Date
    Feb 2002
    Posts
    8
    hmmm... When I use this script, it only displays how many times the movie will be duplicated that many times, but only duplicates the MC once per button push...
    bubble is the MC, and bubblez is the duplicated MC


    on (release) {
    for (i=0; i<iNumber; i++) {
    bubble.duplicateMovieClip(bubblez+i, z++, i);
    trace("Movie Duplicated "+iNumber+" Times");
    }
    }


    what is wrong?
    [Edited by happymoonboy on 07-09-2002 at 04:43 PM]

  6. #6
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    your supposed to replace my // comments with the duplicate movieclip code

    Code:
    for (i = 0; i < iNumber; i++) {
         bubble.duplicateMovieClip(bubble+i, i++);
         trace ("Movie Duplicated " + i++ + " Times");
    }

  7. #7
    Junior Member
    Join Date
    Jul 2002
    Posts
    29
    don't worry happymoonboy I encountered the same thing you did with typing out the for statement on the board.

    flashkit doesn't like the < symbol

    everything got duplicated right, they're just placing themselves over each other. try adding something like:

    _root[myMC +i]._x = 20 * i;

    inside the conditional loop

  8. #8
    Junior Member
    Join Date
    Feb 2002
    Posts
    8
    still no dice, gSolo...
    i did it exactly as you did, but it wont duplicate the clip. I think it is maybe a layer problem.

  9. #9
    Junior Member
    Join Date
    Feb 2002
    Posts
    8
    Originally posted by DanCarrey
    don't worry happymoonboy I encountered the same thing you did with typing out the for statement on the board.

    flashkit doesn't like the < symbol

    everything got duplicated right, they're just placing themselves over each other. try adding something like:

    _root[myMC +i]._x = 20 * i;

    inside the conditional loop
    I already have a script in the duplicated MC to move to random coordinates.

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