-
-
- camera.clear();
-
-
- var cam:Camera = Camera.get();
- if ( cam == null){
-
- }
-
- photow = new Number(240);
- photoh = new Number(180);
-
- cam.setMode(photow, photoh, 10, true);
- camera.attachVideo(cam);
-
-
- var lv:LoadVars;
- lv = new LoadVars();
-
-
- toolbar.btnPhotoBorder1._visible = false;
-
-
-
- toolbar.btnCamera.onRelease = function ()
- {
-
- saveCamera();
- ...
- };
- toolbar.btnCameraRe.onRelease = function(){
- ...
- saveCamera();
- }
- function saveCamera(){
-
- lv.bm = new flash.display.BitmapData(photow, photoh,true, 0);
- lv.bm.draw(camera);
-
- photoPreview.attachBitmap(lv.bm, 1);
- }
-
-
- toolbar.btnUpload.onRelease = function(){
- loading._visible =true;
-
-
- i = lv.bm.height;
- j = lv.bm.width;
- rgb_array = "";
- for (y = i - 1; y >= 0; y--)
- {
- for (x = 0; x < j; x++)
- {
- color = lv.bm.getPixel(x, y).toString(16);
- rgb_array = rgb_array + (color + ",");
- }
- }
- lv.height = i;
- lv.width = j;
- lv.rgb_array = rgb_array;
-
-
-
- lv.sendAndLoad("pagea.aspx", lv, "POST");
-
-
- lv.onLoad = function (success)
- {
- if (success)
- {
-
- getURL("pageb.aspx", "_self");
- }
- };
- }
应"小古"要求,贴出C#处理函数:
C#代码
- System.Drawing.Bitmap DrawImageFromFlashUploader(int width, int height, string[] rgbArray)
- {
- System.Drawing.Bitmap bm = new System.Drawing.Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
- int pos = 0;
- for (int i = bm.Height - 1; i >= 0; i--)
- for (int j = 0; j < bm.Width; j++)
- {
- bm.SetPixel(j, i, System.Drawing.Color.FromArgb(int.Parse(rgbArray[pos], System.Globalization.NumberStyles.HexNumber)));
- pos++;
- }
- return bm;
- }
|