yes, it's not going to work. either that code you posted is
looping and you'll repeatedly define that onEnterFrame loop (which
is unnecessary) and that onEnterFrame loop will never stop (even
when the mouse is near your stage edge). or that code is not
looping and will execute once when your mouse will likely not be
detected and that onEnterFrame loop will never be defined.