Tuesday, November 25, 2008

_root.calculator.outputBox = what.charAt(1)

// movie clip is the button for each number

on(press) {
// b2

// name each instance... b0...b1...b2...b3
var what:String = this._name;

// what.charAt(1); strips the instance name of the "b"
// gets the character at index 1
// TIP: remember indexing begins with 0,
// so index position 1 is really character 2
// then it puts the result in to the output window
_root.calculator.outputBox = what.charAt(1);

}

No comments: