A few days ago a client asked me if I can convert ATF (Adobe Texture Format) to PNG images. Knowing that ATF files are used by some Starling developers when developing games and applications with Adobe Air, I knew that I could build a tool that will load the graphic, add it to the stage, then basically, take a screenshot of the entire stage and save it as a PNG image file. It took a a few hours to get the final application done. I’ve made it available for download in case anyone else needs to convert ATF to PNG (with transparency).
Today I tried to make a full screen button for my Christmas Day Countdown online application. With that application I’m using Starling with Feathers components. If you listen for Event.TRIGGERED on a Feathers button and then change the displayState, you will get a Security error:
SecurityError: Error #2152: Full screen mode is not allowed.
Flash Player is expecting a MouseEvent when changing the displayState, it will not work with a Touch event. I looked for a workaround and I found this forum topic. After I made some improvements, I finally had a working full screen button triggered from Starling. The code below works like a charm:
Starling.current.nativeStage.addEventListener(MouseEvent.MOUSE_DOWN, toggleFullScreen); private function toggleFullScreen(event:MouseEvent):void { if(_fullScrenButton.stage != null) { if(_fullScrenButton.stage.hitTest(new Point(event.stageX, event.stageY)) == _fullScrenButton) { if(Starling.current.nativeStage.displayState == StageDisplayState.FULL_SCREEN) { Starling.current.nativeStage.displayState = StageDisplayState.NORMAL; } else { Starling.current.nativeStage.displayState = StageDisplayState.FULL_SCREEN; } } } } |