AS 2 HELP HELP HELP Snapshot..O_o
anybody who can help me on how to take a snap in a live video streaming? ... then save it on a direct folder? plz do help me ...plz plz plz!this is the only code i have:var cam_me:Camera = new Camera();cam_me = Camera.get();view.attachVideo(cam_me);
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 06-10-2008, 03:01 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Snapshot?
Im trying to take a snapshot of an MC and then display this snapshot in another MC, ive found how to do it in as2 but could anyone point me in the right direction for as3?
PHP Code:
import flash.display.BitmapData;
import flash.geom.*;
function takeSnapshot(mc:MovieClip):BitmapData {
var sp:BitmapData = new BitmapData(mc._width, mc._height, true, 0x000000);
sp.draw(mc, new Matrix(), new ColorTransform(), "normal");
return sp;
}
box2_mc.attachBitmap(takeSnapshot(box1_mc), 1);
FLV Snapshot In AS3
Hey there,
I'm hoping I can get some help cause I'm stuck. Basically, I have an XML file that I parse out and retrieve several urls from. The urls point towards flv files that I would like to add to a thumbnail gallery. I would like to only partly load these flvs (as to reduce load time) and capture a snapshot of the first (or maybe even greater) frame of the video so that I can use it as a trigger to actually load the video. However, I am not familiar enough with the Video class to try and do something this involved. I do, however, already have a function set up to take a snapshot of a movieclip that is passed into it (see below). If I can use this towards my ultimate goal that is great but I am not bent on it either way. All I really want is to get a snapshot of an flv, with minimal load time, and without using the server to do it for me (because I'm running ASP.NET and it is not as flash-firendly as PHP ).
ActionScript Code:
private function getThumb(target:MovieClip, newWidth:int):Bitmap
{
//calculate variables
var r:Number = target.height/target.width;
var newHeight:Number = newWidth*r;
//capture snapshot
var bitmapData:BitmapData = new BitmapData(newWidth, newHeight, true, 0xFFFFFF);
var drawingRectangle:Rectangle = new Rectangle(0, 0, newWidth, newHeight);
bitmapData.draw(target, new Matrix(), null, null, drawingRectangle, false);
//return new bitmap image
return new Bitmap(bitmapData);
}
Snapshot Of .swf?
Does anyone know if it's possible to take a snapshot of a swf using Actionscript and save it as a .jpg file? Is there any sort of "export as bitmap" command that I can use?
Thanks,
Troy
Snapshot Of The Stage
Hello, I am using Flash MX 2004 Pro. I want a button in my movie to take a snapshot JPG of whatever the stage currently looks like. Is there a way to do this?
If that is possible, I then need Flash to send that picture of the stage to an email address.
[F8] Frame Snapshot
Hi,
Is it possible to get a snapshot of a certain frame from within a flash movie? If it is possible I want to be able to load multiple swfs, pull out a frame and display that frame so the user can choose which swf to play. does that sounds feasible?
Snapshot Tutorial Help
Hey,
I saw the snapshot tutorial on flash-db.com and it was great!! I'm now making a webcam application with it. But the problem is that i can't attach the snapshot to a movieclip (or something else) and put that movieclip(with the snapshot) on a other frame.
Got my webcam+snapshot button on frame 10 with framelabel screen2, and i want the snapshot (picture) on frame 20 with framelabel screen3
Is it possible to do this? and how do i do this.
Here's the function to take a snapshot:
Code:
function capture(nr){
snapshot = new BitmapData(output_vid._width,output_vid._height);
//draw the current state of the Video object into
//the bitmap object with no transformations applied
snapshot.draw(output_vid,new Matrix());
var t:MovieClip = createEmptyMovieClip("bitmap_mc",1);
t._x = 0; t._y = 0; t._xscale = t._yscale = 100
//display the specified bitmap object inside the movie clip
t.attachBitmap(snapshot,1);
}
Thnx,
Dragon
Taking A Snapshot
hey guys, im using the webcam function in flash to take photos, does anyoen now how to save these photos into a database, i want the user to be able to take there photo, put there name, and appear in a highscore for a game, any ideas???
this is my code so far
output_vid.attachVideo(Camera.get());
import flash.display.BitmapData
import flash.geom.Matrix
var snapshot:BitmapData=new BitmapData(x=155,y=120);
var snapshot2:BitmapData=new BitmapData(x=155,y=120);
function takeSnapshot(nr)
{
snapshot.draw(output_vid,new Matrix());
}
function takeSnapshot2(nr)
{
snapshot2.draw(output_vid,new Matrix());
}
i have 2 buttons that take the snapshots
cheers
Webcam Snapshot
Hey, I'm trying to make a very simple program that will use Flash to take a picture of the user through their webcam and pass it off to PHP to be used later. I've got it working - kind of. I can't adjust the size of the image output though! No matter what I do, it stays the same. PHP generates the image the size I am looking for (320x240) but it will only make a 160x120 image and fill the rest of it in with white. Can someone look this over and tell me if there is anything wrong with it, I've been working on it a few hours and haven't come up with anything.
Code:
theCam = Camera.get();
theCam.setQuality(38400, 0);
theCam.setKeyFrameInterval(10);
theCam.setMode(320, 240, 5);
webcam.attachVideo(theCam);
import flash.display.BitmapData
snapshot_btn.onPress = function () {
output();
};
function output () {
snap = new BitmapData(webcam._width, webcam._height);
snap.draw(webcam);
var pixels:Array = new Array();
var w:Number = snap.width;
var h:Number = snap.height;
for (var a=0; a<=w; a++) {
for (var b=0; b<=h; b++) {
var tmp = snap.getPixel(a,b).toString(16);
pixels.push(tmp);
}
}
var output:LoadVars = new LoadVars();
output.img = pixels.toString();
output.height = h;
output.width = w;
output.send("webcam.php", "output", "POST");
}
stop();
PHP Code:
<?php
$data = explode(",", $_POST['img']);
$width = $_POST['width'];
$height = $_POST['height'];
$image=imagecreatetruecolor($width, $height);
$background = imagecolorallocate($image, 0, 0, 0);
//Copy pixels
$i = 0;
for($x=0; $x<=$width; $x++){
for($y=0; $y<=$height; $y++){
$int = hexdec($data[$i++]);
$color = ImageColorAllocate($image, 0xFF & ($int >> 0x10), 0xFF & ($int >> 0x8), 0xFF & $int);
imagesetpixel($image, $x, $y, $color);
}
}
//Output image and clean
header("Content-type: image/jpeg");
ImageJPEG($image);
imagedestroy($image);
?>
How To Get My Webcam To Take A Snapshot Using AS3.
Currently working on a school project that requires me to use AS3 to display a webcam, and create a button that will take a snapshot and place it beside the video display.
Managed to get the webcam to display on the stage, however, the snapshot button does not seem to work. Below is my code, anyone able to help?
ActionScript Code:
import flash.display.BitmapData;
import flash.display.DisplayObject;
var cam:Camera = Camera.getCamera();
video_vobj.attachCamera(cam);
stage.addEventListener(MouseEvent.CLICK, takephoto);
var screenS = new BitmapData(cam.width, cam.height);
function takephoto(e:MouseEvent):void {
screenS.draw(video_vobj)
addChild(screenS)
}
Any help is greatly appreciated! =)
Image Snapshot
Hi there, I'm in trouble with snapshoting an image with as3 and put it on my server.
Well, I used the process I've seen at this link: http://www.elctech.com/projects/tran...-rails-rmagick with jpgencoder.
My fla file is composed like this:
into a movieclip (called 'foto') there's my photo, on the main frame I put this code:
Code:
import com.adobe.images.JPGEncoder;
var snapPath = "http://www.blablabla.com/php/snapshot.php";
var snapshot:BitmapData = new BitmapData(foto.width, foto.height);
snapshot.draw(foto);
var encoded_jpg:JPGEncoder = new JPGEncoder(100);
var jpg_binary:ByteArray = encoded_jpg.encode(snapshot);
var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
var request:URLRequest = new URLRequest(snapPath);
request.requestHeaders.push(header);
request.method = URLRequestMethod.POST;
request.data = jpg_binary;
var variables:URLVariables = new URLVariables();
request.data = variables;
variables.snap = "../writable/tony.jpg";
trace(variables.snap);
var loader:URLLoader = new URLLoader();
loader.load(request);
Here follows the php code:
PHP Code:
<?php
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
$filename = ($_POST['snap']);
file_put_contents($filename, $jpg);
?>
Variables are corrected passed from as3 to php, but I can't see the image stored into my web space...I think it's a bitmapdata wrong usage...can some one help please??
MovieClip Snapshot
I'm sure it's going to be difficult, but I need a way of generating an image depending on the content of a certain area of the stage.
My flash API so far is a "White board" so to speak, similar to bebo's, however I have no idea how to capture an image from a certain area of stage.
Any help would be appreciated.
I'm using flash CS3, but the code must be AS2
Thanks,
Noggin
Snapshot Issue
I've downloaded Adobe's snapshot tutorial and have it working, its storing an flv in the streams folder on the server...and it plays it back like it should...
The only problem is that its not a still frame, its a video. I'm using Developer version of FMS 2.02.
I've checked the attachVideo syntax and it states that if the second parameter is 0 the server will only capture a single frame but it doesn't, it captures until I click the button again.
Taking A Snapshot
hey guys, im using the webcam function in flash to take photos, does anyoen now how to save these photos into a database, i want the user to be able to take there photo, put there name, and appear in a highscore for a game, any ideas???
this is my code so far
output_vid.attachVideo(Camera.get());
import flash.display.BitmapData
import flash.geom.Matrix
var snapshot:BitmapData=new BitmapData(x=155,y=120);
var snapshot2:BitmapData=new BitmapData(x=155,y=120);
function takeSnapshot(nr)
{
snapshot.draw(output_vid,new Matrix());
}
function takeSnapshot2(nr)
{
snapshot2.draw(output_vid,new Matrix());
}
i have 2 buttons that take the snapshots
cheers
Saving A Snapshot
Hello Again,
I posted before about this subject and recently require urgent help to solve this problem once and for all. The problem is saving an a movie clip from the stage (webcam capture) to a server via php.
What I have is basically this...
http://www.flashcomguru.com/index.cf...ve-webcam-feed
But when a user clicks on the snapshot button I want it to be able to save to my server (No FMS) via a php script of some sort.
Im pretty good with php, but i dont understand how I can get the image data from the stage, to the script where it will be saved on the server.
ANY help will be greatly appreciated.
Thank you!!!
Webcam Snapshot
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?
ActionScript Code:
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();}
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?
Take Snapshot Of Stage, Possible?
Is this possible?:
I would like to take a snapshot of the contents of the stage at some point in time. The snapshot would be some kind of image data which I can then mess around with. At the point where I want to take the snapshot, the stage will contain images and movieclips contained in the originally loaded SWF, as well as images and movieclips loaded from other SWFS that were loaded dynamically using flash.display.Loader class and attached to the Stage
Thanks
Snapshot In Flash
Hey,
Does anyone know if it's possible to take a snapshot in Flash?
I have a Flash movie and I'd like my site viewers to be able to click on a button marked 'Screen Cap' and then have a screencap taken of the movie.
First Frame Snapshot Of Flv...
Hi Everyone,
I'm curious to know if it is at all possible to take a snapshop of the first frame or nth frame of an flv file and export that snapshop as an image file? I'm using the Flash Video Exporter to convert my videos to .flv format, ideally I would like an image snapshop of a frame in the flv i'm converting... is this at all possible?
Thanks for your time,
- Tony
AS3 - Webcam Snapshot
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?
ActionScript Code:
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();
}
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?
A Very Diiffficult Snapshot Of View
Hi ppl. I just wanted to know if there's some way to make a snapshot of a online-created-screen. I mean, i know how to create a graphic, but i need to export it to gif (well, PNG is right too) ONLINE.
My swf receives some parameters online, depending of a Database. Then it shows the pretty graphics. But i need to send it to a very friendly way that cannot use the Flash plug-in.
If any guru knows how to do such a xtrange programation, please, help...
Thanx a lot.
Exporting A Swf Snapshot As A Jpeg
Yo. So im making a little flash game where you simply drag and drop stuff (remember the eggplant in flash 5? kinda like that). And i want it so that when the user is finished, they can click a button, which produces a 'snapshot' of the swf, which can then be used later in a page or whatever as a jpeg or gif. Im SURE i saw someone say there was a way of doing this once, perhaps using one of the PHP functions aimed at flash. Can anyone help?
Cheers in advance.
Rich
[F8] Help: WebCam Capture A Snapshot
I'm very newbie in action script. I would like to take a snapshot from the local webcam and has a preview of a captured bitmap on the stage, after that.
a) save as a local jpg.
b) directly upload it to a php server.
but after tried searching over the net i found a lot of examples but none of them works for me. At this time i can only show webcam on the stage. Could someone help me what did i do wrong? Thanks in advance.
Code:
import flash.display.BitmapData
import flash.geom.Matrix
/* capture the video stream from the active webcam and display it inside the video object */
my_cam= Camera.get();
my_video.attachVideo (my_cam);
my_video.smoothing=1
// create a new bitmap object
var snapshot=new BitmapData(320,240,true,0x00FFFFFF);
//a function that takes a snapshot of the Video object after push 'SHOOT' button
function takeSnapshot()
{
snapshot.draw(my_video,new Matrix());
this.createEmptyMovieClip("my_video",this.getNextHighestDepth());
my_video.attachBitmap(snapshot, this.getNextHighestDepth(), "auto", true);
}
How To Capture Webcam Snapshot?
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?
Code:
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();
}
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?
[F8] Help: Use WebCam To Capture A Snapshot
I'm very newbie in action script. I would like to take a snapshot from the local webcam and has a preview of a captured bitmap on the stage, after that.
a) save as a local jpg.
b) directly upload it to a php server.
but after tried searching over the net i found a lot of examples but none of them works for me. At this time i can only show webcam on the stage. Could someone help me what did i do wrong? Thanks in advance.
Code:
import flash.display.BitmapData
import flash.geom.Matrix
/* capture the video stream from the active webcam and display it inside the video object */
my_cam= Camera.get();
my_video.attachVideo (my_cam);
my_video.smoothing=1
// create a new bitmap object
var snapshot=new BitmapData(320,240,true,0x00FFFFFF);
//a function that takes a snapshot of the Video object after push 'SHOOT' button
function takeSnapshot()
{
snapshot.draw(my_video,new Matrix());
this.createEmptyMovieClip("my_video",this.getNextHighestDepth());
my_video.attachBitmap(snapshot, this.getNextHighestDepth(), "auto", true);
}
How To Capture Webcam Snapshot?
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?
Code:
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();
}
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?
Webcam Snapshot In Flash
I'm mildly familiar with action script. I would like to take a snapshot from the local webcam and have a preview of the captured image on the stage, and then upload the captured image to a ColdFusion server to be saved as a jpg.
After searching online I've found many examples but none of them work for me. At this time I can only show webcam on the stage. Could someone help? Thanks in advance!
Attach Code
import flash.display.BitmapData
import flash.geom.Matrix
/* capture the video stream from the active webcam and display it inside the video object */
my_cam= Camera.get();
my_video.attachVideo (my_cam);
my_video.smoothing=1
// create a new bitmap object
var snapshot=new BitmapData(320,240,true,0x00FFFFFF);
//a function that takes a snapshot of the Video object after push 'SHOOT' button
function takeSnapshot()
{
snapshot.draw(my_video,new Matrix());
this.createEmptyMovieClip("my_video",this.getNextHighestDepth());
my_video.attachBitmap(snapshot, this.getNextHighestDepth(), "auto", true);
}
Webcam Snapshot To Jpeg
I want to take a singel frame snapshot of a webcam image, which is streaming to a server, and send it to a JSP server and make it a JPEG. How can I do it? Isn't there a simple way? With few lines of code? To make a byte array, perhaps and send it through http?
Snapshot Of RTMP Feed - Possible?
Hi!
Is there a way to get a snapshot of a live streaming RTMP feed? I've tried BitmapData.draw, but this causes a sandbox violation. Is there a way around this? Is there a way (ANY way) to grab a still image from a live RTMP stream and save it to disc?
Thanks in advance,
K.
Saving Snapshot In A Sharedobjects?
hey guys does anyone know how i can save a photo taken from a webcam and save and retrieve it from a shared object??? i dont have php server so throw that out of the window
so far i got the snapshot working, here is my script
stop()
motionTrack._visible = 0
output_vid.attachVideo(Camera.get());
import flash.display.BitmapData
import flash.geom.Matrix
var snapshot:BitmapData=new BitmapData(x=155,y=120);
var snapshot2:BitmapData=new BitmapData(x=155,y=120);
function takeSnapshot(nr)
{
snapshot.draw(output_vid,new Matrix());
}
function takeSnapshot2(nr)
{
snapshot2.draw(output_vid,new Matrix());
}
pic.pic2.attachBitmap(snapshot,1);
another.attachBitmap(snapshot2,1);
main.game.face1.pic2.attachBitmap(snapshot,1);
main.game.face1.another.boss.attachBitmap(snapshot 2,1);
any ideas
cheers
A Question About Snapshot Tutorial
about tutorial : http://www.flash-db.com/Tutorials/sn...hot.php?page=1
when i use a jpg replace the video
the result is very poor
the original jpg
the result:
what's the reason?
Camera Snapshot Effect?
I was looking at one of Verizon's Flash demos regarding their picture phones and there's a portion where you can drag the phone over a horizontal scrolling menu and snap a picture of a portion of the scrolling image. It works really well and I'm curious as to how this might be done or if anyone knows of any tutorials that would lead me in the right direction. Here's the link to the demo itself:
Verizon Picture Messaging Demo
My inital guess is that they're using the masked area of the phone to determine 4 coordinates to create a boundary and somehow grabbing the background picture from that info but I'm not sure.
Taking A Snapshot Of A Movieclip (to Jpg)? Is This Possible?
Hi all,
I'm trying to figure out if it's possible to have Flash take a snapshot (like a screenshot) of a movieclip then make it available as a jpg. Basically, here's what I'm trying to do:
I have an Ad Libs type of form where users type in answers in text fields. When they've filled them all out, a dynamically generated image pops in below (as if their answers generated a unique result). I want the user to be able to email this result, design and all, not just the information.
Any ideas on a good way to accomplish this?
thanks!
Save Snapshot To Jpeg
Hi,
I have an swf that allows a user to upload a photo, which is then used as the background for the swf, and then then can drop items onto this, and resize, rotate, delete them....
I have been searching the forums and google for a way for the user to save what they have done, and have this design emailed to us.
A lot of the posts I have found are old (2003), and I have even tried looking for swfdraw2jpg at www.f-mod.com (which ain't there anymore.. )
I am using Flash 8 Pro, so I am sure there has to be a way to accoumplish this (without having users with slow PC's/connections going off and making a coffee while waiting for it to finish).
Can anyone help?
Tezza
Snapshot Of Bitmap + Vector In Flash
Hey,
If there is anyone out there that has had experience or knows if this is even possible please shoot me over any details.
I am trying to build an SWF application in Flash MX 2004 that contains a bitmap background and some vector animation. I want to allow the user to capture a "snapshot" of an area on the SWF (using a certain size viewfinder) that includes the position of the vectors and the area of the bitmap that the user took.
I realize with vector it would be as easy as capturing the XY coordinates and the vector image at that particular moment in the animation, but what about capturing the bitmap background. And it's sometimes not even the the entire bitmap, could be 1/2 of the bitmap depending on the size of the viewfinder the user chooses. I guess you can say it's like taking a photo of the scene.
Ultimately, the "snapshot" would stay in the SWF as a movieclip of somesort that they can review later (so NOT exported in anyway).
Any ideas? Does that even make sense?
Thanks in advance!
A Newbie Question: How To Print A Snapshot
I almost finished my CD and I have a button that has to anable the viewer to print a snapshot of the CD Screen. Or could be only the middle part where is only text. But may be the last is impossible to do. The Print button is on every page actually. It's an educational CD and has a lot of text.
An actual sample is the interactive Help manual for Flash.
MARY CHRISTMAS to all of you!
Video Snapshot With Progressive Download
I'm creating an application were you are able to take snapshots of a video, but have ran into a security error " Error #2123: Security sandbox violation: BitmapData.draw".
So I have done the follow,
1) Tried playing a file locally- FAILED
2) Used the following crossdomain.xml
PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileHttp.xsd">
<allow-access-from domain="*" />
<site-control permitted-cross-domain-policies="all"/>
</cross-domain-policy>
I did find that flash wasn't requesting this file on first load , so i did Security.loadPolicy, but this FAILED also.
3) Tried using netstream.checkPolicyFile=true - FAILED
4) Tried the following hack:
PHP Code:
video.attachNetStream(null)
bmp.draw(videoContainer) // A sprite
video.attachNetStream(netStream)
also tried drawing from the video object directly.
So now neither a video played locally or a video delivered from my server will allow me to take snapshots. After debugging some more I found that my netStream is dispatching "NetStream.Play.Start" twice, I think this might be the problem but I don't see how or why it would be dispatching it twice for a file played locally.
The strange this is that this application was working fine for 2 weeks, Decided to open it up today to do some work and now it wont function like it's suppose to. If anyone has any guidance to this problem it would greatly appreciated.
Thanks
Creating A Jpeg Snapshot Sequence From A Flv
Hello everyone,
I see there are many apps out there to create snapshot sequences from avi files, I was wondering if anyone had any suggestions on how this might be accomplished on-the-fly using flv video.
I'd like to create a snapshot sequence every 12 seconds from my flv and order them above my scrubber so people can see what scene they are srubbing to without having to move the handle.
Any tips or tutorials would be much appreciated.
Have a good one.
T
Video Snapshot With Progressive Download
I'm creating an application were you are able to take snapshots of a video, but have ran into a security error " Error #2123: Security sandbox violation: BitmapData.draw".
So I have done the follow,
1) Tried playing a file locally- FAILED
2) Used the following crossdomain.xml
quote:
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy xmlns:xsi="
BitmapData On Sprite Snapshot For Reuse
Hello, Im working on a project where I need to be able to deform a mesh from a BitmapData reference. Now im using a Sprite containing a BitmapData with a matrix to make a texture of tiles repeat itself. Afterwards I need to take all those pixels and convert them to a single data in order to send it to a class that I have to tranform the bitmap Data. The thing is that this class BitmapTransformer BitmapTransformer Class uses beginFill and endFill to redraw the image as it is modified. I was wonderirng if theres a way to pass the bitmapData to this class but as a raw image loosing all the transforms that I first made for the past image. Here the code of how im creating my texture image. Notice that once I pass the info to a new Bitmap I only get one image without the tile process. please help me out
Attach Code
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.geom.Matrix;
import flash.geom.*;
var url:String = "miloambar.jpg";
var loader:Loader = new Loader();
function Graphics_beginBitmapFill() {
var request:URLRequest = new URLRequest(url);
loader.load(request);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, drawImage);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
function drawImage(event:Event):void {
var mySprite:Sprite = new Sprite();
var myBitmap:BitmapData = new BitmapData(loader.width, loader.height, false);
myBitmap.draw(loader, new Matrix());
var matrix:Matrix = new Matrix();
matrix.rotate(Math.PI/4);
mySprite.graphics.beginBitmapFill(myBitmap, matrix, true);
mySprite.graphics.drawRect(500, 0, 500, 500);
mySprite.graphics.endFill();
addChild(mySprite);
var myBitmapData:BitmapData = new BitmapData(500, 500);
//Here I try to pass the info to the new Bitmap to use it with BitmapTransform.
myBitmapData.draw(myBitmap);
var bmp:Bitmap = new Bitmap(myBitmapData);
this.addChild(bmp);
bmp.x = 0;
bmp.y = 0;
}
function ioErrorHandler(event:IOErrorEvent):void {
trace("Unable to load image: " + url);
}
Graphics_beginBitmapFill();
Video Snapshot With Progressive Download
I'm creating an application were you are able to take snapshots of a video, but have ran into a security error " Error #2123: Security sandbox violation: BitmapData.draw".
So I have done the follow,
1) Tried playing a file locally- FAILED
2) Used the following crossdomain.xml
PHP Code:
<?xml version="1.0" encoding="UTF-8"?><cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileHttp.xsd"> <allow-access-from domain="*" /> <site-control permitted-cross-domain-policies="all"/></cross-domain-policy>
I did find that flash wasn't requesting this file on first load , so i did Security.loadPolicy, but this FAILED also.
3) Tried using netstream.checkPolicyFile=true - FAILED
4) Tried the following hack:
PHP Code:
video.attachNetStream(null)bmp.draw(videoContainer) // A spritevideo.attachNetStream(netStream)also tried drawing from the video object directly.
So now neither a video played locally or a video delivered from my server will allow me to take snapshots. After debugging some more I found that my netStream is dispatching "NetStream.Play.Start" twice, I think this might be the problem but I don't see how or why it would be dispatching it twice for a file played locally.
The strange this is that this application was working fine for 2 weeks, Decided to open it up today to do some work and now it wont function like it's suppose to. If anyone has any guidance to this problem it would greatly appreciated.
Thanks
Take A Snapshot From Flash Webcam Feature
i know how to see the webcam in my swf, however, i want to have a button that when the user clicks it saves a snapshot from what currently on the webcam on the server.
if it's not possible to do on the server, i don't mind if it will save it on the user's computer and by PHP i'll make it upload the image.
thanks in advanced.
AS3 - Webcam Snapshot With Cropping And Resize? Help
Last edited by youwh : 2008-05-10 at 09:52.
I'm trying to set the position of the area I capture the image. I think the way is to assign the function to a MC? And currently my saving directory is desktop. How could I change it to a folder in the same directory with my swf file?
ActionScript Code:
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;
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("webcam" + count++ +".png" );
var fileStream:FileStream = new FileStream();
fileStream.open(file,FileMode.WRITE);
fileStream.writeBytes(ba);
fileStream.close();
}
BitmapData Doesn't Snapshot Movieclip
I want to load a picture into a movie clip, and then use the draw() function of BitmapData to snapshot it. My codes are as follows:
//---------------------
import flash.display.BitmapData
var img_mc = this.createEmptyMovieClip("img",1);
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.loadClip("pic.jpg",img_mc);
var picBitmap = new BitmapData(83,104,false);
picBitmap.draw(img_mc);
this.createEmptyMovieClip("holder_mc",2)
holder_mc.attachBitmap(picBitmap,2);
//----------------------
But it doesn't work...
Can anyone do me a favor? Thanks!
Capture Webcam Snapshot As Bitmap And Send To Server
I have a local webcam stream appearing on the stage in a movieclip.
When I click a "snapshot button", a still image from the webcam gets attached to a new movieclip on the stage with attachbitmap and then draw()
The snapshot shows up in the movieclip on the stage as a preview.
I want to know how to send the data of this bitmap in the movieclip to a server (php or coldfusion) to be saved as a JPEG.
I can't figure out how to access the bmp data and send it to a server... any answers?
|