ProblemYou want to change the alignment of the movie within the Player. SolutionUse the stage.align property. DiscussionFlash movies appear in the center of the Player by default. You can control the alignment of a movie within the Player by setting the stage.align property of any class that extends DisplayObject. The various alignment modes are implemented as strings, such as "T" for "top," "L" for "left," etc. However, to avoid errors in typing, these have also been made properties of the flash.display.StageAlign class, listed in Table 3-1.
The following class demonstrates the effects of both the scale mode and alignment of a movie within the player. Experiment by changing the stage.scaleMode and stage.align properties to their different values and scaling the browser to various sizes. package { import flash.display.Sprite; import flash.display.StageScaleMode; import flash.display.StageAlign; public class ExampleApplication extends Sprite { public function ExampleApplication( ) { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_RIGHT; graphics.beginFill(0xff0000); graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); graphics.endFill( ); } } } |