Web cam challenge (as3)

i currently have a web cam class, one instance of it and a web cam image on stage.
i want to create two images on stage, one mirrors the other, only bigger.

i tried:

[SIZE=1]var bitmapData:BitmapData = new BitmapData(webcamIns.width+50, [/SIZE][SIZE=1]webcamIns[/SIZE][SIZE=1].height+50, true, 0xffffff);
bitmapData.draw([/SIZE][SIZE=1]webcamIns[/SIZE][SIZE=1]);
var bitmap:Bitmap = new Bitmap(bitmapData);
addChild(bitmap); [/SIZE]

that doesn’t work!!

PLEASE HELP:puzzled:

a prize to my rescuer!!

somebody?..

You need to do this in an event listener, enterframe, setInterval, setTimeout, or one of the camera activity listeners.

If you only run it once at load time, the webcam hasn’t initiated yet, so you wont get an image. Even if you wait till the webcam has initialized, you will only get a single static image without the event listener loop.

the problem is that even with adding an event listener, the image doesn’t appear, as if the “copying” of it can’t be done. i think it because i’m using a class for it, but my webcam class extends Video - a display object…

for now i’m using two instances of my class… not a really good solution since i don’t need all the functionalities of the class for both of the images.

write the video data from the webcam to bitmaps on the stage, use a matrix to flip one of the bitmap

mpelland, how can i use a matrix to flip one of the bitmap?
thanks

i would say that you can create a matrix and set the scale on it then apply that when drawing the bitmapdata

[AS]var m:Matrix = new Matrix();
m.scale(-1, 1);
var outputFlipped:BitmapData = new BitmapData( 320, 240 );
outputFlipped.draw(bmd, m); // bmd would be the original bitmap data[/AS]

i think i can’t get to the camera’s original bitmapData, in the webcam class i have a camera that is added to the video.

The camera object is what you draw to your flipped bitmapData object:

myBitmapData.draw(camera, flippedMatrix);