A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: webcam snapshot problem

  1. #1
    Junior Member
    Join Date
    Apr 2006
    Posts
    8

    webcam snapshot problem

    I follwed this tutorial (the first 3 steps)
    - how to show webcam in flash
    - how to capture it when a button is pressed

    http://www.macromedia.com/devnet/fla...ion_print.html


    unfortunately the capture just doesn't happen, I tired for hours. any idea what I did wrong??

    it should be very easy to resolve for somebody who understands its a bit better than I do.

    just download the FLA file and you can see:
    http://www.raffael3d.com/webcam_snap.fla


    - the camera runs
    - a button that should cause the snapshot, but nothing happens.

    thanks so much for helping.


    the problem I see lies in this code here:


    //create a movie clip to hold the bitmap when we attach it
    this.createEmptyMovieClip("bitmap_mc",this.getNext HighestDepth());

    //display the specified bitmap object inside the movie clip
    bitmap_mc.attachBitmap(snapshot,1);


    snap_btn.addEventListener("click",mx.utils.Delegat e.create(this,takeSnapshot));

    my black button has the instance name "snap.btn", so it should work, no?
    something I dont understand in the code line above is the "click", is this talking about the "press" button function of a button or is this something else?
    Last edited by raffael3d; 04-11-2006 at 07:00 PM.

  2. #2
    Junior Member
    Join Date
    Feb 2002
    Posts
    4
    I too have the same problem and am looking for the answer. did you try to e-mail the auther of the original tutorial post?

    Dale

  3. #3
    Junior Member
    Join Date
    Apr 2006
    Posts
    8
    I did email the guy, but never got a response... unforunately.

  4. #4
    Junior Member
    Join Date
    Feb 2002
    Posts
    4

    Taking a snapshot!?

    Can anyone shed light on the original posting???

    I have looked over the code many time and tried to amend it as best I know how. I placed the amended code on the button, in the frame – using all of the different input triggers. I’ve found many posts in the forums with people who are doing more complicated things with web cams! Does anyone know how to do the simplest?

    I can find no tutorials on this topic either.

    We are trying to:
    1. Have web cam input on to the stage (which the above code does)
    2. Press a button- the picture freezes
    3. Press another button and the picture is cleared and the video freed starts again.

    And help will be much appreciated





    Other Post's Code which is similar:


    Ok lk this is what i have so far.

    http://img322.imageshack.us/my.php?...mpcamera9wr.swf

    the swf will show you the problem im having when i resize the video output. hit the enter button to take the screenshot. There are two clips called bit1 and bit2 that hold the screendumps when taken.

    the code in my frame is this all vriable eg output 1 regard small video and 2's men the big video)

    output1.attachVideo(Camera.get());
    output2.attachVideo(Camera.get());

    import flash.display.BitmapData
    import flash.geom.Matrix

    /*
    create a new bitmap object that is the same size
    as the Video object to store the pixel data
    */
    var snapshot1:BitmapData=new BitmapData(output1._width,output1._height);
    var snapshot2:BitmapData=new BitmapData(output2._width,output2._height);

    /*
    create a function that takes a snapshot
    of the Video object whenever it is called
    */
    function takeSnapshot1()
    {
    //draw the current state of the Video object into
    //the bitmap object with no transformations applied
    snapshot1.draw(output1,new Matrix());
    }



    and the code on my enter button is this:

    on(release){
    _root.takeSnapshot1();
    _root.takeSnapshot2();
    bit1.attachBitmap(snapshot1,1);
    bit2.attachBitmap(snapshot2,1);
    }




    the whole idea is that i need to get te image to appear the full size without the white bit.


    Regards
    Dale

  5. #5
    Junior Member
    Join Date
    Aug 2006
    Location
    Australia
    Posts
    2
    I've been playing with a similar thing tonight and have got it working

    using Dales code... simply change the button code to:

    on(release){
    _root.takeSnapshot1();
    _root.takeSnapshot2();
    this.createEmptyMovieClip("bit1",this.getNextHighe stDepth());
    this.createEmptyMovieClip("bit2",this.getNextHighe stDepth());
    bit1.attachBitmap(snapshot1,1);
    bit2.attachBitmap(snapshot2,1);
    }

    all is good

    have fun!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center