actionscript 3 - 1009: Cannot access a property or method of a null object reference -


i've been stuck such error 2 days now, , search on solving number of previous questions asked error, still can't seem work, because don't understand @ all.

this code :

package {      import flash.events.*;     import flash.display.movieclip;     import flash.events.mouseevent;     import org.libspark.flartoolkit.support.pv3d.flarbasenode;     import org.papervision3d.objects.parsers.dae;     import org.papervision3d.lights.pointlight3d;     import org.papervision3d.materials.shadematerials.flatshadematerial;     import org.papervision3d.materials.utils.materialslist;     import org.papervision3d.objects.primitives.cone;     import org.papervision3d.objects.primitives.plane;     import org.papervision3d.materials.movieassetmaterial;     import org.papervision3d.events.fileloadevent;     import org.papervision3d.objects.displayobject3d;     import org.papervision3d.core.proto.materialobject3d;     import org.papervision3d.objects.primitives.cube;      [swf(width=640, height=530, backgroundcolor=0x808080, framerate=30)]      public class earth extends pv3darapp {          private var _earth:dae;         private var _teapot:dae;         private var _bone:dae;          protected var _basenode:flarbasenode          public function earth() {             addeventlistener(event.init, _oninit);             init('data/camera_para.dat', 'data/paris.pat');         }          private function _oninit(e:event):void {              bulet.addeventlistener(mouseevent.click, _tombolbulet);             teapot.addeventlistener(mouseevent.click, _tombolteapot);             tulang.addeventlistener(mouseevent.click, _tomboltulang);              addchild(bulet);             addchild(teapot);             addchild(tulang);               _earth = new dae();             _earth.load('model/earth.dae');             _earth.scale = 10;             _earth.rotationx = 90;             //_markernode.addchild(_earth);              _teapot = new dae();             _teapot.load('model/teapot.dae');             _teapot.scale = 10;             _teapot.rotationx = 90;             //_markernode.addchild(_teapot);              _bone = new dae();             _bone.load('model/bone.dae');             _bone.scale = 10;             _bone.rotationx = 90;             //_markernode.addchild(_bone);              function _tombolbulet (event:mouseevent):void             {                    remove_all();                 _basenode.addchild(_earth);              }              function _tombolteapot (event:mouseevent):void             {                    remove_all();                 _basenode.addchild(_teapot);              }              function _tomboltulang (event:mouseevent):void             {                    remove_all();                 _basenode.addchild(_bone);              }              function remove_all () : void             {                    _basenode.removechild(_earth);                 _basenode.removechild(_teapot);                 _basenode.removechild(_bone);              }              //addeventlistener(event.enter_frame, _update);         }          /*private function _update(e:event):void {             _earth.rotationz += 0.5             _teapot.rotationz += 0.5             _bone.rotationz += 0.5         }*/     } } 

you should first call new dae() on children, add them via addchild(), not vice versa. also, there no bulet declared, there's bone. also, remove children in remove_all(), while 1 of them seems on screen @ 1 single time. also, have lot of misnamed variables, mess code.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -