# Variable shows up as undefined

**URL:** <https://forum.kirupa.com/t/variable-shows-up-as-undefined/248387>\
**Category:** flash\
**Created:** [January 7, 2008, 9:11pm UTC](https://forum.kirupa.com/t/variable-shows-up-as-undefined/248387 "2008-01-07T21:11:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deadtrees](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@deadtrees](https://forum.kirupa.com/u/deadtrees)\
**Post date:** [January 7, 2008, 9:11pm UTC](https://forum.kirupa.com/t/variable-shows-up-as-undefined/248387/1 "2008-01-07T21:11:26Z")

</div>

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

```auto
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

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

```

Can someone please tell me what I am doing wrong?
