Load an Image

//put this code inside your FlxState
var image = new FlxSprite();
//specify which image you want to use
image.loadGraphic("assets/yourimage.png");
//add the image to a FlxState
add(image);

HaxeFlixel has inbuilt Asset Management thanks to NME. FlxSprite has the wonderful loadGraphic() method that makes your life easy, all you need to do is provide path to your image.

 

The paths that are available must be set in your nmml file in the assets tag. This is an example of an assets tag that is generate with the Haxelib tool in the Getting Started article. At compile time NME will search for all images under the directory so you can use them like the code above.

 

<assets path="assets" include="*.png" type="image" />