| Package | vegas.ui |
| Class | public dynamic class CheatCode |
| Inheritance | CheatCode flash.events.EventDispatcher |
| Implements | Lockable |
| Property | Defined By | ||
|---|---|---|---|
| delay : Number
Indicates the amount of time to wait before reseting the keyboard input. | CheatCode | ||
| keys : Array
Determinates the Array representation of all key codes to validate the cheat code. | CheatCode | ||
| stage : Stage
Indicates the Stage reference of the application. | CheatCode | ||
| Method | Defined By | ||
|---|---|---|---|
CheatCode(keys:Array = null, stage:Stage = null, delay:uint = 1000)
Creates a new CheatCode instance. | CheatCode | ||
createFromString(code:String, stage:Stage = null, delay:uint = 1000):CheatCode [static]
Generates a cheat code object with a specific String expression. | CheatCode | ||
isLocked():Boolean
Returns true if the object is locked. | CheatCode | ||
lock():void
Locks the object. | CheatCode | ||
unlock():void
Unlocks the object. | CheatCode | ||
| delay | property |
delay:NumberIndicates the amount of time to wait before reseting the keyboard input.
public function get delay():Number public function set delay(value:Number):void| keys | property |
keys:ArrayDeterminates the Array representation of all key codes to validate the cheat code.
public function get keys():Array public function set keys(value:Array):void| stage | property |
stage:StageIndicates the Stage reference of the application. This property must be defines to handle the keyboard events.
public function get stage():Stage public function set stage(value:Stage):void| CheatCode | () | Constructor |
public function CheatCode(keys:Array = null, stage:Stage = null, delay:uint = 1000)Creates a new CheatCode instance.
Parameterskeys:Array (default = null) — The Array representation of all key codes to validate the cheat code.
| |
stage:Stage (default = null) — a Stage reference to handle the keyboard events (This property must be defines to handle the keyboard events).
| |
delay:uint (default = 1000) — the amount of time to wait before reseting the keyboard input (default 1000 ms).
|
| createFromString | () | method |
public static function createFromString(code:String, stage:Stage = null, delay:uint = 1000):CheatCodeGenerates a cheat code object with a specific String expression.
Example :
import vegas.ui.CheatCode;
var cheat:CheatCode = CheatCode.createFromString( "hello" , stage ) ;
cheat.onSelect = function():void
{
trace( "hello world !" );
}
Parameters
code:String | |
stage:Stage (default = null) | |
delay:uint (default = 1000) |
CheatCode |
| isLocked | () | method |
public function isLocked():Boolean
Returns true if the object is locked.
Boolean — true if the object is locked.
|
| lock | () | method |
public function lock():voidLocks the object.
| unlock | () | method |
public function unlock():voidUnlocks the object.
import vegas.ui.CheatCode;
///////// konami code ( UP | UP | DOWN | DOWN | LEFT | RIGHT | LEFT | RIGHT | B | A ).
var selectKonami:Function = function( e:Event ):void
{
trace( "hello konami code !" );
}
var konami:Array = [ 38 , 38 , 40 , 40 , 37 , 39 , 37 , 39 , 66 , 65 ] ;
var cheat1:CheatCode = new CheatCode( stage , konami ) ;
cheat1.addEventListener( Event.SELECT , selectKonami ) ;
///////// custom code based String expression ("hello").
var selectHelloWorld:Function = function():void
{
trace( "hello world !" );
}
var cheat2:CheatCode = CheatCode.createFromString( "hello" , stage ) ;
cheat2.onSelect = selectHelloWorld ; // use basic callback method