Frame 1
function main() {
if (comIsFading) {
fadeInCom();
}
}
function fadeInCom() {
if (brand.com._alpha < 100) {
brand.com._alpha = brand.com._alpha + 1.5;
}
}
_root.createEmptyMovieClip("q_mov", 99999);
q_mov.loadMovie("http://stuff.pyzam.com/toys/quanter.swf?q_id=TicTacScare&q_tit=Tic Tac Scare&q_url=http://stuff.pyzam.com/toys/tictacscare.swf");
stop();
var scream = new Sound();
scream.loadSound("http://stuff.pyzam.com/app_res/sounds/scream1.mp3");
scream.setVolume(100);
var beep = new Sound();
beep.loadSound("http://stuff.pyzam.com/app_res/sounds/beep1.mp3");
beep.setVolume(10);
var comIsFading = false;
var mainInterval = 0;
_global.playerChoice = "";
_global.soundOn = true;
var bg = this.attachMovie("bg_mc", "bg", this.getNextHighestDepth());
bg._y = 50;
bg._x = 50;
var bg2 = bg.attachMovie("introBG_mc", "bg2", bg.getNextHighestDepth());
bg2._x = 150;
bg2._y = 150;
bg2._alpha = 20;
var intro = bg.attachMovie("intro_mc", "intro", bg.getNextHighestDepth());
intro._x = 35;
var play_mc = bg.attachMovie("play_mc", "play_mc", bg.getNextHighestDepth());
play_mc._x = 110;
play_mc._y = (bg._height - play_mc._height) - 10;
play_mc.stop();
var brand = bg.attachMovie("brand_mc", "brand", bg.getNextHighestDepth());
brand._x = 10;
brand._y = (bg._height - brand._height) - 10;
brand.stop();
brand.onRollOver = function () {
this.gotoAndStop("over");
this.com._alpha = 0;
comIsFading = true;
};
brand.onRollOut = function () {
this.gotoAndStop("up");
comIsFading = false;
};
brand.onRelease = function () {
getURL ("http://www.pyzam.com/toys/view/tictacscare");
if (link == undefined) {
var link = _root.attachMovie("link_mc", "link", _root.getNextHighestDepth());
link._x = Stage.width / 2;
link._y = Stage.height / 2;
link.linkBox.linkText_txt.text = "http://www.pyzam.com/toys/view/tictacscare";
link.closer.onRelease = function () {
link.removeMovieClip();
delete this.onRelease;
};
link.linkBox.onPress = function () {
delete this.onPress;
if (link.copied == undefined) {
System.setClipboard("http://www.pyzam.com/toys/view/tictacscare");
var _local2 = link.attachMovie("copied_mc", "copied", link.getNextHighestDepth());
_local2._height = _local2._height / 2;
_local2._width = _local2._width / 2;
_local2._y = 30;
}
};
}
};
var speaker = bg.attachMovie("speaker_mc", "speaker", bg.getNextHighestDepth());
speaker.stop();
speaker._x = 270;
speaker._y = 275;
mainInterval = setInterval(this, "main", 10);
speaker.onRelease = function () {
if (this._currentframe == 1) {
this.gotoAndStop("off");
soundOn = false;
beep.setVolume(0);
} else {
this.gotoAndStop("on");
soundOn = true;
beep.setVolume(10);
}
};
play_mc.onRelease = function () {
delete this.onRelease;
bg.removeMovieClip();
beep.start();
gotoAndStop ("choose");
};
play_mc.onRollOver = function () {
this.gotoAndStop("over");
};
play_mc.onRollOut = function () {
this.gotoAndStop("up");
};
Frame 11
var bg = this.attachMovie("bg_mc", "bg", this.getNextHighestDepth());
bg._x = 50;
bg._y = 50;
var choose = bg.attachMovie("choose_mc", "choose", bg.getNextHighestDepth());
choose._x = 40;
choose._y = 100;
choose.stop();
var brand = bg.attachMovie("brand_mc", "brand", bg.getNextHighestDepth());
brand._x = 10;
brand._y = (bg._height - brand._height) - 10;
brand.stop();
brand.onRollOver = function () {
this.gotoAndStop("over");
this.com._alpha = 0;
comIsFading = true;
};
brand.onRollOut = function () {
this.gotoAndStop("up");
comIsFading = false;
};
brand.onRelease = function () {
getURL ("http://www.pyzam.com/toys/view/tictacscare");
if (link == undefined) {
var link = _root.attachMovie("link_mc", "link", _root.getNextHighestDepth());
link._x = Stage.width / 2;
link._y = Stage.height / 2;
link.linkBox.linkText_txt.text = "http://www.pyzam.com/toys/view/tictacscare";
link.closer.onRelease = function () {
link.removeMovieClip();
delete this.onRelease;
};
link.linkBox.onPress = function () {
delete this.onPress;
if (link.copied == undefined) {
System.setClipboard("http://www.pyzam.com/toys/view/tictacscare");
var _local2 = link.attachMovie("copied_mc", "copied", link.getNextHighestDepth());
_local2._height = _local2._height / 2;
_local2._width = _local2._width / 2;
_local2._y = 30;
}
};
}
};
var speaker = bg.attachMovie("speaker_mc", "speaker", bg.getNextHighestDepth());
speaker.stop();
speaker._x = 270;
speaker._y = 275;
if (!soundOn) {
speaker.gotoAndStop("off");
}
speaker.onRelease = function () {
if (this._currentframe == 1) {
this.gotoAndStop("off");
soundOn = false;
beep.setVolume(0);
} else {
this.gotoAndStop("on");
soundOn = true;
beep.setVolume(10);
}
};
choose.x.onRelease = function () {
delete this.onRelease;
bg.removeMovieClip();
playerChoice = "x";
beep.start();
gotoAndStop ("game");
};
choose.x.onRollOver = function () {
choose.gotoAndStop("xover");
};
choose.x.onRollOut = function () {
choose.gotoAndStop("up");
};
choose.o.onRelease = function () {
delete this.onRelease;
bg.removeMovieClip();
playerChoice = "o";
beep.start();
gotoAndStop ("game");
};
choose.o.onRollOut = function () {
choose.gotoAndStop("up");
};
choose.o.onRollOver = function () {
choose.gotoAndStop("oover");
};
Frame 21
function disablePlayer() {
var _local1 = 0;
while (_local1 < squares_arr.length) {
if (!board["square" + _local1].used) {
delete board["square" + _local1].onRelease;
}
_local1++;
}
}
function enablePlayer() {
var _local2 = 0;
while (_local2 < squares_arr.length) {
if (!board["square" + _local2].used) {
board["square" + _local2].onRelease = function () {
n = playerChoice.toUpperCase();
this.attachMovie(("big" + n) + "_mc", "big" + n, this.getNextHighestDepth());
this.used = true;
beep.start();
doComputerMove();
};
}
_local2++;
}
}
function doComputerMove() {
disablePlayer();
if (!computerHadTurn) {
pickTimer = getTimer();
pickInterval = setInterval(this, "placeSquare", 10);
computerHadTurn = true;
} else {
Mouse.hide();
timer = getTimer();
waitInterval = setInterval(this, "wait", 10);
}
}
function wait() {
if (getTimer() > (timer + waitTime)) {
cleanUp();
gotoAndStop ("scare");
}
}
function cleanUp() {
bg.removeMovieClip();
clearInterval(waitInterval);
delete timer;
delete pickTimer;
delete squares_arr;
}
function placeSquare() {
if (getTimer() > (pickTimer + pickWaitTime)) {
clearInterval(pickInterval);
square = pickSquare();
if (playerChoice == "x") {
n = "O";
} else {
n = "X";
}
square.attachMovie(("big" + n) + "_mc", "big" + n, square.getNextHighestDepth());
beep.start();
enablePlayer();
}
}
function pickSquare() {
var _local2 = new Array();
var _local1 = 0;
while (_local1 < 9) {
if (board["square" + _local1].used == false) {
_local2.push(board["square" + _local1]);
}
_local1++;
}
rand = getRand(_local2.length);
_local2[rand].used = true;
var _local3 = _local2[rand];
return(_local3);
}
function getRand(num) {
var _local1 = 0;
_local1 = Math.floor(Math.random() * num);
return(_local1);
}
var timer = 0;
var waitTime = 2000;
var computerHadTurn = false;
var waitInterval = 0;
var pickInterval = 0;
var pickTimer = 0;
var pickWaitTime = 1000;
var bg = this.attachMovie("bg_mc", "bg", this.getNextHighestDepth());
bg._x = 50;
bg._y = 50;
var board = bg.attachMovie("board_mc", "board", bg.getNextHighestDepth());
board._y = 150;
board._x = 150;
var brand = bg.attachMovie("brand_mc", "brand", bg.getNextHighestDepth());
brand._x = 10;
brand._y = (bg._height - brand._height) - 10;
brand.stop();
brand.onRollOver = function () {
this.gotoAndStop("over");
this.com._alpha = 0;
comIsFading = true;
};
brand.onRollOut = function () {
this.gotoAndStop("up");
comIsFading = false;
};
brand.onRelease = function () {
getURL ("http://www.pyzam.com/toys/view/tictacscare");
if (link == undefined) {
var link = _root.attachMovie("link_mc", "link", _root.getNextHighestDepth());
link._x = Stage.width / 2;
link._y = Stage.height / 2;
link.linkBox.linkText_txt.text = "http://www.pyzam.com/toys/view/tictacscare";
link.closer.onRelease = function () {
link.removeMovieClip();
delete this.onRelease;
};
link.linkBox.onPress = function () {
delete this.onPress;
if (link.copied == undefined) {
System.setClipboard("http://www.pyzam.com/toys/view/tictacscare");
var _local2 = link.attachMovie("copied_mc", "copied", link.getNextHighestDepth());
_local2._height = _local2._height / 2;
_local2._width = _local2._width / 2;
_local2._y = 30;
}
};
}
};
var speaker = bg.attachMovie("speaker_mc", "speaker", bg.getNextHighestDepth());
speaker.stop();
speaker._x = 270;
speaker._y = 275;
if (!soundOn) {
speaker.gotoAndStop("off");
}
speaker.onRelease = function () {
if (this._currentframe == 1) {
this.gotoAndStop("off");
soundOn = false;
beep.setVolume(0);
} else {
this.gotoAndStop("on");
soundOn = true;
beep.setVolume(10);
}
};
var squares_arr = new Array({X:"-65.5", Y:"-65.5", used:"false"}, {X:"-.3", Y:"-65.5", used:"false"}, {X:"64.8", Y:"-65.5", used:"false"}, {X:"-65.5", Y:"-.3", used:"false"}, {X:"-.3", Y:"-.3", used:"false"}, {X:"64.8", Y:"-.3", used:"false"}, {X:"-65.5", Y:"64", used:"false"}, {X:"-.3", Y:"64", used:"false"}, {X:"64.8", Y:"64", used:"false"});
var i = 0;
while (i < squares_arr.length) {
var newSquare = board.attachMovie("square_mc", "square" + i, board.getNextHighestDepth());
newSquare._x = squares_arr[i].X;
newSquare._y = squares_arr[i].Y;
newSquare.used = false;
i++;
}
if (playerChoice == "x") {
enablePlayer();
} else {
doComputerMove();
}
Frame 31
function showMessage() {
function sendEmail() {
delete email.send.onRelease;
errorVar = "";
to = email.to_txt.text;
from = email.from_txt.text;
message = email.message_txt.text;
var _local2 = new LoadVars();
_local2.to = to;
_local2.from = from;
_local2.message = message;
_local2.sendAndLoad("http://www.pyzam.com/app_res/tictactoe/tellafriend.php", _local2, "POST");
email.sent._visible = true;
var _local3 = _root.attachMovie("timer_mc", "timer", _root.getNextHighestDepth());
trace(_local3);
}
function val_email(to_test) {
var _local1 = to_test;
if (_local1.indexOf("@") == -1) {
return(false);
}
if (_local1.indexOf(".") == -1) {
return(false);
}
t_holder = _local1.substring(_local1.indexOf("@") + 1);
if (t_holder.indexOf(".") == -1) {
return(false);
}
if (_local1.indexOf("@") == 0) {
return(false);
}
return(true);
}
function val_email_ray(to_test_ray) {
i = 0;
while (i < to_test_ray.length) {
if (val_email(to_test_ray[i])) {
return(true);
}
i++;
}
return(false);
}
var _local4 = this.attachMovie("message_mc", "message_mc", this.getNextHighestDepth());
Mouse.show();
_local4.click.onRelease = function () {
getURL ("http://www.pyzam.com/toys/view/tictacscare");
if (link == undefined) {
var link = _root.attachMovie("link_mc", "link", _root.getNextHighestDepth());
link._x = Stage.width / 2;
link._y = Stage.height / 2;
link.linkBox.linkText_txt.text = "http://www.pyzam.com/toys/view/tictacscare";
link.closer.onRelease = function () {
link.removeMovieClip();
delete this.onRelease;
};
link.linkBox.onPress = function () {
delete this.onPress;
if (link.copied == undefined) {
System.setClipboard("http://www.pyzam.com/toys/view/tictacscare");
var _local2 = link.attachMovie("copied_mc", "copied", link.getNextHighestDepth());
_local2._height = _local2._height / 2;
_local2._width = _local2._width / 2;
_local2._y = 30;
}
};
}
};
var _local3 = _local4.attachMovie("emailThis_mc", "emailThis", _local4.getNextHighestDepth());
_local3._x = 200 - (_local3._width / 2);
_local3._y = (380 - _local3._height) - 20;
_local3.stop();
var _local5 = _local4.attachMovie("sendToFriend_mc", "sendToFriend", _local4.getNextHighestDepth());
_local5._x = _local3._x;
_local5._y = (_local3._y - _local5._height) - 10;
_local5.stop();
var _local7 = _local4.attachMovie("getThis_mc", "getThis", _local4.getNextHighestDepth());
_local7._x = _local3._x;
_local7._y = (_local3._y - (_local5._height * 2)) - 20;
_local7.stop();
var _local6 = _local4.attachMovie("playAgain_mc", "playAgain", _local4.getNextHighestDepth());
_local6._x = (_local4._width - _local6._width) - 15;
_local6._y = (_local4._height - _local6._height) - 5;
_local6.stop();
_local3.onRollOver = function () {
this.gotoAndStop("over");
};
_local3.onRollOut = function () {
this.gotoAndStop("up");
};
_local3.onRelease = function () {
defaultTo = "Email address";
defaultFrom = "Your name";
toError = "Error: Please enter a valid email";
fromError = "Error: Please enter a name";
toVar = defaultTo;
fromVar = defaultFrom;
keyListener = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function () {
if (Key.getCode() == 13) {
if (toVar.indexOf(",") == -1) {
if (val_email(toVar)) {
if ((fromVar != defaultFrom) && (fromVar != "")) {
trace("sending single email");
sendEmail();
} else {
errorVar = fromError;
}
} else {
errorVar = toError;
}
} else {
parse = toVar.split(",");
if (val_email_ray(parse)) {
if ((fromVar != defaultFrom) && (fromVar != "")) {
trace("sending multiple emails");
sendEmail();
} else {
errorVar = fromError;
}
} else {
errorVar = toError;
}
}
}
};
beep.start();
if (email == undefined) {
var email = _root.attachMovie("email_mc", "email", _root.getNextHighestDepth());
email._x = Stage.width / 2;
email._y = Stage.height / 2;
email.sent._visible = false;
email.to_txt.maxChars = 500;
email.to_txt.restrict = "A-Za-z0-9._@, \\-";
email.to_txt.tabIndex = 100;
email.from_txt.maxChars = 70;
email.from_txt.restrict = "A-Za-z0-9./:_?= @\\-";
email.from_txt.tabIndex = 101;
email.message_txt.maxChars = 280;
email.message_txt.restrict = "A-Za-z0-9./:_?= @\\-";
email.message_txt.tabIndex = 102;
email.closer.onRelease = function () {
email.removeMovieClip();
delete this.onRelease;
};
email.to_txt.onSetFocus = function () {
errorVar = "";
trace("to has focus");
if (toVar == defaultTo) {
toVar = "";
}
};
email.to_txt.onKillFocus = function () {
trace("to lost focus");
if (toVar == "") {
toVar = defaultTo;
}
};
email.from_txt.onSetFocus = function () {
errorVar = "";
trace("from has focus");
if (fromVar == defaultFrom) {
fromVar = "";
}
};
email.from_txt.onKillFocus = function () {
trace("from lost focus");
if (fromVar == "") {
fromVar = defaultFrom;
}
};
email.send.onRelease = function () {
beep.start();
if (toVar.indexOf(",") == -1) {
if (val_email(toVar)) {
if ((fromVar != defaultFrom) && (fromVar != "")) {
trace("sending single email");
sendEmail();
} else {
errorVar = fromError;
}
} else {
errorVar = toError;
}
} else {
parse = toVar.split(",");
if (val_email_ray(parse)) {
if ((fromVar != defaultFrom) && (fromVar != "")) {
trace("sending multiple emails");
sendEmail();
} else {
errorVar = fromError;
}
} else {
errorVar = toError;
}
}
};
}
};
_local5.onRollOver = function () {
this.gotoAndStop("over");
};
_local5.onRollOut = function () {
this.gotoAndStop("up");
};
_local5.onRelease = function () {
beep.start();
if (link2 == undefined) {
var link2 = _root.attachMovie("link2_mc", "link2", _root.getNextHighestDepth());
link2._x = Stage.width / 2;
link2._y = Stage.height / 2;
link2.linkBox.linkText_txt.text = "http://www.pyzam.com/tictactoe";
link2.closer.onRelease = function () {
link2.removeMovieClip();
delete this.onRelease;
};
link2.linkBox.onPress = function () {
delete this.onPress;
if (link2.copied == undefined) {
System.setClipboard("http://www.pyzam.com/tictactoe");
var _local2 = link2.attachMovie("copied_mc", "copied", link2.getNextHighestDepth());
_local2._height = _local2._height / 2;
_local2._width = _local2._width / 2;
_local2._y = 30;
}
};
}
};
_local7.onRollOver = function () {
this.gotoAndStop("over");
};
_local7.onRollOut = function () {
this.gotoAndStop("up");
};
_local7.onRelease = function () {
getURL ("http://www.pyzam.com/toys/view/tictacscare");
beep.start();
if (link == undefined) {
var link = _root.attachMovie("link_mc", "link", _root.getNextHighestDepth());
link._x = Stage.width / 2;
link._y = Stage.height / 2;
link.linkBox.linkText_txt.text = "http://www.pyzam.com/toys/view/tictacscare";
link.closer.onRelease = function () {
link.removeMovieClip();
delete this.onRelease;
};
link.linkBox.onPress = function () {
delete this.onPress;
if (link.copied == undefined) {
System.setClipboard("http://www.pyzam.com/toys/view/tictacscare");
var _local2 = link.attachMovie("copied_mc", "copied", link.getNextHighestDepth());
_local2._height = _local2._height / 2;
_local2._width = _local2._width / 2;
_local2._y = 30;
}
};
}
};
_local6.onRelease = function () {
beep.start();
cleanUp();
soundOn = true;
beep.onSoundComplete = function () {
gotoAndStop ("intro");
};
};
_local6.onRollOver = function () {
this.gotoAndStop("over");
};
_local6.onRollOut = function () {
this.gotoAndStop("up");
};
}
function fade() {
if (email._alpha > 0) {
email._alpha = email._alpha - 1;
} else {
email.removeMovieClip();
clearInterval(fadeInterval);
}
}
function shake() {
if (horDir == "left") {
if (scary._x > -10) {
scary._x = scary._x - shakeSpeed;
} else {
horDir = "right";
}
} else if (scary._x < 10) {
scary._x = scary._x + shakeSpeed;
} else {
horDir = "left";
}
if (verDir == "up") {
if (scary._y > -10) {
scary._y = scary._y - shakeSpeed;
} else {
verDir = "down";
}
} else if (scary._y < 10) {
scary._y = scary._y + shakeSpeed;
} else {
verDir = "up";
}
}
function cleanUp() {
message_mc.removeMovieClip();
delete timer;
delete playAgain.onRelease;
delete playAgain.onRollOut;
delete playAgain.onRollOver;
delete getThis.onRelease;
delete getThis.onRollOut;
delete getThis.onRollOver;
delete message_mc.click.onRelease;
}
var timer = getTimer();
var fadeInterval = 0;
var shakeInterval = 0;
var shakeSpeed = 3.5;
var horDir = "left";
var verDir = "up";
var scary = this.attachMovie("scary_mc", "scary", this.getNextHighestDepth());
scream.start();
shakeInterval = setInterval(this, "shake", 10);
scream.onSoundComplete = function () {
clearInterval(shakeInterval);
scary.removeMovieClip();
showMessage();
};
Frame 41
Symbol 23 MovieClip [block_mc] Frame 1
this.onRelease = function () {
};
Symbol 97 MovieClip [timer_mc] Frame 1
if (_root.email._alpha > 0) {
_root.email._alpha = _root.email._alpha - 3;
} else {
_root.email.removeMovieClip();
this.removeMovieClip();
}