Reputation: 208
I added a MOUSE_OVER event listener to my MovieClip, then i added MOUSE_OUT just like this :
mc.addEventListener(MouseEvent.MOUSE_OVER, boxItemMouseOver, false, 0, true);
protected function boxItemMouseOver(e:MouseEvent):void
{
trace("mouse over");
var boxItem:MovieClip = e.currentTarget as MovieClip;
boxItem.addEventListener(MouseEvent.MOUSE_OUT, boxItemMouseOut, false, 0, true);
boxItem.removeEventListener(MouseEvent.MOUSE_OVER, boxItemMouseOver);
}
protected function boxItemMouseOut(e:MouseEvent):void
{
trace("mouse out");
var boxItem:MovieClip = e.currentTarget as MovieClip;
boxItem.addEventListener(MouseEvent.MOUSE_OVER, boxItemMouseOver, false, 0, true);
boxItem.removeEventListener(MouseEvent.MOUSE_OUT, boxItemMouseOut);
}
But whenever i move the mouse inside my MovieClip, the MOUSE_OUT event function is being called, although i still didn't leave the area taken by the MovieClip.
I managed to find out where my Problem is, but still can't fix it, i'm adding to my SWF a Cursor that replaces the icon of the mouse (I hide the mouse), once i add it the problem occurs, here is a simple example.
Code : Simple Source Code, Couple of classes
Upvotes: 0
Views: 83
Reputation: 21
1.. u have 'trace("mouse over")' in both functions 2.. first remove mouse over listener, than add mouse out listener 3.. i don't get, why do u need to declare new variable 'boxItem' when u can just write e.target.removeEventListener(..) 4.. it's impossible what u are talking, i caught several unnecessary code in few lines, so there is big chance u are doing somth wrong in your code, show us bigger piece of your code..
p.s. also, try mouseEnabled to false along with mouseChildren to false, but i doubt it will work
Upvotes: 1
Reputation: 5267
Listen for ROLL_OUT
instead. MOUSE_OUT
is dispatched when cursor left any of the nested chidlren of you MovieClip
.
Upvotes: 0