# Displayobjects drawn to bitmap always dispatches rollover/rollout

**URL:** <https://forum.kirupa.com/t/displayobjects-drawn-to-bitmap-always-dispatches-rollover-rollout/286238>\
**Category:** Uncategorized\
**Created:** [April 12, 2009, 2:56pm UTC](https://forum.kirupa.com/t/displayobjects-drawn-to-bitmap-always-dispatches-rollover-rollout/286238 "2009-04-12T14:56:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigmoor](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bigmoor](https://forum.kirupa.com/u/bigmoor)\
**Post date:** [April 12, 2009, 2:56pm UTC](https://forum.kirupa.com/t/displayobjects-drawn-to-bitmap-always-dispatches-rollover-rollout/286238/1 "2009-04-12T14:56:15Z")

</div>

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
