I'm writing a card game in AS3. The artist I'm working with has produced (in Flash CS4) a single swf-file containing all the card graphics and animations. The structure of the fla working file looks something like this:
- Scene
- CardGraphics (Movie Clip)
- CardFront
- CardBack
- CardValueImage (Movie Clip)
...
In the program I create 52 instances of my Card class, each having a MovieClip instance created from the loaded swf. The idea is to set the frame of the CardValueImage MovieClip to correspond to the Card instance's suit and rank member variables. However, I can't figure out how I access CardValueImage and call gotoAndStop (or whatever method I will need to call).
This is basically what I want to do:
// Card Class
[Embed(source = 'CardGraphics.swf')]
private static var CardsClip:Class;
private var clip:MovieClip = new CardsClip;
// Card Constructor
this.valueImageFrame = suit * 13 + rank; // Calculate which frame contains the
// graphical representation of this card
this.clip.CardValueImage.gotoAndStop(valueImageFrame);