Augmented Reality show one image

Hello,

I’m trying to work with Augmented Reality, I saw some examples and I’m trying to make some changes.

http://www.mikkoh.com/blog/?p=182

this example it shows a 3D cube.

What I want is a little easier, I think.

I want to show a image or a .Swf file.

AS he it uses:


package {
   
    import org.papervision3d.lights.PointLight3D;
    import org.papervision3d.materials.WireframeMaterial;
    import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
    import org.papervision3d.materials.utils.MaterialsList;
    import org.papervision3d.objects.primitives.Cube;
    import org.papervision3d.objects.primitives.Plane;
   
    [SWF(width=640, height=480, backgroundColor=0x808080, frameRate=30)]
   
    public class SimpleCube extends PV3DARApp {
       
        private var _plane:Plane;
        private var _cube:Cube;
       
        public function SimpleCube() {
            // Initalize application with the path of camera calibration file and patter definition file.
            this.init('Data/camera_para.dat', 'Data/flarlogo.pat');
        }
       
        protected override function onInit():void {
            super.onInit(); // You must call this.
           
            // Create Plane with same size of the marker.
            var wmat:WireframeMaterial = new WireframeMaterial(0xff0000, 1, 2); // with wireframe.
            this._plane = new Plane(wmat, 80, 80); // 80mm x 80mm
            this._baseNode.addChild(this._plane); // attach to _baseNode to follow the marker. / _baseNode addChild

            // Place the light at upper front.
            var light:PointLight3D = new PointLight3D();
            light.x = 0;
            light.y = 1000;
            light.z = -1000;
           
            // Create Cube.
            var fmat:FlatShadeMaterial = new FlatShadeMaterial(light, 0xff6600, 0x75104e); // Color is ping.
            this._cube = new Cube(new MaterialsList({all: fmat}), 40, 40, 40); // 40mm x 40mm x 40mm
            this._cube.z = -20; // Move the cube to upper (minus Z) direction Half height of the Cube.
            this._baseNode.addChild(this._cube);
        }
    }
}

AS that I tried to show a image:


package {
    
    import org.papervision3d.lights.PointLight3D;
    import org.papervision3d.materials.WireframeMaterial;
    import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
    import org.papervision3d.materials.utils.MaterialsList;
    import org.papervision3d.objects.primitives.Cube;
    import org.papervision3d.objects.primitives.Plane;

    //image
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.*;
    import flash.net.URLRequest;
    
    [SWF(width=640, height=480, backgroundColor=0x808080, frameRate=30)]
    
    public class SimpleCube extends PV3DARApp {
        
        private var _plane:Plane;
        private var _cube:Cube;
        
        public function SimpleCube() {
            // Initalize application with the path of camera calibration file and patter definition file.
            this.init('Data/camera_para.dat', 'Data/flarlogo.pat');
        }
        
        protected override function onInit():void {
            super.onInit(); // You must call this.
            
            //show image
            var imageLoader:Loader = new Loader();
            var theURL:String = "images/thePic.jpg";
            
            var imageRequest = new URLRequest(theURL);
            
            imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
            imageLoader.load(imageRequest);
            
            function onComplete(evt:Event) {
                
                addChild(imageLoader.content);
                
            }
            
            // Create Plane with same size of the marker.
            var wmat:WireframeMaterial = new WireframeMaterial(0xff0000, 1, 2); // with wireframe.
            this._plane = new Plane(wmat, 80, 80); // 80mm x 80mm
            this._baseNode.addChild(this._plane); // attach to _baseNode to follow the marker. / _baseNode addChild 

            // Place the light at upper front.
            var light:PointLight3D = new PointLight3D();
            light.x = 0;
            light.y = 1000;
            light.z = -1000;
            
            // Create Cube.
            var fmat:FlatShadeMaterial = new FlatShadeMaterial(light, 0xff6600, 0x75104e); // Color is ping.
            this._cube = new Cube(new MaterialsList({all: fmat}), 40, 40, 40); // 40mm x 40mm x 40mm
            this._cube.z = -20; // Move the cube to upper (minus Z) direction Half height of the Cube.
            this._baseNode.addChild(this._cube);
        }
    }
}

When I compile, he shows the image.

What I want is to show the image only when I show the marker.

Does anyone know how to do this?

Sorry about my English