Hello, this is my first message here.
Before asking for my question i would like to congratulate the people
who made away 3d become possible.
I tested some other 3D environment for Flash but, away3d is my
favorite so far.

My question is about changing at runtime a texture on a md2 model.
Here is the code i use to load the model and apply the texture.



var fighterMaterial:BitmapFileMaterial = new
BitmapFileMaterial("models/md2/hheli/hheli.png");
objLoader = Md2.load("models/md2/hheli/hheli.md2",
{material:fighterMaterial, scaling:0.01});
objLoader.addOnSuccess(success);
scene.addChild(objLoader.handle);


Once my object is successfully loaded to the scene, i would like, when
i click on a button, to change the texture of the model.
After some researches on the net, i have found this, but i don't know
how to apply this correctly.
Can i have some help ?

var fighterMaterial2:BitmapFileMaterial = new
BitmapFileMaterial("models/md2/hheli/hheli2.png");
materialData = objLoader.handle.materialLibrary.getMaterial("");
materialData.material = fighterMaterial2;

I don't know what to put in the getMaterial() setting.

also, is there a way of setting material like this ? :
objLoader.handle.materialLibrary.setMaterial(fighterMaterial2);

Thank you very much for your help.

btw, how many people are involved in Away3d right now ?
Julien.

Reply via email to