Variable shows up as undefined

I’m creating a mini quiz. I’ve got a conditional statement for the answer:

if ((H1 > 5) && (H1 < 11 )) { 
                 setProperty (_root.checkKeyN, _visible, 1); 
     setProperty (_root.redXKeyN, _visible, 0);
     var H1Score = 1;
     trace (H1Score);
  }else { 
   setProperty (_root.redXKeyN, _visible, 1); 
   setProperty (_root.checkKeyN, _visible, 0);
   var H1Score:Number = 0;
   trace (H1Score);

Tracing the code (commented out in the example) gives me the respective value.

When I go to call that variable on a button release and display the variable’s content in a dynamic text field (it’s even on the same level), I get undefined, but I don’t know why.

Here’s the code

on (release) { 
_parent.cardAScoretxt.text =  H1Score;

Can someone please tell me what I am doing wrong?