Loading Image from Internet (won't fire)

I am trying to load an image in PNG format from my server into a TileSet. But I keep getting this error, “bitmapData.getTexture is not a function”
Can anyone see what I am doing wrong here?

public var mobLoader:URLLoader = new URLLoader();
public var talusSet:Tileset;	

public function MobComplete(e:Event)
{		
	var b:BitmapData = e.target;		
	talusSet = new Tileset(b);
	var talusMap:Tilemap = new Tilemap(stage.stageWidth, stage.stageHeight, talusSet);
	addChild(talusMap);
}

mobLoader.addEventListener(Event.COMPLETE, MobComplete);
mobLoader.load(new URLRequest("https://www.roomrecess.com/games/BattleBuddies/Mobs/SheetSkeleMace.png"));
var bitmap = new Bitmap();
	addChild(bitmap);

	BitmapData.loadFromFile("https://www.roomrecess.com/games/BattleBuddies/Mobs/SheetSkeleMace.png").onComplete(function(bmd:BitmapData)
	{
		bitmap.bitmapData = bmd;
	});

This should work :slight_smile:

Just change bitmap.bitmapData, too talusSet.bitmapData

1 Like

That works perfectly. And I only actually needed:

`talusSet = new Tileset(bmd);`

Is there a way to monitor the loading progress such on .onProgress or something (I need the data for a loading bar).

Thank you, PX!

1 Like

Ah perfect, glad to hear :smiley: Yes onProgress should work (first int being current loaded and second int being total) , though I have not tested it.

1 Like