Access AWD objects using AWDParser2…how to?

Software: Away3D 4.x

Avatar
miyijura, Newbie
Posted: 12 May 2014 04:30 PM   Total Posts: 6

EDIT: Looks like i post this thread in the wrong section…how can i move it or close it to the Away3D Support section?
Regards!

Hello, hereĀ“s an overview of my problem:

1- I am loading an AWD file made with AwayBuilder. This test file is composed of cubeA, cubeB (both are cubes smile ) and terrain.
2- In my init() i have:

AssetLibrary.enableParser(AWD2Parser);
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETEonAssetComplete);
   
//kickoff asset loading
var loader:Loader3D = new Loader3D();
loader.load(new URLRequest("../embeds/two_cubes.awd"));
   
_view.scene.addChild(loader); 

3- I want to click the cubes and trace a message, so later i can figure out how to make this scene more interactive and with more complex features.

What is the best way to achieve this?
I tried:

private function onAssetComplete(event:AssetEvent):void
  {
  trace(event.asset.name);
 
  if (event.asset.assetType == AssetType.MESH) {
  var mesh:Mesh = event.asset as Mesh;

  if(event.asset.name == “cubeA”){
    cubeA = event.asset as Mesh;
  }
 
  }
 
  //cube detection
  mesh.mouseEnabled = true;
  mesh.addEventListener(MouseEvent3D.CLICK, clickAction);
  }

private function clickAction(e:MouseEvent3D):void
  {
  trace(“hello world”);
  }

Any advice is welcome.
Thanks guys!

 

   
   
‹‹ Blender to AWD

X

Away3D Forum

Member Login

Username

Password

Remember_me



X