Page 1 of 1

Inside skins/backgrounds/foregrounds

Posted: 22 Jan 2015, 14:04
by julifos
I'm coming from OS1 development and I've found some differences. Is there some way to catch MouseEvents from within elements living in skins/backgrounds/foregrounds?

Seems that I can attach events in tiles to the tiles themselves, but not their children.

And seems I can't attach anything to backgrounds/foregrounds? What if I want to have birds in the foreground (passing from time to time) and I want them to be clickable?

Actually, my only idea would be moving the birds to the frontmost tile (instead of the foreground), attach a CLICK event, catch event.stageX/stageY and loop thru all the birds to see if the coordinates match with a hitTestPoint(x,y,true).

Same for the "birds" in the background: should I move everything (which needs mouse interaction) to tiles and stick with hitTestPoint to see if an object has been clicked using the hitTestPoint approach?

Cheers!

Re: Inside skins/backgrounds/foregrounds

Posted: 22 Jan 2015, 17:28
by Bax
As it regards the skins, you have the "skin instance triggers", which allow you to make the skins fire events when clicked for example. See this page: http://openspace-engine.com/support/editor/tileEditor
Background and foreground are not supposed to contain interactive elements because:
- those on the background can be just part of the tile set
- those on the foreground can be totally removed from within OpenSpace, using an additional layer above the OpenSpace component.
Makes sense?

Re: Inside skins/backgrounds/foregrounds

Posted: 22 Jan 2015, 20:18
by julifos
We have visual effects which require integration with OS layers and won't work fine if we use *everything* inside the skin as clickable area. And integrating certain things "out" of OpenSpace could be a nightmare, as every map includes (or not) different things, and we use to work the stuff separately (people doing maps doesn't have access to OpenSpace by default, which is in a higher abstraction layer).

Not a matter of if it makes sense or not: what worked previously now won't work, but I hope we'll find a different approach and make it work again :D

I was just trying to make a picture of the current situation, as we made heavy use of some methods which now work in a pretty different way...

Thanks for the info!

Re: Inside skins/backgrounds/foregrounds

Posted: 23 Jan 2015, 10:03
by Bax
Not 100% sure, but on the skins I think you can still have some control, by setting the mouseEnabled property to false on the parts you don't want to be interactive.

Re: Inside skins/backgrounds/foregrounds

Posted: 23 Jan 2015, 10:20
by julifos
I'll take a look. Seems that buttons don't act as buttons (rollover, etc.), but .buttonMode works (hand cursor), so it's very possible that mouseEnabled/mouseChildren does its job as well :)