i’m having a problem running a function that takes a bitmap then copies each pixels info into an array and passes that array to another function (which coverts the array into a string and sends it to a php page that will reconstruct the bitmap). the problem is that when the function runs an alert box comes up saying that the script is causing the cpu to run slowly and then asks if i want to disable all script on the page. is there a way to make it run a bit more smoothly?
var pixels = Array();
var w:Number = myBitmap.width, tmp;
var h:Number = myBitmap.height;
var a:Number = 0;
function convert() {
for (var b = 0; b<=h; b++) {
tmp = myBitmap.getPixel32(a, b).toString(16);
trace(tmp);
pixels.push(tmp.substr(1));
}
a++;
if (a>w) {
sendData(pixels, h, w);
myBitmap.dispose();
}
}
then the send function is:
function sendData(pixels:Array, h:Number, w:Number) {
var output:LoadVars = new LoadVars();
output.img = pixels.toString();
output.height = h;
output.width = w;
output.send("../saveBitmap.php", "output", "POST");
}