Hi all i have the following code but would like to know how to ensure that each time the screen shot is taken it creates a ‘new’ instance of the screen shot and then randomly positions it on the stage.
This is what i have so far, do i need to do some kind of incrementor each time the function is called and then create the new screen shot with the incrementor as part of the new name?
Thanks in advance.
import flash.display.BitmapData;
import flash.display.DisplayObject;
var theCam:Camera = Camera.getCamera();
videoObj.attachCamera(theCam);
stage.addEventListener(MouseEvent.CLICK, takephoto);
var snapPic:BitmapData = new BitmapData(theCam.width, theCam.height);
var snapPicImage:Bitmap = new Bitmap(snapPic);
function takephoto(e:MouseEvent):void {
snapPic.draw(videoObj);
var highestDepth:int = this.numChildren;
addChildAt(snapPicImage, highestDepth);
snapPicImage.x += 10;// this should be placed in a random position
snapPicImage.y += 10;
}