4 Replies Latest reply on Jul 23, 2007 8:35 AM by Dave.Hollings

    onMotionFinished

    Dave.Hollings
      Hi,

      I was hoping someone might be able to clear this issue up for me. I am currently running Flash MX 2004, and have been looking at tranistions. I am also trying to get onMotionFinished function to work however when testing my fla there is a syntax error on this function. I have looked in the help files and it is not lists, however when looking in the help file of Flash 8 it is there clearly stating that it was available as of Flash MX 2004.

      My question is does this function only work in Flash 8 and above?
        • 1. Re: onMotionFinished
          Damon Edwards Level 3
          lets say here is your tween:
          var tw:Tween = new Tween(blahblah);
          tw.onMotionFinished = function(){ // you must use the Tween name, in this case "tw"
          //do something
          }

          is this how you are implementing it?
          • 2. Re: onMotionFinished
            Dave.Hollings Level 1
            Thats exactly how I'm using the function however it just seems like MX 2004 does not recognise it as an valid syntax. I would assume that the .onMotionFinished would turn blue as most key words do in Flash.
            • 3. Re: onMotionFinished
              Rothrock Level 5
              For some odd reason I seem to recall that it was a bit messed up. If you strict type your Tween variable have to do it like this:

              tw["onMotionFinished"]

              But if you don't strict type it you can:

              tw.onMotionFinished

              See if that works.
              • 4. Re: onMotionFinished
                Dave.Hollings Level 1
                I have tried it however although it stops anything else tweening apart from the object I have started once this object is finished the flag is not reset and no matter what object I press nothing happens, I have provided the code I am working with below:

                Root time line:
                stop()
                import mx.transitions.Tween;

                menu_mc.menu1_mc.menu1_btn.onRelease = function () {
                if(!isTweening) {
                if((menu_mc.menu1_mc._x == 0) && (menu_mc.menu2_mc._x == 26) && (menu_mc.menu3_mc._x == 52)) {
                menu_mc.menu1.yoyo();
                menu_mc.menu2.yoyo();
                menu_mc.menu3.yoyo();
                isTweening = true;
                } else if((menu_mc.menu1_mc._x == 0) && (menu_mc.menu2_mc._x == 26) && (menu_mc.menu3_mc._x == 495)) {
                menu_mc.menu1.yoyo();
                menu_mc.menu2.yoyo();
                isTweening = true;
                } else {
                menu_mc.menu1.yoyo();
                isTweening = true;
                };
                };
                };

                menu_mc.menu2_mc.menu2_btn.onRelease = function () {
                if(!isTweening) {
                if((menu_mc.menu1_mc._x == 0) && (menu_mc.menu2_mc._x == 26) && (menu_mc.menu3_mc._x == 52)) {
                menu_mc.menu2.yoyo();
                menu_mc.menu3.yoyo();
                isTweening = true;
                } else if((menu_mc.menu1_mc._x == 443) && (menu_mc.menu2_mc._x == 469) && (menu_mc.menu3_mc._x == 495)) {
                menu_mc.menu1.yoyo();
                menu_mc.menu2.yoyo();
                isTweening = true;
                } else {
                menu_mc.menu2.yoyo();
                isTweening = true;
                };
                };
                };

                menu_mc.menu3_mc.menu3_btn.onRelease = function () {
                if(!isTweening) {
                if((menu_mc.menu3_mc._x == 495) && (menu_mc.menu2_mc._x == 469) && (menu_mc.menu1_mc._x == 443)) {
                menu_mc.menu1.yoyo();
                menu_mc.menu2.yoyo();
                menu_mc.menu3.yoyo();
                isTweening = true;
                } else if((menu_mc.menu3_mc._x == 495) && (menu_mc.menu2_mc._x == 469) && (menu_mc.menu1_mc._x == 0)) {
                menu_mc.menu2.yoyo();
                menu_mc.menu3.yoyo();
                isTweening = true;
                } else {
                menu_mc.menu3.yoyo();
                isTweening = true;
                };
                };
                };

                menu_mc.menu1["onMotionFinished"] = function () {
                isTweening = false;
                };
                menu_mc.menu2["onMotionFinished"] = function () {
                isTweening = false;
                };
                menu_mc.menu3["onMotionFinished"] = function () {
                isTweening = false;
                };

                menu_mc time line:
                stop();
                import mx.transitions.Tween;

                beginLocationmenu1 = new Object();
                beginLocationmenu1.x = menu1_mc._x;
                beginLocationmenu2 = new Object();
                beginLocationmenu2.x = menu2_mc._x;
                beginLocationmenu3 = new Object();
                beginLocationmenu3.x = menu3_mc._x;

                endLocationmenu1 = new Object();
                endLocationmenu1.x = 0;
                endLocationmenu2 = new Object();
                endLocationmenu2.x = 26;
                endLocationmenu3 = new Object();
                endLocationmenu3.x = 52;

                var menu1:Tween = new Tween(menu1_mc, "_x", mc.transitions.easing.Back.easeInOut, beginLocationmenu1.x, endLocationmenu1.x, 1, true);
                var menu2:Tween = new Tween(menu2_mc, "_x", mc.transitions.easing.Back.easeInOut, beginLocationmenu2.x, endLocationmenu2.x, 1, true);
                var menu3:Tween = new Tween(menu3_mc, "_x", mc.transitions.easing.Back.easeInOut, beginLocationmenu3.x, endLocationmenu3.x, 1, true);

                _gloabl.isTweening = true;