Frame 3
function startGame1() {
showCash();
gotoAndPlay (4);
}
function showCash() {
cashDisplay = "$" + cash;
}
startGame1();
myData = SharedObject.getLocal("myfile");
score.text = myData.data.score;
fscommand ("fullscreen", true);
fscommand ("showmenu", false);
fscommand ("allowscale", true);
stop();
Frame 4
function Need() {
myData.data.score = score.text;
myData.flush();
}
function startGame() {
bet = 0;
showBet();
}
function tellBet() {
output1 = bet * 5000;
output2 = bet * 300;
output3 = bet * 100;
output4 = bet * 25;
output5 = bet * 20;
output6 = bet * 10;
output7 = bet * 3;
output8 = bet * 2;
output9 = bet;
}
function startDeal() {
createDeck();
firstDraw();
showCards();
}
function createDeck() {
suits = ["c", "d", "s", "h"];
temp = new Array();
suit = 0;
while (suit < 4) {
num = 1;
while (num < 14) {
temp.push(suits[suit] + num);
num++;
}
suit++;
}
deck = new Array();
while (temp.length > 0) {
r = int(Math.random() * temp.length);
deck.push(temp[r]);
temp.splice(r, 1);
}
}
function firstDraw() {
cards = new Array();
i = 0;
while (i < 5) {
cards.push(deck.pop());
i++;
}
hold = [true, true, true, true, true];
showCards();
handValue1();
}
function showCards() {
var _local1 = _root;
i = 0;
while (i < 5) {
_local1["card" + i].gotoAndStop(cards[i]);
i++;
}
}
function holdDraw(cardNum) {
var _local1 = cardNum;
if (hold[_local1]) {
_root["card" + _local1].gotoAndStop("back");
hold[_local1] = false;
mysound = new Sound();
mySound.attachSound("select");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
} else {
_root["card" + _local1].gotoAndStop(cards[_local1]);
hold[_local1] = true;
mysound = new Sound();
mySound.attachSound("select");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
}
}
function showFlsh() {
tellTarget ("pair") {
gotoAndStop (1);
};
tellTarget ("2p") {
gotoAndStop (1);
};
tellTarget ("3k") {
gotoAndStop (1);
};
tellTarget ("st8") {
gotoAndStop (1);
};
tellTarget ("flush") {
gotoAndStop (1);
};
tellTarget ("boat") {
gotoAndStop (1);
};
tellTarget ("4k") {
gotoAndStop (1);
};
tellTarget ("st8f") {
gotoAndStop (1);
};
tellTarget ("sf") {
gotoAndStop (1);
};
}
function secondDraw() {
showFlsh();
i = 0;
while (i < 5) {
if (!hold[i]) {
cards[i] = deck.pop();
}
i++;
}
showCards();
handVal = handValue(cards);
winAmt = bet * winnings(handVal);
resultsDisplay = ((handVal + " : ") + "$") + winAmt;
cash = cash + winAmt;
showCash();
gotoAndPlay ("done");
}
function compareHands(a, b) {
numa = Number(a.substr(1, 2));
numb = Number(b.substr(1, 2));
if (numa < numb) {
return(-1);
}
if (numa == numb) {
return(0);
}
if (numa > numb) {
return(1);
}
}
function handValue() {
hand = cards.slice();
hand.sort(compareHands);
suits = new Array();
nums = new Array();
i = 0;
while (i < 5) {
suits.push(hand[i].substr(0, 1));
nums.push(Number(hand[i].substr(1, 2)));
i++;
}
straight = true;
i = 0;
while (i < 4) {
if ((nums[i] + 1) != nums[i + 1]) {
straight = false;
}
i++;
}
if (((((nums[0] == 1) and (nums[1] == 10)) and (nums[2] == 11)) and (nums[3] == 12)) and (nums[4] == 13)) {
straight = true;
}
flush = true;
i = 1;
while (i < 5) {
if (suits[i] != suits[0]) {
flush = false;
}
i++;
}
counts = new Array();
i = 0;
while (i < 14) {
counts.push(0);
i++;
}
i = 0;
while (i < 5) {
counts[nums[i]]++;
i++;
}
pair = false;
twoPair = false;
threeOfAKind = false;
fourOfAKind = false;
i = 1;
while (i < 14) {
if (counts[i] == 2) {
if (pair) {
twoPair = true;
} else {
pair = true;
}
} else if (counts[i] == 3) {
threeOfAKind = true;
} else if (counts[i] == 4) {
fourOfAKind = true;
}
i++;
}
jackOrHigher = false;
i = 1;
while (i < 14) {
if (((i == 1) or (i > 10)) and (counts[i] >= 2)) {
jackOrHigher = true;
}
i++;
}
hasAce = false;
if (counts[1] > 0) {
hasAce = true;
}
if ((straight and flush) and hasAce) {
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
return("Royal Flush");
}
if (straight and flush) {
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
return("Straight Flush");
}
if (fourOfAKind) {
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
return("Four Of A Kind");
}
if (pair and threeOfAKind) {
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
return("Full House");
}
if (flush) {
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
return("Flush");
}
if (straight) {
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
return("Straight");
}
if (threeOfAKind) {
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
return("Three Of A Kind");
}
if (twoPair) {
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
return("Two Pair");
}
if (pair) {
tellTarget ("pair") {
gotoAndPlay (2);
mysound = new Sound();
mySound.attachSound("won");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
};
return("Pair");
}
return("Try Again");
}
function handValue1() {
hand = cards.slice();
hand.sort(compareHands);
suits = new Array();
nums = new Array();
i = 0;
while (i < 5) {
suits.push(hand[i].substr(0, 1));
nums.push(Number(hand[i].substr(1, 2)));
i++;
}
straight = true;
i = 0;
while (i < 4) {
if ((nums[i] + 1) != nums[i + 1]) {
straight = false;
}
i++;
}
if (((((nums[0] == 1) and (nums[1] == 10)) and (nums[2] == 11)) and (nums[3] == 12)) and (nums[4] == 13)) {
straight = true;
}
flush = true;
i = 1;
while (i < 5) {
if (suits[i] != suits[0]) {
flush = false;
}
i++;
}
counts = new Array();
i = 0;
while (i < 14) {
counts.push(0);
i++;
}
i = 0;
while (i < 5) {
counts[nums[i]]++;
i++;
}
pair = false;
twoPair = false;
threeOfAKind = false;
fourOfAKind = false;
i = 1;
while (i < 14) {
if (counts[i] == 2) {
if (pair) {
twoPair = true;
} else {
pair = true;
}
} else if (counts[i] == 3) {
threeOfAKind = true;
} else if (counts[i] == 4) {
fourOfAKind = true;
}
i++;
}
jackOrHigher = false;
i = 1;
while (i < 14) {
if (((i == 1) or (i > 10)) and (counts[i] >= 2)) {
jackOrHigher = true;
}
i++;
}
hasAce = false;
if (counts[1] > 0) {
hasAce = true;
}
if ((straight and flush) and hasAce) {
tellTarget ("sf") {
gotoAndPlay (2);
};
return("Royal Flush");
}
if (straight and flush) {
tellTarget ("st8f") {
gotoAndPlay (2);
};
return("Straight Flush");
}
if (fourOfAKind) {
tellTarget ("4k") {
gotoAndPlay (2);
};
return("Four Of A Kind");
}
if (pair and threeOfAKind) {
tellTarget ("boat") {
gotoAndPlay (2);
};
return("Full House");
}
if (flush) {
tellTarget ("flush") {
gotoAndPlay (2);
};
return("Flush");
}
if (straight) {
tellTarget ("st8") {
gotoAndPlay (2);
};
return("Straight");
}
if (threeOfAKind) {
tellTarget ("3k") {
gotoAndPlay (2);
};
return("Three Of A Kind");
}
if (twoPair) {
tellTarget ("2p") {
gotoAndPlay (2);
};
return("Two Pair");
}
if (pair) {
tellTarget ("pair") {
gotoAndPlay (2);
};
return("Pair");
}
return("Try Again");
}
function winnings(handVal) {
var _local1 = handVal;
if (_local1 == "Royal Flush") {
return(5000);
}
if (_local1 == "Straight Flush") {
return(300);
}
if (_local1 == "Four Of A Kind") {
return(100);
}
if (_local1 == "Full House") {
return(25);
}
if (_local1 == "Flush") {
return(20);
}
if (_local1 == "Straight") {
return(10);
}
if (_local1 == "Three Of A Kind") {
return(3);
}
if (_local1 == "Two Pair") {
return(2);
}
if (_local1 == "Pair") {
return(1);
}
if (_local1 == "Try Again") {
return(0);
}
return(undefined);
}
startGame();
stop();
if (cash <= 0) {
cash = 1000;
}
Frame 5
startDeal();
stop();
Frame 6
stop();
Symbol 8 Button
on (release) {
_root.play();
}
Symbol 11 MovieClip Frame 1
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
setProperty(bar, _xscale , PercentLoaded);
} else {
gotoAndStop ("loaded");
}
Symbol 11 MovieClip Frame 2
gotoAndPlay (1);
Symbol 36 MovieClip Frame 1
stop();
Symbol 36 MovieClip Frame 10
gotoAndPlay (2);
Symbol 38 MovieClip Frame 1
stop();
Symbol 42 MovieClip Frame 1
stop();
Symbol 49 MovieClip Frame 1
stop();
Symbol 52 MovieClip Frame 1
stop();
Symbol 55 MovieClip Frame 1
stop();
Symbol 59 MovieClip Frame 1
stop();
Symbol 62 MovieClip Frame 1
stop();
Symbol 65 MovieClip Frame 1
stop();
Symbol 100 MovieClip Frame 1
stop();
Symbol 105 Button
on (press) {
holdDraw(3);
}
Symbol 106 Button
on (press) {
holdDraw(0);
}
Symbol 107 Button
on (press) {
holdDraw(1);
}
Symbol 108 Button
on (press) {
holdDraw(4);
}
Symbol 109 Button
on (press) {
holdDraw(2);
}
Symbol 118 Button
on (release) {
if (Number(cash) > 0) {
bet = Number(bet) + 5;
cash = cash - 5;
tellBet();
mysound = new Sound();
mySound.attachSound("bet1");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
}
}
Symbol 121 Button
on (press) {
if (Number(bet) > 0) {
gotoAndPlay ("play");
}
}
Symbol 122 Button
on (release) {
if (Number(cash) > 0) {
bet = Number(bet) + 10;
cash = cash - 10;
tellBet();
mysound = new Sound();
mySound.attachSound("bet1");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
}
}
Symbol 123 Button
on (release) {
if (Number(cash) > 0) {
bet = Number(bet) + 100;
cash = cash - 100;
tellBet();
mysound = new Sound();
mySound.attachSound("bet1");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
}
}
Symbol 124 Button
on (release) {
if (Number(cash) > 0) {
bet = Number(bet) + 1000;
cash = cash - 1000;
tellBet();
mysound = new Sound();
mySound.attachSound("bet1");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
}
}
Symbol 130 Button
on (press) {
mysound = new Sound();
mySound.attachSound("play1");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
startGame();
cash = 1000;
output1 = "";
output2 = "";
output3 = "";
output4 = "";
output5 = "";
output6 = "";
output7 = "";
output8 = "";
output9 = "";
}
Symbol 140 Button
on (press) {
holdDraw(0);
}
Symbol 141 Button
on (press) {
holdDraw(1);
}
Symbol 142 Button
on (press) {
holdDraw(2);
}
Symbol 143 Button
on (press) {
holdDraw(3);
}
Symbol 144 Button
on (press) {
holdDraw(4);
}
Symbol 147 Button
on (press) {
secondDraw();
}
Symbol 150 Button
on (press) {
Need();
tellTarget ("pair") {
gotoAndStop (1);
};
mysound = new Sound();
mySound.attachSound("play1");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
if (Number(cash) <= 0) {
gotoAndStop (8);
} else {
gotoAndPlay ("deal");
}
output1 = "";
output2 = "";
output3 = "";
output4 = "";
output5 = "";
output6 = "";
output7 = "";
output8 = "";
output9 = "";
}
Symbol 153 Button
on (press) {
mysound = new Sound();
mySound.attachSound("play1");
mySound.start(0, 1);
mySound.setPan(0);
mySound.setVolume(100);
gotoAndPlay (3);
output1 = "";
output2 = "";
output3 = "";
output4 = "";
output5 = "";
output6 = "";
output7 = "";
output8 = "";
output9 = "";
}