after setting stage.transform.matrix3d, mouse event localX/Y stageX/Y do not work
hello
because need 3d transformation on whole stage, set stage transfromation.matrix3d.
i made 1 test application , find mouse event doesn't work properly.
in application, add sprite containing red circle , test functions.
besides, scale stage along x-axis half using stage.transform.matrix3d
the problem when click on red circle, e.localx/y , e.stagex/y zeros.
but if click on places rather red circle be, e.localx/y , e.stagex/y work fine.
here code.
public function init():void{
var m:matrix3d= new matrix3d();
m.copyrowfrom(0,new vector3d(0.5,0,0,0));
m.copyrowfrom(1,new vector3d(0,1,0,0));
m.copyrowfrom(2,new vector3d(0,0,1,0));
m.copyrowfrom(3,new vector3d(0,0,0,1));
stage.transform.matrix3d = m;
s.graphics.beginfill(0xff0000);
s.graphics.drawcircle(0,0,50);
s.graphics.endfill();
addchild(s);
s.x = (stage.stagewidth)/2;
s.y = (stage.stageheight)/2;
s.z = 0;
stage.addeventlistener(mouseevent.click, onstageclick);
}
private function onstageclick(e:mouseevent):void{
trace("global" + e.stagex + " " + e.stagey);
trace("local" + e.localx + " " + e.localy);
}
More discussions in ActionScript 3
adobe
Comments
Post a Comment