6 Replies Latest reply on Nov 2, 2009 3:13 PM by Rothrock

    Make It Stop

    colleen_stg

      I'm using a free compiled clip to create a snow effect. Looks great, functions well. But part way through I'd like to shrink the area it's snowing in or stop the snow all together. Basic solutions like blank keyframe, motion tweening to smaller coverage area, changing number of flakes to zero, setting snow alpha to 0, etc do not work.

       

      For several days I've tried varying degrees of work-arounds. Adjusting layer arrangement to move to back, codes for depth manager, invisibility, stop. etc. All have been useless anytime I try to tweek the pre-existing Component, it causes an error or the playback screen turns red.

       

      Anyone have any ideas on how I can make the blizzard stop?

       

      I'm using Flash CS3, Action Script 2 (because that's what the component was created in).

      I found the snow effect in the Adobe Exchange, here's the link: http://flashwanted.com/flash-components/flash-effects/flash-snow.html

        • 1. Re: Make It Stop
          Rothrock Level 5

          Nice effect.

           

          The component makes a clip called snegm on the root level -- regardless of where the component is. It looks like that code uses the getNextHighestDepth() to assign the depth.

           

          I had no problem swaping the depth of snegm, nor with controlling its alpha.

           

          If you have components on your stage, they will be smack up against the highest dynamic depth range and snegm will have a depth of 1048576. At that point you would need to swap it to a lower depth to remove it.

          1 person found this helpful
          • 2. Re: Make It Stop
            colleen_stg Level 1

            Bit of a newb...

             

            So I can use the code MovieClip.swapDepths() where MovieClip is snegm in the actions panel? Can I make the depth change happen on a specific frame (119 for example) or does it have to be triggered by an event like a OnClick or OnRelease?

            • 3. Re: Make It Stop
              Rothrock Level 5

              Yeah that is pretty much it.

               

              There could be some kinds of tricky bits if you are swapping it with timeline placed bits or if you just try to swap it to a negative number...

               

              Here is a good tutorial on how depths work in Flash. (Read the whole thing, but be sure to make it to the second page.) http://www.kirupa.com/developer/actionscript/depths.htm

               

              I'm always intrigued by your second question. I've been using Flash for so long that I really can't remember a time when that seemed mysterious to me.

               

              But yes, there is almost nothing that can be done on a click that can't also just be done without a click. The exception I can think of is going full screen. That requires user interaction.

               

              Just put a keyframe on that frame and add some code. Done!

              1 person found this helpful
              • 4. Re: Make It Stop
                colleen_stg Level 1

                Thank you for responding again. It seems pretty straight forward but I'm still having no lucky. After reading all of the tutorial at the link you sent me, I started with the basics. Here's what I have tried so far, with the results:

                 

                Step 1: Added keyframe, placed code 'snegm.swapDepths(10)' in Actions panel. Test movie, no change. I noticed the Actions panel had the layer name : frame # in the bottom left corner. So I figure I'm applying the action to the layer, not to the movie clip.

                 

                Step 2: Select movie clip on stage (so sneg with widget-looking icon shows in bottom left corner of Actions panel), then added 'snegm.swapDepths(10)' in Actions panel. Test movie - it goes black, then bright red at that frame.

                 

                Then I thought maybe I needed to give the clip an instance name to refer to in the code.

                Step 3: I gave clip an instance name of snow_cc, then added a keyframe, placed code 'snow_cc.swapDepths(10)' in Actions panel. When I added the action to the layer and keyframe the test movie showed no change at the keyframe, but the screen fills with bright red at end of show.

                 

                Step 4: While on the keyframe, I selected the movie clip on the stage, then added 'snow_cc.swapDepths(10)' in Actions panel. Test movie - it goes black at that frame, then screen fills with bright red.

                 

                It seemed to me that for some reason this pre-built component is sensitive to having a keyframe added anywhere. Which is why I asked about code to elicit a response at a specific key frame. I thought I could add the code to the clip itself (rather than a keyframe) and tell it "upon entering frame#, swapDepth"

                 

                I went back and re-read the tutorial, as far as I can tell I don't have anything would cause conflicts with the simple coding. The only movie clip is the snow, the rest of the items in the file are graphics (JPEG and BMP), one shape and several text boxes converted to symbols so I could apply motion tweens and 4 invisible buttons with GoToURL action scripts. Just one scene and no timeline refreshes.

                 

                Any further insight you can provide would be appreciated. I suppose I could try and create the snow myself (cutting out the compiled clip I got for free) but I hate to give up at this point because, like you mentioned, it's a pretty nice effect.

                • 5. Re: Make It Stop
                  colleen_stg Level 1

                  So, right after my last post I got to thinking about something I read in the tutorial - about moving a clip to the dynamic zone and then using the removeMovieClip. I just tried it and it worked! Here's the code I used, should anyone using the same effect stumble upon this post:

                   

                  I added a keyframe to the layer and placed this code in the Actions panel:

                   

                  snegm.swapDepths(100);

                  removeMovieClip(snegm)

                   

                  Thanks to Rothrock for the help!

                  • 6. Re: Make It Stop
                    Rothrock Level 5

                    Glad you got that worked out. Isn't that always how it is? Just as soon as you hit that "post" button!

                     

                    Here is another little trick you might want to try:

                     

                    this.onEnterFrame=function(){

                         snegm._alpha-=5;

                         if(snegm._alpha<0){

                              snegm.swapDepths(100);

                              removeMovieClip(snegm)

                              delete this.onEnterFrame;

                         }

                    }

                     

                    That could go on a keyframe where you want the snow to fade out and then when it fades out removes itself.