1

I have a MovieClip instance (movie) brought by code to the stage. I want to add some effects when mouse over or mouse down for this movie. So, first i added event listeners to this MovieClip:

movie.addEventListener(MouseEvent.MOUSE_DOWN, movieDownHandler);
movie.addEventListener(MouseEvent.MOUSE_UP, movieUpHandler);
movie.addEventListener(MouseEvent.MOUSE_OVER, movieOverHandler);
movie.addEventListener(MouseEvent.MOUSE_OUT, movieOutHandler);

Then i added event handlers:

private function movieDownHandler(e:MouseEvent):void {
   trace("down");
}
private function movieUpHandler(e:MouseEvent):void {
   trace("up");
}
private function movieOverHandler(e:MouseEvent):void {
   trace("over");
}
private function movieOutHandler(e:MouseEvent):void {
   trace("out");
}

And when i test it, everything goes ok: mouse over this movie, traces over, mouse down traces down, mouse up traces up and so on... But, when i add size change to the movie, for example, to mouse down handler like this:

private function movieDownHandler(e:MouseEvent):void {
   trace("down");
   movie.scaleX = 0.9;
   movie.scaleY = 0.9;
}

and some filter effect to over handler, for example blurFilter:

private function movieOverHandler(e:MouseEvent):void {
   trace("over");
   e.currentTarget.filters = [new BlurFilter(1,1,1)];
}

then i receive unexpected behavior for event handlers: mouse over traces over (it is ok) and then i press (mouse down without releasing mouse button) at movie, then three events happen one after one: 'down', 'out', 'over' (mouse cursor don't leave MovieClip shape). What is the problem? Furthermore, setting scaleX and scaleY to 1.1 doesn't break handlers behavior

lamer
  • 11
  • 2
  • UP , OVER and OUT you attached to `movieUpHandler` , may be this is the reason? – Ivan Chernykh Oct 21 '13 at 06:11
  • oh, no, this is mistype. Thx for comment – lamer Oct 21 '13 at 06:20
  • btw, i have found that this behavior because of MovieClip content. If i try to change movie clip to just a simple rectangle, everyhing goes ok... But i have also tried to add rectangle over all movie content and this doesn't help me. – lamer Oct 21 '13 at 06:55

1 Answers1

1

When you click a button,it go through three stage,first 'over',then 'down',then 'up',so it trace like that. scareX has a range:0~1,the sacre is 0% ~ 100%

  • thx, but as i said everything went ok before adding scale changes to movie after pressing on it – lamer Oct 21 '13 at 06:38
  • well, `scaleX` can definitely be greater than 1, and less than 0. Say I've got some of my sprites scaled to -1. I say NO. – Vesper Oct 21 '13 at 13:12