Page 1 of 1
Still problems with tile interaction logic
Posted: 06 Dec 2008, 07:39
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?
Posted: 06 Dec 2008, 13:11
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.
Posted: 06 Dec 2008, 14:02
by nig3d
yes, too many things at once by now

.
Do you have any news about my bug? I need helppp

Posted: 06 Dec 2008, 16:11
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?
Posted: 07 Dec 2008, 06:53
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.