Thanks Carl,
The code is actually split across quite a few files, I use data models to hold all properties which are parsed from a server side api, and all components are registered through a object pooling manager. so its a bit tricky to post the files.
The code I posted before was just a basic snippet, below is a more closer version to what i'm working with, set the model and it works with loadermax.
Oh and by the way, I'm using Flex.
var image:ImageLoader;
protected function creationCompleteHandler(event:FlexEvent):void
{
if(model)
{
image = new ImageLoader(model.asset.sourceFile.fileurl, {container:this, x:0, y:0, width:model.transformData.width, height:model.transformData.height, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
image.load();
}
}
//set the asset model
public function set model(value:AssetObjectModel):void
{
_model = value;
if(model)
{
if(model.asset.sourceFile)
{
model.asset.sourceFile.fileurl = FileSystemManager.getInstance().resolvePathForDevice(model.asset.sourceFile.fileurl);
}
if(image)
{
TweenLite.set(image.content, {x:model.transformData.x, y:model.transformData.y, width:model.transformData.width, height:model.transformData.height, rotation:model.transformData.rotation, alpha:model.alpha});
//only load if different url
if(image.url != model.asset.sourceFile.fileurl)
{
image.url = model.asset.sourceFile.fileurl;
image.load();
}
}
}
}
public function get model():AssetObjectModel
{
return _model;
}