AS3 - Can I detect change of value of a variable using addEventListener?

后端 未结 3 872
死守一世寂寞
死守一世寂寞 2021-01-04 13:05

Is it possible to use EventListener to Listen to a variable and detect when the value of that variable changes? Thanks.

3条回答
  •  醉话见心
    2021-01-04 14:09

    You used to be able to do something similar in AS2 using Object.watch. I don't see a direct equivalent, but it looks like mx.binding.utils.ChangeWatcher will give you similar functionality for any variables that are bindable.

    I don't know of a way to do it in AS3 for non-bindable variables, but if the variable you want to watch is bindable (or if you can modify it to be binadable) then ChangeWatcher might give you what you want.

提交回复
热议问题