The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • ActionScript
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 ActionScript

  • youwh Author 
    • 8229 
    • 0 
    • 0 
    Webcam snapshot
    youwh

    No comments yet

    Be the first to comment

    Posted: May 16 2008, 09:06 PM

    by youwh

     

I have followed Lee’s tutorials on saving snapshot from webcam, but now I found out that I need it to be in a normal swf file rather than an air application. How could I change the code here?
[as]import com.adobe.images.PNGEncoder;
import flash.filesystem.*;

var cam:Camera = Camera.getCamera();
var video:Video = new Video(240,180);

cam.setQuality(0, 100);

video.attachCamera(cam);
//video.x = -52.5;
frame.addChild(video);

btn.addEventListener(MouseEvent.CLICK,saveImage);

var count:int = 0;
//how to start from last number;

var scale:Number = .45;

var m:Matrix = new Matrix();
m.scale(scale,scale);

function saveImage(e:MouseEvent):void {
  var bmd:BitmapData = new BitmapData(60,80,false);
  bmd.draw(video,m);
  var ba:ByteArray = PNGEncoder.encode(bmd);
  var file:File = File.desktopDirectory.resolvePath(“card” + count++ +”.png” );
  var fileStream:FileStream = new FileStream();
  fileStream.open(file,FileMode.WRITE);
  fileStream.writeBytes(ba);
  fileStream.close();
}[/as]I wanted to save the snapshot to a folder where my swf is.
Currently the code save the picture from 0 every time i open the swf. How can I save the filename after the last image in that folder?

  0 REPLIES
 
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 775  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,724  Assets
  • Profiles 282,659  Members
  • Topics 93,762  Topics
  • Blog 4  Blog
  • Facebook 1,680  Facebook
  • Twitter 1,165  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 04, 2012 - 20:14:17