This is a wierd bug that I need to find a solution to.
If you draw a movieclip (with a 3d rotation on it) to bitmap, eventlisteners will always dispatch rollout and rollover for that movieclip (on mouse over). A solution could be to set the matrix3d = null ,draw, and then apply the original matrix3d, but I can’t do this in my project 'cause all clips is a 3d object to a parent 3d object that gets drawn to a bitmap every frame. And it would requiere some ugly coding.
to see the bug, copy this example code into the first frame on the stage (cs4 flashplayer 10).
var bmp:BitmapData = new BitmapData(100, 100); //setup a dummy bitmap
var bmpContainer:MovieClip = new MovieClip;
bmpContainer.addChild(new Bitmap(bmp));
var box:MovieClip = new MovieClip;
addChild(box);
box.x = 200;
box.y = 200;
box.graphics.beginFill(0x000000);
box.graphics.drawRect(0, 0, 100, 100);
box.graphics.endFill();
box.rotationY = 20; //Apply any 3d transformation
this.addEventListener(MouseEvent.ROLL_OVER, onMouseOverObject);
this.addEventListener(MouseEvent.ROLL_OUT, onMouseOutObject);
this.addEventListener(Event.ENTER_FRAME, update);
function onMouseOverObject (event:MouseEvent) {
trace(“over”+Math.random())
}
function onMouseOutObject (mouseEvent:MouseEvent) {
trace(“out”+Math.random())
}
function update (event:Event) {
bmp.draw(box); //draw to any bitmap
}
//result: the rotationY and draw doesn’t work together because
//rollover and rollout always gets dispatched