notice: Flash editor updated! Join the development! Thanks to MiniBuilder


embed

FORKED
  1. // forked from nacookan's カメラで撮ってpngをローカルに保存
  2. // 参考 : http://blog.asial.co.jp/512
  3. // 要 Flash Player 10 らしい
  4. package{
  5.     import flash.display.*;
  6.     import flash.text.*;
  7.     import flash.events.*;
  8.     import flash.media.*;
  9.     import flash.net.*;
  10.     import com.adobe.images.PNGEncoder;
  11.     public class CameraCap extends Sprite{
  12.         public function CameraCap():void{
  13.             var cam:Camera = Camera.getCamera();
  14.             if(!cam) return;
  15.             
  16.             var v:Video = new Video(320240);
  17.             v.attachCamera(cam);
  18.             v.x = 50;
  19.             v.y = 50;
  20.             this.addChild(v);
  21.             var button:Sprite = new Sprite();
  22.             button.graphics.lineStyle(2, 0xa0a0a0);
  23.             button.graphics.beginFill(0xe0e0e0);
  24.             button.graphics.drawRect(0010030);
  25.             button.graphics.endFill();
  26.             button.x = 50;
  27.             button.y = 300;
  28.             this.addChild(button);
  29.             button.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
  30.                 var bd:BitmapData = new BitmapData(320340);
  31.                 bd.draw(button);
  32.                 (new FileReference()).save(
  33.                     PNGEncoder.encode(bd),
  34.                     'capture.png'
  35.                 );
  36.             });
  37.         }
  38.     }
  39. }
noswf
  1. // forked from nacookan's カメラで撮ってpngをローカルに保存
  2. // 参考 : http://blog.asial.co.jp/512
  3. // 要 Flash Player 10 らしい
  4. package{
  5.     import flash.display.*;
  6.     import flash.text.*;
  7.     import flash.events.*;
  8.     import flash.media.*;
  9.     import flash.net.*;
  10.     import com.adobe.images.PNGEncoder;
  11.     public class CameraCap extends Sprite{
  12.         public function CameraCap():void{
  13.             var cam:Camera = Camera.getCamera();
  14.             if(!cam) return;
  15.             
  16.             var v:Video = new Video(320280);
  17.             v.attachCamera(cam);
  18.             v.x = 50;
  19.             v.y = 50;
  20.             this.addChild(v);
  21.             var button:Sprite = new Sprite();
  22.             button.graphics.lineStyle(2, 0xa0a0a0);
  23.             button.graphics.beginFill(0xe0e0e0);
  24.             button.graphics.drawRect(0010030);
  25.             button.graphics.endFill();
  26.             button.x = 50;
  27.             button.y = 300;
  28.             this.addChild(button);
  29.             button.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
  30.                 var bd:BitmapData = new BitmapData(320240);
  31.                 bd.draw(v);
  32.                 (new FileReference()).save(
  33.                     PNGEncoder.encode(bd),
  34.                     'capture.png'
  35.                 );
  36.             });
  37.         }
  38.     }
  39. }
noswf
  1. // forked from nacookan's カメラで撮ってpngをローカルに保存
  2. // 参考 : http://blog.asial.co.jp/512
  3. // 要 Flash Player 10 らしい
  4. package{
  5.     import flash.display.*;
  6.     import flash.text.*;
  7.     import flash.events.*;
  8.     import flash.media.*;
  9.     import flash.net.*;
  10.     import com.adobe.images.PNGEncoder;
  11.     public class CameraCap extends Sprite{
  12.         public function CameraCap():void{
  13.             var cam:Camera = Camera.getCamera();
  14.             if(!cam) return;
  15.             
  16.             var v:Video = new Video(300300);
  17.             v.attachCamera(cam);
  18.             v.x = 50;
  19.             v.y = 50;
  20.             this.addChild(v);
  21.             var button:Sprite = new Sprite();
  22.             button.graphics.lineStyle(2, 0xa0a0a0);
  23.             button.graphics.beginFill(0xe0e0e0);
  24.             button.graphics.drawRect(0010030);
  25.             button.graphics.endFill();
  26.             button.x = 300;
  27.             button.y = 300;
  28.             this.addChild(button);
  29.             button.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
  30.                 var bd:BitmapData = new BitmapData(320240);
  31.                 bd.draw(v);
  32.                 (new FileReference()).save(
  33.                     PNGEncoder.encode(bd),
  34.                     'capture.png'
  35.                 );
  36.             });
  37.         }
  38.     }
  39. }
noswf
  1. // forked from nacookan's カメラで撮ってpngをローカルに保存
  2. // 参考 : http://blog.asial.co.jp/512
  3. // 要 Flash Player 10 らしい
  4. package{
  5.     import flash.display.*;
  6.     import flash.text.*;
  7.     import flash.events.*;
  8.     import flash.media.*;
  9.     import flash.net.*;
  10.     import com.adobe.images.PNGEncoder;
  11.     public class CameraCap extends Sprite{
  12.         public function CameraCap():void{
  13.             var cam:Camera = Camera.getCamera();
  14.             if(!cam) return;
  15.             
  16.             var v:Video = new Video(320240);
  17.             v.attachCamera(cam);
  18.             v.x = 50;
  19.             v.y = 50;
  20.             this.addChild(v);
  21.             var button:Sprite = new Sprite();
  22. //            button.graphics.lineStyle(0, 0xa0a0a0);
  23.             button.graphics.beginFill(0xAAAAAA);
  24.             button.graphics.drawRect(0010030);
  25.             button.graphics.endFill();
  26.             button.x = 50;
  27.             button.y = 300;
  28.             this.addChild(button);
  29.             
  30.             var tf:TextField = new TextField();
  31.             var tfFormat:TextFormat = new TextFormat();
  32.             tfFormat.size = 16;
  33.             tfFormat.font = "Osaka";
  34.             tf.text = "撮影&保存";
  35.             tf.setTextFormat(tfFormat);
  36.             tf.y = 3;
  37.             tf.x = 3;
  38.             tf.autoSize = TextFieldAutoSize.LEFT;
  39.             tf.height = 22;
  40.             
  41.             button.addChild(tf);
  42.             
  43.             button.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
  44.                 var bd:BitmapData = new BitmapData(320240);
  45.                 bd.draw(v);
  46.                 (new FileReference()).save(
  47.                     PNGEncoder.encode(bd),
  48.                     'capture.png'
  49.                 );
  50.             });
  51.         }
  52.     }
  53. }
noswf
Get Adobe Flash Player