2 Replies Latest reply on Aug 24, 2006 3:06 PM by uc17

    elastic movements on resize for full browser flash

    uc17
      Im having problems creating easing movemrnts on resize with a full browser flash web page. A great example of this is [url]http://www.dopeawards.com/[/url] but for some reason them only have the easing for the _y value. This is the code I am using. "cover" is the movie clip on stage that i want to have easing properties. but for some reason when I resize the movement is jittery and choppy but it is easing. What will make it smooth?

      cover._x = Stage.width / 2;
      cover._y = Stage.height / 2;

      var coverx = cover._x
      var covery = cover._y


      var stageL:Object = new Object();
      stageL.onResize = function() {

      new mx.transitions.Tween(cover, "_x", mx.transitions.easing.Regular.easeOut, coverx,(Stage.width / 2), 1, true);

      new mx.transitions.Tween(cover, "_y", mx.transitions.easing.Regular.easeOut, coverx,(Stage.height / 2), 1, true);

      }

      Stage.addListener(stageL);



      Please Help!!
        • 1. Re: elastic movements on resize for full browser flash
          abeall Level 3
          Couple of things:

          1) You are using var coverx as the starting point for your _y Tween, don't you mean covery?

          2) You should define coverx and covery inside the onResize, or else the transition will always start at the original position. Actually, you should probably be using Tween.continueTo() instead of continually creating new Tweens

          3) You need set Stage.align = "TL" if you want Stage.width/2 and Stage.height/2 to be the center of the stage. Otherwise, it will always be centered anyway, since defauly align is centered.

          4) This is not required, but rather than naming your MovieClip "cover", I would suggest using proper naming conventions and call it "cover_mc".

          So, the above might end up looking like this:
          Stage.align = "TL";
          cover_mc._x = Stage.width / 2;
          cover_mc._y = Stage.height / 2;
          var stageL:Object = new Object();
          stageL.onResize = function() {
          var coverx = cover_mc._x;
          var covery = cover_mc._y;
          new mx.transitions.Tween(cover_mc, "_x", mx.transitions.easing.Regular.easeOut, coverx, (Stage.width / 2), 1, true);
          new mx.transitions.Tween(cover_mc, "_y", mx.transitions.easing.Regular.easeOut, covery, (Stage.height / 2), 1, true);
          };
          Stage.addListener(stageL);
          • 2. Re: elastic movements on resize for full browser flash
            uc17 Level 1
            Thanks alot, it works perfectly now!