1 Reply Latest reply on Jan 13, 2013 11:08 AM by sinious

    Webcam Photobooth With Graphics?


      I'm making a photobooth that would have graphics (like moustaches, etc) shown when they click "Capture".

      When I tested it, I can see the graphics on my face through the webcam, but not when I've captured the image.
      I'm guessing I have to "printscreen" the image and not "capture" it, because the results only shows the photo from the webcam without the graphics.
      Any suggestions what I can do?

      By the way, this is not my script, I found it on this forum as well.



      // Import the BitmapData class

      import flash.display.BitmapData;

      // Create a new Video Object

      // Library Menu, New Video, video (Actionscript-controlled)

      // Drag video symbol to stage and give it an instance name of 'video_obj'

      var video_obj:Video;

      // Reference the camera object and attach it to the video object

      var cam:Camera = Camera.get();


      // Create a BitmapData Object

      var camera_bmp = new BitmapData(cam.width, cam.height);

      // Add a movieclip to the stage with the instance name 'capture_btn'

      // and add a button event handler

      capture_btn.onPress = function() {

          // Draw the Video Object image onto the BitmapData Object


          // Create a container movieclip

          var container:MovieClip = _root.createEmptyMovieClip("container", this.getNextHighestDepth());

          // Attach the BitmapData Object to the container movieclip

          container.attachBitmap(camera_bmp, this.getNextHighestDepth());



      After the user has taken a photo with the graphics on it, I'd like the option of sending the photo, and an added message, to myself.
      Any ideas how I can do this?

      Thanks so much!

        • 1. Re: Webcam Photobooth With Graphics?
          sinious Most Valuable Participant

          All that code is doing is grabbing the data from the camera. If you want to overlay the mustache or any other items you'll need to also add them into the var "container" that has the cameras data attached to it. You'll want to add these items AFTER you get the data from the camera, so add them below:



          // add mustache here via attachMovie() linkage from library or load external graphics, etc here


          If you're familiar with AS2 and not AS3, that's a good reason to get a job done on time, otherwise if you're getting code snippits and are piecing something together I'd go for the performance and features of AS3 for a better experience. AS2 on a machine with a fast single processor should give fairly good results but interfacing with other devices can be more reliable (printers, etc) with AS3. I've done some kiosks similar to this in both AS2 and AS3 (more augmented reality than photos though).