5 Replies Latest reply on Jun 12, 2008 8:52 AM by kglad

    Need help with Bounce effect

    xslamx Level 1
      Hi, I'm using Flash CS3 but I'm working in Actionscript 2.0. What I'm trying to do is a simple bounce effect for an png image in a banner that I'm working on. Right now I have the 90 px image right above the 728x90 stage. I want it to bounce down into place onto the stage. I selected the image, converted it to a movie clip and named the instance of the clip girl_mc. Then I created an Actions layer, selected the first frame of that layer, and opened my Action panel. Here's the code I used to get the bounce effect but it's not working...

      import mx.transitions.Tween;
      import mx.transitions.easing.*;

      new Tween(girl_mc,"_y",Bounce.easeOut,girl_mc._y,45,3,true);

      The 45 is the position I want it to end up at (which is right in the middle of the 90 pixel stage).

      Can anyone let me know what I'm doing wrong? Big thanks in advance!




        • 1. Re: Need help with Bounce effect
          kglad Adobe Community Professional & MVP
          nothing's wrong with your code. either girl_mc is not the instance name of your movieclip or its _y property is already 45.
          • 2. Re: Need help with Bounce effect
            xslamx Level 1
            Actually, you're right, when I worked up the file from scratch the bounce effect worked fine. Question, I have two objects I want to bounce (girl_mc and weight_mc). I want the weight one to start bouncing into place about a half second or second after the girl one. How would I do that? I tried dragging the weight_mc movie clip to the 10th frame on the timeline and the whole thing didn't work. I also tried creating a keyframe on the actions layer at the 10th frame and putting the weight_mc actionscript there and again the whole thing didn't work. Any suggestions?
            • 3. Re: Need help with Bounce effect
              xslamx Level 1
              Actually, you're right, when I worked up the file from scratch the bounce effect worked fine. Question, I have two objects I want to bounce (girl_mc and weight_mc). I want the weight one to start bouncing into place about a half second or second after the girl one. How would I do that? I tried dragging the weight_mc movie clip to the 10th frame on the timeline and the whole thing didn't work. I also tried creating a keyframe on the actions layer at the 10th frame and putting the weight_mc actionscript there and again the whole thing didn't work. Any suggestions?
              • 4. Re: Need help with Bounce effect
                xslamx Level 1
                Also, as soon as I try to add a simple timeline animation (an alpha tween on another object on a different layer) the bounce effect stopped working. Is this bounce actionscript not compatible with timeline animation on different objects?

                I apologize in advance for this, I'm just starting to get into animation with Actionscript.
                • 5. Re: Need help with Bounce effect
                  kglad Adobe Community Professional & MVP
                  1. to delay code execution, you can use setTimeout() to call a function that executes your code. setTimeout works like setInterval() but only calls the function once.

                  2. you can't mix timeliine and actionscript tweens. the actionscript will break the timeline tween.