Skip to main content
Participant
September 4, 2007
Question

Card Flip Back Delay, Concentration Game

  • September 4, 2007
  • 5 replies
  • 395 views
Hello all. I'm fairly new to Actionscripting and am using CS3. I just wrote a concentration game following a lynda.com tutorial. I want there to be a delay before two non matching flip cards flip back over. You probably know this, but a goToAndPlay("flipBack") is in the code. Here's what I think is the applicable snippet.

else
{
_firstCard.gotoAndPlay("flipBack");
event.currentTarget.gotoAndPlay("flipBack");
...
}

I will be applying the delay to both card flipping instances.
This topic has been closed for replies.

5 replies

kglad
Community Expert
Community Expert
September 6, 2007
the code i gave does not create any cards. the code you posted doesn't appear to create any cards.

the code i gave would test if a clicked card is the first or second card. if it's the 2nd it compares the two and takes appropriate action or has comments to prompt you to add code to take appropriate action.
Participant
September 6, 2007
I follow the logic behind what you did. However, I still can't get it to work. Now, none of the cards are created on the stage of the movie. At this point I think this may be something that I'll have to revisit later once I have more scripting under my belt. If I can find someone to take a look at the files I'll do that. Thanks for the help though.
kglad
Community Expert
Community Expert
September 6, 2007
is checkMatch() called every time a card is turned?
Participant
September 6, 2007
Yes, it is. Every time there is a click.
kglad
Community Expert
Community Expert
September 6, 2007
:

kglad
Community Expert
Community Expert
September 5, 2007
you should use a counter that determines whether the call to checkMatch() is odd-numbered (assign _firstCard) or even-numbered (assign _secondCard and compare _firstCard and _secondCard and take the appropriate action depending upon the values or _types of the two cards).
Participant
September 6, 2007
I really don't understand what you mean kglad. I guess you are giving me a solution to my problem, but I don't know what your directions are leading me towards.

This tutorial is straight from lynda so I know a ton of people have used it, I just need an example to "reverse-engineer" to figure out how to delay the cards turning back over.
kglad
Community Expert
Community Expert
September 5, 2007
use:

Participant
September 5, 2007
Thank kglad. I have inserted the code that you gave but am now getting an error that I can't fix. I believe it may be because the _firstCard variable isn't defined for the function cardTurnF. Any clue?

I've attached the entire function that checks the cards and is supposed to flip them back over. Hopefully I placed the code in the correct places.

The error is:

TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-16()
at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
at flash.utils::Timer/flash.utils:Timer::tick()