I am looking to make a card game in Flash CS4 using AS3 and I am stuck on the very first step.
I have created graphics for a standard 52 card deck of playi开发者_如何学Cng cards and imported them into the library in Flash and then proceeded to convert them all to Movie Clips.
I have also used the linkage to make them available in the code. The movie clips and the linkage are named in sequence, as in the Ace of Clubs would be C1, two of Diamonds is called D2, Jack of Spades is S11. (C = Clubs, D = Diamonds, S = Spades, H = Hearts and numbers 1 through 13 are the card values. 1 being Ace, 11 being Jack, 12 being Queen, 13 being King).
As far as I know my next step would be to arrange the cards into an array. This is the part that I am having problems with. Can someone please point me in the right direction, what would be the best way to do this. Could you provide me with a bit of sample code as well?
I have had a look at few tutorials online but they are all telling me different things, some are incomplete and the rest...well...they're just cr*ppy.
Check out this project called as3cards, perhaps it will be of use.
http://code.google.com/p/as3cards/
if you set up the linkage properties for the movieclips it means you have made a class for it.
so if your linkage class is setup like this: C1 you can make instances of your movieclips like this
new C1();
and if you want to put them all into an array you can do
var arr : Array = new Array(new C1(),new C2(),..,new D1(), new D2,..,.. );
精彩评论