# Newbie Q: Why cant i get a hold of my variable outside the function?

**URL:** <https://forum.kirupa.com/t/newbie-q-why-cant-i-get-a-hold-of-my-variable-outside-the-function/225053>\
**Category:** flash\
**Created:** [May 8, 2007, 1:52pm UTC](https://forum.kirupa.com/t/newbie-q-why-cant-i-get-a-hold-of-my-variable-outside-the-function/225053 "2007-05-08T13:52:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![erebore](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@erebore](https://forum.kirupa.com/u/erebore)\
**Post date:** [May 8, 2007, 1:52pm UTC](https://forum.kirupa.com/t/newbie-q-why-cant-i-get-a-hold-of-my-variable-outside-the-function/225053/1 "2007-05-08T13:52:13Z")

</div>

Im trying to make the mouse controll the timeline depending on its \_xmouse cords. But i cant change the varable for the Interval speed.

Why cant I trace the speed variable outside the function?

Thank you for your help!

```auto
stop()

forward = function(){
        if(_xmouse > 300){
        nextFrame();
        }else if (_xmouse < 200){
        prevFrame();    
    }
}

[COLOR=Red]onEnterFrame = function (){
_global.speed=_xmouse;// havn´t come up with the maths for this yet
}
trace(_global.speed)[/COLOR]

hastighet = setInterval(forward,speed);

```
