I have a Width and Height parametr. I have been given an array of colors in such format: [r, g, b, a, r, g, b, a, r, g, b, a… etc]
Data can be acsessed by something like this
for(var y = 0; y < height; y++)
{
for(var x = 0; x < width; x++)
{
r = data[y*width + x + 0]
g = data[y*width + x + 1]
b = data[y*width + x + 2]
a = data[y*width + x + 3]
}
}
I want to paint that data on some sprite. How to do such thing?
BTW: I use Flash Builder for mxml+actionscript coding. So if it is easy for you you can give example using MXML (not todraw on some sprite but on some MXML component).
I’m not sure why you would want to do that in MXML, you’re probably better off doing this in coding this in AS3 by drawing on a sprite and then add the sprite as a child to a MXML component.
Try using the
BitmapDataclass, it has asetPixel()method that lets you set RGBA values.