Watch function in as 3

I have been trying to convert the watch function code into AS 3. I am totally new to AS 3 and could not find the solution yet. Here is my code -


var buttons = {left:0, right:0};

function buttonCallback(prop, oldvalue, newvalue, userdata) {
if (newvalue == 0) {
buttonUp(userdata);
}
if (newvalue == 1) {
buttonDown(userdata);
}
return newvalue;
}

function buttonDown(buttonID){
trace(buttonID +" down");
};
function buttonUp(buttonID){
trace(buttonID +" up");
};

buttons.watch(“left”, buttonCallback, “LEFT”);
buttons.watch(“right”, buttonCallback, “RIGHT”);

The variable ‘buttons’ must be in the root timeline. And, I cannot use this variable inside any other class.

Is it possible to convert it to AS 3?

Thanks!