Stopping Yoyo tweens...

Been racking my brains on the issue of stopping a tween
onRollOver of a movie clip. I've used tween.stop()....and delete
tween....created a boolean variable that flags false when I
rollOver the mc. Not sure what else there is...all I can get is a
sort of jiggle from the clip which should stop where the mouse had
contacted it. Your help would be very much appreciated!!!

There isn't a lot that you can do with Flash's built in Tween
class. You can do much better if you use a third party Tween
library. I use TweenMax. Here's a link to the AS2 version:
http://blog.greensock.com/tweenmaxas2/

Similar Messages

  • Is it possible to stop a tween in a movie clip

    Hello Kglad and other forum expert!
    I have a movie clip (really just an image converted to a
    movie clip).
    I a "zoom" effect set on two layers - on for the zoom mask,
    and the other for the base image.
    I just use the modify/transform in some keyframes to have the
    image motion tween from normal size to a larger size.
    The tween (aka zoom) is shown through the mask layer.
    I did not create the motion tween using actionscript, but in
    the timeline between 2 keyframes.
    Is there a way I can stop the tween when the movie plays ( by
    clicking a "pause" button).
    Thanks for a great info resource,
    eholz1

    you can use the stop() method of movieclips to stop the
    timeline of the tweening movieclip. you can use the play() method
    to continue to tweening.

  • How to stop a tween in full swing?

    how can I stop a tween in full swing? stop won't work...
    (flash 8 as2)
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var animTween:Tween = new Tween(thumbnail_mc, "_x",
    Strong.easeOut, thumbnail_mc._x, -menu, 50, true);
    function buttonHandler() {
    animTween.stop();
    many thanks!!!

    stop() works just fine. It must be that within
    buttonHandler() you don't
    have scope to animTween. Try tracing animTween:
    function buttonHandler() {
    trace(animTween);
    animTween.stop();
    I'm thinking you won't see [Tween], but instead will see
    undefined.
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Do I need to stop a tweened movie clip if it's not visible?

    Hi,
    I'm a beginner.
    I have a tweened movie clip (it has a changing alpha state that makes it fade up from invisible). I hide this movie clip when the movie starts (with "myMovieClip__MC.visible = false" at the top of the frame script. My question is this: Is this movie clip still tweening while it's hidden (and using processor resources)? IOW: should I hide it AND stop it at the movie start...or is that unnecessary because when it's hidden it's stopped?
    Thanks

    it's still playing and using some resources even if not visible and not on the stage or in the display list, but it may not be using that many resources.

  • Placing a stop to Tweened Buttons

    Hi Guys,
    I realize I might have done this the hard  way, but bear with me as I am brand new to flash and need to get a  simple presentation done for my boss by the end of the afternoon.
    I  have created set of dials/meters with moving arms that change as  buttons are pressed.  The arms move based on a "Classic Tween" set-up I  created.  I then applied my buttons to the flash document and then coded  in some "gotoAndPlay" on an actions layer to get the arms on the dials  to move when I click on the buttons.  My problem is that since I have 3  buttons (High, Medium & Low) and the tweens follow one frame right  after another (0, 41,78) there is no stop.  When I click on Low it plays  the low tween, the medium one, and the high tween.  When I click on the  medium it plays both the Medium and then the High.  The High button  obviously only plays itself.  I don't know how to insert a stop between  these buttons.  Can you guys help me?  I have pasted my simple code  below os you can see it:
    stop();
    low_btn.addEventListener(MouseEvent.CLICK, onLow);
    function onLow (Event:MouseEvent):void
         gotoAndPlay(0)
    med_btn.addEventListener(MouseEvent.CLICK, onMed);
    function onMed (Event:MouseEvent):void
         gotoAndPlay(41)
    high_btn.addEventListener(MouseEvent.CLICK, onHigh);
    function onHigh (Event:MouseEvent):void
         gotoAndPlay(75)
    Please, please, please help me.
    Thank you so much.

    This answer seems intuitive, but I am wondering how to add that stop?
    Do I add the stop to my Actions Layer or on the layer that has the actual moving arm?
    Also, how to apply it to the specific frame? Just put the frame number in the paranthesis?
    Thanks

  • Actionscript is stopping my Tweening. Is there an override?

    Hi Everybody,
    I'm importing/assigning values dynamically using XML and everything's working fine...
    ...until the timeline reaches a tween for the same object and it fails to animate.
    Is there a way I can kill/override the AS2 assignment to the object and have it listen back to the timeline?
    Thanks for any suggestions!

    you can't mix timeline tweening with actionscript that affects the timeline-tweened property.
    ie, use one (actionscript) or the other (the timeline).

  • Yoyo in Tween not working

    Hello, I have a tween in my .fla that isnt working properly. I have 2 buttons, Start and Yoyo. When I click the "Start" button the tween runs. Clicking the "Yoyo" button play the tween in reverse. All fine, but when I press the "Start" button again after I've ran the animation twice the animation always run in yoyo mode. What my problem. Code:
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    //Tween Parameters
    var myTween:Tween = new Tween(mybox_mc, "y", Back.easeInOut, 0, 100, 1, true);
    // Stop the Tween
    myTween.stop();
    // Event Listeners
    start_btn.addEventListener(MouseEvent.CLICK, moveContHolder);
    yoyo_btn.addEventListener(MouseEvent.CLICK, moveContHolderR);
    // Functions
    function moveContHolder(e:MouseEvent):void{
    myTween.start();
    function moveContHolderR(e:MouseEvent):void{
    myTween.yoyo();

    It's apparent that the tween is redefined/reversed by the yoyo() method, so if your goal is to have the object tween back and forth, then you really only need the yoyo() method after the tween has been started.  So what you might want is to do is redefine the start_btn functionality when the yoyo_btn is clicked.
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    //Tween Parameters
    var myTween:Tween = new Tween(mybox_mc, "y", Back.easeInOut, 0, 100, 1, true);
    // Stop the Tween
    myTween.stop();
    // Event Listeners
    start_btn.addEventListener(MouseEvent.CLICK, moveContHolder);
    yoyo_btn.addEventListener(MouseEvent.CLICK, moveContHolderR);
    var tweensStarted:Boolean = false;
    // Functions
    function moveContHolder(e:MouseEvent):void{
    myTween.start();
    tweensStarted = true;
    function moveContHolderR(e:MouseEvent):void{
    myTween.yoyo();
    if(tweensStarted){
         start_btn.removeEventListener(MouseEvent.CLICK, moveContHolder);
         start_btn.addEventListener(MouseEvent.CLICK, moveContHolderR);
         tweensStarted = false;

  • Trouble stopping a motion tween

    Hello,
    I'm new here and to Flash CS5.  I'm having a lot of trouble stopping motion tweens.  (No troubles with a Classic Tweens).  When I have a layer with the animation, and then use the code snippets to insert a stop(); ...it won't stop. If I create a layer below the motion tween, put a keyframe in and place a stop there, it stops just fine.  However, I've been told this isn't correct, that all actions should happen on the Actions layer.  I'm sure I'm over looking something fairly simple, any help would be appreciated.  I've added a couple of screen shots to try and clairfy the situation, if you need anything else let me know
    This dosen't work
    This does work
    Thanks
    Billy

    as far as flash is concerned, you can put that stop() in any layer.  layers don't even exist in your swf.  they exist in the ide strictly for user convenience.
    that said, it is a good practice to centralize code as much as you can.  so, if you're coding on a timeline, putting the code in its own layer is better than spreading it across several layers.  but, your code will work without problem when spread across several layers or when placed in your background layer.
    anyway, if code in your Actions layer fails and code in your background layer works, the code is not the same in each layer.

  • Tween doesn't stop

    Hello
    My problem is that I have a movieclip that initiates a
    function when clicked. This function contains if-statements to find
    out if the movieclip has been pressed before. I then uses w.stop();
    to stop a tween started before, but i doesn't work!
    I want to stop the tween because otherwise the
    onMotionFinished-statements are executed and I don't want that
    until the tween really is finished. Can anyone help me?

    Seems to be working for me.
    The one thing I changed is that I wrapped the if else
    statements that check the width of box inside of an onEnterFrame
    function, that way the width of the box is checked continuously as
    the tween is running, and not just once when the function runs.
    Here's the code:

  • Actionscript Tweening stuck in mouseover position

    Here is my code for rollOver() and rollOut(). This code is
    applied to a small movieclip that moves the movieclip up 10 pixels
    on mouseover and back down on mouseout. It also gives the movieclip
    the elastic effect. Sometimes when I rollover the movieclip when
    viewing the swf, it gets stuck in the mouseover position when I
    have already rolled out. Any idea why it does this?
    on (rollOver) {
    var adobe = _level0.controls.Dock.graphics.adobe;
    var adobereflect =
    _level0.controls.Dock.graphics.adobereflect;
    var adobetxt = _level0.controls.Dock.graphics.adobetxt;
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var Tweenadobe1:Tween = new Tween(adobe, "_y",
    Elastic.easeOut, 27, 12, 15, false);
    var Tweenadobe2:Tween = new Tween(adobereflect, "_y",
    Elastic.easeOut, 55, 65, 15, false);
    var Tweenadobe3:Tween = new Tween(adobetxt, "_alpha", None,
    100, 0, 30, false);
    Tweenadobe1.onMotionFinished = function() {
    Tweenadobe1.stop();
    Tweenadobe2.onMotionFinished = function() {
    Tweenadobe2.stop();
    Tweenadobe3.onMotionFinished = function() {
    Tweenadobe3.stop();
    on (rollOut) {
    var adobe = _level0.controls.Dock.graphics.adobe;
    var adobereflect =
    _level0.controls.Dock.graphics.adobereflect;
    var adobetxt = _level0.controls.Dock.graphics.adobetxt;
    var Tweenadobe4:Tween = new Tween(adobe, "_y",
    Elastic.easeOut, 12, 27, 15, false);
    var Tweenadobe5:Tween = new Tween(adobereflect, "_y",
    Elastic.easeOut, 65, 55, 15, false);
    var Tweenadobe6:Tween = new Tween(adobetxt, "_alpha", None,
    0, 100, 30, false);
    Tweenadobe4.onMotionFinished = function() {
    Tweenadobe4.stop();
    Tweenadobe5.onMotionFinished = function() {
    Tweenadobe5.stop();
    Tweenadobe6.onMotionFinished = function() {
    Tweenadobe6.stop();
    }

    stopping your tweens in an onMotionFinished isn't going to do
    anything useful. stopping your rollOver tweens when you rollOut
    would be helpful and stopping your rollOut tweens when you rollOver
    would be helpful.

  • Need help with image gallery and preloader

    Here is my  portfolio site currently. WWW.PALMEI.COM. When you go into the the galleries you can view the images; the images load and it's all working fine. But if I was to go back on the page before the image was to load the image loads later which is then in the way of everything and cannot be deleted or removed. What would a solution be for solving this problem. Also, my preloader is not working at all as you can tell.
    Here is my code in frame 1 for the perloader:
    [AS]
    stop();
    loaderInfo.addEventListener(ProgressEvent.PROGRESS, updatePreLoader);
    function updatePreLoader(evtObj:ProgressEvent):void
                        var percent:Number = Math.floor((evtObj.bytesLoaded*100)/evtObj.bytesTotal);
                        preloader_txt.text = percent+"%";
                                  if (percent==100) {
                                            nextFrame ();
    [/AS]
    Thank you very much for your help. Have developed headache and need some new eyes on it.

    Thank you again Ned for your reponse as you helped me solve the image array problem last week or so ago.
    Here is the code:
    [AS]
    stop();
    import fl.transitions.Tween;
    import fl.transitions.easing.*
    import fl.transitions.TweenEvent;
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    var sep3Tween4:Tween = new Tween(Sep2_mc, "y", Regular.easeOut,338 , 655, 1, true);
    var sepTween4:Tween = new Tween(Sep_mc, "y", Regular.easeOut,0 , -320, 1, true);
    BoyBack.addEventListener(MouseEvent.CLICK, Portfolioclick);
    function Portfolioclick(evtObj :MouseEvent) {
              gotoAndStop("Portfolio");
               removeChild(B);
    var BoyBackTween:Tween = new Tween(BoyBack, "y", Regular.easeOut,510,487,2, true);
    BoyBackTween.addEventListener(TweenEvent.MOTION_FINISH, onfinis);
    function onfinis(e:TweenEvent):void {
    BoyBackTween.yoyo();
    var arrayB:Array = [ B1, B2, B3, B4, B5, B6, B7, B8,B9, B10, B11, B12];
    var arrayImages:Array = ["ill_1.jpg","ill_2.jpg","ill_3.jpg","ill_4.jpg","ill_5.jpg","ill_6.jpg","ill_7.jpg","ill _8.jpg", "ill_9.jpg","ill_10.jpg","ill_11.jpg","ill_12.jpg"];
    var imgLoader:Loader = new Loader;
    var B:BlackBox = new BlackBox();
    B.addChild(imgLoader);
    for (var i:uint=0; i<arrayB.length; i++){
         arrayB[i].mouseChildren = false;
         arrayB[i].addEventListener( MouseEvent.MOUSE_OVER, onButtonOver);
         arrayB[i].addEventListener( MouseEvent.MOUSE_OUT, onButtonOut);
         arrayB[i].addEventListener( MouseEvent.CLICK, onButtonRemoveB);
               arrayB[i].addEventListener( MouseEvent.CLICK, onButtonClick);
               arrayB[i].imgNum = i;
                     imgLoader.y  = 100;
                          imgLoader.x =275;
                          B.y = -55;
                     B.x =-100;
    function onButtonOver( e:MouseEvent ):void {
         var B:MovieClip = MovieClip(e.target);
         if(B.tween){
           B.tween.stop();
         B.tween = new Tween( B, "y", Regular.easeOut,600, 591, .5, true );
    function onButtonOut( e:MouseEvent ):void {
         var B:MovieClip = MovieClip(e.target);
         if( B.tween ){
           B.tween.stop();
         B.tween = new Tween( B, "y", Regular.easeOut, 591, 600, 1, true );
    function onButtonRemoveB( e:MouseEvent ):void {
    removeChild(TwoDtxt);
    function onButtonClick( e:MouseEvent ):void {
       if(this.contains(B)){
           removeChild(B);
       imgLoader.load(new URLRequest(arrayImages[e.currentTarget.imgNum]));
       imgLoader.contentLoaderInfo.addEventListener( Event.COMPLETE , loaded);
    function loaded(event:Event):void {
         addChild(B);
          var targetLoader:Loader = Loader(event.target.loader);
    var AlphaTween1:Tween = new Tween(T1, "alpha", Strong.easeOut, 1, .20, 2.5, true);
    var AlphaTween2:Tween = new Tween(Bottom1, "alpha", Strong.easeOut, 1, .20, 2.5, true);
    [/AS]
    Before the image loads if you were to click on the boy with the balloon"the back button" the image would than load later on say the"portfolio" part of the site.

  • Array problem in Photo Gallery

    I want to have an array of buttons that each move with mouse over and mouse out. Then once user clicks the button the image is loaded from an array and put onto the screen. Once another button is clicked say B2 the B1 image is removed and a new image replaces it.
    Here is the working code up to this point with no errors; I am using Flash cs5.
    [AS]
    var buttonArrayportfolio:Array = [ B1, B2, B3, B4, B5, B6, B7, B8];
    for each( var B:MovieClip in buttonArrayportfolio)
              B.mouseChildren = false;
              B.addEventListener( MouseEvent.MOUSE_OVER, onButtonOver  );
              B.addEventListener( MouseEvent.MOUSE_OUT,  onButtonOut   );
              B.addEventListener( MouseEvent.CLICK,      onButtonClick );
    function onButtonOver( e:MouseEvent ):void
              var B:MovieClip = MovieClip(e.target);
              if( B.tween )
                        B.tween.stop();
              B.tween = new Tween( button, "y", Regular.easeOut,622.9, 591, .5, true );
    function onButtonOut( e:MouseEvent ):void
              var B:MovieClip = MovieClip(e.target);
              if( B.tween )
                        B.tween.stop();
              B.tween = new Tween( B, "y", Regular.easeOut, 591, 622.9, 1, true );
    function onButtonClick( e:MouseEvent ):void
        var arrayB:Array = [ B1, B2, B3, B4, B5, B6, B7, B8,];
        var arrayImages:Array = ["KidRabbit.png","Hydrant.png","Hydrant.png"];
        for (var i:int = 0; i<1; i++)
            var B:BlackBox = new BlackBox();
            var pictLdr:Loader = new Loader();
            B.addChild(pictLdr);
            addChild(B);
                    pictLdr.load(new URLRequest(arrayImages[i]));
            pictLdr.contentLoaderInfo.addEventListener( Event.COMPLETE , loaded);
            //arrayImages.push(B);
            //arrayImages[i].x = i * 150 +  i * 10;
            //addChild(arrayImages[i]);  
    function loaded(event:Event):void
              var targetLoader:Loader = Loader(event.target.loader);
    [/AS]

    See if the following is more what you want.  It only uses one BlackBox object and one loader.  By using one loader you don't need to unlload it to load another because whatever you load into into will replace what was already loaded into it.  Part of the key to this solution is assigning the loop index value to each button as it increments in the first loop.  That number is what is used to call the image associated with the button in the onClick function.
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    var arrayB:Array = [ B1, B2, B3, B4, B5, B6, B7, B8,];
    var arrayImages:Array = ["KidRabbit.png","Hydrant.png","Hydrant.png","KidRabbit.png","Hydrant.png","Hydrant.png", "KidRabbit.png","Hydrant.png"];
    var imgLoader:Loader = new Loader;
    var B:BlackBox = new BlackBox();
    B.addChild(imgLoader);
    for (var i:uint=0; i<arrayB.length; i++){
         arrayB[i].mouseChildren = false;
         arrayB[i].addEventListener( MouseEvent.MOUSE_OVER, onButtonOver);
         arrayB[i].addEventListener( MouseEvent.MOUSE_OUT, onButtonOut);
         arrayB[i].addEventListener( MouseEvent.CLICK, onButtonClick);
         arrayB[i].imgNum = i;
    function onButtonOver( e:MouseEvent ):void {
         var B:MovieClip = MovieClip(e.target);
         if(B.tween){
           B.tween.stop();
         B.tween = new Tween( B, "y", Regular.easeOut,622.9, 591, .5, true );
    function onButtonOut( e:MouseEvent ):void {
         var B:MovieClip = MovieClip(e.target);
         if( B.tween ){
           B.tween.stop();
         B.tween = new Tween( B, "y", Regular.easeOut, 591, 622.9, 1, true );
    function onButtonClick( e:MouseEvent ):void {
       if(this.contains(B)){
           removeChild(B);
       imgLoader.load(new URLRequest(arrayImages[e.currentTarget.imgNum]));
       imgLoader.contentLoaderInfo.addEventListener( Event.COMPLETE , loaded);
    function loaded(event:Event):void {
         addChild(B);
          var targetLoader:Loader = Loader(event.target.loader);

  • How to create a smooth transition from end of a movie clip to beginning of a movie clip?

    I have a motion tween that is 180 frames in length. When the tween ends on the last frame and returns to the first frame to replay there is a slight jump in the tween. Is there anyway to stop the tween from jumping from last frame to the first?

    The answer lies in the first posting you made for this topic.  You shouldn't start a new discussion for the same topic.

  • Dynamic MovieClip Names

    I have an array that houses the names of six movieclips. I randomly select three of them. I am trying to get my randomly chosen movieClips to do what I want them to do. I have tried the following code to get the first to fade in:
    stop();
    // import tween classes
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var FirstPersonAnimation:Object;
    trace("mc"+[_global.FirstPerson]);
    FirstPersonAnimation = new Tween("mc"+[_global.FirstPerson], "_alpha", Regular.easeInOut, 0, 100, _global.FadeInTime, true);
    FirstPersonAnimation.onMotionFinished = function() {
    _root.nextFrame();
    But it does not work. The trace comes back with the full movie clip name ex: mcTom, but even though that value comes up in the trace, the AS doesn't see it as a movie clip. Any thoughts on how I can correct this?
    -Kirk

    I'm not sure what is involved with _global.FirstPerson, but when you use it the way you do, you are just feeding a string into the Tween.  You need to convert that string into an object using array notation:
    this["mc_"+_global.FirstPerson]

  • Mose Over/Out Issue

    I have a script that will expand a box on  a mouse over of a button, and shrink it on a mouse out of that button. It seems to have a problem. Most of the time its works fine, but on occasion it will tween out to 100% , and then I need to move in and out to get it to sync back up. Here is the script. it seems to happen If i move over or out of the button, while its tweening
    Hopefully someone can help me find the bug
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    select_mc.addEventListener(MouseEvent.MOUSE_OVER, expandonepad)
    setChildIndex(pad_mc, 1)
    setChildIndex(select_mc, 0)
    pad_mc.scaleY=0
    pad_mc.scaleX=0
    var growpadx:Tween
    var growpady:Tween
    addChild(pad_mc)
    function expandonepad (Event:MouseEvent)
    pad_mc.x=45
    pad_mc.y=20.00
    growpadx=new Tween (pad_mc, "scaleX", Strong.easeOut, pad_mc.scaleX, 1.02, 2, true)
    growpady=new Tween (pad_mc, "scaleY", Strong.easeOut, pad_mc.scaleY, 1.05, 2, true)
    select_mc.removeEventListener(MouseEvent.MOUSE_OVER, expandonepad)
    select_mc.addEventListener(MouseEvent.MOUSE_OUT, shrinkonepad)
    function shrinkonepad (Event:MouseEvent)
    growpadx=new Tween (pad_mc, "scaleX", Strong.easeIn, pad_mc.scaleX, 0, 1, true)
    growpady=new Tween (pad_mc, "scaleY", Strong.easeIn, pad_mc.scaleY, 0, 1, true)
    select_mc.addEventListener(MouseEvent.MOUSE_OVER, expandonepad)
    select_mc.removeEventListener(MouseEvent.MOUSE_OUT, shrinkonepad)

    One approach that might work would be to stop the Tween before you start another, but you'll need to test for the Tween before you try...as in...
    function expandonepad (Event:MouseEvent)
          if(growpadx){
              growpadx.stop();
              growpady.stop();

Maybe you are looking for