last week or so i saw someone asking for frames on a sprite and "gotoAndStop".
since we all use some kind of work around i though i share mine with you.
i wrote a little extension called FrameSprite. what this class does it very simple.
this class extends the starling.display.Sprite and is able to do everything you would want to do with a normal sprite.
Difference is that with this Sprite you can add frames to your sprite and give them labels just like you would do with flash.
the example below shows you how this class works.
var player_jumpAtlas:TextureAtlas = new BigTextureAtlas([tex1],[xml1]);
var player_walkleftAtlas:TextureAtlas = new BigTextureAtlas([tex2],[xml2]);
//we create the player sprite witch is going to contain all the animations it hass.
var player:FrameSprite = new FrameSprite();
//we create the player jumping movieclip.
var player_jump:MovieClip = new MovieClip(player_jumpAtlas.getTextures());
//add the mc to the juggler like you would normaly do.
//we create the player walking to the left movieclip.
var player_walkleft:MovieClip = new MovieClip(player_walkleftAtlas.getTextures());
//we add the player sprite to the stage
//first we must add a frame to the FrameSprite
//with the addChildToFrame function you can add a mc to a specific frame within the player sprite a frame, both frame number and framelaber work here.
//here we do the same as shown above but we give the seccond frame a diffrent name.
//with the gotoAndStop functie you can give a frame label or the frame number, both work.
//this returns the frame number currently active.
//this returns the frame label currently active
//this returns the current frame sprite holder
var frame_sprite:Sprite = player.currentFrameSprite;
//for example, lets give this mc a name
player_jump.name = "player_jump_mc";
// with could find this specific mc now with
player_jump = MovieClip(frame_sprite.getChildByName("player_jump_mc"));
//removeFrame can give number or string.
//isnt this obvious?