Why does this work? (onChanged)

Hi All,

Can someone tell me why this is not working…

I want to be able to track data changes and then call a function.


 
// New Object
cool = new Object();
cool.dog = 0;
 
// Create Listener
dataListener = new Object();
_root.cool.dog.addListener(dataListener);
dataListener.onChanged = function() {
trace("the data has changed");
};
 
// Button
buttonBtn.onPress = function() {
cool.dog++;
};
 
 

for now the button makes the changes, but in my application the data changes on a random event, so I need to monitor it.

Thanks people…

Codekill…