Frame 1
this.__proto__ = new com.pixelpim.games.standard_eng.Main();
init();
Symbol 9 MovieClip [_menu] Frame 1
#initclip 9
Object.registerClass("_menu", Smenu);
#endinitclip
Symbol 12 MovieClip Frame 1
stop();
Symbol 18 MovieClip Frame 1
stop();
Symbol 21 MovieClip [s_square] Frame 1
#initclip 12
Object.registerClass("s_square", com.pixelpim.sudoku.Square);
#endinitclip
Symbol 30 MovieClip Frame 1
stop();
Symbol 30 MovieClip Frame 35
stop();
Symbol 31 MovieClip [s_board] Frame 1
#initclip 11
Object.registerClass("s_board", com.pixelpim.sudoku.Board);
#endinitclip
Symbol 40 MovieClip [_checkbox] Frame 1
#initclip 10
Object.registerClass("_checkbox", Checkbox);
#endinitclip
Symbol 51 MovieClip [__Packages.com.pixelpim.games.standard_eng.Main] Frame 0
class com.pixelpim.games.standard_eng.Main extends MovieClip
{
var UIcolors, texts, choiceButton, su, ss, numberMenu, choiceMenu, board, chkMarkings, chkMenu, attachMovie, printBoard, page;
function Main () {
super();
UIcolors = new com.pixelpim.games.standard_eng.UIC();
texts = new com.pixelpim.sudoku.lang.EN();
}
function init() {
choiceButton.onRelease = function () {
this._parent.choiceMenu.show(80, 290);
};
su = SharedObject.getLocal("pixelpim_sudoku_2_user");
ss = SharedObject.getLocal("pixelpim_sudoku_2");
createMenues();
if ((su.data.level == undefined) || (su.data.sudokuversion != sudokuversion)) {
su.data.level = 0;
su.data.userNumbers = ",,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,";
su.data.highlight = true;
su.data.showNumberMenu = true;
su.data.sudokuversion = sudokuversion;
}
if (ss.data.baseRegion == undefined) {
var _local2 = new com.pixelpim.sudoku.Sudoku(su.data.level);
ss.data.baseRegion = _local2.baseRegion;
ss.data.positions = _local2.positions;
ss.data.markings = _local2.markings;
ss.data.finished = false;
}
Key.removeListener(this);
Key.addListener(this);
addBoard();
}
function onKeyDown() {
numberMenu.hide();
choiceMenu.hide();
if (Key.isDown(37)) {
board.moveCursor("left");
} else if (Key.isDown(39)) {
board.moveCursor("right");
} else if (Key.isDown(38)) {
board.moveCursor("up");
} else if (Key.isDown(40)) {
board.moveCursor("down");
} else if ((Key.getAscii() >= 49) && (Key.getAscii() <= 57)) {
var _local2 = Key.getAscii() - 48;
board.currentCursor.setNumber(_local2);
} else if ((Key.isDown(46) || (Key.isDown(8))) || (Key.isDown(32))) {
board.currentCursor.setNumber("");
}
}
function saveUserNumbers() {
var _local5 = "";
var _local7 = board.allRegions;
var _local6 = 0;
while (_local6 < 9) {
var _local4 = _local7[_local6];
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
if (!_local3.isLocked()) {
_local5 = _local5 + (_local3.getNumber() + ",");
} else {
_local5 = _local5 + ",";
}
_local2++;
}
_local5 = _local5 + "|";
_local6++;
}
su.data.userNumbers = _local5;
}
function onChoiceMenu(labelObj) {
var _local2 = labelObj.data;
if (_local2 == "hint") {
board.hint();
} else if (_local2 == "erase") {
board.autoErase();
} else if (((_local2 == 0) || (_local2 == 1)) || (_local2 == 2)) {
su.data.level = _local2;
su.data.userNumbers = ",,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,";
su.flush();
ss.clear();
init();
} else if (_local2 == 99) {
printOut();
} else if (((_local2 == 100) || (_local2 == 101)) || (_local2 == 102)) {
printPage(_local2 - 100);
}
}
function onNumberMenu(labelObj) {
board.currentCursor.setNumber(labelObj.data);
}
function onCheck(chkBox) {
if (chkBox._name == "chkMarkings") {
su.data.highlight = chkMarkings.checked;
board.onTextChange();
} else {
su.data.showNumberMenu = chkMenu.checked;
}
}
function win() {
ss.data.finished = true;
var _local2 = 0;
while (_local2 < board.allSquares.length) {
board.allSquares[_local2].hint();
_local2++;
}
board.winanimation.gotoAndPlay(2);
}
function noWin() {
ss.data.finished = false;
board.winanimation.gotoAndStop(1);
}
function printOut() {
attachMovie("s_board", "printBoard", 2, {_x:350, _y:96, print:true, _visible:false});
var _local2 = new Object();
_local2.id = setInterval(this, "preparePrint", 20, _local2);
}
function preparePrint(delay) {
clearInterval(delay.id);
printBoard.setSudoku(su, ss);
printBoard.createTextField("txt", 1001, -96, 100, 190, 18);
printBoard.txt.autoSize = "left";
printBoard.txt.text = UIcolors.PRINT_TEXT;
var _local2 = new TextFormat();
_local2.font = "_sans";
_local2.size = 11;
_local2.bold = true;
printBoard.txt.setTextFormat(_local2);
var _local3 = new PrintJob();
if (_local3.start()) {
_local3.addPage(String(printBoard), undefined, {printAsBitmap:false});
_local3.send();
}
}
function printPage(level) {
attachMovie("page", "page", 3, {_x:250, _y:0, print:true, _visible:false});
var _local12 = new Array();
var _local13 = 80;
var _local5 = 140;
var _local7 = 240;
var _local6 = -1;
var _local3 = 0;
while (_local3 < 6) {
var _local2 = new Object();
if ((_local3 % 2) == 0) {
_local2._x = 164;
_local6++;
if (_local3 == 0) {
_local2._y = _local5;
} else {
_local2._y = _local5 + (_local6 * _local7);
}
} else {
_local2._x = 333 + _local13;
if (_local3 == 1) {
_local2._y = _local5;
} else {
_local2._y = _local5 + (_local6 * _local7);
}
}
_local2.print = true;
_local2.name = "board" + (_local3 + 1);
var _local9 = page.attachMovie("s_board", _local2.name, _local3 + 1, _local2);
var _local11 = {data:{}};
var _local4 = new com.pixelpim.sudoku.Sudoku(level);
_local11.data.baseRegion = _local4.baseRegion;
_local11.data.positions = _local4.positions;
_local11.data.markings = _local4.markings;
_local11.level = level;
_local12.push({ss:_local11, target:_local9});
_local3++;
}
page.createTextField("txt", 1001, 68, 20, 190, 18);
page.txt.autoSize = "left";
page.txt.text = UIcolors.PRINT_TEXT;
var _local14 = new TextFormat();
_local14.font = "_sans";
_local14.size = 11;
_local14.bold = true;
page.txt.setTextFormat(_local14);
var _local15 = new Object();
_local15.id = setInterval(this, "preparePage", 20, _local15, _local12, level);
}
function preparePage(delay, boardArr, level) {
clearInterval(delay.id);
var _local4 = {data:{}};
_local4.data.level = level;
_local4.data.userNumbers = ",,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,|,,,,,,,,";
var _local2 = 0;
while (_local2 < 6) {
boardArr[_local2].target.setSudoku(_local4, boardArr[_local2].ss);
_local2++;
}
var _local5 = new PrintJob();
if (_local5.start()) {
_local5.addPage(String(page), undefined, {printAsBitmap:false});
_local5.send();
}
}
function addBoard() {
attachMovie("s_board", "board", 1, {_x:114, _y:166});
var _local2 = new Object();
_local2.id = setInterval(this, "boardAdded", 20, _local2);
}
function boardAdded(obj) {
clearInterval(obj.id);
board.setSudoku(su, ss, UIcolors);
}
function createMenues() {
attachMovie("_menu", "choiceMenu", 100);
var _local3 = {_x:0, _y:0, direction:"up", cbScope:this, cbMethod:"onChoiceMenu"};
choiceMenu.initialize(_local3, UIcolors.menuColorObj);
choiceMenu.addItem({label:texts.NEW_GAME, type:"heading"});
choiceMenu.addItem({label:texts.EASY, data:0});
choiceMenu.addItem({label:texts.MEDIUM, data:1});
choiceMenu.addItem({label:texts.HARD, data:2, hr:true});
choiceMenu.addItem({label:texts.HINT, data:"hint"});
choiceMenu.addItem({label:texts.ERASE_FAULTS, data:"erase", hr:true});
choiceMenu.addItem({label:texts.PRINT, type:"heading"});
choiceMenu.addItem({label:texts.PRINT_THIS, data:99});
choiceMenu.addItem({label:texts.PRINT_0, data:100});
choiceMenu.addItem({label:texts.PRINT_1, data:101});
choiceMenu.addItem({label:texts.PRINT_2, data:102});
attachMovie("_menu", "numberMenu", 200);
var _local2 = {_x:200, _y:200, direction:"up", cbScope:this, cbMethod:"onNumberMenu"};
numberMenu.initialize(_local2, UIcolors.menuColorObj);
numberMenu.addItem({label:texts.ERASE, data:""});
numberMenu.addItem({label:"1", data:1});
numberMenu.addItem({label:"2", data:2});
numberMenu.addItem({label:"3", data:3});
numberMenu.addItem({label:"4", data:4});
numberMenu.addItem({label:"5", data:5});
numberMenu.addItem({label:"6", data:6});
numberMenu.addItem({label:"7", data:7});
numberMenu.addItem({label:"8", data:8});
numberMenu.addItem({label:"9", data:9});
chkMarkings.initialize({cbScope:this, cbMethod:"onCheck", label:texts.MARK, checked:su.data.highlight}, UIcolors.chkBoxColors);
chkMenu.initialize({cbScope:this, cbMethod:"onCheck", label:texts.NUMBERMENU, checked:su.data.showNumberMenu}, UIcolors.chkBoxColors);
}
var sudokuversion = "1.7";
}
Symbol 52 MovieClip [__Packages.com.pixelpim.games.standard_eng.UIC] Frame 0
class com.pixelpim.games.standard_eng.UIC
{
var menuColorObj, chkBoxColors;
function UIC () {
menuColorObj = {dText:0, hText:16777215, dBg:15594232, hBg:DEFAULT};
chkBoxColors = {tColor:DEFAULT, cColor:DEFAULT, bolded:false};
}
var DEFAULT = 4352412;
var TEXT_HIGH = 10485760;
var TEXT_DEFAULT = 0;
var SQUARE_BG_COLOR = 16777215;
var SQUARE_BORDER_COLOR = com.pixelpim.games.standard_eng.UIC.prototype.DEFAULT;
var SQUARE_HIGHLIGHT_COLOR = 16775605;
var LINK_COLOR = 13158;
var PRINT_TEXT = "www.idg.se";
}
Symbol 53 MovieClip [__Packages.com.pixelpim.sudoku.lang.EN] Frame 0
class com.pixelpim.sudoku.lang.EN
{
function EN () {
}
var MARK = "Highlight";
var NUMBERMENU = "Numbermenu";
var ERASE = "Erase";
var NEW_GAME = "New Game";
var EASY = " Easy";
var MEDIUM = " Medium";
var HARD = " Difficult";
var HINT = "Show one number";
var ERASE_ALL = "Erase Everything";
var ERASE_FAULTS = "Erase all faults";
var PRINT = "Print";
var PRINT_THIS = " Current";
var PRINT_0 = " Page with 6 easy";
var PRINT_1 = " Page with 6 medium";
var PRINT_2 = " Page with 6 difficult";
}
Symbol 54 MovieClip [__Packages.com.pixelpim.sudoku.Sudoku] Frame 0
class com.pixelpim.sudoku.Sudoku
{
var randPos, allMarkings, positions, baseRegion, markings;
function Sudoku (level) {
randPos = new Array();
randPos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,1,,,1,1,1|1,1,1,,,1,1,1,";
_local2[1][0] = "1,,1,,,1,1,,1|,1,,,1,1,,1,|1,,1,1,,,,1,1|11,1,,,,1,1,1,1|,,,1,,1,,,1|,,1,1,1,1,,1,|1,,1,1,1,,,1,|,1,,,1,,1,,1|1,,1,,1,1,1,,";
_local2[1][1] = "1,,1,,1,1,1,,|1,,1,1,,,,,1|1,,,1,,1,,,1|,,1,1,1,1,,,|,,,1,,1,,1,1|1,1,,,1,,1,1,|1,,,1,,1,,1,|,1,1,,1,,1,,|1,,,1,1,1,,1,1";
_local2[1][2] = "1,,,,1,1,,,1|1,,1,1,,1,,1,|1,,1,1,1,,,,|1,,1,1,1,1,,,|1,,,,1,,1,,1|1,,1,1,,,,1,1|1,,1,,,,1,1,1|1,,1,1,,,,,1|1,1,1,,,1,1,1,";
_local2[2][0] = "1,,1,,,,1,,1|,1,,,1,1,,1,|1,,1,,,,,1,1|,,1,,,1,1,1,|,1,,1,,1,,,1|,,,,1,1,,1,|1,,1,,1,,,1,|,1,,,1,,1,,|1,,1,,1,,1,,";
_local2[2][1] = ",,,,,1,1,1,|1,,1,1,,,,,1|1,,,1,,1,,,|,,1,1,1,1,,,|,,,1,,1,,1,|1,1,,,,,1,1,|1,,,1,,1,,1,|,1,,,1,,1,,|1,,,1,,1,,1,";
_local2[2][2] = "1,,,,1,1,,,1|1,,1,,,1,,1,|1,,1,,1,,,,|,,1,1,,1,,,|1,,,,1,,,,1|,,1,1,,,,1,|1,,1,,,,,1,1|1,,1,1,,,,,1|1,1,1,,,,,1,";
allMarkings.push(_local2);
var _local5 = [[2, 5, 8, 1, 4, 7, 0, 3, 6], [8, 7, 6, 5, 4, 3, 2, 1, 0], [6, 3, 0, 7, 4, 1, 8, 5, 2]];
var _local9;
_local9 = randPos.length - 1;
var _local6 = 1;
positions = randPos[_local6];
baseRegion = splitNshuffle("8,5,3,9,4,6,2,1,7").join(",");
var _local8 = allMarkings[_local6];
_local9 = _local8[level].length - 1;
var _local11 = Math.round(Math.random() * _local9);
markings = _local8[level][_local11];
var _local4 = splitString(positions);
var _local3 = splitString(markings);
if (lastRotation) {
var _local10 = Math.round(Math.random() * 2);
_local4 = alter(_local4, _local5[_local10]);
_local3 = alter(_local3, _local5[_local10]);
}
lastRotation = !lastRotation;
if (Math.round(Math.random()) == 1) {
var _local7 = [2, 1, 0, 5, 4, 3, 8, 7, 6];
_local4 = alter(_local4, _local7);
_local3 = alter(_local3, _local7);
}
positions = _local4.join("|");
markings = _local3.join("|");
}
function alter(pos, map) {
var _local6 = new Array(9);
var _local2 = 0;
while (_local2 < 9) {
var _local3 = new Array(9);
var _local1 = 0;
while (_local1 < 9) {
_local3[map[_local1]] = pos[_local2][_local1];
_local1++;
}
_local6[map[_local2]] = _local3;
_local2++;
}
return(_local6);
}
function splitNshuffle(str) {
var _local2 = str.split(",");
var _local3 = new Array();
var _local4 = _local2.length;
var _local1 = 0;
while (_local1 < _local4) {
_local3.push(_local2.splice(Math.round(Math.random() * (_local2.length - 1)), 1));
_local1++;
}
return(_local3);
}
function splitString(str) {
var _local3 = new Array();
var _local2 = str.split("|");
var _local1 = 0;
while (_local1 < _local2.length) {
_local3[_local1] = _local2[_local1].split(",");
_local1++;
}
return(_local3);
}
static var lastRotation = false;
}
Symbol 55 MovieClip [__Packages.com.pixelpim.sudoku.Board] Frame 0
class com.pixelpim.sudoku.Board extends MovieClip
{
var UIcolors, currentCursor, print, _parent, _y, _x;
function Board () {
super();
}
function setSudoku(su, ss, uic) {
UIcolors = uic;
makeSquareArrays();
currentCursor = undefined;
var _local8 = ss.data.baseRegion.split(",");
var _local9 = splitString(ss.data.positions);
var _local10 = splitString(su.data.userNumbers);
var _local11 = splitString(ss.data.markings);
var _local4 = 0;
while (_local4 < 9) {
var _local7 = allRegions[_local4];
var _local6 = _local11[_local4];
var _local5 = _local10[_local4];
var _local3 = 0;
while (_local3 < 9) {
var _local2 = _local7[_local3];
_local2.inp.text = _local5[_local3];
_local2.value = _local8[_local9[_local4][_local3]];
_local2.setColor(UIcolors);
_local2.mark = _local6[_local3];
if (_local2.mark == 1) {
_local2.lock();
}
if (((currentCursor == undefined) && (!_local2.isLocked())) && (print == undefined)) {
currentCursor = _local2.showCursor();
}
_local3++;
}
_local4++;
}
onTextChange();
}
function moveCursor(dir) {
if (typeof(dir) == "movieclip") {
currentCursor.hideCursor();
currentCursor = dir.showCursor();
if (_parent.su.data.showNumberMenu) {
var _local8 = _parent.numberMenu;
_local8._y = 0;
var _local2 = _y + dir._y;
_local8.direction = ((_local2 <= 149) ? "down" : "up");
_local8.show(_x + dir._x, _local2);
if ((_local8._x + _local8._width) > 228) {
_local8._x = _local8._x - ((_local8._x + _local8._width) - 228);
}
}
return(undefined);
}
var _local10 = currentCursor._name.split("_");
var _local3 = Number(_local10[0]);
var _local2 = Number(_local10[1]);
if (dir == "up") {
var _local4 = _local2 - 1;
while (_local4 >= 0) {
var _local7 = ((("_level0.board." + _local3) + "_") + _local4) + ".inp";
var _local6 = this[(_local3 + "_") + _local4];
if (_local6.mark != 1) {
currentCursor.hideCursor();
currentCursor = this[(_local3 + "_") + _local4].showCursor();
_local4 = -1;
}
_local4--;
}
} else if (dir == "down") {
var _local4 = _local2 + 1;
while (_local4 <= 8) {
var _local7 = ((("_level0.board." + _local3) + "_") + _local4) + ".inp";
var _local6 = this[(_local3 + "_") + _local4];
if (_local6.mark != 1) {
currentCursor.hideCursor();
currentCursor = this[(_local3 + "_") + _local4].showCursor();
_local4 = 9;
}
_local4++;
}
} else if (dir == "left") {
var _local5 = _local3 - 1;
while (_local5 >= 0) {
var _local7 = ((("_level0.board." + _local5) + "_") + _local2) + ".inp";
var _local6 = this[(_local5 + "_") + _local2];
if (_local6.mark != 1) {
currentCursor.hideCursor();
currentCursor = this[(_local5 + "_") + _local2].showCursor();
_local5 = -1;
}
_local5--;
}
} else if (dir == "right") {
var _local5 = _local3 + 1;
while (_local5 <= 8) {
var _local7 = ((("_level0.board." + _local5) + "_") + _local2) + ".inp";
var _local6 = this[(_local5 + "_") + _local2];
if (_local6.mark != 1) {
currentCursor.hideCursor();
currentCursor = this[(_local5 + "_") + _local2].showCursor();
_local5 = 9;
}
_local5++;
}
}
}
function hint() {
if (_parent.ss.data.finished) {
return(undefined);
}
var _local4 = getRow(Math.round(Math.random() * 8));
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
if (!_local3.isCorrect()) {
_local3.hint();
onTextChange();
return(undefined);
}
_local2++;
}
hint();
}
function autoErase() {
if (_parent.ss.data.finished) {
return(undefined);
}
var _local4 = 0;
while (_local4 < 9) {
var _local3 = allRows[_local4];
var _local2 = 0;
while (_local2 < _local3.length) {
if (!_local3[_local2].isCorrect()) {
_local3[_local2].inp.text = "";
}
_local2++;
}
_local4++;
}
onTextChange();
}
function showAll() {
if (_parent.ss.data.finished) {
return(undefined);
}
var _local4 = 0;
while (_local4 < 9) {
var _local3 = allRows[_local4];
var _local2 = 0;
while (_local2 < _local3.length) {
if (!_local3[_local2].isCorrect()) {
_local3[_local2].inp.text = _local3[_local2].value;
}
_local2++;
}
_local4++;
}
onTextChange();
}
function onTextChange() {
var _local2;
var _local9 = 0;
while (_local9 < 9) {
var _local3 = allRows[_local9];
var _local7 = true;
_local2 = 0;
while (_local2 < _local3.length) {
_local3[_local2].highlightState = false;
_local7 = _local7 && (_local3[_local2].isCorrect());
_local2++;
}
_local2 = 0;
while (_local2 < _local3.length) {
_local3[_local2].highlightState = _local7;
_local2++;
}
_local9++;
}
_local9 = 0;
while (_local9 < 9) {
var _local5 = allColumns[_local9];
var _local6 = true;
_local2 = 0;
while (_local2 < _local5.length) {
_local6 = _local6 && (_local5[_local2].isCorrect());
_local2++;
}
_local2 = 0;
while (_local2 < _local5.length) {
_local5[_local2].highlightState = (_local5[_local2].highlightState ? true : (_local6));
_local2++;
}
_local9++;
}
_local9 = 0;
while (_local9 < 9) {
var _local4 = allRegions[_local9];
var _local8 = true;
_local2 = 0;
while (_local2 < _local4.length) {
_local8 = _local8 && (_local4[_local2].isCorrect());
_local2++;
}
_local2 = 0;
while (_local2 < _local4.length) {
_local4[_local2].highlightState = (_local4[_local2].highlightState ? true : (_local8));
_local2++;
}
_local9++;
}
var _local10 = 0;
_local9 = 0;
while (_local9 < 9) {
var _local3 = allRows[_local9];
_local2 = 0;
while (_local2 < _local3.length) {
if (_local3[_local2].highlightState) {
_local10++;
}
if (_parent.su.data.highlight) {
_local3[_local2].highlight(_local3[_local2].highlightState);
} else {
_local3[_local2].highlight(false);
}
_local2++;
}
_local9++;
}
if (_local10 == 81) {
_parent.win();
} else {
_parent.noWin();
}
_parent.saveUserNumbers();
}
function makeSquareArrays() {
allRegions = new Array();
allColumns = new Array();
allRows = new Array();
allSquares = new Array();
var _local4 = new Array(0, 1, 2, 0, 1, 2, 0, 1, 2);
var _local5 = new Array(0, 0, 0, 1, 1, 1, 2, 2, 2);
var _local2 = 0;
while (_local2 < 9) {
allRegions.push(getRegion(_local4[_local2], _local5[_local2]));
allColumns.push(getColumn(_local2));
var _local3 = getRow(_local2);
allRows.push(_local3);
allSquares = allSquares.concat(_local3);
_local2++;
}
}
function getRow(y) {
var _local3 = new Array();
var _local2 = 0;
while (_local2 < 9) {
_local3.push(this[(_local2 + "_") + y]);
_local2++;
}
return(_local3);
}
function getColumn(x) {
var _local3 = new Array();
var _local2 = 0;
while (_local2 < 9) {
_local3.push(this[(x + "_") + _local2]);
_local2++;
}
return(_local3);
}
function getRegion(x, y) {
var _local3 = new Array();
for (var _local4 in this) {
var _local2 = this[_local4];
if (typeof(_local2) == "movieclip") {
if ((_local2.regionX == x) && (_local2.regionY == y)) {
_local3.push(_local2);
}
}
}
return(_local3.reverse());
}
function splitString(str) {
var _local3 = new Array();
var _local2 = str.split("|");
var _local1 = 0;
while (_local1 < _local2.length) {
_local3[_local1] = _local2[_local1].split(",");
_local1++;
}
return(_local3);
}
var allRegions = new Array();
var allColumns = new Array();
var allRows = new Array();
var allSquares = new Array();
}
Symbol 56 MovieClip [__Packages.com.pixelpim.sudoku.Square] Frame 0
class com.pixelpim.sudoku.Square extends MovieClip
{
var locked, _name, x, y, regionX, regionY, inp, _parent, UIcolors, border, value, bg, cursor, useHandCursor;
function Square () {
super();
hideCursor();
locked = false;
var _local3 = _name.split("_");
x = Number(_local3[0]);
y = Number(_local3[1]);
regionX = 1;
regionY = 1;
if (x < 3) {
regionX = 0;
} else if (x > 5) {
regionX = 2;
}
if (y < 3) {
regionY = 0;
} else if (y > 5) {
regionY = 2;
}
inp.maxChars = 1;
inp.restrict = "1-9";
}
function getNumber() {
return(inp.text);
}
function setNumber(nr) {
inp.text = nr;
_parent.onTextChange(this);
}
function setColor(uic) {
UIcolors = uic;
new Color(border).setRGB(UIcolors.SQUARE_BORDER_COLOR);
highlight(false);
}
function lock() {
inp.textColor = UIcolors.TEXT_HIGH;
inp.text = value;
locked = true;
}
function unlock() {
inp.textColor = UIcolors.TEXT_DEFAULT;
locked = false;
}
function isLocked() {
return(locked);
}
function highlight(bool) {
var _local2 = (bool ? (UIcolors.SQUARE_HIGHLIGHT_COLOR) : (UIcolors.SQUARE_BG_COLOR));
_local2 = ((_local2 == undefined) ? 16777215 : (_local2));
new Color(bg).setRGB(_local2);
}
function hint() {
bg.play();
inp.text = value;
}
function isCorrect() {
return(String(value) == String(inp.text));
}
function isEmpty() {
return(inp.text == "");
}
function showCursor() {
cursor._visible = true;
cursor.play();
return(this);
}
function hideCursor() {
cursor._visible = false;
return(this);
}
function onRelease() {
if (!locked) {
useHandCursor = false;
_parent.moveCursor(this);
}
}
function onRollOver() {
useHandCursor = false;
}
var highlightState = false;
}
Symbol 1 MovieClip [__Packages.Smenu] Frame 0
class Smenu extends MovieClip
{
var labels, labelCount, currentLabel, sLabel, cbScope, cbMethod, _x, x, _y, y, direction, colorObj, bg, shadow, hitTest, onMouseUp, _visible;
function Smenu () {
super();
labels = new Array();
labelCount = 0;
hide();
currentLabel = sLabel;
}
function initialize(props, colorObj) {
cbScope = props.cbScope;
cbMethod = props.cbMethod;
_x = (x = props._x);
_y = (y = props._y);
direction = props.direction;
this.colorObj = colorObj;
new Color(bg).setRGB(colorObj.dBg);
}
function addItem(labelObj) {
var _local4 = labelCount * ROWHEIGHT;
if (labelCount > 0) {
currentLabel = currentLabel.duplicateMovieClip("sLabel" + labelCount, labelCount + 10, {_y:_local4});
}
currentLabel.label_txt.autoSize = "left";
if (labelObj.type == "heading") {
new Color(currentLabel.bg).setRGB(colorObj.dBg);
currentLabel.label_txt.text = labelObj.label;
currentLabel.label_txt.text._x = MARG;
var _local3 = new TextFormat();
_local3.bold = true;
_local3.color = colorObj.dText;
currentLabel.label_txt.setTextFormat(_local3);
currentLabel.hr._visible = Boolean(labelObj.hr);
} else {
currentLabel.labelObj = labelObj;
currentLabel.colorObj = colorObj;
currentLabel.label_txt.text = labelObj.label;
currentLabel.label_txt.text._x = MARG;
currentLabel.data = labelObj.data;
currentLabel.onRelease = function () {
this._parent.onLabelPress(this);
this.onRollOut();
};
currentLabel.onRollOut = function () {
this.label_txt.textColor = this.colorObj.dText;
new Color(this.bg).setRGB(this.colorObj.dBg);
};
currentLabel.onRollOver = function () {
this.useHandCursor = false;
this.label_txt.textColor = this.colorObj.hText;
new Color(this.bg).setRGB(this.colorObj.hBg);
};
currentLabel.onReleaseOutside = currentLabel.onRollOut;
currentLabel.onRollOut();
currentLabel.hr._visible = Boolean(labelObj.hr);
}
labels.push(currentLabel);
labelWidth = ((currentLabel._width > labelWidth) ? (currentLabel._width) : (labelWidth));
labelCount++;
resize();
}
function resize() {
var _local3 = (MARG + labelWidth) + MARG;
var _local5 = labelCount * ROWHEIGHT;
shadow._width = (bg._width = _local3);
shadow._height = (bg._height = _local5);
var _local4 = labels.length;
var _local2;
_local2 = 0;
while (_local2 < _local4) {
labels[_local2].bg._width = _local3;
labels[_local2].hr._width = _local3;
_local2++;
}
if (direction == "up") {
_y = y - _local5;
}
}
function onLabelPress(labelObj) {
cbScope[cbMethod](labelObj);
hide();
}
function myOnMouseUp() {
if (!hitTest(_root._xmouse, _root._ymouse)) {
hide();
}
}
function hide() {
onMouseUp = undefined;
_visible = false;
}
function show(x, y) {
onMouseUp = myOnMouseUp;
if (x != undefined) {
_x = (this.x = x);
_y = (this.y = y);
resize();
}
_visible = true;
}
var ROWHEIGHT = 17;
var MARG = 4;
var labelWidth = 0;
}
Symbol 33 MovieClip [__Packages.Checkbox] Frame 0
class Checkbox extends MovieClip
{
var textLabel, label, checkV, cbScope, cbMethod, useHandCursor;
function Checkbox () {
super();
textLabel.autoSize = "left";
}
function initialize(propObj, colorObj) {
label = ((propObj.label == undefined) ? "" : (propObj.label));
textLabel.text = label;
var _local4 = new TextFormat();
_local4.bold = ((colorObj.bolded == undefined) ? true : (colorObj.bolded));
_local4.color = ((colorObj.tColor == undefined) ? (DEFAULT_COLOR) : (colorObj.tColor));
textLabel.setTextFormat(_local4);
if (colorObj.cColor != undefined) {
new Color(checkV.check).setRGB(colorObj.cColor);
}
cbScope = propObj.cbScope;
cbMethod = propObj.cbMethod;
check(Boolean(propObj.checked));
}
function onRelease() {
checkV._visible = !checkV._visible;
cbScope[cbMethod](this);
}
function onRollOver() {
useHandCursor = false;
}
function check(checkBool) {
checkV._visible = checkBool;
}
function get checked() {
return(checkV._visible);
}
var DEFAULT_COLOR = 0;
}