Simple practice of taking photos with flash cameras

Source: Internet
Author: User
Tags flv file

Open Flash CS3 and create a new Flash file (Script 2.0). Named Pagea.fla

First step: Create a video component in the library, type selection: Video (subject to ActionScript control). Press F11 to open the library panel, the right key blank place a pop-up menu, choose "New Video", any name.

Step two: Drag the video symbol to the scene and resize it to the size you want. and named "Camera". At the same time, place two button on the layer, named "Btncamera" and "Btnupload" respectively.

Step three: Create a new layer, named "Code layer" click the first frame of the timeline, press F9 to open the Code panel, paste the following code:

  JScript Code   //camera is a video instance in the scene          // Note If you want to get the size of the photo you want, first do a FLV file of the size you want, and then select embedded          camera.clear ( );                                   //Camera Control Object            var cam:camera = camera.get ();           if  ( cam  == null) {             //code here if client no camera installed          }         //init variable           photow = new number (160);         &nbsp Photoh = new number (;      )              Cam.setmode (photow, photoh, 10, true);           camera.attachvideo (CAM);  //bound webcam video streaming to video                   //This object is used to send data to the Web page can get or post          var lv:loadvars;          lv = new  Loadvars ();                                     //When press the photo button            btncamera.onrelease = function  ()            {              //get current video picture                savecamera ();             //...         };          //toolbar.btncamerare.onrelease = function () {               //  ...              //savecamera ();         //}           Function savecamera () {                //Create a new Bitmapdate object and get the image information on the video               lv.bm = new flash.display.bitmapdata (photow, photoh,true, 0);                  lv.bm.draw (camera); Nbsp;              //photopreview is a movie  in the scene Clip instance, for output bitmapdate implementation photo Pre-cable               var  Tempobj = _root.createemptymovieclip ("Photo",  100);       tempobj._x  = 300;       tempObj._y = 40;           tempobj.attachbitmap (lv.bm, 1);             }                  // Upload photos to server           btnupload.onrelease = function () {                    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.