2013年11月10日 星期日

actionscript - array

helpful:
http://livedocs.adobe.com/flash/9.0_tw/ActionScriptLangRefV3/Array.html



var myArray:Array = new Array("Flash", "ActionScript", "Republic of Code");
trace(myArray);
trace(myArray[0]);


//add elementmyArray[3] = "Tutorial";

//remove from 2nd and 1 item
myArray.splice(2,1);

//remove the last item
myArray.pop();

//add one item at the last
myArray.push("39");










2013年11月4日 星期一

actionscript - random number




 return Math.random() * (max - min) + min;

2013年11月3日 星期日

actionscript keyboard event

function reportKeyDown(event:KeyboardEvent):void 
{ 
    trace("Key Pressed: " + String.fromCharCode(event.charCode) +         " (character code: " + event.charCode + ")"); 
} 
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);