AS3 フルスクリーンで表示(TEST)
- 時間:2009年12月10日 18:27
-
delicious に登録
-
はてブに登録
- トラックバック:(0)
- コメント:(0)
フルスクリーンで表示のテスト
うまくいっとる。明日追記
【サンプルswf】
【Sample20091210.as】
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.getTimer;
public class Sample20091210 extends Sprite {
private var _normalBtn:TextBtn;
private var _fullBtn:TextBtn;
public function Sample20091210():void {
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
_init();
}
private function _init():void {
_normalBtn = new TextBtn("通常");
addChild(_normalBtn);
_normalBtn.x = stage.stageWidth / 2 - _normalBtn.width / 2 - 100;
_normalBtn.y = stage.stageHeight / 2 - _normalBtn.height / 2;
_normalBtn.addEventListener(MouseEvent.MOUSE_DOWN, _normalHandler);
_fullBtn = new TextBtn("フルスクリーン");
addChild(_fullBtn);
_fullBtn.x = stage.stageWidth / 2 - _fullBtn.width / 2 + 100;
_fullBtn.y = stage.stageHeight / 2-_fullBtn.height / 2;
_fullBtn.addEventListener(MouseEvent.MOUSE_DOWN, _fullHandler);
}
private function _normalHandler(e:MouseEvent):void {
stage.displayState = StageDisplayState.NORMAL;
}
private function _fullHandler(e:MouseEvent):void {
stage.displayState = StageDisplayState.FULL_SCREEN;
}
}
}
import flash.display.Sprite;
import flash.text.*;
dynamic class TextBtn extends Sprite {
public function TextBtn(str:String):void {
this.graphics.beginFill(0x666666);
this.graphics.drawRect(0,0, 100, 22);
this.graphics.endFill();
this.buttonMode = true;
this.mouseChildren = false;
var tf= new TextField();
tf.width = 100;
tf.y = 2;
tf.autoSize = TextFieldAutoSize.CENTER; //autoSizeを指定しないと高さが100pxになる
tf.selectable=false;
this.addChild(tf);
var format:TextFormat=new TextFormat();
format.color=0xFFFFFF;
format.size = 12;
tf.defaultTextFormat = format;
tf.text = str;
}
}
AS3 フルスクリーンで表示(TEST)に対してコメントをする