Showing posts with label haxe flixel nme bitmap flxsprite loading. Show all posts
Showing posts with label haxe flixel nme bitmap flxsprite loading. Show all posts

Tuesday, April 24, 2012

Flixel HaXe + NME FlxSprite Loading in iPad

AS3 embed style uses custom class ddeclarations and the Assets getbitmapdata for cross compatability:



class TestClass extends Bitmap
{
    public function new() { super(Assets.getBitmapData("assets/map/ArmyGrid.png")); }
}

    class GenericGrid
    {

public static var Test:Class<Bitmap> = TestClass;

        public function new()
        {   
            t = new FlxSprite(0, 215, Test);   
            t.x = FlxG.width / 2 - t.width / 2;
            t.updateTileSheet();
            parentState.add(t);


OR!

Loadgraphic seems to work also on direct names on ipad so far:


/* test: succeeded, this works
        t = new FlxSprite(0, 0);
        t.loadGraphic("assets/map/ArmyGrid.png", false, false);
        t.updateTileSheet();
        t.x = FlxG.width / 2 - t.width / 2;
        t.y += 200;
        parentState.add(t);
*/

Note: Using Haxe + NME and FlixelHaxe from BeebleRox