03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example<br />

The following example uses setTimeout() to call a function named my_delayedFunction<br />

after a two(2) second delay, <strong>and</strong> uses the return value to call clearTimeout() if the user<br />

presses the Escape key. The example will output the string "two second delay" after two<br />

seconds has elapsed, unless the user presses the Escape key before my_delayedFunction is<br />

called.<br />

var my_timedProcess:Number = setTimeout(my_delayedFunction, 2000, "two<br />

second delay");<br />

function my_delayedFunction (arg1) {<br />

trace(arg1);<br />

}<br />

var escListener:Object = new Object();<br />

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

if (Key.isDown(Key.ESCAPE)) {<br />

clearTimeout(my_timedProcess);<br />

}<br />

};<br />

Key.addListener(escListener);<br />

When you use this example, be sure to select Control > Disable Keyboard Shortcuts in the test<br />

environment.<br />

See also<br />

clearTimeout function, setInterval function<br />

showRedrawRegions function<br />

showRedrawRegions(enable:Boolean, [color:Number]) : Void<br />

Provides the ability for the debugger player to outline the regions of the screen that are being<br />

redrawn (that is, dirty regions that are being updated). The outlines can also be turned on<br />

with the Show Redraw Regions menu option.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Parameters<br />

enable:Boolean - Specifies whether to enable (true) or disable (false) redraw regions.<br />

When set to true, the redraw rectangles are shown. When set to false, the redraw rectangles<br />

are cleared.<br />

color:Number [optional] - The color to draw with. The default is red: 0xFF0000.<br />

Global Functions 105

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

Saved successfully!

Ooh no, something went wrong!