Game Development Reference
In-Depth Information
_rolloverHighlight.visible = true;
}
protected function onRollOut(e:MouseEvent):void {
_rolloverHighlight.visible = false;
}
public function select():void {
_clickHighlight.visible = true;
}
public function deselect():void {
_clickHighlight.visible = false;
}
public function activate():void {
addEventListener(MouseEvent.CLICK, onClick, false, 1,
true);
addEventListener(MouseEvent.ROLL_OVER, onRollOver,
false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, onRollOut, false,
0, true);
buttonMode = true;
}
public function deactivate():void {
removeEventListener(MouseEvent.CLICK, onClick);
removeEventListener(MouseEvent.ROLL_OVER, onRollOver);
removeEventListener(MouseEvent.ROLL_OUT, onRollOut);
buttonMode = false;
_rolloverHighlight.visible = false;
deselect();
}
The first three methods are triggered by mouse events and tog-
gle the rollover state and select method. The next four are more
implementations from the interface, all of which affect the different
states and mouse input.
public function lock():void {
deactivate();
setTimeout(pieceLockAnimation, 500);
}
public function movePiece(newX:Number, newY:Number):void {
TweenLite.to(this, .5, { x:newX, y:newY, ease:Expo.
easeOut} );
}
Search Nedrilad ::




Custom Search