Groups | Blog | Home
all groups > flash actionscript > april 2006 >

flash actionscript : Webcam snapshot tutorial


raffael3d
4/10/2006 10:13:47 PM
I did this tutorial

www.macromedia.com/cfusion/search/index.cfm?loc=en_us&term=webcam%20snapshot%20t
utorial

part 1 works fine, I see the webcam and it works. Now all I need is to make a
snapshot, however it just doens't work, altough I tried everything that it says
there...

just download the Fla file, publish it and click on the black button, nothing
happens, altough it's setup like in the tutorial
www.raffael3d.com/webcam_snap.fla

any idea what I did wrong?? thanks!!


domconlon
9/28/2006 3:33:57 PM
I'm having the same trouble - following
http://www.adobe.com/devnet/flash/articles/webcam_motion_03.html.

I have the webcam feed working fine. On one frame I put the code and i have
defined a movieclip with the name snap_btn. It creates the blank bitmap but
won't fill it with the image. I don't think the button works either.

anybody help?

Dom

Code follows:
:frown;

//(From previous page)
/* capture the video stream from the active webcam and display it inside the
video object */
output_vid.attachVideo(Camera.get());
import flash.display.BitmapData;
import flash.geom.Matrix;
/*

create a new bitmap object that is the same size
as the Video object to store the pixel data

*/
var snapshot:BitmapData = new BitmapData(output_vid._width,
output_vid._height);
/*

create a function that takes a snapshot
of the Video object whenever it is called

*/
function takeSnapshot() {
//draw the current state of the Video object into
//the bitmap object with no transformations applied
snapshot.draw(output_vid, new Matrix());
}
//create a movie clip to hold the bitmap when we attach it
this.createEmptyMovieClip("bitmap_mc", this.getNextHighestDepth());
//display the specified bitmap object inside the movie clip
bitmap_mc.attachBitmap(snapshot, 1);

snap_btn.addEventListener("click", mx.utils.Delegate.create(this,
takeSnapshot));
AddThis Social Bookmark Button