Starling / Feathers and Away3D interoperation issue

Software: Away3D 4.x

SirGordon, Newbie
Posted: 13 September 2014 07:32 AM   Total Posts: 29

Hi!

I am developing a game with Feathers as UI and Away3D as game entity display and I ran into a problem that any click is captured by both technologies. How can I fork interactive events?
For example, if I click a Feathers Button, i would like Away3D to ignore this event, because this Button is over an Away3D View.

   

rdoi, Member
Posted: 29 September 2014 01:41 PM   Total Posts: 86   [ # 1 ]

Well, because the Starling uses its own mouse event hierarchy, you will have to “hit test” the Starling layer before running the away event handler. This is required because the away event is processed before the starling layer (stage3d rendering order).

The easiest (dirtiest) way is to add a conditional in every away mouse event, checking if any starling/feathers element was hit, running the away code only if it returns the Starling stage.

if (starling.stage.hitTest(pointClicked, true) is starling.display.Stage) {
  // do the away code
}

If you want to go deeper, you could check the Mouse3DManager.fireMouseEvents() and the view.render() workflow.

And also check the Starling forum too, you may find a better way to deal with this. I myself solved in the Gestouch extension.

   

SirGordon, Newbie
Posted: 29 September 2014 01:48 PM   Total Posts: 29   [ # 2 ]

Thanks for the reply!
I tried to rework Mouse3DManager a bit but.. left this idea, probably should investigate more.

So Gestouch can solve this?

Btw, did you try to run it on androids? Away3D + Starling is flickering on my android phone and tablet :S

   

rdoi, Member
Posted: 29 September 2014 02:06 PM   Total Posts: 86   [ # 3 ]

Well, Gestouch by itself would not help you instantly, you still have to extend it with an Away3D TouchHitTester, doing almost the same thing I described:

Test Starling layer, if not hit, test the Away layer (View3D), and finally the Flash layer.

And yes, we did some projects with Starling/Feathers + Away in android mobiles without any flickering problem. You maybe rendering their layers in different frames. Did you follow the away+staling tutorial?

   

SirGordon, Newbie
Posted: 29 September 2014 02:09 PM   Total Posts: 29   [ # 4 ]

Yes, my enterFrameHandler consists of four lines like this:
{
Stage3DProxy.clear()
View3D.render()
Starling.nextFrame()
Stage3DProxy.present()
}

it’s flickering only on android, but not on my PC :(

   

rdoi, Member
Posted: 30 September 2014 05:24 PM   Total Posts: 86   [ # 5 ]

Im not sure what is causing the flick, we do tests here with ipad, GalaxyTab and S2/S4, and no related problem. Do you have another device to test?

I would suggest you open a specific topic about this problem, attaching your test code.

   

SirGordon, Newbie
Posted: 30 September 2014 06:43 PM   Total Posts: 29   [ # 6 ]

Found the problem. I had an enterFrame listener on flash stage consisting of four lines:
{
Stage3DProxy.clear()
View3D.render();
Starling.nextFrame();
Stage3DProxy.present();
}
as said in this tutorial http://away3d.com/tutorials/Away3D_and_Starling_Interoperation
This works on pc but is flickering on androids. I guess it’s because first my listener captures the event, and then the automatic Stage3DProxy enterFrame event again does clear() and present(), which causes black screen because no drawTriangles is called between those clear() and present(). So i recommend to everybody, attach your enterFrame listener not to flash stage, but to Stage3DProxy, and don’t call clear() and present() manually.

   

Hector, Sr. Member
Posted: 05 February 2016 06:51 PM   Total Posts: 137   [ # 7 ]

Hi, I’m starting with Feathers + Away3D interoperation. Is there (in 2016) an example, update or new method to manage the events? All the tutorials and examples I’ve found are pretty old.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X