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

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!

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);