# Variable problem

**URL:** <https://forum.kirupa.com/t/variable-problem/244609>\
**Category:** Uncategorized\
**Created:** [November 20, 2007, 5:14am UTC](https://forum.kirupa.com/t/variable-problem/244609 "2007-11-20T05:14:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leonthelion](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@leonthelion](https://forum.kirupa.com/u/leonthelion)\
**Post date:** [November 20, 2007, 5:14am UTC](https://forum.kirupa.com/t/variable-problem/244609/1 "2007-11-20T05:14:21Z")

</div>

I’m having a variable problem, I have some code where player presses x and you go to a different frame, but I’m trying to make a delay so that if you have x down you wont just zoom through the frames. The problem is that for some reason the variable is always 0. Heres my code on the frame before the talking scene:

```php
 
 _root.talktimer=100

```

right after that frame I have this code:

```php
 
stop()
onEnterFrame=function(){
_root.talktimer-=1
if(_root.talktimer=0 & Key.isDown(88)){
 gotoAndPlay(46)}}

```

For some reason when I get to the frame with talktimer-=1 the timer atomatically sets itself to 0. Can anyone help me with this?  
OFF TOPIC:  
How do global variable work and how can I make one show? Do I put this in the variable spot in a dynamic text (\_global.variable)? Or do I do it some other way?
