Hi all,
I am pretty new to Away3D. I am wondering how to load object model (awd or obj) in Away3d 3.6. I’ve searched the web and couldn’t find any working sample. For example, I use Flash Professional CS5 to build the following code for Flash Player 10 and it gives an error. Can someone help me with this simple loading?
package
{
import away3d.containers.View3D;
import away3d.events.Loader3DEvent;
import away3d.loaders.Loader3D;
import away3d.loaders.AWData;
import away3d.primitives.Cube;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
public class Main extends Sprite
{
private var _view : View3D;
private var _loader : Loader3D;
private var cube:Cube;
private var _awData: AWData;
public function Main()
{
_view = new View3D();
this.addChild(_view);
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
//I draw a cube to see know the code is still run well when the awd object doesn't appear
cube = new Cube({width:75, height:75, depth:75});
_view.scene.addChild(cube);
//loader doesn't work
_loader = AWData.load("Building_awd1.awd", {x:200, y:-200, z: 0}) ;
_view.scene.addChild( _loader );
}
private function onEnterFrame(ev : Event) : void
{
_view.render();
}
}
}