topical media & game development

talk show tell print

lib-flex-animation-code-10-TweenGroupDemo1.ax

lib-flex-animation-code-10-TweenGroupDemo1.ax (swf ) [ flash ] flex


  package {
          
          import flash.display.*;
          
          import gs.TweenGroup;
  
          [SWF(backgroundColor=0xffffff)]
          public class @ax-lib-flex-animation-code-10-TweenGroupDemo1 extends Sprite
          {
                  private var sprite:Sprite;
                  private var group:TweenGroup;
                  
                  public function @ax-lib-flex-animation-code-10-TweenGroupDemo1()
                  {
                          stage.scaleMode = StageScaleMode.NO_SCALE;
                          stage.align = StageAlign.TOP_LEFT;
                          
                          var s1:Sprite = makeSprite(100, 100, 0xff0000);
                          var s2:Sprite = makeSprite(100, 200, 0x00ff00);
                          var s3:Sprite = makeSprite(100, 300, 0x0000ff);
                          var s4:Sprite = makeSprite(100, 400, 0xffff00);
                          
                          TweenGroup.allTo([s1, s2, s3, s4], 3, {x:800});
                  }
                  
                  private function makeSprite(xpos:Number, ypos:Number, color:uint):Sprite
                  {
                          var s:Sprite = new Sprite();
                          s.graphics.beginFill(color);
                          s.graphics.drawRect(-50, -25, 100, 50);
                          s.graphics.endFill();
                          s.x = xpos;
                          s.y = ypos;
                          addChild(s);
                          return s;
                  }
          }
  }
  


(C) Æliens 18/6/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.