Hi,
Im using the embed method to load my obj models, and all comes fine, but the problem is that all the data is loaded when the swf is opened, so my project became really heavy to load at the first time. I would like to load the obj only when I need it, but i have no sucess.
I would like to change this:
[Embed(source=”/../embeds/myobj.obj”, mimeType=“application/octet-stream”)]
private var _myobj:Class;
private var _loader:Loader3D
Parsers.enableAllBundled()
_loader = new Loader3D();
_loader.loadData( new _myobj());
_loader.addEventListener(AssetEvent.ASSET_COMPLETE, loadComplete);
public function loadComplete(event:AssetEvent):void
{
trace(“sucess!’) //its fine
_model:Mesh = event.asset as Mesh;
_model.material = myMaterial
view.scene.addChild(_model);
}
to this:
Parsers.enableAllBundled()
_loader = new Loader3D();
_loader.loadData( new URLRequest(’/../embeds/myobj.obj’));
_loader.addEventListener(AssetEvent.ASSET_COMPLETE, loadComplete);
public function loadComplete(event:AssetEvent):void
{
trace(“sucess!’) //no feedback :(
_model:Mesh = event.asset as Mesh;
_model.material = myMaterial
view.scene.addChild(_model);
}
Someone can helpme with this?
Thanks in advance.