i would have posted this sooner but comcast shit on me
At 3/17/07 06:22 PM, sniffy-gerbil wrote: Would this be a valid code?
you should try as3, its basically the same but more java like. but for this code to work in as2 it would need some slight changes
class Character extends MovieClip {
public var name:String;
//needs "var" identifier before variable name
public var age:Number;
//int is in as3 not as2
private var items:Array = new Array(20);
//arrays get their own datatype and one array can handle multiple types
/*you dont need functions to set/get variables, just make them public and change them outside the class, like:
myCharacter.name = "";
your way works though*/
public function addItem(item:String):Void {
//put private/public/super on everything
items.push(item);
}
}
if i missed anything im sure gust will be all over it. also i took put "public" before "class" im not sure if it matters so test out both