Clicking thru starling

Software: Away3D 4.x

CubeHeaded, Newbie
Posted: 25 December 2012 01:45 PM   Total Posts: 6

In my project i’m using away3d 4 for 3d scene and on top of that i have starling for ui, everything working just fine, only when i’m clicking on starling ui elements 3d objects underneath it is responding on the mouse event too.
How can i avoid that?
Excuse me if this question already was answered somewhere on forum, i just can’t find it.
Thanks in advance!

   

CubeHeaded, Newbie
Posted: 28 December 2012 03:38 PM   Total Posts: 6   [ # 1 ]

still struggling with this one, anybody?

   

dlx, Newbie
Posted: 30 December 2012 12:14 AM   Total Posts: 12   [ # 2 ]

Hi CubeHeaded,

I just created a thread about the same issue, before I saw your post…
You are not alone ! I’ll let you know if I have an answer before you do wink

   

dlx, Newbie
Posted: 30 December 2012 12:32 AM   Total Posts: 12   [ # 3 ]

OK, I just found out !
maybe this post could help you out :
http://away3d.com/forum/viewthread/3512/
I felt like a moron when reading this thread…

   

rthompson, Newbie
Posted: 03 January 2013 09:54 PM   Total Posts: 9   [ # 4 ]

@dlx this is not the same issue, CubeHeaded is saying the mouse events are firing in both Starling and Away3D, instead of just firing for Starling..I’m having the same issue.

Did you find a solution to this CubeHeaded?

It appears that even though Starling is layered atop Away3D, Away3D receives the mouse events first (preventing some kind of hack).  This makes sense as in my loop I call view.render() before starling.nextFrame()...

Any help would be much appreciated.

   

Avatar
80prozent, Sr. Member
Posted: 04 January 2013 04:08 PM   Total Posts: 430   [ # 5 ]

the only workarround i can think of is to take a snapshot of your starling layer, and store it in a bitmap, where all areas without ui-components are transparent.
than inside of your away3d mouselistner, you could check if the pixel you clicked is transparent in starling or not. if its not transparent, just ignore the event in away3d.

hope that makes sense.
maybe there is a much easier way for this…
i dont know very much about using multiple stage3ds, but i believe it will be possible to do it this way…

 Signature 

sorry…i hope my actionscript is better than my english…

   

CubeHeaded, Newbie
Posted: 08 January 2013 08:51 AM   Total Posts: 6   [ # 6 ]

@rthompson
unfortunately I have not found a normal solution for this problem
workaround that 80prozent offers will work file, but quite difficult to implement (at least in my project)
I’m sure there’s an easier way to do this, I will continue to look for it

Nevertheless, thanks for the idea 80prozhent

   

rthompson, Newbie
Posted: 08 January 2013 02:59 PM   Total Posts: 9   [ # 7 ]

How I handled this was my UI is on the bottom 20% of the stage. So, I put a MOUSE_CLICK handler on the stage (guaranteed to fire before starling/away3d), and if mouse is in this area set a global variable to true signaling the click occurred in the UI area.  Then in the away3d MouseEvent3D handlers check to see if that global variable is true or false.

Not ideal, but works for my particular project.

   

Avatar
80prozent, Sr. Member
Posted: 08 January 2013 06:32 PM   Total Posts: 430   [ # 8 ]

jeah i think thats basically the easiest way to solve this problem.
best would be if their would be a way to know which stage3d was clicked inside the mainStage Mouselistener. something like using Event.target to know wich kind of object has been clicked. i tried a lot of stuff, but everything failed…

so best is you sepperate your ui and your away3d click-areas, into simple rectancles.
or you define your ui-clickareas by making a screenshot of you ui. i dont think it would be very difficult and performance intensive, as long as the ui is not animated.

hope that makes sense

 Signature 

sorry…i hope my actionscript is better than my english…

   

Matej, Jr. Member
Posted: 22 March 2013 10:46 AM   Total Posts: 38   [ # 9 ]

I have the same problem, cant get mouse events trough starling

   

Nice_2000, Newbie
Posted: 28 January 2014 02:00 AM   Total Posts: 1   [ # 10 ]
if ( ui.root.hitTest(new Point(stage.mouseXstage.mouseY)) == null )
{
 
...
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X