Hi all,
I can’t get this material thing working. Searched google wide and deep with no results. Basically I am loading a 3ds file, single mesh ie one object (yes, with uvs) like this:
var my_mesh:Mesh;
//creating a parser with initial material
var max3ds_parser:Max3DS = new Max3DS();
max3ds_parser.material = new WireColorMaterial(0xFF0000);
var loader:Loader3D = new Loader3D();
loader.addEventListener(Loader3DEvent.ON_SUCCESS, onSuccess);
loader.loadGeometry("myMesh.3ds", max3ds_parser);
function onSuccess(e:Loader3DEvent):void{
my_mesh = Mesh(e.loader.handle);
view.scene.addChild(my_mesh)
}
Up until now everything is fine, the mesh appears in the view with red wirecolormaterial applied, but now I want to apply new material on the same my_mesh after a mouse click, so:
stage.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void{
//FAIL cames here:
my_mesh.material = new WireframeMaterial(0x000000);
trace("clicked!");
}
Mighty Failure, can’t get this to work. Seems so simple but I can’t figure out how to change the material during run-time.
Thank you for any help.