What is the best Way to add 2D assets with Interactivity

Software: Away3D 4.x

kochumvk, Newbie
Posted: 08 August 2012 12:02 PM   Total Posts: 17

Away3D/Stage3D highjacks focus and any movie clip added on display list is not triggering mouse events.

What is the best way to handle this situation? Please suggest.

   

Avatar
Fabrice Closier, Administrator
Posted: 08 August 2012 01:06 PM   Total Posts: 1265   [ # 1 ]

It’s usually the inverse situation as Stage3D is allways behind the displaylist.
Can you send us a (simple clean) class that reproduce this?

 

   

Richard Olsson, Administrator
Posted: 09 August 2012 07:04 AM   Total Posts: 1192   [ # 2 ]

This has already been reported as a bug, but we can’t seem to reproduce it. The bug is reported here: https://github.com/away3d/away3d-core-fp11/issues/378

 

   

kochumvk, Newbie
Posted: 09 August 2012 11:27 AM   Total Posts: 17   [ # 3 ]
Fabrice Closier - 08 August 2012 01:06 PM

It’s usually the inverse situation as Stage3D is allways behind the displaylist.
Can you send us a (simple clean) class that reproduce this?

I have attached a sample with published swfs. you can see the intended behavior in ‘test_without_away.swf’ which i published after commenting the function init() call in ‘test.as’

I think the reported bug is different.

Thanks for your help Fabrice Closier.

 

File Attachments
Archive.zip  (File Size: 217KB - Downloads: 178)
   

Avatar
Alejandro Santander, Administrator
Posted: 09 August 2012 12:34 PM   Total Posts: 414   [ # 4 ]

Hey, thanks for posting your example. Made me realize what is going on…

Yeah, Stage3D is a has a different rendering mechanism than the regular flash display tree, and is always under it, BUT, View3D still extends Sprite and contains something called “hitField”. This is basically an invisible graphic that is used to capture input on the view. So after all, the view is not just Stage3D, its is both things.

So? In you example, your child is added BEFORE the 3D view, so the view and this invisible graphics it has is covering your sprite and hence stealing all mouse events from it. Try initializing the view and THEN adding your interactive sprite on top of it. I can guarantee it will capture mouse events then.

hth

 

   

kochumvk, Newbie
Posted: 10 August 2012 04:50 AM   Total Posts: 17   [ # 5 ]

Thats working. Thanks. However I am wondering why the view3d is getting events when the top layer sprite also gets event. That is hover controller is working even when we are dragging on the 2d sprite.

Great help. Actually I didn’t checked it since the sprite appears over the stage3D layer.

 

   

Richard Olsson, Administrator
Posted: 10 August 2012 09:01 AM   Total Posts: 1192   [ # 6 ]

When you handle the event on your 2D (display list) sprite, prevent it from bubbling to make sure it doesn’t reach the view or stage, and that might help. To do that, invoke the Event.stopImmediatePropagation() method on the event object in your handler.

 

   

kochumvk, Newbie
Posted: 13 August 2012 08:01 AM   Total Posts: 17   [ # 7 ]

That works. Thanks.Only problem is that buttonMode is not working in browser. It is a minor issue, not a problem. Yeah it works in stand alone player.

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X