# Create an event listener for when value has changed?

**URL:** <https://forum.kirupa.com/t/create-an-event-listener-for-when-value-has-changed/331130>\
**Category:** flash\
**Created:** [May 23, 2013, 7:15pm UTC](https://forum.kirupa.com/t/create-an-event-listener-for-when-value-has-changed/331130 "2013-05-23T19:15:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeekTweak\_0](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@GeekTweak\_0](https://forum.kirupa.com/u/GeekTweak_0)\
**Post date:** [May 23, 2013, 7:15pm UTC](https://forum.kirupa.com/t/create-an-event-listener-for-when-value-has-changed/331130/1 "2013-05-23T19:15:11Z")

</div>

I have a sub-class that needs to run a function in the main-class when necessary, but from the sub-class, i cant just simply do that without creating some stack overflow or something. so i need to add an event listener inside the main class to check for that change of value in the sub-class.

I want to create an event listener to check for when an integer value has changed, so i don’t have to create a timer event in the main-class checking periodically, as that seems un-efficient and a large pain.

How would be best to create an event listener that checks for the change in an integer variable? I hate to be a bother but if there is any simple code example could be posted it would help me in the understanding process. I learn much better via direct example 😛 THANKS.
