kottore / away3d

Automatically exported from code.google.com/p/away3d
0 stars 0 forks source link

Sprite2D Mouse Events #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sprite2D 
objects don`t receive mouse interaction or/and don`t fire events

...
var sprite:Sprite2D = new Sprite2D(myBitmapData, {useHandCursor:true});
scene.addChild(sprite);
sprite.addOnMouseDown(function(e:MouseEvent3D):void {trace("SPRITE EVENT",e)});
...

Result: Silents

looks like another sprite object have the same problem

Original issue reported on code.google.com by gasu.basu on 13 Nov 2008 at 1:21

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
An tweak solution was founded here:
http://markmail.org/message/l64wqxxsx6x3i5cm#query:away3d%20sprite%20mouse%20eve
nts%20problem+page:1+mid:skk2bctuh6ajbhsy+state:results

...
This might not be the root cause of the issue, but in
away3d.core.draw.DrawScaledBitmap.contains(), changing the line that reads:

mapping = new Matrix(scale*cos, -scale*sin, scale*sin, scale*cos, topleft.x, 
topleft.y);

to be:

if( rotation != 0 ) mapping = new Matrix(scale*cos, -scale*sin, scale*sin, 
scale*cos,
topleft.x, topleft.y); else mapping = new Matrix(scale, 0, 0, scale, topleft.x,
topleft.y );

seems to get mouse events working on my Sprite2D billboards. 
...

It`s really worked, checked in my project

Original comment by gasu.basu on 20 Nov 2008 at 9:38

GoogleCodeExporter commented 8 years ago
it worked...but,
roll-over events are triggered when the mouse is within the sprite2d's bounds
REGARDLESS of any button overlayed over it.

e.g. on roll-over of a sprite2d, display a button in 2d stage overlapping the 
3d stage.
roll-over the part of that button that is inside the bounds of the sprite2d and 
it
will trigger the roll-over of the sprite2d.

thanks anyway - i just gotta do more code checks for when the sprite2ds have the
onRollOver action

Original comment by kuer...@gmail.com on 3 Dec 2008 at 5:00

GoogleCodeExporter commented 8 years ago
thanx for the fix! updated and in the trunk revision 893

unfortunately the sprit2d rollovers are not paer of the same problem... 
interrupting
rollover events for mouseevent3d would have worse consequences for things like
interactive moviematerials. if you can work around that effect, it is probably 
the
best long term solution

Rob

Original comment by rob.bate...@gmail.com on 11 Dec 2008 at 9:28