2 Replies Latest reply on Aug 30, 2007 3:35 AM by Voddie

    Transition help

    Voddie Level 1
      Hi

      Flash 8 / AS2 - limited AS2 knowledge

      Im building a project using the transitions classes and easing to move a mc around the stage.

      I have made a mc arriving on scene with the below transition

      import mx.transitions.Tween;
      import mx.transitions.easing.*;
      var myImg_tweenxscale:Object = new Tween(content_mc, "_x", mx.transitions.easing.Strong.easeOut, 1000, -32.5, 3, true);

      this works fine, my dilemma of which I've search for three hours now without success is

      I want to control this mc via a navigation buttons along _x, ie. on btn1 move content_mc to _x=35, btn2 to _x=70 etc. Basically it would be moving left or right on button click to its new position with easing.

      How do I write the transition when I don't know which button has been pressed and therefore don't know the starting _x point as required in the above transition?

      Thanks in advance

      Voddie
        • 1. Re: Transition help
          Damon Edwards Level 3
          import mx.transitions.easing.Strong;
          import mx.transitions.Tween;

          btn1.onRelease = function(){
          var tw:tween = new Tween(content_mc, "_x", Strong.easeOut, content_mc._x, 35, 3, true);
          };
          btn2.onRelease = function(){
          var tw:Tween = new Tween(content_mc, "_x", Strong.easeOut, content_mc._x, 70, 3, true);
          };
          btn3.onRelease = function(){
          var tw:Tween = new Tween(content_mc, "_x", Strong.easeOut, content_mc._x, 150, 3, true);
          };
          and so on...
          p.s. you don't need to import all the eases, when you're only using 1.
          • 2. Re: Transition help
            Voddie Level 1
            Hi dzedward

            Thanks for the code help, sorry took a while to get back to you, family crisis.

            I am already using code on my buttons, eg, btn1

            on (rollOver)
            {
            if (_root.link != page)
            {
            this.gotoAndPlay("over");
            }
            }
            on (releaseOutside, rollOut)
            {
            if (_root.link != page)
            {
            this.gotoAndPlay("out");
            }
            }
            on (release)
            {
            _root["btn" + _root.link].gotoAndPlay("out");
            _root.link = page;
            }

            How could i incorporate your code into what I already have?

            Thanks in advance

            voddie