Skip to content

Instantly share code, notes, and snippets.

@starpause
Forked from jgranick/DisplayingABitmap.hx
Created March 9, 2012 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starpause/2004394 to your computer and use it in GitHub Desktop.
Save starpause/2004394 to your computer and use it in GitHub Desktop.
How to display a bitmap (NME recipe)
package;
import nme.display.Bitmap;
import nme.display.Sprite;
import nme.Assets;
import nme.Lib;
/**
* @author Joshua Granick
*/
class DisplayingABitmap extends Sprite {
public function new () {
super ();
//use Assets.getBitMapData if .getAsset results in nme.installer.#Assets has no field getAsset
var logo = new Bitmap (Assets.getAsset ("assets/nme.png"));
addChild (logo);
}
public static function main () {
Lib.current.addChild (new DisplayingABitmap ());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment