dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Random duplication of MCs ...teach me

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    116

    Random duplication of MCs ...teach me

    Need some help with this one...

    I want an MC to appear randomly on the screen, say about five at any given moment, and then scale down to nothing as to disappear.
    Used the duplicate feature like once in flash before,...i know, i know, but here I am asking for help so teach me and I shall know and never ask again.

    Here's what I got so..

    i = 0;
    if (i<100) {
    duplicateMovieClip (_root.mymc, "mymc" add i, 10+i);
    setProperty (["mymc"] add i, _yscale, "300");
    setProperty (["mymc"] add i, _xscale, "300");
    i = (i+1);
    }

    I have the if statement, because I want this duplication of mc's to last only for a few seconds, like 8sec. The 10+i, because I need a number of layers set aside.

    Thanks flash gurus

  2. #2
    Rusty Flasher
    Join Date
    Jul 2002
    Location
    Utahr
    Posts
    51
    Fla****ok

    I don't exactly understand what you're doing, but from what it sounds like you want to randomly duplicate a movie clip, and then you want the duplicated movie clip to scale from 300% to invisible? If I understand right, then this is how I would do it.

    I would set up a random variable, and call it whatever you want. We'll just call ours 'n'

    //this picks a random number between 0 and 10
    n = rand(10)

    //then I would set up a loop

    i = 0
    while (i<n)
    {
    duplicateMovieClip (_root.mymc, "mymc" + i, 0)
    i = i++
    }

    This will randomly duplicate your movie clip. To make it disappear, I would set up the tween in the movie clip that is being duplicated and then leave the last frame blank. I'm not sure if this will help you out or not, but that is how I would do it. I think you get the general idea.



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