LayerManager and Sprite

Hello everybody!! I have a question want to ask.
If I want to use LayerManager.getLayerAt(int) to get the index of the sprite, and also want to get that sprite’s frame index, what and how I should do? ???
Thanks for your reply!!

Something like this:


Layer layer = layerManager.getLayerAt(index);
if (layer instanceof Sprite)
{
  Sprite sprite = (Sprite)layer;
  int frame = sprite.getFrame();
  // do something useful with 'frame' value
}

If you know that all your layers are Sprites, you don’t need the ‘instanceof’ test.