A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [RESOLVED] Rising rain

  1. #1
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305

    resolved [RESOLVED] Rising rain

    Hello, can anyone help me modify the following code (the code to make it rain), so instead of the movieclip duplicating and falling, it duplicates and rises...

    This code is in the movieclip:

    onClipEvent (load) {
    //put the size of the movie stage here
    movieWidth = 550;
    movieHeight = 300;

    //variables that will modify the falling snow
    //this is for the speed of the falling rain
    i = 20+Math.random()*100;
    k = -Math.PI+Math.random()*Math.PI;

    //giving each snowflake unique characteristics
    this._xscale = this._yscale=50+Math.random()*100;
    this._alpha = 75+Math.random()*100;
    this._x = -10+Math.random()*movieWidth;
    this._y = -10+Math.random()*movieHeight;
    }
    onClipEvent (enterFrame) {
    //putting it all together
    rad += (k/180)*Math.PI;
    this._x -= Math.cos(rad);
    this._y += i;
    if (this._y>=movieHeight) {
    this._y = -5;
    }
    if ((this._x>=movieWidth) || (this._x<=0)) {
    this._x = -10+Math.random()*movieWidth;
    this._y = -5;
    }
    }

    This code is in the frame:

    for (k=0; k<25; k++) {
    duplicateMovieClip(_root.rain, "rain"+k, k);
    }

    Also, I can see this wont work if you import the .swf into anther movie, does anyone know why?

    Thanks in advance..

    Steve
    Last edited by thesween; 09-29-2007 at 09:15 PM.

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    change _root to _parent to fix the loading problem.

    change
    this._y += i;
    if (this._y>=movieHeight) {
    this._y = -5;

    to
    this._y -= i;
    if (this._y<=movieHeight) {
    this._y = movieHeight+5;

    that might do it.

  3. #3
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Aha!!! Fantastic, thankyou Bret The rising rain didn't work at first, everything was stuck below the movie,so I fiddled around with it (since you told me where to look). For anyone interested, here's how to reverse the effect... (only a tiny bit different to the above amendments)..

    this._y -= i;
    if (this._y>=movieHeight) {
    this._y = movieHeight+5;

    Thanks again Bret
    Steve

  4. #4
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Actually, Ive been messing round with it more now because it only plays the rising rain for about a second.. I've modified almost every part without success, any idea what Im doing wrong???
    Last edited by thesween; 01-16-2009 at 02:20 PM.

  5. #5
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    If you try the original while exporting in flash 5 it should work. This was an old script from several years ago that was played around on in this forum.
    Attached Files Attached Files
    Any programming language is at its best before it is implemented and used.

  6. #6
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Brilliant, cheers mate. One more problem though, I need it to work inside another movie... Im using it as a background, however, it won't work inside the other movie.. it just displays one rising rain drop. Ive tried changing the _root to parent, but this isnt working... Ive tried chaging the root movie export settings but still nothing... any ideas why it's being difficult?

    Cheers
    Steve

  7. #7
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    http://www.diversioncentral.com/thesween/bubble2.html

    if this works the the fun file is at
    http://www.diversioncentral.com/thesween/bubble2.fun

    let me know if it works becuase it took a while to get it to reproduce and I will not say thats its right to begin with. But it shoiuld work with flash 8. If it does then I can put it on koolexchange.
    Any programming language is at its best before it is implemented and used.

  8. #8
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    FANTASTIC MATE!!! The bubbles are awesome and also work inside another movie perfectly!!! I love the added feature of the bubble moving away from the curser slightly, nice touch.. Top effect! Definetly add that to kool exchange.

    Thanks again for the help
    Steve

  9. #9
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    I changed this and uploaded to koolexchange. It now has floating links effect which has been done before but still something different.

    http://www.diversioncentral.com/thesween/bubble2.html
    Any programming language is at its best before it is implemented and used.

  10. #10
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305
    Awesome mate, looks great... People will definetly be greatful for this one.

    Nice1

    Steve

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