Hi,
First of all thanks for such great library.
How I should address the image file in my code? Should it be relative to the SWF file or as we normally do with Embed syntax? I'm asking this because LoaderMax.getLoader is giving null pointer errors and I suspect it being not able to find the image files.
It's driving me nuts, I tried every possible path I can come up with like static or relative paths, with \ or /, single or double quote, no luck.
Address works in EMBED syntax but same thing doesn't in loader:
override public function create():void
{
var loader: LoaderMax = new LoaderMax({ name: "imageLoader",
onProgress: progressHandler,
onComplete: completeHandler,
onError: errorHandler});
// The image is not in the source folder, but in the output of the SWF!
// loader.append(new ImageLoader('src/data/sprites/player.png', { name: "photo1" } ));
loader.append(new ImageLoader('H:/Flash/WIP/trunk/src/data/sprites/player.png', {name: "photo1"}));
loader.load();
}
private function progressHandler(event:LoaderEvent):void
{
trace("progress: " + event.target.progress);
}
private function completeHandler(event:LoaderEvent):void
{
var asd:* = LoaderMax.getLoader("photo1");
AssetsRegistry.playerSprite.pixels = LoaderMax.getLoader("photo1").rawContent.bitmapData;
FlxG.switchState(new PlayState);
}
private function errorHandler(event:LoaderEvent):void
{
trace("error occured with " + event.target + ": " + event.text);
}
compiler halts at:
AssetsRegistry.playerSprite.pixels = LoaderMax.getLoader("photo1").rawContent.bitmapData;
saying that it's a null pointer. I tried looking inside the lodaer after the load call and it's _rawContent is null. So I think it cannot find the image file.
Thanks in advance.