Combined Code
frame 1 {
stop();
}
movieClip 31 {
frame 1 {
stop();
}
frame 2 {
stop();
}
frame 3 {
stop();
}
frame 4 {
stop();
}
frame 5 {
stop();
}
frame 6 {
stop();
}
frame 7 {
stop();
}
frame 8 {
stop();
}
frame 9 {
stop();
}
frame 10 {
stop();
}
frame 11 {
stop();
}
frame 12 {
stop();
}
frame 13 {
stop();
}
}
movieClip 32 {
frame 1 {
_parent._visible = false;
stop();
}
frame 2 {
out = false;
_parent._visible = true;
tellTarget ('ThisCard') {
gotoAndStop('BackOfCard');
}
}
frame 9 {
stop();
}
frame 10 {
out = true;
}
frame 13 {
tellTarget ('ThisCard') {
gotoAndStop(_parent._parent._parent.cardArray[_parent._parent.ThisCardNumber - 1] + 1);
}
}
frame 16 {
stop();
}
frame 20 {
tellTarget ('ThisCard') {
gotoAndStop('BackOfCard');
}
}
frame 23 {
out = false;
stop();
}
frame 36 {
stop();
_parent._visible = false;
}
}
button 34 {
on (release) {
if (_parent.PlayingGame) {
if (_parent.CurrentFlipsCount < 999) {
if (!CardMotion.out) {
++_parent.CurrentFlipsCount;
_parent.CurrentFlips = 'Flips: ' add _parent.CurrentFlipsCount;
if (_parent.NoOfCardsOut == 0) {
tellTarget ('CardMotion') {
gotoAndPlay('SpinFront');
}
_parent.NoOfCardsOut = 1;
_parent.FirstCard = _parent.cardArray[ThisCardNumber - 1];
_parent.FirstCardName = this._name;
} else {
if (_parent.NoOfCardsOut == 1) {
tellTarget ('CardMotion') {
gotoAndPlay('SpinFront');
}
_parent.NoOfCardsOut = 2;
_parent.SecondCard = _parent.cardArray[ThisCardNumber - 1];
_parent.SecondCardName = this._name;
if (_parent.CurrentPairsCount == 11) {
gotoAndPlay(30);
} else {
gotoAndPlay(2);
}
} else {
if (_parent.NoOfCardsOut == 2) {
tellTarget (''_parent.' add _parent.SecondCardName') {
gotoAndStop('DoNothing');
}
_parent.NoOfCardsOut = 3;
gotoAndPlay(30);
}
}
}
}
} else {
_parent.GameOverPage = 'ExcessFlips';
_parent.gotoAndStop('GameOver');
}
}
}
}
movieClip 35 {
frame 1 {
ThisCardNumber = int(this._name.substr(4, 2));
stop();
}
frame 30 {
if (_parent.FirstCard == _parent.SecondCard) {
if (_parent.CurrentPairsCount == 11) {
_parent.FinalTime = 'Your time: ' add _parent.Timer.time;
_parent.FinalFlips = 'Flip count: ' add _parent.CurrentFlipsCount;
_parent.FinalTimeNum = int(_parent.Timer.atime[2]) * 60 + int(_parent.Timer.atime[4]) + int(_parent.Timer.atime[6]) / 10;
_parent.FinalFlipsNum = _parent.CurrentFlipsCount;
if (_parent.UsePersonalBest) {
_parent.UpdateCookies = false;
if (_parent.FinalTimeNum < _parent.CookieGameTime | _parent.CookieGameTime == 0) {
_parent.PersonalBestTime = _parent.FinalTimeNum;
_parent.UpdateCookies = true;
} else {
_parent.PersonalBestTime = _parent.CookieGameTime;
}
if (_parent.FinalFlipsNum < _parent.CookieGameFlips | _parent.CookieGameFlips == 0) {
_parent.PersonalBestFlips = _parent.FinalFlipsNum;
_parent.UpdateCookies = true;
} else {
_parent.PersonalBestFlips = _parent.CookieGameFlips;
}
if (_parent.UpdateCookies) {
_parent.PersonalRecords.gotoAndPlay('SetCookies');
}
}
if (_parent.UseScoreboard) {
_parent.GameOverPage = 'GameComplete';
_parent.gotoAndPlay('GameOver');
} else {
_parent.GameOverPage = 'CompleteNoScoreboard';
_parent.gotoAndPlay('GameOver');
}
} else {
tellTarget (''_parent.' add _parent.FirstCardName add '.CardMotion'') {
gotoAndPlay('CardFadeOut');
}
tellTarget (''_parent.' add _parent.SecondCardName add '.CardMotion'') {
gotoAndPlay('CardFadeOut');
}
_parent.matchedArray[_parent.FirstCard] = true;
var TempPairsCount = 0;
x = 1;
while (x < 13) {
if (_parent.matchedArray[x]) {
++TempPairsCount;
}
++x;
}
_parent.CurrentPairsCount = TempPairsCount;
_parent.CurrentPairs = 'Pairs Matched: ' add _parent.CurrentPairsCount;
}
} else {
tellTarget (''_parent.' add _parent.FirstCardName add '.CardMotion'') {
gotoAndPlay('SpinBack');
}
tellTarget (''_parent.' add _parent.SecondCardName add '.CardMotion'') {
gotoAndPlay('SpinBack');
}
}
}
frame 31 {
if (_parent.NoOfCardsOut == 3) {
tellTarget ('CardMotion') {
gotoAndPlay('SpinFront');
}
_parent.NoOfCardsOut = 1;
_parent.FirstCard = _parent.cardArray[ThisCardNumber - 1];
_parent.FirstCardName = this._name;
_parent.SecondCard = 0;
_parent.SecondCardName = '';
} else {
_parent.NoOfCardsOut = 0;
_parent.FirstCard = 0;
_parent.FirstCardName = '';
_parent.SecondCard = 0;
_parent.SecondCardName = '';
}
}
}
movieClip 40 {
}
movieClip 43 {
}
movieClip 46 {
frame 1 {
function StopWatch() {
see = microtime;
if (pickup) {
freeze = microtime;
timeBase = getTimer();
}
if (reset) {
freeze = 0;
time = (atime.join('')).substr(3, 7);
reset = 0;
}
if (timerOn) {
if (check) {
timeBase = getTimer();
check = 0;
}
timeNow = getTimer();
microtime = Number(timeNow) - Number(timeBase) + Number(freeze);
mts = ((microtime / 1000).toString()).split('.');
atime[6] = mts[1].substr(0, 1);
if ((atime[6].toString()).length < 1) {
atime[6] = '0';
}
atime[4] = mts[0];
if (atime[4] == '60') {
atime[4] = '00';
atime[2] = Number(atime[2]) + Number(1);
}
if ((atime[4].toString()).length < 2) {
atime[4] = '0' add atime[4];
}
if ((atime[4].toString()).length < 1) {
atime[4] = '00';
}
if ((atime[2].toString()).length < 2) {
atime[2] = '0' add atime[2].toString();
}
if (59 < atime[2]) {
atime[0] = Number(atime[0]) + Number(1);
atime[2] = '00';
}
if ((atime[0].toString()).length < 2) {
atime[0] = '0' add atime[0];
}
if ((atime[0].toString()).length < 1) {
atime[0] = '00';
}
if (0 < atime[0]) {
_parent.GameOverPage = 'ExcessTime';
_parent.gotoAndStop('GameOver');
}
time = (atime.join('')).substr(3, 7);
if (60000 < microtime) {
microtime -= 60000;
check = 1;
freeze = 0;
}
seconds = Number(atime[0]) * 3600 + Number(atime[2]) * 60 + Number(atime[4]);
}
}
stop();
timerON = 0;
check = 1;
reset = 1;
pickUp = 0;
atime = new Array();
atime[0] = '00';
atime[1] = ':';
atime[2] = '00';
atime[3] = ':';
atime[4] = '00';
atime[5] = '.';
atime[6] = '0';
}
frame 2 {
stop();
timerON = 1;
check = 1;
pickUp = 0;
}
frame 3 {
stop();
timerON = 0;
check = 1;
pickUp = 1;
}
}
movieClip 51 {
}
movieClip 52 {
}
movieClip 53 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
button 54 {
on (rollOver) {
tellTarget ('NewGameText') {
gotoAndPlay(2);
}
}
on (rollOut) {
tellTarget ('NewGameText') {
gotoAndPlay(11);
}
}
on (release) {
tellTarget ('_parent') {
gotoAndStop('StartGame');
}
}
}
movieClip 55 {
}
movieClip 60 {
frame 1 {
stop();
}
frame 2 {
stop();
}
}
movieClip 61 {
frame 1 {
stop();
}
frame 10 {
stop();
}
frame 20 {
stop();
gotoAndStop(1);
}
}
button 62 {
on (rollOver) {
PauseText.gotoAndPlay(2);
}
on (rollOut) {
PauseText.gotoAndPlay(11);
}
on (release) {
if (_parent.PlayingGame) {
_parent.PlayingGame = false;
_parent.Timer.gotoAndStop('TimerPause');
PauseText.ButtonText.gotoAndStop(2);
} else {
if (_parent._currentframe == 3) {
_parent.PlayingGame = true;
_parent.Timer.gotoAndStop('TimerOn');
PauseText.ButtonText.gotoAndStop(1);
}
}
}
}
movieClip 63 {
}
movieClip 67 {
frame 1 {
function getCookie(name) {
var cname = name + '=';
var clen = _root.CookieString.length;
var cbegin = 0;
while (cbegin < clen) {
var vbegin = cbegin + cname.length;
if (_root.CookieString.substring(cbegin, vbegin) == cname) {
var vend = _root.CookieString.indexOf(';', vbegin);
if (vend == -1) {
vend = clen;
}
return unescape(_root.CookieString.substring(vbegin, vend));
}
cbegin = _root.CookieString.indexOf(' ', cbegin) + 1;
if (cbegin == 0) {
break;
}
}
return null;
}
if (_parent.UsePersonalBest) {
CookieReadTimeout = 0;
_root.CookieString = null;
getURL('javascript:document.' add _parent.MovieTitle add '.SetVariable(\'_root.CookieString\',(document.cookie) ? document.cookie : \'\');', '');
} else {
this._visible = false;
}
}
frame 5 {
if (CookieReadTimeout < 300) {
if (_root.CookieString == null) {
++CookieReadTimeout;
gotoAndPlay(2);
} else {
gotoAndPlay(7);
}
} else {
gotoAndPlay(6);
}
}
frame 6 {
_parent.CookieGameTime = 0;
_parent.CookieGameFlips = 0;
_parent.RecordTime = 'Fastest Time: Unknown';
_parent.RecordFlips = 'Lowest Flips: Unknown';
stop();
}
frame 7 {
_parent.CookieGameTime = getCookie(_parent.TimeCookieName);
_parent.CookieGameFlips = getCookie(_parent.FlipsCookieName);
if (_parent.CheckNull(_parent.CookieGameTime)) {
_parent.CookieGameTime = 0;
_parent.RecordTime = 'Fastest Time: Unknown';
} else {
_parent.RecordTime = 'Fastest Time: ' add _parent.ConvertTimeToText(_parent.CookieGameTime);
}
if (_parent.CheckNull(_parent.CookieGameFlips)) {
_parent.CookieGameFlips = 0;
_parent.RecordFlips = 'Lowest Flips: Unknown';
} else {
_parent.RecordFlips = 'Lowest Flips: ' add _parent.CookieGameFlips;
}
stop();
}
frame 8 {
getURL('javascript:expires = new Date(); expires.setTime(expires.getTime() + (24 * 60 * 60 * 1000 * 365)); document.cookie = \'' add _parent.TimeCookieName add '=' add escape(_parent.PersonalBestTime) add '; expires=\' + expires.toGMTString(); document.cookie = \'' add _parent.FlipsCookieName add '=' add escape(_parent.PersonalBestFlips) add '; expires=\' + expires.toGMTString(); void(0);', '');
}
}
movieClip 68 {
frame 1 {
CardCount = 1;
}
frame 2 {
n = 1;
while (n < 25) {
if (n < 10) {
CardTarget = '_parent.Card0' add n add '.CardMotion';
} else {
CardTarget = '_parent.Card' add n add '.CardMotion';
}
tellTarget ('CardTarget') {
gotoAndStop('CardInvisible');
}
++n;
}
}
frame 3 {
if (CardCount < 25) {
if (CardCount < 10) {
CardTarget = '_parent.Card0' add CardCount add '.CardMotion';
} else {
CardTarget = '_parent.Card' add CardCount add '.CardMotion';
}
tellTarget ('CardTarget') {
gotoAndPlay('CardFadeIn');
}
++CardCount;
} else {
gotoAndPlay(6);
}
}
frame 5 {
gotoAndPlay(3);
}
frame 6 {
CardCount = 1;
stop();
tellTarget ('_parent') {
gotoAndStop('GameLoaded');
}
}
}
movieClip 69 {
}
movieClip 72 {
}
movieClip 75 {
frame 1 {
stop();
}
frame 2 {
stop();
}
frame 3 {
stop();
}
frame 4 {
stop();
}
frame 5 {
stop();
}
frame 6 {
stop();
}
frame 7 {
stop();
}
frame 8 {
stop();
}
frame 9 {
stop();
}
frame 10 {
stop();
}
frame 11 {
stop();
}
frame 12 {
stop();
}
frame 13 {
stop();
}
}
movieClip 87 {
}
movieClip 95 {
}
movieClip 96 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
button 97 {
on (rollOver) {
HighScoreText.gotoAndPlay(2);
}
on (rollOut) {
HighScoreText.gotoAndPlay(11);
}
on (release) {
if (_parent._parent.CheckNull(_parent.UserRealName)) {
_parent.gotoAndStop('MissingFields');
} else {
_parent.gotoAndPlay('SubmitScores');
}
}
}
movieClip 98 {
}
movieClip 129 {
frame 1 {
function FillHighScoreVariables(ConvertTimes) {
BestTimeNames0 = BestTimeNames[0];
BestTimeNames1 = BestTimeNames[1];
BestTimeNames2 = BestTimeNames[2];
BestTimeNames3 = BestTimeNames[3];
BestTimeNames4 = BestTimeNames[4];
if (ConvertTimes) {
BestTimes0 = _parent.ConvertTimeToText(BestTimes[0]);
BestTimes1 = _parent.ConvertTimeToText(BestTimes[1]);
BestTimes2 = _parent.ConvertTimeToText(BestTimes[2]);
BestTimes3 = _parent.ConvertTimeToText(BestTimes[3]);
BestTimes4 = _parent.ConvertTimeToText(BestTimes[4]);
} else {
BestTimes0 = BestTimes[0];
BestTimes1 = BestTimes[1];
BestTimes2 = BestTimes[2];
BestTimes3 = BestTimes[3];
BestTimes4 = BestTimes[4];
}
BestFlipNames0 = BestFlipNames[0];
BestFlipNames1 = BestFlipNames[1];
BestFlipNames2 = BestFlipNames[2];
BestFlipNames3 = BestFlipNames[3];
BestFlipNames4 = BestFlipNames[4];
BestFlips0 = BestFlips[0];
BestFlips1 = BestFlips[1];
BestFlips2 = BestFlips[2];
BestFlips3 = BestFlips[3];
BestFlips4 = BestFlips[4];
}
stop();
}
frame 2 {
stop();
}
frame 3 {
stop();
}
frame 4 {
writing = 'false';
loadVariables(_parent.ScoreboardScriptFile, '_parent.UserMessages', 'GET');
TimeoutCount = 0;
play();
}
frame 9 {
++TimeoutCount;
loadVariables(_parent.ScoreboardScriptFile, '_parent.UserMessages');
answer = 'Sending';
}
frame 14 {
if (TimeoutCount < 150) {
if (answer != 'Sending') {
gotoAndPlay(15);
} else {
gotoAndPlay(5);
}
} else {
gotoAndStop(113);
}
}
frame 15 {
BestTimeNames = timenames.split('¬');
BestTimes = recordtimes.split('¬');
BestFlipNames = flipnames.split('¬');
BestFlips = recordflips.split('¬');
HighScore = false;
t = 0;
while (t < 5) {
if (BestTimes[t] >= _parent.FinalTimeNum) {
HighScore = true;
}
++t;
}
t = 0;
while (t < 5) {
if (BestFlips[t] >= _parent.FinalFlipsNum) {
HighScore = true;
}
++t;
}
if (HighScore) {
gotoAndPlay(87);
} else {
gotoAndPlay(16);
}
}
frame 86 {
gotoAndStop(112);
}
frame 87 {
stop();
}
frame 88 {
stop();
}
frame 89 {
writing = 'false';
loadVariables(_parent.ScoreboardScriptFile, '_parent.UserMessages', 'GET');
TimeoutCount = 0;
play();
}
frame 94 {
++TimeoutCount;
loadVariables(_parent.ScoreboardScriptFile, '_parent.UserMessages');
answer = 'Sending';
}
frame 99 {
if (TimeoutCount < 150) {
if (answer != 'Sending') {
gotoAndPlay(100);
} else {
gotoAndPlay(90);
}
} else {
gotoAndStop(113);
}
}
frame 100 {
BestTimeNames = timenames.split('¬');
BestTimes = recordtimes.split('¬');
BestFlipNames = flipnames.split('¬');
BestFlips = recordflips.split('¬');
HighScoreTime = 5;
HighScoreFlips = 5;
t = 0;
while (t < 5) {
if (BestTimes[t] >= _parent.FinalTimeNum) {
if (HighScoreTime == 5) {
HighScoreTime = t;
}
}
++t;
}
if (HighScoreTime < 5) {
BestTimes.splice(HighScoreTime, 0, _parent.FinalTimeNum);
BestTimeNames.splice(HighScoreTime, 0, UserRealName);
}
t = 0;
while (t < 5) {
if (BestFlips[t] >= _parent.FinalFlipsNum) {
if (HighScoreFlips == 5) {
HighScoreFlips = t;
}
}
++t;
}
if (HighScoreFlips < 5) {
BestFlips.splice(HighScoreFlips, 0, _parent.FinalFlipsNum);
BestFlipNames.splice(HighScoreFlips, 0, UserRealName);
}
TestMessages = HighScoreTime;
if (HighScoreTime < 5 | HighScoreFlips < 5) {
gotoAndPlay(101);
} else {
gotoAndPlay(112);
}
}
frame 101 {
FillHighScoreVariables(false);
writing = 'true';
loadVariables(_parent.ScoreboardScriptFile, '_parent.UserMessages', 'GET');
TimeoutCount = 0;
play();
}
frame 106 {
++TimeoutCount;
loadVariables(_parent.ScoreboardScriptFile, '_parent.UserMessages');
answer = 'Sending';
}
frame 111 {
if (TimeoutCount < 150) {
if (answer != 'Sending') {
gotoAndPlay(112);
} else {
gotoAndPlay(102);
}
} else {
gotoAndStop(113);
}
}
frame 112 {
FillHighScoreVariables(true);
stop();
}
frame 113 {
stop();
}
}
movieClip 130 {
frame 1 {
function ShuffleCards() {
cardArray = new Array();
var startArray = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12];
var placeArray = new Array();
a = 0;
while (a < startArray.length) {
placeArray.push(a);
++a;
}
a = 0;
while (a < startArray.length) {
do {
trg = random(placeArray.length);
newplace = placeArray[trg];
} while (startArray[a] == startArray[newplace] && a != startArray.length - 1);
placeArray.splice(trg, 1);
if (startArray[a] != startArray[newplace]) {
cardArray.push(startArray[newplace]);
} else {
cardArray.unshift(startArray[newplace]);
}
++a;
}
}
function ConvertTimeToText(ConvertNumber) {
if (ConvertNumber) {
var tempMinutes = String(int(Math.floor(Number(ConvertNumber / 60))));
var tempSeconds = String(int(Math.floor(Number(ConvertNumber))) - int(Math.floor(Number(ConvertNumber / 60))) * 60);
var tempTenths = (ConvertNumber.toString()).split('.');
if (tempMinutes.length < 2) {
tempMinutes = '0' add tempMinutes;
}
if (tempSeconds.length < 2) {
tempSeconds = '0' add tempSeconds;
}
if (!tempTenths[1]) {
tempTenths[1] = 0;
} else {
tempTenths[1] = tempTenths[1].charAt(0);
}
return tempMinutes add ':' add tempSeconds add '.' add tempTenths[1];
} else {
return '00:00.0';
}
}
function CheckNull(checkstring) {
if (checkstring.length < 1) {
return true;
}
if (checkstring == '') {
return true;
}
if (checkstring == null) {
return true;
}
return false;
}
UseScoreboard = false;
UsePersonalBest = false;
MovieTitle = 'CardGame';
ScoreboardScriptFile = 'highscores.php';
ScoreboardScoresFile = 'highscores.txt';
TimeCookieName = 'RecordGameTime';
FlipsCookieName = 'RecordFlipsTime';
stop();
}
instance Timer of movieClip 46 {
onClipEvent (enterFrame) {
StopWatch();
}
}
frame 2 {
FirstCard = 0;
SecondCard = 0;
FirstCardName = '';
SecondCardName = '';
NoOfCardsOut = 0;
ShuffleCards();
CurrentFlipsCount = 0;
CurrentFlips = 'Flips: 0';
CurrentPairsCount = 0;
CurrentPairs = 'Pairs Matched: 0';
matchedArray = new Array();
n = 1;
while (n < 13) {
matchedArray[n] = false;
++n;
}
PauseButton.PauseText.ButtonText.gotoAndStop(1);
Timer.gotoAndStop('TimerOff');
CardActions.gotoAndPlay('TurnCards');
stop();
}
frame 3 {
PlayingGame = true;
tellTarget ('Timer') {
gotoAndStop('TimerOn');
}
stop();
}
frame 4 {
PlayingGame = false;
CurrentFlipsCount = 0;
CurrentFlips = 'Flips: 0';
CurrentPairsCount = 0;
CurrentPairs = 'Pairs Matched: 0';
n = 1;
while (n < 25) {
if (n < 10) {
CardTarget = 'Card0' add n add '.CardMotion';
} else {
CardTarget = 'Card' add n add '.CardMotion';
}
tellTarget ('CardTarget') {
gotoAndStop('CardInvisible');
}
++n;
}
Timer.gotoAndStop('TimerOff');
PauseButton.PauseText.ButtonText.gotoAndStop(1);
PauseButton.PauseText.gotoAndStop(1);
UserMessages.gotoAndPlay(GameOverPage);
stop();
}
}