# Trying to understand Variables

**URL:** <https://forum.kirupa.com/t/trying-to-understand-variables/327524>\
**Category:** flash\
**Created:** [March 7, 2012, 2:38am UTC](https://forum.kirupa.com/t/trying-to-understand-variables/327524 "2012-03-07T02:38:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BindleStick](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@BindleStick](https://forum.kirupa.com/u/BindleStick)\
**Post date:** [March 7, 2012, 2:38am UTC](https://forum.kirupa.com/t/trying-to-understand-variables/327524/1 "2012-03-07T02:38:00Z")

</div>

Hey, I have another as3 problem.  
I created a variable:

**var EnergyNumber:Number = 100;**

And I put a buttonMode on a movie clip, which takes away 10 from EnergyNumber when you click it.

\*\*//Action for clicking Girl Button  
Girl\_btn.addEventListener(MouseEvent.CLICK, GirlTalk);  
Girl\_btn.buttonMode = true;

function GirlTalk(event:MouseEvent){  
var EnergyNumber -= 10;  
}\*\*

I also want another movie clip to go to its second frame when EnergyNumber is equal or less than 50.

**function MidDayFunction(){  
if(EnergyNumber \<= 50)  
{ bg\_mc.gotoAndPlay(“MidDay”);  
}  
}**

I was wondering if I went about this the right way or not? I can’t tell if it’s working or not.
