> #1009: Cannot access a property or method of a null object reference. this error does not say the obj loading has failed. it says you have a null object. It can be anything...
on your listener loadComplete, trace(e.loader.handle); //--> e == LoaderEvent is it null? if not, you might try to fix a non-bug... Fabrice On Feb 9, 2011, at 8:33 PM, Andrew wrote: > No it was not, > > The tutorial I have been using is this one: > http://www.flash-3d.net/2010/11/loading-complex-models-with-away3d/ > > I have tried exporting models from maya as well as 3dsMax to .dae > format but for some reason nothing works. > > I either get a blank white screen or a run time error. I get Error > #1009: Cannot access a property or method of a null object reference. > > If someone could please help me it would be wonderful, this has been > such a pain. > > I spoke to another person recently who told me to simply change var > loader3D:Loader3D = Collada.load("daeModel/cow.dae"); to > var loader3D:Loader3D = Obj.load("daeModel/ship.obj"); and use .obj > files instead of .dae because they are problematic but the one .obj I > had simply gave me a blank screen as well. I do not get wireframe, > circles like others have had problems with or anything just a while > screen. > > On Jan 31, 5:25 pm, "Brian Bosak" <[email protected]> wrote: >> ?Was the model made in SketchUp by any chance? Lots of people have had >> problems importing SketchUp DAE models. Not just problems with Away3D, but >> many other projects as well; including Blender. If it's a SketchUp model, >> try tweaking the export 'options' a bit to see if you can fix it. Sometimes >> that helps, sometimes it doesn't. >> >> >> >> >> >> >> >> -----Original Message----- >> From: Andrew >> Sent: Monday, January 31, 2011 5:39 AM >> To: Away3D.dev >> Subject: [away3d] Problems Importing .dae Models >> >> I am currently working on a school project where I am using Adobe Air >> to try and create a periscope game for the Android platform. >> I have been looking through multiple forums/tutorials to figure out >> how to import models and have thankfully figured it out but for some >> reason I am only able to import one model (a cow) and any other .dae I >> try to import simply leaves me with a black white screen. >> >> Does Away3d have a size restriction for importing 3d models? the cow I >> have is only about 50kb where the others I have are at least 100kb.. I >> would be very surprised if I was forced to only use models 50kb or >> smaller but I have had a lot of trouble researching this. >> >> I have included the code below, I would include the 3d models as well >> but I have no idea how to attach items on this forum. >> >> If anyone could help me figure out how to get other models to appear >> it would be greatly appreciated. It baffles me that I am able to >> import the cow model which is relatively detailed but no other model I >> find. I was also able to make a cube appear (7kb). >> >> I am at a loss right now on what to do and any help would be amazing. >> Thank you in advance. >> >> package >> { >> import away3d.containers.ObjectContainer3D; >> import away3d.containers.View3D; >> import away3d.events.Loader3DEvent; >> import away3d.loaders.Collada; >> import away3d.loaders.Loader3D; >> >> import flash.display.Sprite; >> import flash.events.Event; >> >> public class Main extends Sprite >> { >> protected var cow:ObjectContainer3D; >> protected var view:View3D; >> protected var i:int = 0; >> >> public function Main() >> { >> super(); >> this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStage); >> } >> >> protected function onAddedToStage(event:Event):void >> { >> createChildren(); >> loadModel(); >> startRendering(); >> } >> >> protected function createChildren():void >> { >> view = new View3D({x:stage.stageWidth/2, y:stage.stageHeight/2}); >> addChild(view); >> } >> >> protected function loadModel():void >> { >> var loader3D:Loader3D = Collada.load("daeModel/cow.dae"); >> loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS, >> onModelLoadSuccess); >> } >> >> protected function onModelLoadSuccess(event:Loader3DEvent):void >> { >> >> cow = event.loader.handle as ObjectContainer3D; >> cow.scale(100); >> cow.moveDown(1); >> view.scene.addChild(cow); >> } >> >> protected function startRendering():void >> { >> addEventListener(Event.ENTER_FRAME, onRenderTick); >> } >> >> protected function onRenderTick(event:Event = null):void >> { >> >> //Render View >> view.render(); >> >> //If our cow is ready - spin >> if (cow) >> { >> cow.yaw(5); >> >> } >> } >> } >> }
