Loading a simple Collada file

Software: Away3D 4.x

kitfox, Newbie
Posted: 14 January 2015 07:47 PM   Total Posts: 2

How do I set up my resources so that they get compiled with my project and the Loader3D is able to find everything?  I’ve tried putting my resources in a directory called /res in the same place as my source tree, but these aren’t being copied to my build directory and so my code fails when it tries to resolve the URL.

Parsers.enableAllBundled();
   var 
loader:Loader3D = new Loader3D(truenull);
   var 
token:AssetLoaderToken loader.load(new URLRequest("res/room.dae"));
   
token.addEventListener(AssetEvent.ASSET_COMPLETEonAssetComplete); 

When I use a full path name the loader can find it, but I can’t use this when I publish:

var token:AssetLoaderToken loader.load(new URLRequest("C:/dev/myProj/res/room.dae")); 

I also came across an article saying I should embed it, but it relied on a class called away3d.loader.Collada which no longer seems to be part of the away3d distro

[Embed (source="../art/room.dae"mimeType="application/octet-stream")]
public static const DAEFILE:Class; 

How can I organize my project so that I can find and load my Collada files both during development and after I’ve published my app?

   

Avatar
mrpinc, Sr. Member
Posted: 14 January 2015 08:09 PM   Total Posts: 119   [ # 1 ]

No need to embed. If you can load it from an absolute path while testing you should be able to load it when publishing.  You’ll just need to change your path to be a relative one.

So for example instead of loading:

“C:/dev/myProj/res/room.dae”

you would load:

“res/room.dae”

This would mean that there would be a res/ folder in your project path and that would have your ‘room.dae’ file within it.

The res folder above would need to be relative to where you SWF is.

so if your output folder structure is

myApp.swf
res/
  room.dae

The above suggestion should work.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X