package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.MovieClip; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageDisplayState; import flash.display.StageScaleMode; import flash.events.Event; import flash.events.MouseEvent; import flash.filters.GlowFilter; import flash.text.TextField; import flash.text.TextFormat; import flash.utils.getTimer; import flash.utils.setTimeout; import flash.text.TextFormatAlign; public class FFLags extends MovieClip { var txt:TextField; var n:Number = 100; var dt:uint = getTimer(); var bmp:Bitmap; var lagOnFullscreen:Boolean = false; public function createButton(x:Number,y:Number,width:Number,height:Number,label:String,color:uint,listener:Function):void{ var b:Sprite = new Sprite(); b.graphics.beginFill(color); b.graphics.drawRect(0,0,width,height); b.buttonMode=true; addChild(b); b.x = x; b.y=y; b.addEventListener(MouseEvent.CLICK,listener); var t:TextField = new TextField(); t.defaultTextFormat = new TextFormat(null,null,null,null,null,null,null,null,TextFormatAlign.CENTER); t.text=label; t.width=width; t.mouseEnabled=false; t.name="label"; b.addChild(t); } public function FFLags() { stage.scaleMode=StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; var bmd:BitmapData = new BitmapData(stage.stageWidth/2,stage.stageHeight,false,0); bmp = new Bitmap(bmd); addChild(bmp); createButton(0,0,100,50,"less",0xaaaaaa, function(e:Event):void{ n-=10000; } ); createButton(330,0,100,50,"stop on fullscreen\nfalse",0xaaaaaa, function(e:Event):void{ lagOnFullscreen=!lagOnFullscreen; e.currentTarget.getChildByName("label").text="stop onfullscreen\n"+lagOnFullscreen; } ); createButton(110,0,100,50,"more",0xaaaaaa, function(e:Event):void{ n+=10000; } ); createButton(220,0,100,50,"fullscreen",0xaaaaaa, function(e:Event):void{ if (stage.displayState == StageDisplayState.NORMAL) { stage.displayState=StageDisplayState.FULL_SCREEN; } else { stage.displayState=StageDisplayState.NORMAL; } bmp.bitmapData = new BitmapData(stage.stageWidth/2,stage.stageHeight,false,0); if(lagOnFullscreen){ removeEventListener(Event.ENTER_FRAME,frame); setTimeout(function(){addEventListener(Event.ENTER_FRAME,frame)},300); } } ); txt = new TextField(); txt.y = 100; addChild(txt); addEventListener(Event.ENTER_FRAME,frame); txt.filters = [new GlowFilter(0xFFFFFF,1,2,2,100)]; } public function frame(e:Event):void{ graphics.clear(); bmp.bitmapData.lock() for(var i:uint=0;i