Sunday, May 23, 2010

Reading note of 'Real world flash game development'

Chapter 3:
A Quick Review of the Planning Steps
● One- to two-sentence description
● Game screen wireframe and fl ow
● List of game mechanics
● List of assets (art, animation, sound, video, and copy)
● Technical requirements
● UML class diagrams

Chapter 4:
传入任意数量参数到函数/方法

function myFunction (… params):void {
for (var i:int = 0; I < params.length; i + + ) {
if (!(params[i] is DisplayObject)) {
throw new ArgumentError( “ Only DisplayObjects can be used in myFunction. ” );
}
}
}


Getter/Setter

package {
public class MyClass {
protected var _maxNameLength:int = 8;
protected var _name:String;
protected var _lives:int = 3;
public function get name():String {
return _name;
}
public function set name(value:String):void {
name = value.substr(0,maxNameLength);
}
public function get lives():int {
return _lives;
}
}
}
//OUTSIDE CLASS
var myInstance:MyClass = new MyClass();
myInstance .name = “ CHRISTOPHER ” ;
trace (myInstance.name); //OUTPUTS “ CHRISTOP ” ;
trace (myInstance.lives); //OUTPUTS 3;
myInstance .lives = 10; //THROWS ERROR


to be Continued.