flash.events.ThrottleEvent
語言版本: | ActionScript 3.0 |
執行階段版本: | Flash Player 11, AIR 3.2 |
當 Flash Player 節流、暫停或繼續播放內容時會傳送 ThrottleEvent。
語言版本: | ActionScript 3.0 |
執行階段版本: | Flash Player 11, AIR 3.2 |
可能有一個好處是:
但缺點呢?
load()
方法並搭配 URL,效果如同將 source
屬性設定為該 URL,加上設定
autoPlay
屬性為 false
。flash.events.FullScreenEvent
import flash.events.FullScreenEvent; import flash.events.FullScreenEvent; import flash.events.MouseEvent; import flash.display.StageDisplayState; import flash.display.StageScaleMode; this.stage.scaleMode = StageScaleMode.NO_SCALE; this.toNormalScreenBtn.visible = false; this.stage.addEventListener(Event.FULLSCREEN,fullScreenEventHandler); this.toFullScreenBtn.addEventListener(MouseEvent.CLICK,toFullScreenHandler); this.toNormalScreenBtn.addEventListener(MouseEvent.CLICK,toNormalScreenHandler); function toFullScreenHandler(event:MouseEvent):void{ this.stage.displayState = StageDisplayState.FULL_SCREEN ; return; } function toNormalScreenHandler(event:MouseEvent):void{ this.stage.displayState = StageDisplayState.NORMAL ; return; } function fullScreenEventHandler(event:FullScreenEvent):void{ this.info.text = "event.fullScreen : " + event.fullScreen; switch(event.fullScreen){ case true: this.toFullScreenBtn.visible = false; this.toNormalScreenBtn.visible = true; break; case false: this.toFullScreenBtn.visible = true; this.toNormalScreenBtn.visible = false; break; default: break; } return; }
Capabilities.screenResolutionX & Capabilities.screenResolutionY
package { import flash.display.MovieClip; import flash.events.Event; import flash.system.Capabilities; public class ScreenResolutionXY extends MovieClip { public function ScreenResolutionXY() { /*當在swf執行後,取得目前螢幕解析度最大值, 此時調整螢幕解析度,ENTER_FRAME事件並不能達到更新數值的效果*/ this.addEventListener(Event.ENTER_FRAME,enterFrameHandler); return; } public function enterFrameHandler(event:Event):void{ this.hPx.text = Capabilities.screenResolutionX.toString(); this.vPx.text = Capabilities.screenResolutionY.toString(); return; } } }
stage.fullScreenSourceRect
SimpleButton(upState:DisplayObject = null, overState:DisplayObject = null, downState:DisplayObject = null, hitTestState:DisplayObject = null)http://help.adobe.com/zh_TW/FlashPlatform/reference/actionscript/3/flash/display/SimpleButton.html
建立新的 SimpleButton 實體。
import flash.display.BitmapData; import flash.display.Bitmap; import flash.events.MouseEvent; import flash.display.SimpleButton; var bmd1:BitmapData = new BitmapData(100,100,true,0xff2266ff); var bm1:Bitmap = new Bitmap(bmd1); bm1.x=100;bm1.y=60; /*this.addChild(bm1);*/ var bmd2:BitmapData = new BitmapData(100,100,true,0xffff0000); var bm2:Bitmap = new Bitmap(bmd2); bm2.x=100;bm2.y=60; /*this.addChild(bm2);*/ var simpleButton:SimpleButton = new SimpleButton(bm1,bm2,null,bm1); addChild(simpleButton); simpleButton.addEventListener(MouseEvent.MOUSE_DOWN,mouseHandler); function mouseHandler(event:MouseEvent):void{ trace(event.type); } trace(getSize(simpleButton));
SimpleButton DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object
Bitmap DisplayObject EventDispatcher Object
BitmapData.hitTest()方法:
BitmapData.hitTest(firstPoint:Point, firstAlphaThreshold:uint, secondObject:Object, secondBitmapDataPoint:Point = null, secondAlphaThreshold:uint = 1):Boolean