topical media & game development

talk show tell print

animation-ch13-SingleSegment.ax

animation-ch13-SingleSegment.ax [swf] [flash] flex


  package {
          import flash.display.Sprite;
          import flash.display.StageScaleMode;
          import flash.display.StageAlign;
          import flash.events.Event;
  
          public class @ax-animation-ch13-SingleSegment extends Sprite
          {
                  private var slider:animation_ch13_SimpleSlider;
                  private var segment:animation_ch13_Segment;
                  
                  public function @ax-animation-ch13-SingleSegment()
                  {
                          init();
                  }
                  
                  private function init():void
                  {
                          stage.scaleMode = StageScaleMode.NO_SCALE;
                          stage.align = StageAlign.TOP_LEFT;
                          
                          segment = new animation_ch13_Segment(100, 20);
                          addChild(segment);
                          segment.x = 100;
                          segment.y = 100;
                          
                          slider = new animation_ch13_SimpleSlider(-90, 90, 0);
                          addChild(slider);
                          slider.x = 300;
                          slider.y = 20;
                          slider.addEventListener(Event.CHANGE, onChange);
                  }
                  
                  private function onChange(event:Event):void
                  {
                          segment.rotation = slider.value;
                  }
          }
  }
  


(C) Æliens 04/09/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.