Hey Joseph can you try again with sphere?( i try to separate problem here)
On 3 March 2010 02:55, Joseph <[email protected]> wrote: > Hello :) > > Having some issues swapping bitmap materials in away3dlite. Got the > general syntax/calls from the Basic LoadModel.as example. Below is how > I am trying to swap materials (I just cut and paste the more relavent > snippets). I verified the key presses are working fine, etc. I see the > model in the scene and it has the mainship100BM material applied but > doesn't change to the 2nd material upon key press. > > Any ideas why I am not seeing the material change? > > Thanks! > > Joseph > > > > [Embed (source="../mainmodel-rev4a_diff_mod1-100-512.gif")]public var > mainbody100:Class; > [Embed (source="../mainmodel-rev4a_diff_mod1-70-512.gif")]public var > mainbody70:Class; > > private var max3dsMain:Max3DS; > private var loaderMain:Loader3D; > private var modelMain:ObjectContainer3D; > > private function init():void > { > initEngine(); > initMaterials(); > initObjects(); > initListeners(); > } > > private function initMaterials():void > { mainship100BM= new BitmapMaterial(Cast.bitmap(mainbody100)); > mainship70BM= new BitmapMaterial(Cast.bitmap(mainbody70)); > materialArray = [enemy100BM, enemy70BM]; > } > > private function initObjects():void > { > max3dsMain = new Max3DS(); > max3dsMain.scaling = 0.4; > max3dsMain.centerMeshes = true; > max3dsMain.material = mainship100BM; > //max3dsMain.material = new WireColorMaterial(); > loaderMain = new Loader3D(); > loaderMain.loadGeometry("../main_model_2.3DS", max3dsMain) > loaderMain.addEventListener(Loader3DEvent.LOAD_SUCCESS, > onSuccessMainObj); > scene.addChild(loaderMain); > } > > function onSuccessMainObj(event:Event):void > { > modelMain = loaderMain.handle as ObjectContainer3D; > modelMain.rotationZ = 180; > modelMain.rotationY = 180; > modelMain.y = 0; > modelMain.x = 0; > } > > > > private function onEnterFrame(event:Event):void > > { > > if(whatkey.isDown(39)) { > modelMain .material = materialArray[0]; > } > > if(whatkey.isDown(37)) { > modelMain .material = materialArray[1]; > } > view.render(); > } > -- katopz http://www.sleepydesign.com
