# Refresh / reread variables within movie

**URL:** <https://forum.kirupa.com/t/refresh-reread-variables-within-movie/295504>\
**Category:** flash\
**Created:** [August 31, 2009, 2:59pm UTC](https://forum.kirupa.com/t/refresh-reread-variables-within-movie/295504 "2009-08-31T14:59:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kekekiko](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kekekiko](https://forum.kirupa.com/u/kekekiko)\
**Post date:** [August 31, 2009, 2:59pm UTC](https://forum.kirupa.com/t/refresh-reread-variables-within-movie/295504/1 "2009-08-31T14:59:40Z")

</div>

I have created a little virtual shop that reads the amount of money a player has and then enables different products to be bought. Eg - if someone has 200 points they can buy a ball for 20 or a bat for 200. This all works fine for one purchase. All of the items check the score and are enabled or disabled fine. However, say I purchase the ball - the points reduces by 20 to 180 - not a problem - but the bat is still enabled even though the variable has reduced so they can’t afford it.

Is there a way of refreshing the variable so that the items are constantly monitoring the variable amounts?

Here is the code I put in an mc inside the ball mc that enables it:

onEnterFrame = function(){  
if (\_root.myscore \>= 100) {  
this.\_parent.gotoAndStop(“2”);  
}  
}

I put it in an mc so that if they buy the item it goes to a different frame where there is no mc to check the myscore var and therefore they’ve bought it!

I know it is the onEnterFrame that is the problem but I am not too sure what event handler would work. Any suggestions?!
