A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: falling image

  1. #1
    Mets in 02!?
    Join Date
    Apr 2002
    Posts
    30
    Hi, I'm making a page and in the background I want it to look like it's raining I created a raindrop and converted to a movieclip. I added this script for a random start and reset. How can I get it to fall down the screen and get duplicate it a few times?
    onClipEvent (load) {
    function reset () {
    this._x = random(450)+10;
    this._y = 100;
    rainSpeed = random(20)-1;
    }
    reset();
    thanx for the help in advance

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    323
    Ok... Put that code in frame 1...

    In frame 2, put this code:

    _y = _y + rainSpeed;
    if ( _y > GROUND_Y ) {
    reset();
    }

    Kinda obvious what "GROUND_Y" is, right?

    In frame 3, just put:

    gotoAndPlay(2);

    So basically, it'll start out in 1, initialize to a random location, then loop between frames 2 and 3... Frame 2 will keep moving it down until it reaches the bottom, then reset it again... Try it

  3. #3
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    All that has you movie nicely "raining" down the screen and then jumping to a new position to do it again.

    To create lots of raindrops without having to put them onstage, drop one onstage and add this to it for 20 drops, just change the number for more or less

    onClipEvent (load) {
    var CopyCount;
    if (CopyCount <= 20) {
    CopyCount = Number(CopyCount)+1;
    duplicateMovieClip (Raindrop, "Raindrop" add CopyCount, CopyCount);
    }
    }


    mark

  4. #4
    Junior Member
    Join Date
    Apr 2001
    Posts
    7

    call me fool but I need your help

    Hey Guys!

    I'm new at flash scripting but I was looking to do something like this, as mentioned above. I tried this but it didn;t work. It would be great if any of you could please fwd. me the souce file?

    Many thanks

  5. #5
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    I have to apologise
    It doesnt work, the duplicate script being in the onClipEvent means all the mc's try to duplicate themselves 2o times and then those do on and on NOT GOOD!!

    I have built a movie that works, let me know where to send it.

    mark

  6. #6
    Junior Member
    Join Date
    Apr 2001
    Posts
    7

    Post

    Thanks Mark.

    Can you please email me the source file at lostinsydney@hotmail.com.

    Thanks again )

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