Inside skins/backgrounds/foregrounds

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

User avatar
julifos
Posts: 31
Joined: 10 Oct 2009, 23:33
Contact:

Inside skins/backgrounds/foregrounds

Postby julifos » 22 Jan 2015, 14:04

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!
User avatar
Bax
Site Admin
Posts: 4332
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Inside skins/backgrounds/foregrounds

Postby Bax » 22 Jan 2015, 17:28

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?
Paolo Bax
The SmartFoxServer Team
User avatar
julifos
Posts: 31
Joined: 10 Oct 2009, 23:33
Contact:

Re: Inside skins/backgrounds/foregrounds

Postby julifos » 22 Jan 2015, 20:18

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!
User avatar
Bax
Site Admin
Posts: 4332
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Inside skins/backgrounds/foregrounds

Postby Bax » 23 Jan 2015, 10:03

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.
Paolo Bax
The SmartFoxServer Team
User avatar
julifos
Posts: 31
Joined: 10 Oct 2009, 23:33
Contact:

Re: Inside skins/backgrounds/foregrounds

Postby julifos » 23 Jan 2015, 10:20

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 :)

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 6 guests