Changing the Alignment controlled by stage.align : StageAlign « Development « Flash / Flex / ActionScript






Changing the Alignment controlled by stage.align

 

You can control the alignment of a movie within the Player by setting the stage.align property of any class that extends DisplayObject. 

StageAlign.TOP 
StageAlign.BOTTOM 
StageAlign.LEFT 
StageAlign.RIGHT 
StageAlign.TOP_LEFT 
StageAlign.TOP_RIGHT 
StageAlign.BOTTOM_LEFT 
StageAlign.BOTTOM_RIGHT 

package {
  import flash.display.Sprite;
  import flash.display.StageScaleMode;
  import flash.display.StageAlign;

  public class Main extends Sprite {
    public function Main(  ) {

      stage.scaleMode = StageScaleMode.NO_SCALE;
      stage.align = StageAlign.TOP_RIGHT;
      
      graphics.beginFill(0xff0000);
      graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
      graphics.endFill(  );
    }
  }
}

        








Related examples in the same category