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;
			}
		}
	}
}