Hello.
As my post title say, i'm serach for an easy way to change the color
material on a rollovered mesh
i clone a collada, and i try to change is color whan my mouse is over
it...
here is my code:
var gabFloorMat:ShadingColorMaterial = new ShadingColorMaterial
(0x81ccef,{cache:false});
var selectedFloorMat:ShadingColorMaterial = new ShadingColorMaterial
(0xbddfef,{cache:true});
var floorGab = Collada.load("floorGab.dae",{autoLoadTextures :
true,scaling:0.005});
floorGab.addOnSuccess(gabLoadSucess)
function gabLoadSucess(evt:LoaderEvent):void{
floorGab = ObjectContainer3D(evt.loader.handle);
floorGab.position = new Number3D(0,0,0);
for(var i:int=0;i <= nbFloor;i++){
floorGab.clone(this["floor"+i])
this["floor" + i].name = "floor" + i
this["floor" + i].y = 20*i
hospital.addChild(this["floor" + i])
this["floor" + i].addOnMouseOver(manageFloorInfo);
this["floor" + i].addOnMouseOut(manageFloorInfo);
}
function manageFloorInfo(evt:MouseEvent3D):void{
var currentFloor = evt.object
currentFloor.mouseEnabled = true
currentFloor.useHandCursor = true
currentFloor.material = selectedMaterial
}
as you can think, nothing happen
currentFloor.material always return "null"
I also try to instance my material to change in my loadSucess function
floorMat = floorGab.materialLibrary.getMaterial("floorID")
and in my rollover function
floorMat .material = selectedMaterial
this work but of course all my cloned collada change color....
please, can you help me ?