Flex sample : Base64, JPEGEncoder, PNGEncoder
I created a sample of Base64, JPEGEncoder, PNGEncoder because I wanted Base64 text of a small image. It has grown bigger while I was making it.... So it might not be simple.
On making it, I found a bug of Base64Encoder.encodeBytes method.
// see encodeBytes in Base64Encoder.as
/* original code is below. This is wrong I think.
var plainIndex:uint = offset;
while (plainIndex < length)
*/
/* This should be below.
var plainIndex:uint = offset;
while (plainIndex < offset + length)
*/
The current third parameter of encodeBytes method doesn't mean "length" but it means "end of offset" to read bytes, I think.
BTW, I noticed we can't access to Loader.content after it's read bytes via Loader.loadBytes even if ApplicationDomain is same. Could not we do this before??
The sample is here.
ImageToBase64String
All Flex samples is here.
Flex samples
CF8 samples is here.
CF8 samples
On making it, I found a bug of Base64Encoder.encodeBytes method.
// see encodeBytes in Base64Encoder.as
/* original code is below. This is wrong I think.
var plainIndex:uint = offset;
while (plainIndex < length)
*/
/* This should be below.
var plainIndex:uint = offset;
while (plainIndex < offset + length)
*/
The current third parameter of encodeBytes method doesn't mean "length" but it means "end of offset" to read bytes, I think.
BTW, I noticed we can't access to Loader.content after it's read bytes via Loader.loadBytes even if ApplicationDomain is same. Could not we do this before??
The sample is here.
ImageToBase64String
All Flex samples is here.
Flex samples
CF8 samples is here.
CF8 samples
Comments
[Add Comment]
# Posted By Danny Miller
| 7/9/08 2:56 AM
# Posted By Shigeru
| 7/9/08 3:03 PM
[Add Comment]