title: Drag and Drop Matching Type game with groupings in flash
body: <p>sorry for the misunderstandings in my program, i'm quite new here and i am also new in using flash. here is the sample output that i used in my code</p>
  
  <p>![sample output(http://i1114.photobucket.com/albums/k532/deadmaster2903/sample.jpg)</p>
  
  <hr>
  
  <p>and here is the code i used:</p>
  
  <pre><code> var objectoriginalX:Number;
   var objectoriginalY:Number;
   var score:Number = 0;
   var count:Number = 30;
   var myTimer:Timer = new Timer(1000,count);
   myTimer.addEventListener(TimerEvent.TIMER, countdown);
   myTimer.start();
   if (myText_txt.text == "0")
   {
  myText_txt.text ="Times Up!";
   }
   function countdown(event:TimerEvent):void
   {
  myText_txt.text = String((count)-myTimer.currentCount);
   }
   //fall
   fallapple_mc.buttonMode = true;
   fallapple_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallapple_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallchicory_mc.buttonMode = true;
   fallchicory_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallchicory_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallchilipeppers_mc.buttonMode = true;
   fallchilipeppers_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallchilipeppers_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallchinesecabbage_mc.buttonMode = true;
   fallchinesecabbage_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallchinesecabbage_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallcranberries_mc.buttonMode = true;
   fallcranberries_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallcranberries_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallcucumber_mc.buttonMode = true;
   fallcucumber_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallcucumber_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   falldates_mc.buttonMode = true;
   falldates_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   falldates_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallgrapes_mc.buttonMode = true;
   fallgrapes_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallgrapes_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallleaflettuce_mc.buttonMode = true;
   fallleaflettuce_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallleaflettuce_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallnuts_mc.buttonMode = true;
   fallnuts_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallnuts_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallpersimmon_mc.buttonMode = true;
   fallpersimmon_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallpersimmon_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   fallpomegranates_mc.buttonMode = true;
   fallpomegranates_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   fallpomegranates_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   //spring
   springasparagus_mc.buttonMode = true;
   springasparagus_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springasparagus_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springbasil_mc.buttonMode = true;
   springbasil_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springbasil_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springbeans_mc.buttonMode = true;
   springbeans_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springbeans_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springbeets_mc.buttonMode = true;
   springbeets_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springbeets_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springberries_mc.buttonMode = true;
   springberries_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springberries_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springiceberg_mc.buttonMode = true;
   springiceberg_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springiceberg_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springmango_mc.buttonMode = true;
   springmango_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springmango_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springpapaya_mc.buttonMode = true;
   springpapaya_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springpapaya_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springpeas_mc.buttonMode = true;
   springpeas_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springpeas_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springradish_mc.buttonMode = true;
   springradish_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springradish_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springrhubarb_mc.buttonMode = true;
   springrhubarb_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springrhubarb_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   springshallots_mc.buttonMode = true;
   springshallots_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   springshallots_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   //summer
   summerapricot_mc.buttonMode = true;
   summerapricot_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summerapricot_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summerbellpepper_mc.buttonMode = true;
   summerbellpepper_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summerbellpepper_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summerbrocolli_mc.buttonMode = true;
   summerbrocolli_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summerbrocolli_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summercherries_mc.buttonMode = true;
   summercherries_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summercherries_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summercorn_mc.buttonMode = true;
   summercorn_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summercorn_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summerfigs_mc.buttonMode = true;  
   summerfigs_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summerfigs_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summerokra_mc.buttonMode = true;
   summerokra_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summerokra_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summerpeaches_mc.buttonMode = true;
   summerpeaches_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summerpeaches_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summerplum_mc.buttonMode = true;
   summerplum_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summerplum_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summersquash_mc.buttonMode = true;
   summersquash_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summersquash_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summertomato_mc.buttonMode = true;
   summertomato_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summertomato_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   summerwatermelon_mc.buttonMode = true;
   summerwatermelon_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   summerwatermelon_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   //winter
   winteravocado_mc.buttonMode = true;
   winteravocado_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   winteravocado_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   winterbrusselsprouts_mc.buttonMode = true;
   winterbrusselsprouts_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   winterbrusselsprouts_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   wintercabbage_mc.buttonMode = true;
   wintercabbage_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   wintercabbage_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   wintercauliflower_mc.buttonMode = true;
   wintercauliflower_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   wintercauliflower_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   winterceleryroots_mc.buttonMode = true;
   winterceleryroots_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   winterceleryroots_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   winterfennel_mc.buttonMode = true;
   winterfennel_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   winterfennel_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   wintergrapefruit_mc.buttonMode = true;
   wintergrapefruit_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   wintergrapefruit_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   wintermandarin_mc.buttonMode = true;
   wintermandarin_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   wintermandarin_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   wintermushrooms_mc.buttonMode = true;
   wintermushrooms_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   wintermushrooms_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   winterpears_mc.buttonMode = true;
   winterpears_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   winterpears_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   winterspinach_mc.buttonMode = true;
   winterspinach_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   winterspinach_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
   wintersquash_mc.buttonMode = true;
   wintersquash_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
   wintersquash_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
  
   function pickupObject(event:MouseEvent):void
   {
  event.target.startDrag(true);
  event.target.parent.addChild(event.target);
  objectoriginalX = event.target.x;
  objectoriginalY = event.target.y;
  response_txt.text = " ";
   }
   function dropObject(event:MouseEvent):void
   {
  event.target.stopDrag();
  var matchingTargetName:String = "target" + event.target.name;
  var matchingTarget:DisplayObject = getChildByName(matchingTargetName);
  if (event.target.dropTarget != null &amp;&amp; event.target.dropTarget.parent == matchingTarget)
  {
      event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
      event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
      event.target.buttonMode = false;
      event.target.x = matchingTarget.x;
      event.target.y = matchingTarget.y;
      response_txt.text = "You did it!";
      score++;
      scoreField.text = String(score);
  }
  else
  {
      event.target.x = objectoriginalX;
      event.target.y = objectoriginalY;
      response_txt.text = "Try again";
  }
   };
  </code></pre>
  
  <hr>
  
  <p>so from what i have said before, if you could see the gray boxes and are named with their specified type, that is the dog/cat box i was referring to before. and the images above are the kinds i was talking to</p>
  
  <hr>
  
  <p>so the problem were as you could see in the image, the chicory vegetables is placed under the fall (where it belongs to) in the 2nd box, from the code reference i have seen, they do it this way.</p>
  
  <p><strong>OBJECT</strong> which is the item is only equal to 1 <strong>CONTAINER</strong> which is the box</p>
  
  <p>i kept on searching for ways that will let 1 image if dragged and dropped to the specified group types, it will be correct (even if yo place it on the 1st box, the image will automatically be in the 2nd box if the group is true)</p>
  
  <p>also, i noticed my timer isn't working, and the text that states whether the answer is true or false produces wrong or incomplete output. if you see <em>ou i it</em> that was what im referring to which is supposed to be <em>you did it</em></p>
  
  <p>thanks for those who will answer. im still searching for solutions but i cant seem to find the same problem that i am having</p>