Frame 1
FSCommand2("GetLanguage", "language");
if (language == "en-US") {
langStr = "en";
lang = 0;
} else {
langStr = "es";
lang = 1;
}
_global.platform = {};
platform.setData = function (init, bill, tip, split) {
if (!init) {
if (selectedField == "totalBillField") {
FSCommand2("SetVars", "ezTip", "totalBill=" + bill);
FSCommand2("SetVars", "ezTip", "currentRow=1");
}
if (selectedField == "tipField") {
FSCommand2("SetVars", "ezTip", "tip=" + tip);
FSCommand2("SetVars", "ezTip", "currentRow=2");
}
if (selectedField == "splitField") {
FSCommand2("SetVars", "ezTip", "split=" + split);
FSCommand2("SetVars", "ezTip", "currentRow=3");
}
_root.currentRow = currentRow;
} else if (init) {
FSCommand2("SetVars", "ezTip", "totalBill=" + bill);
FSCommand2("SetVars", "ezTip", "tip=" + tip);
FSCommand2("SetVars", "ezTip", "split=" + split);
FSCommand2("SetVars", "ezTip", "currentRow=1");
_root.currentRow = 1;
}
};
platform.quitFlash = function () {
fscommand ("Launch", "ezTip,close");
};
platform.rowChkeck = function (num) {
FSCommand2("SetVars", "ezTip", "currentRow=" + num);
_root.currentRow = num;
};
platform.getMode = function () {
FSCommand2("GetVars", "ezTip", "screenMode", "/");
modeNum = String(screenMode);
if (modeNum == "0") {
gotoAndPlay ("mode0");
platform.setData(true, 0, 15, 1);
getBill = "0";
getTip = "15";
getSplit = "1";
} else {
trace("------------------ mode" + modeNum);
_root.gotoAndStop("mode1");
platform.getValue();
}
};
platform.isBeep = function () {
fscommand ("beep", "3");
};
var getBill;
var getTip;
var getSplit;
platform.getValue = function () {
getBill = totalBill;
getTip = tip;
getSplit = split;
_root.currentRow = currentRow;
if ((getBill == undefined) || (getBill == "")) {
getBill = "0";
}
if ((getTip == undefined) || (getTip == "")) {
getTip = "15";
}
if ((getSplit == undefined) || (getSplit == "")) {
getSplit = "1";
}
if ((_root.currentRow == undefined) || (_root.currentRow == "")) {
_root.currentRow = "1";
}
};
var ezTipEvent = {};
ezTipEvent.onEvent = function () {
if (arguments[0] == "getLongKey") {
getLongKey_Model();
}
};
ExtendedEvents.ezTip.addListener(ezTipEvent);
platform.getValue();
Frame 10
if (reStart) {
billInitial1("0", true);
tipPercentInitial("15", false);
splitInitial("1", false);
platform.setData(true, 0, 15, 1);
getBill = "0";
getTip = "15";
getSplit = "1";
_root.currentRow = 1;
nTextFieldArray = 0;
colorChange_view(totalBill_mc, 13369344);
colorChange_view(tipField_mc, 0);
colorChange_view(splitField_mc, 0);
}
reStart = false;
mask_mc.setMask(barMask);
highlight_mc.setMask(red_mask);
splitFirstFlag = false;
Frame 11
function textFieldModel(fieldName, defaultMark) {
fieldName.text = defaultMark;
}
function textTitleOverlappingCheck(select) {
if (textTitleCnt != select) {
textTitleCnt = select;
barMotionModel(select);
}
}
function KeyCheckContoller() {
var _local1 = Key.getCode();
if (_local1 == ExtendedKey.SOFT1) {
keydownChk = false;
if (MainFlag) {
if (_local1 == ExtendedKey.SOFT1) {
beenReset = true;
reStart = true;
gotoAndPlay ("reset");
}
}
} else {
keydownChk = true;
}
if (Key.isDown(38)) {
selectedField = selectTextFieldModel(38);
keydownChk = false;
} else if (Key.isDown(40)) {
selectedField = selectTextFieldModel(40);
keydownChk = false;
}
splitAllowFlag = null;
tipAllowFlag = null;
if (selectedField == "totalBillField") {
billAreaView();
colorChange_view(totalBill_mc, 13369344);
colorChange_view(tipField_mc, 0);
colorChange_view(splitField_mc, 0);
}
if (selectedField == "tipField") {
tipAllowKeyModel();
tipAreaView();
colorChange_view(totalBill_mc, 0);
colorChange_view(tipField_mc, 13369344);
colorChange_view(splitField_mc, 0);
}
if (selectedField == "splitField") {
splitAllowKeyModel();
splitAreaView();
colorChange_view(totalBill_mc, 0);
colorChange_view(tipField_mc, 0);
colorChange_view(splitField_mc, 13369344);
}
textTitleOverlappingCheck(selectedField);
}
function colorChange_view(mc, sColor) {
var _local1 = new Color(mc);
_local1.setRGB(sColor);
}
function selectTextFieldModel(keyNumber) {
var _local3 = 40;
var _local1 = 38;
var _local2 = textFieldArray.length - 1;
if (keyNumber == _local3) {
if (nTextFieldArray < (textFieldArray.length - 1)) {
nTextFieldArray++;
} else {
nTextFieldArray = 0;
}
return(textFieldArray[nTextFieldArray]);
}
if (keyNumber == _local1) {
if (nTextFieldArray > 0) {
nTextFieldArray--;
} else {
nTextFieldArray = _local2;
}
return(textFieldArray[nTextFieldArray]);
}
}
function splitAreaView() {
splitKeyCodeStep = 48;
splitKeyCodeLimit = 57;
mysplitKeyCode = Key.getCode();
if ((mysplitKeyCode >= splitKeyCodeStep) && (mysplitKeyCode <= splitKeyCodeLimit)) {
splitKeyArrayView(mysplitKeyCode - splitKeyCodeStep);
} else if (Key.isDown(46)) {
beenReset = false;
splitKeyArrayView(46);
}
}
function splitAllowKeyModel() {
if (Key.isDown(39)) {
splitAllowFlag = "right";
mask_mc.splitAllow_mc.rightAllow_mc.play();
splitAllowView();
} else if (Key.isDown(37)) {
splitAllowFlag = "left";
mask_mc.splitAllow_mc.leftAllow_mc.play();
splitAllowView();
}
}
function splitAllowView() {
if (splitAllowFlag == "right") {
splitOriginNumber++;
splitOriginString = splitOriginNumber.toString();
if (splitOriginString.length == 1) {
splitKeyArray[0] = splitOriginString;
} else if (splitOriginString.length == 2) {
splitKeyArray[0] = splitOriginString.substr(0, 1);
splitKeyArray[1] = splitOriginString.substr(1, 2);
} else if (splitOriginString == "100") {
splitKeyArray = [];
splitKeyArray[0] = 1;
splitOriginNumber = 1;
}
} else if (splitAllowFlag == "left") {
splitOriginNumber--;
splitOriginString = splitOriginNumber.toString();
if (splitOriginString.length == 1) {
splitKeyArray = [];
splitKeyArray[0] = splitOriginString;
} else if (splitOriginString.length == 2) {
splitKeyArray[0] = splitOriginString.substr(0, 1);
splitKeyArray[1] = splitOriginString.substr(1, 2);
}
if (splitOriginString == "0") {
splitKeyArray = [];
splitKeyArray[0] = "9";
splitKeyArray[1] = "9";
splitOriginNumber = 99;
}
}
splitKeyCalcModel(splitKeyArray.join(""));
splitInputFlag = true;
}
function splitKeyArrayView(splitKeyNumber) {
splitInputFlag = true;
splitKeyInsert = splitKeyNumber;
var _local3 = 46;
var _local4 = 1;
if (splitKeyNumber != _local3) {
if (splitKeyArray.length <= _local4) {
if (((splitKeyArray[0] == 1) && (splitKeyNumber != 0)) && (!splitInputFlag)) {
splitKeyArray.pop();
splitKeyArray.push(splitKeyNumber);
_root.ttr = "1";
} else if (((splitKeyArray[0] == 1) && (splitKeyNumber != 0)) && (splitInputFlag)) {
if (!splitFirstFlag) {
splitKeyArray.pop();
}
_root.ttr = "1_1";
splitInput_cnt = true;
splitKeyArray.push(splitKeyNumber);
trace("2");
} else if (((splitKeyArray.length == 1) && ((splitAllowFlag == "right") || (splitAllowFlag == "left"))) && (splitKeyNumber != 0)) {
splitKeyArray.pop();
splitKeyArray.push(splitKeyNumber);
_root.ttr = "2";
} else if (((splitKeyArray[0] == 1) && (splitKeyNumber == 0)) && (splitInputFlag)) {
splitKeyArray.push(splitKeyNumber);
_root.ttr = "3-1" + splitInputFlag;
} else if ((splitKeyArray[0] != 1) && (splitKeyNumber == 0)) {
splitKeyArray.push(splitKeyNumber);
_root.ttr = "4";
} else if (splitInputFlag) {
splitKeyArray.push(splitKeyNumber);
_root.ttr = "5";
} else if (direct) {
splitKeyArray.push(splitKeyNumber);
delete direct;
_root.ttr = "6";
}
} else if (splitKeyNumber != 0) {
splitKeyArray = [];
splitKeyArray.push(splitKeyNumber);
_root.ttr = "7";
}
} else {
splitKeyArray.pop();
if (splitKeyArray.length == 0) {
splitKeyArray[0] = 1;
}
}
delete splitAllowFlag;
splitOriginNumber = Number(splitKeyArray.join(""));
splitKeyCalcModel(splitKeyArray.join(""));
splitFirstFlag = true;
}
function splitKeyCalcModel(splitResultString) {
splitTextFieldController(splitResultString);
}
function splitTextFieldController(textResult) {
splitField_mc.splitField.text = (highlight_mc.f3.splitField.text = (mask_mc.splitField_mc.splitField.text = textResult));
if (tempSplitLine != splitField_mc.splitField.text) {
tempSplitLine = splitField_mc.splitField.text;
}
if ((oldSplit == splitField_mc.splitField.text) && (splitKeyInsert == 46)) {
goBackModule();
}
oldSplit = splitField_mc.splitField.text;
resultController();
}
function tipAreaView() {
var _local2 = 48;
var _local3 = 57;
var _local1 = Key.getCode();
if ((_local1 >= _local2) && (_local1 <= _local3)) {
tipKeyArrayView(_local1 - _local2);
} else if (Key.isDown(46)) {
tipKeyArrayView(46);
}
}
function tipAllowKeyModel() {
if (Key.isDown(39)) {
tipAllowFlag = "right";
mask_mc.tipAllow_mc.rightAllow_mc.play();
tipAllowView();
} else if (Key.isDown(37)) {
tipAllowFlag = "left";
mask_mc.tipAllow_mc.leftAllow_mc.play();
tipAllowView();
}
}
function tipAllowView() {
if (tipAllowFlag == "right") {
tipOriginNumber++;
tipOriginString = tipOriginNumber.toString();
if (tipOriginString.length == 1) {
tipKeyArray[0] = tipOriginString;
} else if (tipOriginString.length == 2) {
tipKeyArray[0] = tipOriginString.substr(0, 1);
tipKeyArray[1] = tipOriginString.substr(1, 2);
} else if (tipOriginString == "100") {
tipKeyArray = [];
tipKeyArray[0] = 0;
tipOriginNumber = 0;
}
} else if (tipAllowFlag == "left") {
tipOriginNumber--;
tipOriginString = tipOriginNumber.toString();
if (tipOriginString.length == 1) {
tipKeyArray = [];
tipKeyArray[0] = tipOriginString;
} else if (tipOriginString.length == 2) {
tipKeyArray[0] = tipOriginString.substr(0, 1);
tipKeyArray[1] = tipOriginString.substr(1, 2);
}
if (tipOriginString < 0) {
tipKeyArray = [];
tipKeyArray[0] = "9";
tipKeyArray[1] = "9";
tipOriginNumber = 99;
}
}
tipKeyCalcModel(tipKeyArray.join(""));
}
function tipKeyArrayView(tipKeyNumber) {
tipKeyInsert = tipKeyNumber;
var _local2 = 46;
var _local3 = 1;
if (tipKeyArray[0] == 0) {
tipKeyArray.pop();
}
if (tipKeyNumber != _local2) {
if (tipKeyArray.length <= _local3) {
tipKeyArray.push(tipKeyNumber);
} else {
tipKeyArray = [];
tipKeyArray.push(tipKeyNumber);
}
} else {
tipKeyArray.pop();
if (tipKeyArray.length == 0) {
tipKeyArray[0] = 0;
}
}
tipOriginNumber = Number(tipKeyArray.join(""));
tipKeyCalcModel(tipKeyArray.join(""));
}
function tipKeyCalcModel(tipResultString) {
var _local1 = " %";
tipTextFieldController(tipResultString + _local1);
}
function tipTextFieldController(textResult) {
tipField_mc.tipField.text = (mask_mc.tipField_mc.tipField.text = textResult);
if (tempTipLine != tipField_mc.tipField.text) {
tempTipLine = tipField_mc.tipField.text;
}
if ((oldTip == tipField_mc.tipField.text) && (tipKeyInsert == 46)) {
goBackModule();
}
oldTip = tipField_mc.tipField.text;
resultController();
}
function billAreaView() {
var _local2 = 48;
var _local3 = 57;
var _local1 = Key.getCode();
if ((_local1 >= _local2) && (_local1 <= _local3)) {
deleteKey = true;
billKeyArrayView(_local1 - _local2);
} else if (Key.isDown(46)) {
if (totalBill_mc.totalBillField.text == "$0.00") {
goBackModule();
}
deleteKey = false;
billKeyArrayView(46);
}
}
function billKeyArrayView(billKeyNumber) {
billKeyInsert = billKeyNumber;
var _local1 = 46;
var _local3 = 5;
if (billKeyArray[0] == 0) {
billKeyArray.pop();
}
if (billKeyNumber != _local1) {
if (billKeyArray.length <= _local3) {
billKeyArray.push(billKeyNumber);
}
} else {
billKeyArray.pop();
if (billKeyArray.length == 0) {
billKeyArray[0] = 0;
}
}
billOriginNumber = billKeyArray.join("") / 100;
billKeyCalcModel(billKeyArray.join(""));
check_billOverlapping();
}
function check_billOverlapping() {
newNum = billOriginNumber;
if (newNum == oldNum) {
if ((billKeyArray.length > 1) && (keydownChk)) {
platform.isBeep();
}
}
oldNum = billOriginNumber;
}
function billKeyCalcModel(billResultString) {
var _local3 = "$";
if (billResultString.length == 1) {
billTextFieldController(((_local3 + billResultString.substr(0, 0)) + "0.0") + billResultString.substring(0));
reStart = false;
}
if (billResultString.length == 2) {
billTextFieldController(((_local3 + billResultString.substr(0, 0)) + "0.") + billResultString.substring(0));
reStart = false;
}
if (billResultString.length >= 3) {
if (reStart) {
_local3 = "$0.00";
billTextFieldController(_local3);
} else {
var _local1 = 3;
while (_local1 <= 6) {
if (billResultString.length == _local1) {
billTextFieldController(((_local3 + billResultString.substr(0, Number(_local1 - 2))) + ".") + billResultString.substring(Number(_local1 - 2)));
}
_local1++;
}
}
}
}
function billTextFieldController(textResult) {
totalBill_mc.totalBillField.text = (mask_mc.totalBill_mc.totalBillField.text = textResult);
if (tempBillLine != totalBill_mc.totalBillField.text) {
tempBillLine = totalBill_mc.totalBillField.text;
}
resultController();
if ((oldBill == totalBill_mc.totalBillField.text) && (billKeyInsert == 46)) {
goBackModule();
}
oldBill = totalBill_mc.totalBillField.text;
}
function coinController(string) {
if ((coinString != string) && (!Key.isDown(46))) {
coinMotionModel1(true);
coinString = string;
}
if (Key.isDown(46)) {
coinMotionModel1(false);
}
}
function pointRoundingController(num) {
var _local1;
var _local2 = 100;
_local1 = Math.round(Number(num) * _local2) / _local2;
if (_local1.toString().indexOf(".") != -1) {
if (_local1.toString().substring(_local1.toString().indexOf(".") + 1).length == 1) {
return(_local1.toString() + "0");
}
return(_local1);
}
return(_local1.toString() + ".00");
}
function unCatch(num) {
if ((num == undefined) || (num == "")) {
return(0);
}
return(num);
}
function resultController() {
if (keydownChk) {
platform.setData(false, Math.round(billOriginNumber * 100), tipOriginNumber, splitOriginNumber);
}
var _local2 = unCatch(billOriginNumber) * (tipOriginNumber / 100);
mask_mc.tipPercentField_mc.tipPercentField.text = (tipPercentField_mc.tipPercentField.text = "$" + pointRoundingController(String(_local2)));
var _local1 = (unCatch(billOriginNumber) + (unCatch(billOriginNumber) * (tipOriginNumber / 100))) / splitOriginNumber;
oweField_mc.oweField.text = ("$" + pointRoundingController(String(_local1))) + " ";
if (checkField != oweField_mc.oweField.text) {
timeCheck();
}
checkField = oweField_mc.oweField.text;
MainFlag = true;
}
function coinMotionModel1(option) {
if (option) {
coinCnt1++;
var _local1 = 10;
var _local2 = coinArea_mc._width;
var _local5 = coinArea_mc._height;
coinArea_mc.attachMovie("coin" + String(random(2) + 1), "coin" + coinCnt1, coinCnt1, {_x:random(100), _y:random(70)});
coinArray1.push(coinArea_mc["coin" + coinCnt1]);
} else {
removeMovieClip(coinArray1[coinArray1.length - 1]);
coinArray1.pop();
}
}
function barMotionModel(option) {
switch (option) {
case "totalBillField" :
stringEffect(str1);
platform.rowChkeck(1);
this.onEnterFrame = function () {
red_mask._y = (bar_mc._y = (barMask._y = barMask._y + (Math.round(yPos1 - bar_mc._y) / Ratio)));
if (Math.floor(bar_mc._y) == yPos1) {
delete this.onEnterFrame;
}
};
break;
case "tipField" :
stringEffect(str2);
platform.rowChkeck(2);
this.onEnterFrame = function () {
red_mask._y = (bar_mc._y = (barMask._y = barMask._y + (Math.round(yPos2 - bar_mc._y) / Ratio)));
if (Math.round(bar_mc._y) == yPos2) {
delete this.onEnterFrame;
}
};
break;
case "splitField" :
stringEffect(str3);
platform.rowChkeck(3);
this.onEnterFrame = function () {
red_mask._y = (bar_mc._y = (barMask._y = barMask._y + (Math.round(yPos3 - bar_mc._y) / Ratio)));
if (Math.round(bar_mc._y) == yPos3) {
delete this.onEnterFrame;
trace("delete this.onEnterFrame;");
}
};
}
}
function stringEffect(str) {
propTxt1.text = str;
}
function billInitial1(num, option) {
billKeyArray = [];
if ((num == "0") || (num == 0)) {
billKeyArray = ["0"];
billOriginNumber = 0;
billKeyCalcModel("0");
} else {
var _local1 = 0;
while (_local1 <= (num.length - 1)) {
billKeyArray.push(num.substr(_local1, 1));
_local1++;
}
billOriginNumber = Number(billKeyArray.join("")) / 100;
billKeyCalcModel(billKeyArray.join(""));
}
resultController();
colorChange_view(totalBill_mc, 13369344);
if (option) {
selectedField = "totalBillField";
barMotionModel(selectedField);
}
}
function tipPercentInitial(num, option) {
tipKeyArray = [];
var _local1 = 0;
while (_local1 <= (num.length - 1)) {
tipKeyArray.push(num.substr(_local1, 1));
_local1++;
}
tipKeyCalcModel(tipKeyArray.join(""));
tipOriginNumber = Number(num);
tipOriginString = String(num);
resultController();
if (option) {
selectedField = "tipField";
barMotionModel(selectedField);
}
}
function splitInitial(num, option) {
splitKeyArray = [];
var _local1 = 0;
while (_local1 <= (num.length - 1)) {
splitKeyArray.push(num.substr(_local1, 1));
_local1++;
}
splitKeyCalcModel(splitKeyArray.join(""));
splitOriginNumber = Number(num);
splitOriginString = String(num);
resultController();
if (option) {
selectedField = "splitField";
barMotionModel(selectedField);
}
}
function coinInitial(str) {
var _local1 = 1;
while (_local1 < str.length) {
coinMotionModel1(true);
_local1++;
}
}
function timeCheck() {
var n = 0;
this.createEmptyMovieClip("temp", this.getNextHighestDepthO());
this.temp.onEnterFrame = function () {
n++;
if (n > 10) {
delete temp.onEnterFrame;
handMc.gotoAndPlay(2);
}
};
}
function goBackModule() {
platform.quitFlash();
}
function getLongKey_Model() {
if (selectedField == "totalBillField") {
billInitial1("0", true);
}
if (selectedField == "tipField") {
tipPercentInitial("1", true);
}
if (selectedField == "splitField") {
splitInitial("1", true);
}
}
System.useCodepage = true;
stop();
var textFieldArray = ["totalBillField", "tipField", "splitField"];
var nTextFieldArray = 0;
var selectedField;
Key.removeListener(keyCtrlListener);
Key.removeListener(myListener);
myListener = new Object();
myListener.onKeyDown = function () {
};
Key.addListener(myListener);
var textTitleCnt = "";
var splitOriginNumber = 1;
var splitOriginString = "1";
var splitKeyArray = [splitOriginNumber];
var splitAllowFlag;
var splitKeyInsert;
var splitInput_cnt = false;
var tempSplitLine = "1";
var oldSplit;
var tipOriginNumber = 15;
var tipOriginString = "15";
var tipKeyArray = [1, 5];
var tipAllowFlag;
var tipKeyInsert;
var tempTipLine = "15 %";
var oldTip;
var billOriginNumber;
var billKeyArray = [];
var deleteKey = true;
var billKeyInsert;
var newNum;
var oldNum;
var coinString;
var tempBillLine;
var oldBill;
var checkField = "$.00";
var keyCtrlListener = {};
keyCtrlListener.onKeyDown = KeyCheckContoller;
Key.addListener(keyCtrlListener);
var coinCnt1 = 0;
var coinArray1 = [];
var yPos1 = 0;
var yPos2 = 28;
var yPos3 = 58;
var Ratio = 2;
var str1 = "\"Enter original total.\"";
var str2 = "Enter tip %";
var str3 = "Enter # to split";
var my_fmt = new TextFormat();
var initNumber = 0;
var strLength;
var protString;
var intervalTimer = 10;
var changeSentence;
mask_mc.setMask(barMask);
if (_root.currentRow == 1) {
billInitial1(getBill, true);
tipPercentInitial(getTip, false);
splitInitial(getSplit, false);
}
if (_root.currentRow == 2) {
billInitial1(getBill, false);
tipPercentInitial(getTip, true);
splitInitial(getSplit, false);
}
if (_root.currentRow == 3) {
billInitial1(getBill, false);
tipPercentInitial(getTip, false);
splitInitial(getSplit, true);
}
Symbol 35 MovieClip Frame 1
stop();
gotoAndStop(_root.lang + 1);
Symbol 44 MovieClip Frame 1
stop();
gotoAndStop(_root.lang + 1);
Symbol 47 MovieClip Frame 1
stop();
Symbol 50 MovieClip Frame 1
stop();
Symbol 53 MovieClip Frame 1
stop();
Symbol 65 MovieClip Frame 1
stop();
Symbol 65 MovieClip Frame 8
stop();