Flash file for video camera
Import It.sephiroth.mloaderWindow
Import It.sephiroth.PrintScreen
Mycam = Camera.get ();
Mycam.setmode (390, 290, 10);
My_video.attachvideo (Mycam);
var Loader:mloaderwindow = This.createclassobject (Mloaderwindow, "loader", ten, {_x:-1000, _y:-1000})
Loader.setstyle ("BorderColor", 0x006699)
var listener:object = new Object ();
listener.onprogress = function (Target:movieclip, Loaded:number, Total:number) {
var perc = Math.Round ((loaded/total) *100)
Loader.label = "Sending ... "+ perc +%"
Loader.value = perc
}
Listener.oncomplete = function (Target:movieclip, load_var:loadvars) {
Loader.label = "Sending ..."
Load_var.send ("makepic.aspx", "_self", "POST")
Loader.close ()
}
function Print_me () {
var mc_x = 15;
var mc_y = 15;
My_video.attachvideo (NULL);
PN = new Printscreen ();
Pn.addlistener (listener);
Pn.print (_root, 0, 0, 390, 290, mc_x, mc_y)
Loader.label = "in output ... 0% "
Loader.open (True, true, true);
}
asp.net get the data for the Flash camera program:
private bool CreateImage (string Path)
{
int w = 0;
int h = 0;
Try
{
w = Int. Parse (request.form["width"]);
h = Int. Parse (request.form["height"]);
}
catch (Exception ee)
{
Response.Write (EE. message);
return false;
}
Bitmap Newmap = new Bitmap (w, h);
int rows = 0;
int cols = 0;
Graphics gp = Graphics.fromimage (NEWMAP);
GP. Clear (Color.White);
ImageCodecInfo Myimagecodecinfo;
System.Drawing.Imaging.Encoder Myencoder;
Encoderparameter Myencoderparameter;
encoderparameters myencoderparameters;
myimagecodecinfo = Imagecodecinfo.getimageencoders () [1];
myencoder = System.Drawing.Imaging.Encoder.Quality;
myencoderparameters = new EncoderParameters (1);
myencoderparameter = new Encoderparameter (Myencoder, 95L);
myencoderparameters.param[0] = myencoderparameter;
gp.compositingquality = compositingquality.highquality;
GP. SmoothingMode = smoothingmode.highquality;
GP. Interpolationmode = Interpolationmode.highqualitybicubic;
GP. TextRenderingHint = Textrenderinghint.cleartypegridfit;
for (rows = 0; rows < Newmap. Height; rows++)//Looping picture height
{
string px = request["px" + rows];
string[] c_row = px. Split (', ');
for (cols = 0; cols < Newmap. Width; cols++)//Looping picture width
{
String values = C_row[cols];
if (Values!= "" && values!= null)
{
string hex = values;
while (Hex. Length < 6)
{//Prevent color loss
Hex = "0" + hex;
}
int r = Int. Parse (Hex. Substring (0, 2), System.Globalization.NumberStyles.HexNumber);
int g = Int. Parse (Hex. Substring (2, 2), System.Globalization.NumberStyles.HexNumber);
int b = Int. Parse (Hex. Substring (4, 2), System.Globalization.NumberStyles.HexNumber);
Newmap. SetPixel (cols, rows, Color.FromArgb (R, G, b));
}
}
}
Gp. DrawImage (newmap, 0, 0, W, h);
Path = Server.MapPath ("makepic.aspx") + "123.jpg";
Save path, modify here
Newmap. Save (Path, Myimagecodecinfo, myencoderparameters);
Myencoderparameters.dispose ();
Gp. Dispose ();
Newmap. Dispose ();
Response.Redirect (Path);
return true;
}
To Flash is not too much explanation from the alliance power up and down a flash source, so called in PHP, here instead in asp.net call