Also, this could be an addition to the Quad class:
public function setColorChannels(r:Number, g:Number, b:Number) : void
{
for (var i:int=0; i<4; ++i)
mVertexData.setColorChannels(i, r, g, b);
onVertexDataChanged();
if ( r < 1 || g < 1 || b < 1 )
mTinted = true;
else if ( alpha != 1.0)
mTinted = true;
else mTinted = mVertexData.tinted;
}
and this to the VertexData class:
public function setColorChannels(vertexID:int, r:Number, g:Number, b:Number):void
{
var offset:int = vertexID * ELEMENTS_PER_VERTEX + COLOR_OFFSET;
if ( mPremultipliedAlpha )
{
var multiplier:Number = mRawData[offset + 3];
mRawData[offset] = r * multiplier;
mRawData[offset+1] = g * multiplier;
mRawData[offset+2] = b * multiplier;
}
else
{
mRawData[offset] = r ;
mRawData[offset+1] = g;
mRawData[offset+2] = b;
}
}
Running through 50000 quads (alot, yes) and setting the color through:
q.color = 0xFF0000;
takes almost 40% more time than
q.setColorChannels(1.0, 0.0, 0.0);
using these methods. And yeah, they do the same thing.