Help! Trying to make a card game in AS2

Hey guys, I have a problem that needs immediate help.

I have a card game in which the user selects 6 cards from a deck, and they go face down on the table. Then the user can click the cards in turn to flip them over, revealing one of 72 different card faces that I am loading through an XML file.

My problem is twofold. First off, each card needs to be unique. That means that the user should never encounter the same card twice in one draw. Currently it is possible to get the same card six times in a row. I know I need to use some sort of exclusion variable but I have no idea what the syntax should be, or where it should go in my script.

My second problem is probably easier, but I am rusty with Flash and I’m not sure how to solve it without breaking my code. Basically, a user can continually click one card, “flipping” the same card over and over to get a different card face. I only want them to be able to click a card once, and once its done, they have to move to the next one.

I have linked my code and XML code below. A lot of it is from help I have gotten from these boards and other sources in the past. I’m trying to finish this ASAP - Please help!

stop(); 

    var thisCard:MovieClip 
     
    var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",10000); 
    tooltip._alpha = 0; 
     
    var imageFileName:Array = []; 

    var cardXML:XML = new XML(); 
    cardXML.ignoreWhite = true; 
    cardXML.onLoad = loadImages; 
    cardXML.load("cardXML.xml"); 

    function loadImages(loaded) { 
       if (loaded) { 
           
          var nodes = this.firstChild.childNodes; 
          totalImages = nodes.length; 
           
          for (i=0; i<totalImages; i++) { 
             imageFileName* =nodes*.attributes.img; 
          } 
          trace(imageFileName); 
          //<--See if the array is populated 
          //Load finish. 
          //Now you can assign the release handler to the card MovieClip. 

          for (a=1;a<=6;a++){  // Assign the release handler to all (6) clips
		var Clip=_root["card"+a]  // Assume cards are in the _root (main) stage 
				          // (otherwise you must give the right target path, eg: _root.Container["card"+a] -if inside a "Container" clip-)
		Clip.invis.onRelease = releaseHandler; 		
          }		  
       } 
    } 
    function flipCard() { 
       var RandomImage=getRandomImage() // With the old code you would get 2 different random values..
       trace("Load "+RandomImage+" to "+_root.thisCard.inner); 
       thisCard.inner.loadMovie(RandomImage); 
    } 
    //This function returns a random image filepath 
    function getRandomImage():String { 
       var ran = Math.round(Math.random()*(totalImages-1)); 
       return imageFileName[ran]; 
    } 
    
   function releaseHandler():Void { 
      thisCard = this._parent; 
      flipCard(); 
   } 

   // Reset all cards (removes any loaded images from cards)   
   //(REQUIRES a button on stage named: "resetButton")
   resetButton.onRelease=function(){ //Just in case you need it..
      for (a=1;a<=6;a++){          
         var Clip=_root["card"+a]  // Assume cards are in the _root (main) stage
         unloadMovie(Clip.inner)
      } 
   }

My XML code: (Note - not all images are plugged in yet, I want to get the flash working first)

<?xml version="1.0" encoding="iso-8859-1"?>

