Actionscript Question
Out of context: Reply #4
- Started
- Last post
- 10 Responses
- enobrev0
from my experience, flash can't actually track the mouse once it's left the movie (unfit?). And for whatever reason, I haven't found a var that states that the mouse is gone... but, I've used something similar to this recently:
bounds = createEmptyMovieClip('bounds', 9999);
bounds.lineStyle(1, 0x000000, 100);
bounds.moveTo(5, 5);
bounds.lineTo(Stage.width -5, 5);
bounds.lineTo(Stage.width - 5, Stage.height -5);
bounds.lineTo(5, Stage.height -5);
bounds.lineTo(5, 5);bounds.onEnterFrame = function() {
if (hitTest(_root._xmouse, _root._ymouse)) {
trace('ON');
} else {
trace('OFF');
}
}copy and paste that into a new movie and you'll see the affect in the trace.
Basically, it creates a box about 5 pixels smaller than the movie. Then it checks if the mouse is in that box.
That extra 5 pixels gives it room to test the mouse position pretty well.
Also, you'll notice I put it at dept 9999. I believe it can be under other things (try putting at 1), but i haven't had the change to try
good luck!