Maybe the following helps.
For Flash 8/AS2 I use the following pixelscanning & sending method:
my_loadvars = new LoadVars();
// Array containing hex values (2x3=6 bytes/chars per pixel)
my_loadvars.width = 320;
my_loadvars.height = 240;
my_loadvars.px = new Array(); // Array of hex values (RGB)
for (i=0; i<240; i++) {
for (j=0; j<320; j++) {
my_loadvars.px.push(bitmap.getPixel(j, i).toString(16)); // hex values
(RGB)
}
}
my_loadvars.send("http://yourprocessingscript.php", "_self", "POST");
OR.....
my_loadvars = new LoadVars();
// Pure byte-array (3 bytes per pixel)
my_loadvars.width = 320;
my_loadvars.height = 240;
my_loadvars.px2 = new String(""); // RGB-byte string
for (i=0; i<240; i++) {
for (j=0; j<320; j++) {
var pixValue:Number=myBitmapData.getPixel(j, i);
my_loadvars.px2+= String.fromCharCode(pixValue>>16 & 0xFF, pixValue>>8 &
0xFF, pixValue & 0xFF);
}
}
my_loadvars.send("http://yourprocessingscript.php", "_self", "POST");
The latter method is untested. The first method is succesfully implemented
in a project.
If you "just" use it for small areas like 320x240 the image is transfered to
the server within a couple of seconds on ADSL.
Regards,
Ruben
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens
> Claudius Ceteras
> Verzonden: dinsdag 24 april 2007 23:54
> Aan: [email protected]
> Onderwerp: Re: [Red5] Taking photos with Red5 (use ByteArray)
>
> Hi,
>
> > Looks like in ActionScript 3 there is a new ByteArray class
> > that makes it
> > much easier to do this sort of thing. I guess now I'll have
> > to download
> > the Flex 2 SDK and start learning how to play with that. :)
>
> >From a quick i would say the real magic is done by the JPGEncoder
> class(included here: http://code.google.com/p/as3corelib/) which relies on
> ByteArray, but just for the output, not for encoding to JPG, so i guess -
> from a first look - that this could be portable to AS2.
>
> I'll probably have time next week to take a closer look. If this doesn't
> work out, i guess i will do something stream-based.
>
> With kind regards
>
> Claudius
>
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org