Detect when mouse leaves movie

Hi. I’m trying to have a function execute when the mouse leaves the entire stage. Unfortunately, if the mouse leaves too soon i need the animation thats going to finish before the new function executes. Kind of like a rollover/rolloff but for the entire movie.

I’ve tried a couple things but nothing works perfectly. You can see in my code below where I tried a few things with _xmouse etc. I’m also not sure if i’m using the variables correctly. HELP!

var pos = "in";

import mx.transitions.Tween;
import mx.transitions.easing.*;
bigButton.onRollOver = function (){
    if (pos == "in"){
        pos = "moving";
        //Animation In using tween classes
            FadeDetails.onMotionFinished = function() {
                pos = "out";
            };
    };
    };
};
/*var xval = _root._xmouse;
var yval = _root._ymouse;
this.onEnterFrame = function() {
    if ( xval > 0 && xval < 460 && yval < 236 && yval > 0 ) {
    } else {
    //if (xval < 0 || xval > 602 || yval > 236 || yval < 0) {
        Close();
    };
};*/
bigButton.onRollOut = function (){
    Close();
};
function Close(){
    if (pos == "out") {
    pos = "moving";
            //Animation Out using tween classes
        MoveTextY2.onMotionFinished = function() {
            pos = "in";
        };
    };
    };
};