How to import camera integration in flash.
Lately I have been working on a app that needed webcam integration in Adobe Flash. I managed to get it to work! All you need is one piece of actionscript 3.0 code and I’m going to give it to you.

Hello there! I’m Kevin Groenendaal and i’m twenty years old. I love to share my knowledge about everything web related! When i’m not writing code or design i like to spend time with friends and family. You can follow me on twitter.
Open flash, create a new file ( actionscript 3.0 ) and change the height and width to 600×400 at properties.
Name the first layer simply Actions and place this script inside that frame:
import flash.media.Camera;
var videoPreviewWidth:Number = 600;// video preview width
var videoPreviewHeight:Number = 400;// video previw height
var videoPreviewX:Number = 0;// video preview x cord.
var videoPreviewY:Number = 0;// video preview y cord.
var videoFps = 30;// video fps
var bandwidth:int = 0;//
var quality:int = 100;// The quality between 0-100.
//var camera:Camera = Camera.getCamera();
var camera:Camera;
doMacFix ();
function doMacFix ():String {
if (flash.system.Capabilities.os.indexOf("Mac OS") > -1) {
var i:int;
var length:Number = Camera.names.length;
while (i < length) {
if (Camera.names[i] == "USB Video Class Video") {
return i.toString();
}
i++;
}
}
return null;
}
trace (flash.system.Capabilities.os);
if (flash.system.Capabilities.os.indexOf("Mac") > -1) {
camera = Camera.getCamera(doMacFix());
if (camera != null) {
camera.setMode (320,240,12);
}
} else {
camera = Camera.getCamera();
}
camera.setQuality (bandwidth, quality);
camera.setMode (videoPreviewWidth, videoPreviewHeight, videoFps, false);//
//This will create the video preview area
var video:Video = new Video(videoPreviewWidth,videoPreviewHeight);
video.x = videoPreviewX;// video preview x cord.
video.y = videoPreviewY;// video preview y cord.
video.attachCamera (camera);
addChild (video);
Publish your movie and the flash player should ask permission to start your webcam. Click allow and your webcam starts immediately!
Short but very useful article. Tomorrow, I’ll explain how to place transparent video’s on your website.


Just what i was looking for! This is hot!
T
Your welcome
ок забегу на медне
ок ценно
ок таски