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.


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001760.html