<cardXML>
<image title="Air" img="images/air/air.jpg" type="air" tag = "1"
descripText = "" 
/>
<image title="Archangel Raphael" img="images/air/archangel_raphael.jpg" type="air" tag = "2"
descripText = "" 
/>
<image title="Birth" img="images/air/birth.jpg" type="air" tag = "3"
descripText = ""
/>
<image title="Copper" img="images/air/copper.jpg" type="air" tag = "4"
descripText = ""
/>
<image title="Crow" img="images/air/crow-card.jpg" type="air" tag = "5"
descripText = ""
/>
<image title="Dagger" img="images/air/dagger.jpg" type="air" tag = "6"
descripText = ""
/>
<image title="Dawn" img="images/air/dawn.jpg" type="air" tag = "7"
descripText = ""
/>
<image title="Flexibility" img="images/air/flexibility.jpg" type="air" tag = "8"
descripText = ""
/>
<image title="Hazel Tree" img="images/air/hazel-tree.jpg" type="air" tag = "9"
descripText = ""
/>
<image title="Intellect" img="images/air/intellect.jpg" type="air" tag = "10"
descripText = ""
/>
<image title="Mental Body" img="images/air/mental-body.jpg" type="air" tag = "11"
descripText = ""
/>
<image title="Mind" img="images/air/mind.jpg" type="air" tag = "12"
descripText = ""
/>
<image title="New Moon" img="images/air/new-moon.jpg" type="air" tag = "13"
descripText = ""
/>
<image title="Ostara" img="images/air/ostara.jpg" type="air" tag = "14"
descripText = ""
/>
<image title="Ram's Horns" img="images/air/ram's-horns.jpg" type="air" tag = "15"
descripText = ""
/>
<image title="Septagram" img="images/air/septagram.jpg" type="air" tag = "16"
descripText = ""
/>
<image title="Smell" img="images/air/smell.jpg" type="air" tag = "17"
descripText = ""
/>
<image title="Spring" img="images/air/spring.jpg" type="air" tag = "18"
descripText = ""
/>
<image title="Thinking" img="images/air/thinking.jpg" type="air" tag = "19"
descripText = ""
/>
<image title="Topaz" img="images/air/topaz.jpg" type="air" tag = "20"
descripText = ""
/>
<image title="Yellow" img="images/air/yellow.jpg" type="air" tag = "21"
descripText = ""
/>

<image title="Archangel Uriel" img="images/earth/archangel-uriel.jpg" type="earth" tag = "22"
descripText = ""
/>
<image title="Balance" img="images/earth/balance.jpg" type="earth" tag = "23"
descripText = ""
/>
<image title="Bison" img="images/earth/bison.jpg" type="earth" tag = "24"
descripText = ""
/>
<image title="Black" img="images/earth/black.jpg" type="earth" tag = "25"
descripText = ""
/>
<image title="Body" img="images/earth/body.jpg" type="earth" tag = "26"
descripText = ""
/>
<image title="Earth" img="images/earth/earth.jpg" type="earth" tag = "27"
descripText = ""
/>
<image title="Elm" img="images/earth/elm.jpg" type="earth" tag = "28"
descripText = ""
/>
<image title="Grounding" img="images/earth/grounding.jpg" type="earth" tag = "29"
descripText = ""
/>
<image title="Helm Of Awe" img="images/earth/helm-of-awe.jpg" type="earth" tag = "30"
descripText = ""
/>
<image title="Lead" img="images/earth/lead.jpg" type="earth" tag = "31"
descripText = ""
/>
<image title="Midnight" img="images/earth/midnight.jpg" type="earth" tag = "32"
descripText = ""
/>
<image title="Old Age" img="images/earth/old-age.jpg" type="earth" tag = "33"
descripText = ""
/>
<image title="Pentacle" img="images/earth/pentacle.jpg" type="earth" tag = "34"
descripText = ""
/>
<image title="Physical Body" img="images/earth/physical-body.jpg" type="earth" tag = "35"
descripText = ""
/>
<image title="Quartz" img="images/earth/quartz.jpg" type="earth" tag = "36"
descripText = ""
/>
<image title="Sensation" img="images/earth/sensation.jpg" type="earth" tag = "37"
descripText = ""
/>
<image title="Touch" img="images/earth/touch.jpg" type="earth" tag = "38"
descripText = ""
/>
<image title="Unicursal Hexagram" img="images/earth/unicursal-hexagram.jpg" type="earth" tag = "39"
descripText = ""
/>
<image title="Waning Moon" img="images/earth/waning-moon.jpg" type="earth" tag = "40"
descripText = ""
/>
<image title="Winter" img="images/earth/winter.jpg" type="earth" tag = "41"
descripText = "" 
/>
<image title="Yule" img="images/earth/yule.jpg" type="earth" tag = "42"
descripText = ""
/>

</cardXML>