Tutorial | Control effect:
Click here to download the source file
var My_cam:camera = Camera.get ();//create My_cam get camera info
My_video.attachvideo (My_cam);//my_video video accepts and displays camera content
//
_root.map = new Flash.display.BitmapData (0)/Set BitmapData
_root.map._width=320;
_root.map._height=240;
_root.fake.attachbitmap (map, 0, "Auto", true);//fake Receive map content
balls = [];
BALLS[1] = _root["Ball" +1];
_root.onenterframe = function () {
_root.map.draw (My_video)//redraw My_video to map
var clr = _root.map.getpixel (balls[1]._x, balls[1]._y);//get pixel pixel value
Trace (CLR);
Trace ("0x" + clr.tostring (16));//convert pixel value to 16-bit
BALLS[1].OUTCLR = CLR;
if (clr>6579047) {
Balls[1].kill ();//Trigger
}
}; This way can realize the specific positioning of video control, direction and so on, but will be webcam quality and background lighting, the environment, the specific game design, proposed to add dynamic gain color.