EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - HOME (Key.home Property); INSERT (Key.insert Property)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 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...
Key 681
HOME (Key.HOME property)
public static HOME : Number
The key code value for the Home key (36).
Availability: ActionScript 1.0; Flash Player 5
Example
The following example attaches a draggable movie clip called
car_mc at the x and y
coordinates of 0,0. When you press the Home key,
car_mc returns to 0,0. Create a movie clip
that has a linkage ID
car_id, and add the following ActionScript to Frame 1 of the Timeline:
this.attachMovie("car_id", "car_mc", this.getNextHighestDepth(), {_x:0,
_y:0});
car_mc.onPress = function() {
this.startDrag();
};
car_mc.onRelease = function() {
this.stopDrag();
};
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.HOME)) {
car_mc._x = 0;
car_mc._y = 0;
}
};
Key.addListener(keyListener);
The MovieClip.getNextHighestDepth() method used in this example requires Flash Player
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
MovieClip.getNextHighestDepth() method.
INSERT (Key.INSERT property)
public static INSERT : Number
The key code value for the Insert key (45).
Availability: ActionScript 1.0; Flash Player 5

Table of Contents

Related product manuals