13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Working with video<br />

For AIR cont<strong>en</strong>t running in full-scre<strong>en</strong> mode on the desktop, the system scre<strong>en</strong> saver and power-saving options are<br />

disabled during play until either the video input stops or the user exits full-scre<strong>en</strong> mode.<br />

For full details on using full-scre<strong>en</strong> mode, see “Working with full-scre<strong>en</strong> mode” on page 167.<br />

Enabling full-scre<strong>en</strong> mode for Flash Player in a browser<br />

Before you can implem<strong>en</strong>t full-scre<strong>en</strong> mode for Flash Player in a browser, <strong>en</strong>able it through the Publish template for<br />

your application. Templates that allow full scre<strong>en</strong> include and tags that contain an<br />

allowFullScre<strong>en</strong> parameter. The following example shows the allowFullScre<strong>en</strong> parameter in an tag.<br />

<br />

...<br />

<br />

<br />

<br />

...<br />

<br />

In Flash, select File -> Publish Settings and in the Publish Settings dialog box, on the HTML tab, select the Flash Only<br />

- Allow Full Scre<strong>en</strong> template.<br />

In Flex, <strong>en</strong>sure that the HTML template includes and tags that support full scre<strong>en</strong>.<br />

Initiating full-scre<strong>en</strong> mode<br />

For Flash Player cont<strong>en</strong>t running in a browser, you initiate full-scre<strong>en</strong> mode for video in response to either a mouse<br />

click or a keypress. For example, you can initiate full-scre<strong>en</strong> mode wh<strong>en</strong> the user clicks a button labeled Full Scre<strong>en</strong> or<br />

selects a Full Scre<strong>en</strong> command from a context m<strong>en</strong>u. To respond to the user, add an ev<strong>en</strong>t list<strong>en</strong>er to the object on which<br />

the action occurs. The following code adds an ev<strong>en</strong>t list<strong>en</strong>er to a button that the user clicks to <strong>en</strong>ter full-scre<strong>en</strong> mode:<br />

var fullScre<strong>en</strong>Button:Button = new Button();<br />

fullScre<strong>en</strong>Button.label = "Full Scre<strong>en</strong>";<br />

addChild(fullScre<strong>en</strong>Button);<br />

fullScre<strong>en</strong>Button.addEv<strong>en</strong>tList<strong>en</strong>er(MouseEv<strong>en</strong>t.CLICK, fullScre<strong>en</strong>ButtonHandler);<br />

function fullScre<strong>en</strong>ButtonHandler(ev<strong>en</strong>t:MouseEv<strong>en</strong>t)<br />

{<br />

stage.displayState = StageDisplayState.FULL_SCREEN;<br />

}<br />

The code initiates full-scre<strong>en</strong> mode by setting the Stage.displayState property to<br />

StageDisplayState.FULL_SCREEN. This code scales the <strong>en</strong>tire stage to full scre<strong>en</strong> with the video scaling in<br />

proportion to the space it occupies on the stage.<br />

Last updated 6/6/2012<br />

482

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!