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 ) and terrain.
2- In my init() i have:
AssetLibrary.enableParser(AWD2Parser);
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);
//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 this:
private function onAssetComplete(event:AssetEvent):void
{
trace(event.asset.name);
if (meshContainer = ObjectContainer3D(AssetLibrary.getAsset("cubeA"))) {
//cubeA.addEventListener(MouseEvent3D.MOUSE_DOWN, clickAction);
trace("the element:" + meshContainer.name + " exists in the scene" );
}
}
The trace output shows the message confirming that those elements exists, but i can´t figure out how to add mouse events to them.
Any advice is welcome.
Thanks guys!