Tuesday, September 20, 2011

How to access your web cam and take a snapshot using flash actionscript 3.0

In this post i will help you how to access your web cam and take a snap shot and save it as in JPEG format.

  1. Create a new flash file with name WebCam.
  2. Create a button with instance name "_capt " in the stage
  3. Then create a new actionscript 3 file with name "vido". copy and paste the following code into that and save it..
        import com.adobe.images.JPGEncoder;
            import flash.display.Bitmap;
            import flash.display.BitmapData;
            import flash.media.Video;
            import flash.media.Camera;
            import flash.display.Sprite;
            import flash.events.*;
            import flash.display.MovieClip;
            import flash.net.FileReference;
            import flash.utils.ByteArray;
            import flash.geom.Matrix;

            public class vido extends Sprite
                public var _camera:Camera;
                public var _video:Video;
                public var _capt:MovieClip;
                public var _snap:Bitmap;
                public var _snapContent:BitmapData;
                public var _fileRefer:FileReference;
                public var bytes:ByteArray;
                    public function vido()
                        _video=new Video(320,240);
                    public function takeCapt(evt:MouseEvent)
                        var _snapContent:BitmapData=new BitmapData(320,240, false, 0);                  
                        var _snap:Bitmap=new Bitmap();
                        _snap.x = 304;
                        var jpgEncode:JPGEncoder = new JPGEncoder();
                        var bytes:ByteArray = jpgEncode.encode(_snapContent);
                        var _fileRefer=new FileReference();
                        _fileRefer.save(bytes, "image.jpeg");                  
5. You can download the JPEG Encoder from here
6. Goto the webcam fla and give the class name =vido.
7.Run  the flash file and take the snapshot and save it as jpeg.


Sunday, September 4, 2011

The ultimate list of tutorials and plugins for jQuery


In this site you've found the ultimate list of tutorials and plugins for jQuery.You want to see just follow the link http://jquerylist.com