Error #1009: Cannot access a property or method of a null object reference.on camera

184 Views Asked by At

im working on augmented reality application where my augmented object can be touched by hands. So it has motion detection in it. i build it using flartoolkit and away3d.

I already made the augmented reality and motion detection part. The problem is where i combined them,

I get the class for motion detection from http://blog.soulwire.co.uk/code/actionscript-3/webcam-motion-detection-tracking

Whenever i try to run my program, it get Error #1009: Cannot access a property or method of a null object reference.on camera

from what i analyze, my code cant differentiate which camera that i use. If anyone can show hot to fix it, it will help me a lot

here's initialization for camera in augmented reality part

this.flarManager.removeEventListener(Event.INIT, this.onFlarManagerInited);

        this.camera3D = new FLARCamera_Away3D(this.flarManager, new Rectangle(0, 0, this.stage.stageWidth, this.stage.stageHeight));
        this.view = new View3D({x:0.5*this.stage.stageWidth, y:0.5*this.stage.stageHeight, scene:this.scene3D, camera:this.camera3D});
        this.addChild(this.view);

        this.light = new DirectionalLight3D();
        this.light.direction = new Vector3D(500, -300, 200);
        this.scene3D.addLight(light);

and here's initialization for camera in my motion detection part

        var camW : int = 420;
        var camH : int = 320;

        // Create the camera
        var cam : Camera = Camera.getCamera();
        cam.setMode(camW, camH, stage.frameRate);

        // Create a video
        var vid : Video = new Video(camW, camH);
        vid.attachCamera(cam);
0

There are 0 best solutions below