Make flash listen for change in a variable

I am trying to get my flash animation to do something when it detects a change in a variable (number) that is communicated to it from JavaScript. All I need to do is *
if variable change{
do this stuff
}*

Anyone know how I can do that?

Thanks