“FlashPlatform Initialization”的版本间的差异
来自Blueidea
第3行: | 第3行: | ||
− | + | ==舞台尺寸的軟匹配:== | |
+ | <syntaxhighlight lang="actionscript"> | ||
+ | /* | ||
+ | ~~ Blueidea wiki [Category:Flash platform]~~ | ||
+ | www.blueidea.com | ||
+ | */ | ||
+ | package { | ||
+ | import flash.display.Shape; | ||
+ | import flash.display.Sprite; | ||
+ | import flash.display.StageAlign; | ||
+ | import flash.display.StageScaleMode; | ||
+ | import flash.events.Event; | ||
+ | |||
+ | // ${1} | ||
+ | /** | ||
+ | * The <code>Molehill</code> class.<br/> | ||
+ | */ | ||
+ | public class Test extends Sprite { | ||
+ | //========================================================================== | ||
+ | // Constructor | ||
+ | //========================================================================== | ||
+ | /** Constructor */ | ||
+ | public function Test() { | ||
+ | stage.align = StageAlign.TOP_LEFT; | ||
+ | stage.scaleMode = StageScaleMode.NO_SCALE; | ||
+ | // 待會用來填充舞台。 | ||
+ | $shape = new Shape(); | ||
+ | repaintBorder(stage.stageWidth, stage.stageHeight); | ||
+ | stage.addEventListener(Event.RESIZE, stage_resizeHandler); | ||
+ | } | ||
+ | private var $border:Shape; | ||
+ | private function repaintBorder(width:uint, height:uint):void { | ||
+ | // ${2} | ||
+ | } | ||
+ | //========================================================================== | ||
+ | // Event listeners | ||
+ | //========================================================================== | ||
+ | private function stage_resizeHandler(event:Event):void { | ||
+ | repaintBorder(stage.stageWidth, stage.height); | ||
+ | } | ||
+ | } // <- end class -> | ||
+ | } | ||
+ | </syntaxhighlight> |
2011-04-13T22:37:38的版本
Flash platform 應用初始化常用設置。
舞台尺寸的軟匹配:
/* ~~ Blueidea wiki [Category:Flash platform]~~ www.blueidea.com */ package { import flash.display.Shape; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; // ${1} /** * The <code>Molehill</code> class.<br/> */ public class Test extends Sprite { //========================================================================== // Constructor //========================================================================== /** Constructor */ public function Test() { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; // 待會用來填充舞台。 $shape = new Shape(); repaintBorder(stage.stageWidth, stage.stageHeight); stage.addEventListener(Event.RESIZE, stage_resizeHandler); } private var $border:Shape; private function repaintBorder(width:uint, height:uint):void { // ${2} } //========================================================================== // Event listeners //========================================================================== private function stage_resizeHandler(event:Event):void { repaintBorder(stage.stageWidth, stage.height); } } // <- end class -> }