0 Replies Latest reply on Aug 26, 2009 10:59 PM by shaylee tan

    Memory Game

    shaylee tan

      Hi all!  i am doing a memory flipping game.Currently i am hardcoding all the image path for the images i had.

       

      <mx:Image id="test" x="480" y="177" width="100" height="100" source="assets/card_2.JPG" scaleContent="false" click="test.source = 'assets/torres.JPEG'"/>
         
      <mx:Image id="tests" x="623" y="438" width="100" height="100" source="assets/card_2.JPG" scaleContent="false" click="tests.source = 'assets/torres.JPEG'"/>

       

       

      What i need to do is to store all the images in an array.After that, i need to compare those image arrays. Because for the memory game,i must able to match all the identical pairs of cards. So my question is how am i going to match those images. When the 1st image is clicked,it flipped open. If i clicked on a 2nd image,it flipped open too. This is the tricky part. If both images are the same,it will stay open. If both images are different,both will flipped back.

       

       

      Can anyone guide me along with my doubts? I faced a serious problem in understanding the codes. Thank for the help in advance.

       

       

       

      Is the the correct way of storing those images in an array?

       

       

      private function Image():void {
                             
      gameArray.push("assets/pat.jpg");
      gameArray.push("assets/hunt.jpg");
      gameArray.push("assets/ger.jpg");
      gameArray.push("assets/ars.jpg");
      gameArray.push("assets/lamps.jpg");
      gameArray.push("assets/kaka.jpg");
      gameArray.push("assets/torres.jpg");
      gameArray.push("assets/vidic.jpg");

       

      gameArray.push(test.source);
      gameArray.push(tests.source);
      gameArray.push(kaka.source);
      gameArray.push(kaka1.source);
      gameArray.push(vidic.source);
      gameArray.push(vidic1.source);
      gameArray.push(gerrard.source);
      gameArray.push(gerrard1.source);
      gameArray.push(ars.source);
      gameArray.push(ars1.source);
      gameArray.push(lampard.source);
      gameArray.push(lampard1.source);
      gameArray.push(hunt.source);
      gameArray.push(hunt1.source);
      gameArray.push(pato.source);
      gameArray.push(pato1.source);

       


      }