gskinner/EaselJS — Issue #95: SpriteSheet getFrame not working
Author: ahmednuaman
Created: 2012-01-04 20:35:51+00:00
State: open

I don't know whether I'm doing something really silly or not but I couldn't get the SpriteSheet class to work correctly. When using `getFrame` it would only ever return the first frame.

This is the code I was using:

```javascript
function handleImageLoaded(e)
{
var c = new Container();
var d = { };
var l = rx * ry;
var lh = canvas.height / ry;
var lw = canvas.width / rx;
var lx = 0;
var ly = 0;
var s;
var t;

d.images = [ e.target ];
d.frames = { width: lw, height: lh, count: l };

s = new SpriteSheet( d );

for ( var i = 0; i < l; i++ )
{
t = new Bitmap( s.getFrame( i ).image );

t.x = lx++ * lw;
t.y = ( lx == rx ? ly++ : ly ) * lh;

lx = lx == rx ? 0 : lx;

c.addChild( t );
}

stage.addChild( c );

stage.update();
}
```