03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

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.

See also<br />

substr (String.substr method)<br />

nextFrame function<br />

nextFrame() : Void<br />

Sends the playhead to the next frame.<br />

Example<br />

In the following example, when the user presses the Right or Down arrow key, the playhead<br />

goes to the next frame <strong>and</strong> stops. If the user presses the Left or Up arrow key, the playhead<br />

goes to the previous frame <strong>and</strong> stops. The listener is initialized to wait for the arrow key to be<br />

pressed, <strong>and</strong> the init variable is used to prevent the listener from being redefined if the<br />

playhead returns to Frame 1.<br />

stop();<br />

if (init == undefined) {<br />

someListener = new Object();<br />

someListener.onKeyDown = function() {<br />

if (Key.isDown(Key.LEFT) || Key.isDown(Key.UP)) {<br />

_level0.prevFrame();<br />

} else if (Key.isDown(Key.RIGHT) || Key.isDown(Key.DOWN)) {<br />

_level0.nextFrame();<br />

}<br />

};<br />

Key.addListener(someListener);<br />

init = 1;<br />

}<br />

See also<br />

prevFrame function<br />

nextScene function<br />

nextScene() : Void<br />

Sends the playhead to Frame 1 of the next scene.<br />

Example<br />

In the following example, when a user clicks the button that is created at runtime, the<br />

playhead is sent to Frame 1 of the next scene. Create two scenes, <strong>and</strong> enter the following<br />

ActionScript on Frame 1 of Scene 1.<br />

Global Functions 63

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

Saved successfully!

Ooh no, something went wrong!