How to Create Card Match Game Using Adobe Flash

Written by joy campbell
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Create Card Match Game Using Adobe Flash
(Burke/Triolo Productions/Brand X Pictures/Getty Images)

Adobe Flash matching games are one of the favourites for online game players. Online games, innovated by Flash Macromedia in 1996, quickly became recognised for its usefulness by Flash programmers. At first the concentration with Flash was on animation, but with the introduction of Action Script, the door was opened to better game creations. Programmers concentrated on creating popular off line games such as matching games, solitary and arcade styled games into online games. Flash games today are attracting more and more players with score boards and the ability to compete with other players.

Skill level:

Other People Are Reading


  1. 1

    Open Flash and click "File," then "New" and then click "Flash File (ActionScript 3.0)" from the pullout menu. Save your file by clicking on "File," on the main menu and then "Save As" and type in the name "card_match" and then click "Save."

  2. 2

    Create a movie clip by clicking on "Insert" on the main menu and then "New Symbol." Click the "Movie Clip" type radio button and type in "cards" for the name.

  3. 3

    Click on the "Rectangle" tool from the tool bar and place your mouse in the lower right corner of the registration point (looks like a cross), click and while holding down your mouse, drag across the stage to draw a rectangle.

  4. 4

    Add a keyframe to frames "1-9" by right clicking on the frame and then click "Insert Keyframe" from the pullout menu. Add colour to rectangles by clicking on the keyframe and then click on the paint bucket "FillColor" on the tool bar. Choose different colours for each frames making keyframe "9" your default colour. Save your file by clicking on "File" and then "Save" on the main menu.

  5. 5

    Right click on the cards movie clip in the library and click on "linkage," type in "cards" for the class and click on the check box for "Export for ActionScript" and "Export in first frame."

  6. 6

    Open a Flash Action Script file by clicking "File," on the main menu, click "New" and then click "ActionScript File" from the pullout menu. Save your file by clicking on "File," on the main menu and then "Save As" and type in the name "card_match," then click "Save."

  7. 7

    Connect your Action Script file to ActionScript 3.0 by Clicking "Window" from the main menu of your ActionScript 3.0 file and then click "Properties" and "Properties" again from the pullout menu. Type in "card_match" for the "Document Class" value.

  8. 8

    Copy and paste the following code and then test your file by click by pressing "Ctrl + Enter" on your keyboard.

    package {

    import flash.display.Sprite;



    import flash.utils.Timer;

    public class card_match extends Sprite {

    private var first_tile:cards;

    private var second_tile:cards;

    private var pause_timer:Timer;

    var carddeck:Array = new Array(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8);

    public function card_match() {

    for (x=1; x<=4; x++) {

    for (y=1; y<=4; y++) {

    var random_card = Math.floor(Math.random()*carddeck.length);

    var tile:cards = new cards();

    tile.col = carddeck[random_card];



    tile.x = (x-1)*82;

    tile.y = (y-1)*82;






    public function tile_clicked(event:MouseEvent) {

    var clicked:cards = (event.currentTarget as cards);

    if (first_tile == null) {

    first_tile = clicked;



    else if (second_tile == null && first_tile != clicked) {

    second_tile = clicked;


    if (first_tile.col == second_tile.col) {

    pause_timer = new Timer(1000,1);




    else {

    pause_timer = new Timer(1000,1);






    public function reset_tiles(event:TimerEvent) {



    first_tile = null;

    second_tile = null;



    public function remove_tiles(event:TimerEvent) {



    first_tile = null;

    second_tile = null;





Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.