Skip to content

Instantly share code, notes, and snippets.

@alamboley
Last active October 12, 2015 11:48
Embed
What would you like to do?
How to handle mouse events (Citrus Engine recipe)
var coin:Coin = new Coin("coin", {view:"art.png", touchable:true});
//Within your state class. Same process for Starling or Away3D
var coinArt:DisplayObject = view.getArt(coin) as DisplayObject;
coinArt.addEventListener(MouseEvent.CLICK, handleCoinClick);
private function handleCoinClick(e:MouseEvent):void
{
var clickedCoin:Coin = view.getObjectFromArt(e.currentTarget) as Coin;
if (clickedCoin)
{
//do your logic here
clickedCoin.kill = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment