Class 09 - WebcamXtra Workshop
1 |
Different ways
to display the image |
| 2 |
Use the webcamxtra
cast directly by dragging it onto the stage. |
| 3 |
Use copyPixels
command to display the image onto the stage. In this case, you cannot
overlay other sprites on top of the image. It has better playback
performance.
Say you have the webcamxtra
cast member named webCam.
function startMovie() {
_global.display = _movie.stage.image;
member("webCam").findGlobs = true;
} |
function exitFrame() {
var m = member("webCam").cameraImage;
var r1 = m.rect;
var r2 = _global.display.rect;
_global.display.copyPixels(m,r2,r1);
_movie.go(_movie.frame);
}
|
|
| 4 |
Use copyPixels
command to copy the webcam image onto the image of another bitmap
cast member and that cast member has been dragged on the stage as
a sprite.
Say, you have
a bitmap cast member named "here" of size 320 x 240 which
is shown on the stage as a sprite.
function startMovie() {
_global.img = member("here").image;
member("webCam").findGlobs = true;
} |
function exitFrame() {
var m = member("webCam").cameraImage;
var r1 = member("webCam").cameraImage.rect;
var r2 = _global.img.rect;
_global.img.copyPixels(member("webCam").cameraImage,
r2,r1);
_movie.go(_movie.frame);
}
|
|
|