The shuffle of the AS3.0 cards in random order

Source: Internet
Author: User

Package {/** @ClassName:p ackage::P okermain * @Intro: This is an initial 1-52 playing cards, and then shuffle it in a disorderly order; * @Author: Not if * @Date: 2015.07.22 * @LanguageVersion: ActionScript 3.0 **/    ImportFlash.display.Sprite;  Public classPokermainextendsSprite {//Set Total Poker        Private varNum: Number= 52;  Public functionPokermain () {//Poker Shuffle:init_shuffle (); }        Private functionInit_shuffle ():void        {            varTempObject=NULL; var_pokers:vector.<Object> =Get_poker ();  for(varm:uint=0; m<num; m++)            {                varN:uint = Math.random () *NUM; Temp=_pokers[m]; _POKERS[M]=_pokers[n]; _pokers[n]=temp; Trace (M+"--:--"+_pokers[m].name+"<|>"+_pokers[m].style); }        }        Private functionGet_poker ():vector.<Object>         {            //Create a Poker object pool            varpoker:vector.<Object>=Newvector.<Object>(); var_name:string =""; var_style:string ="";  for(varr:uint=0; r<num; r++)            {                varPoker:Object= {Name:NULL, Style:NULL}; varN:uint=uint ((r-0.3)/4);varM:uint=uint ((r-1)%4); Switch(m) { Case0: {_style="Red Peach";                        };  Break;  Case1: {_style="Spades";                        };  Break;  Case2: {_style="Block";                        };  Break;  Case3: {_style="Plum Blossom";                        };  Break; default: {_style="Unknown";                        };  Break; }                Switch(n) { Case0: _name="K";  Break;  Case1: _name="A";  Break;  Case11: _name="J";  Break;  Case12: _name="Q";  Break; default: _name=String (n);  Break; } poker.name=_name; Poker.style=_style;            Poker.push (POKER); }            returnPOKER; }    }}

The shuffle of the AS3.0 cards in random order

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.