tile.addSkin() Help

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

Moderators: Lapo, Bax

clouting
Posts: 17
Joined: 18 May 2011, 13:57

tile.addSkin() Help

Postby clouting » 22 Jul 2011, 14:03

Hi,

I am trying to use the tile.addSkin() method but am getting the following error when it is called:

1195: Attempted access of inaccessible method addSkin through a reference with static type com.smartfoxserver.openspace.shared.view.items:Tile.

Can I add skins to tiles like this?

thanks
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 22 Jul 2011, 14:55

No you can't. In fact that method is not documented in the API.
Skins can be added in the Editor only.
Paolo Bax
The SmartFoxServer Team
clouting
Posts: 17
Joined: 18 May 2011, 13:57

Postby clouting » 25 Jul 2011, 06:50

Okay...

Is there anyway I can add a display object tot a tile dynamically? I am trying to add some arrows to show the map exits.

I have tried to use the addChild method but I get the following error when I interact with it (ROLLOVER) etc

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.smartfoxserver.openspace.shared.control.map::MapManager/getTileInstanceData()
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 25 Jul 2011, 12:08

You should better explain how this should work.
Paolo Bax
The SmartFoxServer Team
clouting
Posts: 17
Joined: 18 May 2011, 13:57

Postby clouting » 25 Jul 2011, 13:09

I have setup a database table to store the location and data of individual exits.

My table contains the coordinate of the exit, the map to load when when the exit is taken and a coordinate for the spawn point when the new map loads.

In the onOpenSpaceMapRendered() method I want to retrieve all the exits for the room I am in and add an arrow to show where the exits are.

Is there a way I can add the arrows to the tile dynamically (through code) rather than having to add them in openspace editor?

When I use tile.addChild(arrow); I get the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.smartfoxserver.openspace.shared.control.map::MapManager/getTileInstanceData()

Any ideas??

Thanks
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 25 Jul 2011, 13:21

No you can't. You have to use the editor.
Please notice that skins are contained in an sprite called skinsHolder inside the Tile object. Maybe you are able to reach it programmatically and attach that arrow dynamically.
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 21 guests