摘自:http://www.darronschall.com/weblog/archives/000126.cfm
import mx.utils.Delegate;
import mx.controls.Button;
function init() {
createClassObject(Button, "btn1", 1, {label:"plus 1"});
createClassObject(Button, "btn2", 2, {label:"plus 5", _y: btn1._y+btn1.height});
var f = Delegate.create(this, onIncrement);
f.step = 1;
btn1.addEventListener("click", f);
f = Delegate.create(this, onIncrement);
f.step = 5;
btn2.addEventListener("click", f);
total = 0;
}
function onIncrement() {
total += arguments.caller.step;
trace(total);
}
init();