Trying to understand Variables

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.