Ultrashock Forums > Flash > ActionScript
AS3 - 3rd event.Target?

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
AS3 - 3rd event.Target?
Old 2008-05-09

I'm trying to create a Flip & Match memory game here. Right now, what I achieve is when 2 cards is flip over and if both doesn't match. It will flip back to the cover.

I was thinking of only flipping back the 2 cards when the 3rd card is clicked.

ActionScript Code:
  1. private function checkCards(event:MouseEvent):void {
  2.              //event.currentTarget.removeEventListener(MouseEvent.CLICK, checkCards);
  3.              if (_firstCard == undefined) {
  4.                  _firstCard = event.currentTarget;
  5.              } else if (prevCards == "opened") {
  6.                  trace("third");
  7.                  _firstCard.gotoAndPlay("flipBack");
  8.                  _2ndCard.gotoAndPlay("flipBack");
  9.              } else if (String(_firstCard._type) == String(event.currentTarget._type)) {
  10.                  trace("match");
  11.                  _firstCard = undefined;
  12.              } else {
  13.                  trace("wrong");
  14.                  _2ndcard = event.currentTarget;
  15.                  prevCards = "opened";
  16.              }
Right now I don't know how I can change the 2 cards to a "ready to close cards" rather than sharing the same _firstCard with the 3rd car.

Any idea how I could over come this problem?
postbit arrow Be the first to comment! | 300 views postbit arrow Reply: with Quote   
Registered User
youwh is offline
seperator
Posts: 13
2005-12-29
seperator
Thread Tools
Display Modes Rate This Thread
Rate This Thread: