Hi there.
I am implementing my own particle system, that is based on Sprite3Ds with spritesheet textures and a 3dPlan that manages every animation and particles, and clashed against the troublesome way to implement texture animation in Sprite3Ds.
I resolved the problem with a single change in the Sprite3D class:
public function get geometry():SubGeometry
{
return _geometry;
}
This getter function returns the Sprite3D subgeometry, and gives direct access to the Uv’s
This way I can do something like this (being dot a Sprite3D):
var geo=dot.geometry;
var dotData:Array=[];
geo.scaleUV(0.25,0.25);
for (var k:uint=0;k<geo.UVData.length;k+=2)
{
dotData.uv[k]=geo.UVData[k];
dotData.uv[k+1]=geo.UVData[k+1];
}
This will store the default uv positions that will be changed with the animation
And then, to animate, something like this (uvPos is an array with the preset uv positions for a 4x4 spritesheet animation frame)
var geo=dot.geometry;
for (var k:uint=0;k<geo.UVData.length;k+=2)
{
geo.UVData[k]=dotData.uv[k]+uvPos[0];
geo.UVData[k+1]=dotData.uv[k+1]+uvPos[1];
}
geo.updateUVData(geo.UVData);
These two parts could be implemented inside the Sprite3D- an array storing the default uv positions, and a method to automatically update the uv position, given uv values. (sort of Sprite3D.moveUV(w,v))
I honestly love old school programming and it seems to me that these simple and direct methods would be worth gold for all the Flash programmers out there.