EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - TAB (Key.tab Property)

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
388 ActionScript classes
Example
The following example moves a movie clip called
car_mc a constant distance (10) when you
press the arrow keys. A sound plays when you press the Spacebar. Give a sound in the library a
linkage identifier of
horn_id for this example.
var DISTANCE:Number = 10;
var horn_sound:Sound = new Sound();
horn_sound.attachSound("horn_id");
var keyListener_obj:Object = new Object();
keyListener_obj.onKeyDown = function() {
switch (Key.getCode()) {
case Key.SPACE :
horn_sound.start();
break;
case Key.LEFT :
car_mc._x -= DISTANCE;
break;
case Key.UP :
car_mc._y -= DISTANCE;
break;
case Key.RIGHT :
car_mc._x += DISTANCE;
break;
case Key.DOWN :
car_mc._y += DISTANCE;
break;
}
};
Key.addListener(keyListener_obj);
TAB (Key.TAB property)
public static TAB : Number
The key code value for the Tab key (9).
Availability: ActionScript 1.0; Flash Lite 2.0
Example
The following example creates a text field, and displays the date in the text field when you
press Tab.
this.createTextField("date_txt", this.getNextHighestDepth(), 0, 0, 100,
22);
date_txt.autoSize = true;
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.TAB)) {
var today_date:Date = new Date();

Table of Contents

Related product manuals