Add Full Screen with publishing settings
When changing the publishing settings to allow your SWF to launch in full screen you first have to change the publishing setting under the HTML tag.
Adding a click handlers
You can also add full screen capabilities to a SWF file without publishing an HTML page by adding code to the
The <object> tag: <param name="allowFullScreen" value="true" /> and
The <embed> tag: allowfullscreen="true"
You must also add ActionScript to allow full screen by using buttons or the stage.
Using buttons to launch Full Screen
fullBtn.addEventListener(MouseEvent.CLICK, goFull);
function goFull(event:MouseEvent):void{
stage.displayState = StageDisplayState.FULL_SCREEN;
}
escapeBtn.addEventListener(MouseEvent.CLICK, goSmall);
function goSmall(event:MouseEvent):void{
stage.displayState = StageDisplayState.NORMAL;
}
Using the Stage to launch Full Screen
import flash.display.StageDisplayState;
function goFullScreen():void
{
if (stage.displayState == StageDisplayState.NORMAL)
{
stage.displayState = StageDisplayState.FULL_SCREEN;
}
else
{
stage.displayState = StageDisplayState.NORMAL;
}
}
stage.addEventListener(MouseEvent.CLICK, _handleClick);
function _handleClick(event:MouseEvent):void
{
goFullScreen();
}
If the SWF file is already published, changing the HTML <embed> and <param> tags will not allow full screen.
No comments:
Post a Comment