No luck with that. Is this is a new bug? I feel like I've changed the material on faces in the past in Away3dLite without running into this error.
On Sep 24, 6:27 pm, John Brookes <[email protected]> wrote: > Maybe > _view.render(); > just before > plane.faces[0]... > > On 24 September 2010 20:10, savagelook <[email protected]> wrote: > > > > > Whenever I try to change the material of a particular face in the > > latest version of away3dlite I get the following error when I execute > > render(): > > > RangeError: Error #1125: The index 0 is out of range 0. > > at > > away3dlite.containers::Scene3D/removeSceneMaterial()[C:\development > > \away3dlite_3ds\src\away3dlite\containers\Scene3D.as:36] > > at away3dlite.core.base::Mesh/buildMaterials()[C:\development > > \away3dlite_3ds\src\away3dlite\core\base\Mesh.as:166] > > at > > away3dlite.core.base::Mesh/project()[C:\development\away3dlite_3ds > > \src\away3dlite\core\base\Mesh.as:72] > > at away3dlite.containers::ObjectContainer3D/project()[C:\development > > \away3dlite_3ds\src\away3dlite\containers\ObjectContainer3D.as:65] > > at away3dlite.containers::Scene3D/project()[C:\development > > \away3dlite_3ds\src\away3dlite\containers\Scene3D.as:94] > > at away3dlite.containers::View3D/render()[C:\development > > \away3dlite_3ds\src\away3dlite\containers\View3D.as:534] > > at away3dlite_3ds/_onEnterFrame()[C:\development\away3dlite_3ds\src > > \away3dlite_3ds.as:53] > > > Here's a simple test case that will cause the above error to happen: > > > package > > { > > import away3dlite.cameras.HoverCamera3D; > > import away3dlite.containers.Scene3D; > > import away3dlite.containers.View3D; > > import away3dlite.materials.ColorMaterial; > > import away3dlite.primitives.Cube6; > > import away3dlite.primitives.Plane; > > > import flash.display.Sprite; > > import flash.display.StageQuality; > > import flash.events.Event; > > > [SWF(frameRate="60", height="600", width="800", > > backgroundColor="0x000000")] > > public class away3dlite_3ds extends Sprite > > { > > private var _view:View3D; > > private var _camera:HoverCamera3D; > > > public function away3dlite_3ds() > > { > > if (stage) { > > _init(); > > } else { > > this.addEventListener(Event.ADDED_TO_STAGE, > > function(e:Event):void > > { _init(); }); > > } > > } > > > private function _init():void { > > stage.quality = StageQuality.LOW; > > > _camera = new HoverCamera3D(); > > _camera.distance = 300; > > _camera.tiltAngle = 10; > > > _view = new View3D(new Scene3D(), _camera); > > _view.x = stage.stageWidth/2; > > _view.y = stage.stageHeight/2; > > this.addChild(_view); > > > var plane:Plane = new Plane(new > > ColorMaterial(0xffffff), 200, 200, > > 2, 2); > > plane.bothsides = true; > > _view.scene.addChild(plane); > > > plane.faces[0].material = new > > ColorMaterial(0xff0000); > > > this.addEventListener(Event.ENTER_FRAME, > > _onEnterFrame); > > } > > > private function _onEnterFrame(e:Event):void { > > _camera.panAngle -= 1; > > _camera.hover(); > > _view.render(); > > } > > } > > }
