FLASH大头贴源程序解析
/*FLASH大头贴原程序
/*程序编写:Benmouse 2005-12-01
import flash.display.BitmapData; //要应用这个对象。。必须要包含一下
myCrame=Camera.get(); //创建摄象头对象
myVideo.attachVideo(myCrame); //显示视频
var imger:BitmapData = new BitmapData(myVideo._width, myVideo._height, false);
imgShow.attachBitmap(imger, this.getNextHighestDepth(), "auto", true);
var thehang:Number=0;
var ID:Number;
var PX:Array=new Array();
btn1.onRelease=function()
{
imger.draw(myVideo); //imger是场景中一个空的组件,用来显示myVideo的图象
thehang=0;
_root.ID=setInterval(makeImg, 5);
}
function makeImg()
{
var pix:Number;
var pixer:String;
PX[thehang]=new Array();
for(w=0;w<imgShow._width;w++)
{
pix=imger.getPixel(w,thehang);
pixer=pix.toString(16);
if(pix == 0xFFFFFF) pixer = ""; // don’t send blank pixel
PX[thehang].push(pixer);
}
thehang+=1;
if(thehang>=imgShow._height)
{
clearInterval(_root.ID);
imger.dispose();
sendVars();
}
}
function sendVars()
{
sender=new LoadVars();
sender.w=myVideo._width;
sender.h=myVideo._height;
for(i=0;i<sender.h;i++)
{
sender["PX"+i]=_root.PX[i];
}
sender.send("send.php","_blank","POST");
}