Hi everybody,
Happy new year btw !
I want to separate event handling from a container and it child. So as you can see, my source code is very simple :
package {
import flash.display.Sprite;
import flash.display.*;
import flash.events.*;
public class test extends Sprite{
public function test() {
var container:Sprite = new Sprite(); // my container
container.graphics.beginFill(0, 1); // whatever the color
container.graphics.drawRect(0, 0, 100, 100); // origin at 0,0
container.graphics.endFill();
addChild(container);
var decor:Sprite = new Sprite(); // and it child
decor.graphics.beginFill(0, 1); // whatever the color
decor.graphics.drawRect(200, 200, 100, 100); // origin at 200,200
decor.graphics.endFill();
container.addChild(decor);
container.mouseChildren = false;
container.addEventListener(MouseEvent.ROLL_OVER, onOver, false, 0, true);
}
private function onOver(e: MouseEvent):void {
trace("ROLL trace");
}
}
}
When I roll over the container object, I’ve got the trace (OK for me).
BUT When I roll over the decor object, I’ve got the trace too (not what I want).
I just want the container to be triggered by the mouse event, not it child.
So what’s happened to my mouseChildren = false…? I don’t understand…
Thanks for any help.
B.R.