This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inside a class which extends CitrusObject e.g. CitrusSprite, APhysicsObjects... | |
kill = true; | |
// If you have an access to the variable of the object : | |
hero.kill = true; | |
// Or within a State class (the previous code works too) : | |
remove(hero); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Citrus object's view management is powerful: when a view is added to the object it is loaded and added to a template | |
// called SpriteArt which is a container of your art. This template allows to load external files thanks to their path. | |
// It works the same way with Starling. | |
var _hero:Hero = new Hero("my hero", {view:"myHero.swf"}); | |
// _hero.view refers to the path "myHero.swf" not to the swf loaded. | |
// If the view specified is a DisplayObject, you can directly make whatever you want on it (filter, blendMode, ect). | |
var _heroGraphic:SpriteArt = view.getArt(_hero) as SpriteArt; | |
// _heroGraphic is the container of the art. It will loads and display the art. Most often you will work with this. |
NewerOlder