Skip navigation
DJ Gecko
Currently Being Moderated

rotationX and rotationY and rotationZ and PerspectiveProjection together break MouseEvent

Apr 21, 2009 8:19 PM

When I change the rotation of a movie clip, and apply PerspectiveProjection, all mouse events applied to that movie clip and all the movie clips inside that movie clip break. 

 

The mouse event bellow will not work for me.

 

a_mc.rotationX = 1;

a_mc.rotationY = 1;

a_mc.rotationZ = 1;

//

var perspective:PerspectiveProjection = new PerspectiveProjection();

perspective.fieldOfView = 45;

 

var point:Point = new Point((a_mc.stage.stageWidth / 2) + 200, -350);

perspective.projectionCenter = point;

a_mc.transform.perspectiveProjection = perspective;

 

a_mc.addEventListener(MouseEvent.MOUSE_UP, testEvent);

 

function testEvent (event:MouseEvent):void {

     trace("testEvent");

}

 

 

 

But if I remove the rotation code it works:

 

//a_mc.rotationX = 1;

//a_mc.rotationY = 1;

//a_mc.rotationZ = 1;

//

 

var perspective:PerspectiveProjection = new PerspectiveProjection();

perspective.fieldOfView = 45;

 

var point:Point = new Point((a_mc.stage.stageWidth / 2) + 200, -350);

perspective.projectionCenter = point;

a_mc.transform.perspectiveProjection = perspective;

 

 

 

a_mc.addEventListener(MouseEvent.MOUSE_UP, testEvent);

 

 

function testEvent (event:MouseEvent):void {

     trace("testEvent");

}

 

 

 

 

And if I remove the perspective code it works:

 

a_mc.rotationX = 1;

a_mc.rotationY = 1;

a_mc.rotationZ = 1;

 

 

 

a_mc.addEventListener(MouseEvent.MOUSE_UP, testEvent);

 

 

function testEvent (event:MouseEvent):void {

     trace("testEvent");

}

 

 

 

Is there something I'm doing wrong?

 

Thanks!

  • Currently Being Moderated
    Community Member
    Apr 21, 2009 9:23 PM

    I don't know what the best solution is, but I don't think you're doing anything wrong.

     

    It appears to be related to the PerspectiveProjection....

     

    There are some comments about this in various locations:

     

    https://bugs.adobe.com/jira/browse/FP-1609?page=com.atlassian.jira.plu gin.system.issuetabpanels:all-tabpanel

     

    http://maohao.wordpress.com/category/flash/   (flex related, but the same issue)

     

     

     

    I don't have flash CS4, but was able to get your code running in FlashDevelop....

     

    I followed the examples above and changed the line to

     

    a_mc.parent.transform.perspectiveProjection = perspective;

     

    which got the mouse events working again...although perhaps not in the way you want. Sorry can't suggest anything else....

     

    Actually this seems quite relevant:

    http://www.actionscript.org/forums/showthread.php3?p=868566

    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points