Still problems with tile interaction logic

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

Moderators: Lapo, Bax

Post Reply
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Still problems with tile interaction logic

Post by nig3d »

Hi,

forgive me if I'm missing something, but I don't remember if you can interact with a skin that is placed on a not walkable tile.
It should be possible, but I don't remember how, can you help me?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

It depends on what you mean with "interacting". If you mean users are able to click a skin of a non-walkable tile, the answer is yes. Chech the Ranch example: the doors of the house are movieclips inside skins of non-walkable tiles, and you can interact with them.
Paolo Bax
The SmartFoxServer Team
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Post by nig3d »

yes, too many things at once by now :).
Do you have any news about my bug? I need helppp :)
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Post by nig3d »

If I didn't get wrongly I should use the function getMapObject to get the movieclip on the map and then add an Event listener.
Am I correct?
nig3d
Posts: 164
Joined: 02 Jul 2008, 09:42

Post by nig3d »

I want to share with you the class I use to make a skin not interactive.
The skin, that I don't want blocking my mouse click, is exported with the following class.

Code: Select all

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	* ...
	* @author DefaultUser (Tools -> Custom Arguments...)
	*/
	public class OsSkinDisabled extends Sprite
	{
		public function OsSkinDisabled() 
		{
		}
		
		public function setCustomParams(params:Array):void
		{
			addEventListener(Event.ADDED, initSkin, false, 0, true);
		}
		
		private function initSkin(evt:Event):void
		{
			removeEventListener(Event.ADDED, initSkin);
			parent.parent.mouseChildren = false;
			mouseEnabled = false;
			buttonMode = true;
			parent.parent.mouseEnabled = false;
		}
	}
}
it works nice and smooth.
Post Reply