Instance of Symbol 39 MovieClip in Frame 1
//component parameters
onClipEvent (initialize) {
xin_motion_val = "Toward";
xin_alphatype_val = "No";
xout_motion_val = "None";
xout_alphatype_val = "No";
perc_req_val = 100;
show_perc_val = "Yes";
slow_factor_val = 0.2;
init_action_val = "_root.stop();";
play_action_val = "_root.play();";
}
Frame 21
stop();
Frame 22
stop();
words = "SOME TEST|DUCK|CAT|MARSH|AMPHIBIOUS|LOFT|AMBIVALENT|SARCASTIC|GENERATION|FUNCTION|PHONE|CLOCK|STEREO|SPEAKER|BUREAU|BOARD|MOUSE|COMPUTER|CHAIR|COKE|BACKPACK|DOORMAN|FLOOR|PROMOTION|BOOK|HIGHLIGHTER|POPCORN|FOOTBALL|LITTLE|GLASSES|SCHEDULE|MARKETING|DIRECT|SHADOW|CRANE|WINDOW|PURSE|CLOTHES|BUILDING|PICTURE|LAMP|BOOTS|PENCIL|DICTIONARY";
Instance of Symbol 102 MovieClip in Frame 22
//component parameters
onClipEvent (initialize) {
show_unfound_val = "True";
special_sound_probability_val = 0.25;
incorrect_points_val = -5;
correct_points_val = 20;
game_over_circle_color_rgb = 16711680 /* 0xFF0000 */;
game_over_circle_color_r = 255;
game_over_circle_color_g = 0;
game_over_circle_color_b = 0;
game_over_circle_color_a = 100;
drag_circle_color_rgb = 0;
drag_circle_color_r = 0;
drag_circle_color_g = 0;
drag_circle_color_b = 0;
drag_circle_color_a = 100;
word_selection_type_val = "Circled";
words_per_puzzle_val = 15;
grid_columns_val = 18;
grid_rows_val = 18;
database_file_val = "wordsearch_new.txt";
time_limit_val = 300000 /* 0x0493E0 */;
possible_word_directions_label = "Top Left to Bottom Right|Top Right to Bottom Left|Bottom Left to Top Right|Bottom Right to Top Left|Top to Bottom|Bottom to Top|Left to Right|Right to Left";
possible_word_directions_load_type = "Load URL|Load URL|Load URL|Load URL|Load URL|Load URL|Load URL|Load URL";
possible_word_directions_load_url = "http://|http://|http://|http://|http://|http://|http://|http://";
possible_word_directions_load_target = "_blank|_blank|_blank|_blank|_blank|_blank|_blank|_blank";
possible_word_directions_swf_type = "Level|Level|Level|Level|Level|Level|Level|Level";
possible_word_directions_swf_level = "1|1|1|1|1|1|1|1";
possible_word_directions_swf_mc = "_root.content|_root.content|_root.content|_root.content|_root.content|_root.content|_root.content|_root.content";
possible_word_directions_simple = "|||||||";
}
Frame 23
stop();
Frame 24
stop();
Symbol 5 MovieClip [circle_selection] Frame 1
var x1 = from_mc._x;
var y1 = from_mc._y;
var x2 = to_mc._x;
var y2 = to_mc._y;
this._x = x1;
this._y = y1;
end._x = x2 - x1;
end._y = y2 - y1;
middle._rotation = 0;
middle._width = Math.sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
angle = (Math.atan2(y2 - y1, x2 - x1) * 180) / Math.PI;
start._rotation = angle;
middle._rotation = angle;
end._rotation = angle + 180;
Symbol 10 MovieClip [letter_textfield] Frame 1
stop();
Symbol 14 MovieClip [word_bank_textfield] Frame 1
stop();
Symbol 17 Button
on (release) {
getURL ("http://www.eyeland.com", "_self");
}
Symbol 39 MovieClip Frame 1
stop();
Instance of Symbol 38 MovieClip "swfloader" in Symbol 39 MovieClip Frame 1
onClipEvent (load) {
function strip_spaces(str) {
var _local2 = str;
var _local3 = new String("");
var _local1 = 0;
while (_local1 < _local2.length) {
if ((_local2.charAt(_local1) != " ") && (_local2.charAt(_local1) != ";")) {
_local3 = _local3 + _local2.charAt(_local1);
}
_local1++;
}
return(_local3);
}
function simple_script(action, timeline) {
action = strip_spaces(action);
if ((action.length > 0) && ((action.indexOf(")") != -1) && (action.indexOf("(") != -1))) {
var _local3 = action.split(".");
var timeline_action = _local3.pop();
var first_paren = timeline_action.indexOf("(");
var second_paren = timeline_action.indexOf(")");
var timeline_function = timeline_action.substr(0, first_paren);
var function_parameter = timeline_action.substr(first_paren + 1, second_paren - (first_paren + 1));
var _local2 = timeline;
var _local1 = 0;
while (_local1 < _local3.length) {
_local2 = _local2[_local3[_local1]];
_local1++;
}
if (function_parameter.indexOf("\"") != -1) {
function_parameter = function_parameter.substr(1, function_parameter.length - 2);
}
_local2[timeline_function](function_parameter);
}
}
function execute_action() {
var _local1 = _parent;
unloaded = true;
_local1._visible = false;
simple_script(_local1.play_action_val, _local1);
}
_parent.anim.gotoAndStop(1);
simple_script(_parent.init_action_val, _parent);
var done = false;
var unloaded = false;
var orig_x = _parent._x;
var orig_y = _parent._y;
var dist_x = (_parent._x + ((_parent._width * 2) / 3));
var dist_y = (_parent._y + ((_parent._height * 2) / 3));
var orig_a = _parent._alpha;
var accel_jump = 0.75;
var slow_factor = _parent.slow_factor_val;
var speed_factor = (1 + (slow_factor / (1 - slow_factor)));
var ready = false;
var perc_fadeout = 0;
_parent.perc._x = _parent.anim._x - (_parent.perc._width / 2);
_parent.perc._y = _parent.anim._y - (_parent.perc._height / 2);
if (slow_factor < 1) {
switch (_parent.xin_motion_val) {
case "Up" :
_parent._y = orig_y + (dist_y * 2);
break;
case "Down" :
_parent._y = orig_y - (dist_y * 2);
break;
case "Left" :
_parent._x = orig_x + (dist_x * 2);
break;
case "Right" :
_parent._x = orig_x - (dist_x * 2);
break;
case "Toward" :
_parent._xscale = (_parent._yscale = 1);
break;
case "None" :
_parent._alpha = 0;
}
} else {
ready = true;
}
}
onClipEvent (enterFrame) {
if (unloaded) {
return(undefined);
}
if (!ready) {
switch (_parent.xin_motion_val) {
case "Toward" :
_parent._xscale = _parent._xscale + ((100 - _parent._xscale) * slow_factor);
_parent._yscale = _parent._xscale;
if (_parent.xin_alphatype_val == "Yes") {
_parent._alpha = Math.round((orig_a / 100) * Math.max(0, Math.min(_parent._xscale, 100)));
}
if (Math.abs(100 - _parent._xscale) < 0.5) {
_parent._xscale = (_parent._yscale = 100);
_parent._alpha = orig_a;
ready = true;
}
break;
default :
_parent._x = _parent._x + ((orig_x - _parent._x) * slow_factor);
_parent._y = _parent._y + ((orig_y - _parent._y) * slow_factor);
if (_parent.xin_alphatype_val == "Yes") {
if (_parent.xin_motion_val == "None") {
_parent._alpha = _parent._alpha + ((orig_a - _parent._alpha) * slow_factor);
} else if (Math.abs(orig_x - _parent._x) > Math.abs(orig_y - _parent._y)) {
_parent._alpha = 100 - Math.round(((orig_a / 100) * (Math.min(dist_x, Math.abs(_parent._x - orig_x)) / dist_x)) * 100);
} else {
_parent._alpha = 100 - Math.round(((orig_a / 100) * (Math.min(dist_y, Math.abs(_parent._y - orig_y)) / dist_y)) * 100);
}
}
if (!(((_parent.xin_motion_val == "None") && (Math.abs(_parent._alpha - orig_a) <= 1)) || (((_parent.xin_motion_val != "None") && (Math.abs(_parent._y - orig_y) < 0.5)) && (Math.abs(_parent._x - orig_x) < 0.5)))) {
break;
}
_parent._x = orig_x;
_parent._y = orig_y;
_parent._alpha = orig_a;
ready = true;
}
} else if (!done) {
var rl = _root.getBytesLoaded();
var rt = (_root.getBytesTotal() * (_parent.perc_req_val / 100));
if ((rl > 10) && (rt > 10)) {
rl = Math.min(rl, rt);
var new_frame = (_parent.anim._currentframe + Math.ceil(((_parent.anim._totalframes * (rl / rt)) - _parent.anim._currentframe) / 4));
new_frame = Math.max(1, new_frame);
if (_parent.show_perc_val == "Yes") {
_parent.perc.text = Math.round(((new_frame - 1) / (_parent.anim._totalframes - 1)) * 100) + " %";
}
if (new_frame != _parent.anim._currentframe) {
_parent.anim.gotoAndStop(new_frame);
}
if ((_parent.anim._totalframes == _parent.anim._currentframe) && (rl >= rt)) {
done = true;
}
}
} else if (slow_factor < 1) {
switch (_parent.xout_motion_val) {
case "Down" :
if (_parent._y <= orig_y) {
_parent._y = orig_y + accel_jump;
}
_parent._y = orig_y + (Math.abs(_parent._y - orig_y) * speed_factor);
perc_fadeout = Math.round((Math.min(dist_y, Math.abs(_parent._y - orig_y)) / dist_y) * 100);
if (_parent._y > (orig_y + (dist_y * 2))) {
execute_action();
}
break;
case "Up" :
if (_parent._y >= orig_y) {
_parent._y = orig_y - accel_jump;
}
_parent._y = orig_y - (Math.abs(_parent._y - orig_y) * speed_factor);
perc_fadeout = Math.round((Math.min(dist_y, Math.abs(_parent._y - orig_y)) / dist_y) * 100);
if (_parent._y < (orig_y - (dist_y * 2))) {
execute_action();
}
break;
case "Right" :
if (_parent._x <= orig_x) {
_parent._x = orig_x + accel_jump;
}
_parent._x = orig_x + (Math.abs(_parent._x - orig_x) * speed_factor);
perc_fadeout = Math.round((Math.min(dist_x, Math.abs(_parent._x - orig_x)) / dist_x) * 100);
if (_parent._x > (orig_x + (dist_x * 2))) {
execute_action();
}
break;
case "Left" :
if (_parent._x >= orig_x) {
_parent._x = orig_x - accel_jump;
}
_parent._x = orig_x - (Math.abs(_parent._x - orig_x) * speed_factor);
perc_fadeout = Math.round((Math.min(dist_x, Math.abs(_parent._x - orig_x)) / dist_x) * 100);
if (_parent._x < (orig_x - (dist_x * 2))) {
execute_action();
}
break;
case "Away" :
if ((_parent._xscale >= 100) || (_parent._yscale >= 100)) {
_parent._xscale = (_parent._yscale = 100 - accel_jump);
}
_parent._xscale = (_parent._yscale = Math.max(0.5, 100 - ((100 - _parent._yscale) * speed_factor)));
perc_fadeout = 100 - Math.round(Math.max(0, Math.min(_parent._xscale, 100)));
if (_parent._xscale < 1) {
execute_action();
}
break;
default :
perc_fadeout = perc_fadeout + ((100 - perc_fadeout) * slow_factor);
if (Math.abs(perc_fadeout - 100) > 1) {
break;
}
execute_action();
}
if (!(_parent.xout_alphatype_val === "Yes")) {
} else {
_parent._alpha = (orig_a / 100) * (100 - perc_fadeout);
}
} else {
execute_action();
}
}
Symbol 46 MovieClip Frame 1
_parent.stop();
Symbol 46 MovieClip Frame 65
stop();
_parent.play();
Symbol 51 Button
on (release) {
getURL ("http://www.urgames.com", "_self");
}
Symbol 55 Button
on (release) {
getURL ("http://www.gamesforyourwebsite.com", "_self");
}
Symbol 59 Button
on (release) {
getURL ("http://www.urgames.com/forums", "_self");
}
Symbol 63 Button
on (release) {
getURL ("http://www.urgames.com/cheats", "_self");
}
Symbol 71 Button
on (release) {
this.play();
}
Symbol 77 MovieClip Frame 1
stop();
Symbol 79 MovieClip Frame 1
stop();
Symbol 81 MovieClip Frame 1
stop();
Symbol 83 MovieClip Frame 1
stop();
Symbol 90 Button
on (press) {
_root.gotoAndStop("Starting Screen");
}
Symbol 91 MovieClip Frame 1
stop();
Symbol 100 Button
on (press) {
_root.gotoAndStop("Starting Screen");
}
Symbol 102 MovieClip Frame 1
Math.randi = function (a, b) {
return(Math.floor(Math.random() * (b - a)) + Math.floor(a));
};
Math.sign = function (val) {
var _local1 = val;
if (_local1 != 0) {
return(_local1 / Math.abs(_local1));
}
return(0);
};
Array.prototype.swap = function (a, b) {
var _local1 = this;
var _local2 = _local1[a];
_local1[a] = _local1[b];
_local1[b] = _local2;
};
Array.prototype.shuffle = function () {
var _local2 = this;
var _local1 = 0;
while (_local1 < _local2.length) {
_local2.swap(_local1, Math.randi(0, _local2.length));
_local1++;
}
};
Array.prototype.random_subset = function (n) {
var _local3 = new Array();
var _local2 = Array.getIndices(0, this.length - 1);
_local2.shuffle();
var _local1 = 0;
while (_local1 < n) {
_local3[_local1] = this[_local2[_local1]];
_local1++;
}
return(_local3);
};
Array.getIndices = function (a, b) {
var _local2 = a;
var _local3 = new Array();
var _local1 = _local2;
while (_local1 <= b) {
_local3[_local1 - _local2] = _local1;
_local1++;
}
return(_local3);
};
Array.get_letter_grid = function (m, n) {
var _local3 = new Array();
var _local2 = 0;
while (_local2 < m) {
_local3[_local2] = new Array();
var _local1 = 0;
while (_local1 < n) {
_local3[_local2][_local1] = String.fromCharCode(Math.randi(65, 91));
_local1++;
}
_local2++;
}
return(_local3);
};
Array.prototype.sortOn = function (p) {
var _local1 = p;
Array.$sortprop = _local1;
var _local2 = function (a, b) {
var _local1 = Array.$sortprop;
return(b[_local1] > a[_local1]);
};
this.sort(_local2);
delete Array.$sortprop;
};
Array.prototype.return_copy = function () {
var _local2 = this;
var _local3 = new Array();
var _local1 = 0;
while (_local1 < _local2.length) {
_local3[_local1] = _local2[_local1];
_local1++;
}
return(_local3);
};
String.prototype.return_reverse = function () {
var _local2 = this;
var _local3 = "";
var _local1 = _local2.length - 1;
while (_local1 >= 0) {
_local3 = _local3 + _local2.charAt(_local1);
_local1--;
}
return(_local3);
};
Array.prototype.hasElement = function (e) {
var _local2 = this;
var _local3 = e;
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1] == _local3) {
}
_local1++;
}
return(false);
};
Array.prototype.intersection = function (A) {
var _local2 = this;
var _local3 = A;
var _array = new Array();
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local3.hasElement(_local2[_local3])) {
_array.push(_local2[_local1]);
}
_local1++;
}
return(_array);
};
String.prototype.searchReplace = function (s, r) {
return(this.split(s).join(r));
};
WordSearch = function () {
this.load_game_data();
};
WordSearch.prototype.time_limit = ((Number(time_limit_val) == 0) ? Number.MAX_VALUE : (Number(time_limit_val)));
WordSearch.prototype.database_file = database_file_val;
WordSearch.prototype.grid_rows = Number(grid_rows_val);
WordSearch.prototype.grid_columns = Number(grid_columns_val);
WordSearch.prototype.words_per_puzzle = Number(words_per_puzzle_val);
WordSearch.prototype.word_selection_type = word_selection_type_val;
WordSearch.prototype.drag_circle_color = drag_circle_color_rgb;
WordSearch.prototype.game_over_circle_color = game_over_circle_color_rgb;
WordSearch.prototype.correct_points = Number(correct_points_val);
WordSearch.prototype.incorrect_points = Number(incorrect_points_val);
WordSearch.prototype.special_sound_probability = Number(special_sound_probability_val);
WordSearch.prototype.show_unfound = show_unfound_val;
WordSearch.prototype.timeline = this;
WordSearch.prototype.load_game_data = function () {
var _local2 = this;
_local2.words = _local2.timeline._parent.words.split("|");
var _local1 = 0;
while (_local1 < _local2.words.length) {
_local2.words[_local1] = _local2.words[_local1].toUpperCase();
_local1++;
}
_local2.initialize();
};
WordSearch.prototype.initialize = function () {
this.initialize_variables();
this.initialize_graphics();
};
WordSearch.prototype.initialize_variables = function () {
var _local1 = this;
_local1.mouse_down = false;
_local1.depth = 0;
_local1.score = 0;
_local1.start_time = getTimer();
_local1.answer_key = new Array();
_local1.letter_grid_width = _local1.timeline.grid_area._width;
_local1.letter_grid_height = _local1.timeline.grid_area._height;
_local1.word_bank = _local1.words.random_subset(_local1.words_per_puzzle);
_local1.word_bank.sortOn("length");
_local1.create_letter_grid();
_local1.embed_word_bank();
};
WordSearch.prototype.create_letter_grid = function () {
var _local3 = this;
var initial_grid = Array.get_letter_grid(_local3.grid_rows, _local3.grid_columns);
_local3.letter_grid = new Array();
var _local2 = 0;
while (_local2 < _local3.grid_rows) {
_local3.letter_grid[_local2] = new Array();
var _local1 = 0;
while (_local1 < _local3.grid_columns) {
_local3.letter_grid[_local2][_local1] = new Object();
_local3.letter_grid[_local2][_local1].letter = initial_grid[_local2][_local1];
_local3.letter_grid[_local2][_local1].word_bank_letter = false;
_local3.letter_grid[_local2][_local1].letter_found = false;
_local3.letter_grid[_local2][_local1].drag_selected = false;
_local1++;
}
_local2++;
}
};
WordSearch.prototype.embed_word_bank = function () {
var _local3 = this;
var _local1 = _local3.word_bank.return_copy();
var _local2 = 0;
while (_local2 < _local1.length) {
_local1[_local2] = _local1[_local2].searchReplace(" ", "");
_local2++;
}
_local2 = 0;
while (_local2 < _local1.length) {
var index_j = Math.randi(0, _local3.grid_rows);
var index_k = Math.randi(0, _local3.grid_columns);
var possible_directions = _local3.get_possible_word_directions(_local1[_local2].length, index_j, index_k);
var bool = _local3.embed_word(_local1[_local2], index_j, index_k, possible_directions);
if (!bool) {
_local1.push(_local1[_local2]);
}
_local2++;
}
};
WordSearch.prototype.get_possible_word_directions = function (word_length, index_j, index_k) {
var _local1 = word_length;
var _local3 = index_k;
var _local2 = new Array();
if (((index_j + _local1) < this.grid_rows) && ((_local3 + _local1) < this.grid_columns)) {
_local2.push("Top Left to Bottom Right");
}
if (((index_j + _local1) < this.grid_rows) && ((_local3 - _local1) >= 0)) {
_local2.push("Top Right to Bottom Left");
}
if (((index_j - _local1) >= 0) && ((_local3 + _local1) < this.grid_columns)) {
_local2.push("Bottom Left to Top Right");
}
if (((index_j - _local1) >= 0) && ((_local3 - _local1) >= 0)) {
_local2.push("Bottom Right to Top Left");
}
if ((index_j + _local1) < this.grid_rows) {
_local2.push("Top to Bottom");
}
if ((index_j - _local1) >= 0) {
_local2.push("Bottom to Top");
}
if ((_local3 + _local1) < this.grid_columns) {
_local2.push("Left to Right");
}
if ((_local3 - _local1) >= 0) {
_local2.push("Right to Left");
}
return(_local2);
};
WordSearch.prototype.embed_word = function (word, index_j, index_k, possible_directions) {
var _local3 = possible_directions;
_local3.shuffle();
if (this.answer_key.length < (0.2 * this.word_bank.length)) {
_local3.sortOn("length");
}
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = this.calculate_slope_increments(_local3[_local1]);
if (!this.word_overlaps(word, index_j, index_k, _local2)) {
this.put_letters_in(word, index_j, index_k, _local2, _local3[_local1]);
return(true);
}
_local1++;
}
return(false);
};
WordSearch.prototype.put_letters_in = function (word, index_j, index_k, increments, direction) {
var _local3 = word;
var _local1 = 0;
while (_local1 < _local3.length) {
var j = (index_j + (_local1 * increments.j));
var k = (index_k + (_local1 * increments.k));
var _local2 = this.letter_grid[j][k];
_local2.word_bank_letter = true;
_local2.letter = _local3.charAt(_local1);
_local1++;
}
var answer = new Object();
answer.start = {j:index_j, k:index_k};
answer.length = _local3.length;
answer.increments = increments;
answer.direction = direction;
answer.word = _local3;
this.answer_key.push(answer);
};
WordSearch.prototype.word_overlaps = function (word, index_j, index_k, increments) {
var _local1 = 0;
while (_local1 < word.length) {
var j = (index_j + (_local1 * increments.j));
var _local3 = index_k + (_local1 * increments.k);
var _local2 = this.letter_grid[j][_local3];
if (_local2.word_bank_letter && (_local2.letter != word.charAt(_local1))) {
return(true);
}
_local1++;
}
return(false);
};
WordSearch.prototype.calculate_slope_increments = function (direction) {
var _local1 = direction;
if (_local1 == "Top Left to Bottom Right") {
return({j:1, k:1});
}
if (_local1 == "Bottom Left to Top Right") {
return({j:-1, k:1});
}
if (_local1 == "Top Right to Bottom Left") {
return({j:1, k:-1});
}
if (_local1 == "Bottom Right to Top Left") {
return({j:-1, k:-1});
}
if (_local1 == "Left to Right") {
return({j:0, k:1});
}
if (_local1 == "Right to Left") {
return({j:0, k:-1});
}
if (_local1 == "Top to Bottom") {
return({j:1, k:0});
}
if (_local1 == "Bottom to Top") {
return({j:-1, k:0});
}
return(undefined);
};
WordSearch.prototype.initialize_graphics = function () {
var _local1 = this;
_local1.create_letter_grid_graphics();
_local1.render_letter_grid();
_local1.render_word_bank();
};
WordSearch.prototype.create_letter_grid_graphics = function () {
var _local1 = this;
_local1.letter_spacing_x = _local1.timeline.grid_area._width / (_local1.grid_columns + 1);
_local1.letter_spacing_y = _local1.timeline.grid_area._height / (_local1.grid_rows + 1);
var j = 0;
while (j < _local1.grid_rows) {
var _local2 = 0;
while (_local2 < _local1.grid_columns) {
_local1.timeline.attachMovie("letter_textfield", (("letter_" + j) + "_") + _local2, _local1.depth++);
var _local3 = _local1.timeline[(("letter_" + j) + "_") + _local2];
_local3._x = _local1.timeline.grid_area._x + (_local1.letter_spacing_x * (_local2 + 1));
_local3._y = _local1.timeline.grid_area._y + (_local1.letter_spacing_y * (j + 1));
_local3.field = _local1.letter_grid[j][_local2].letter;
_local3.index_j = j;
_local3.index_k = _local2;
_local2++;
}
j++;
}
};
WordSearch.prototype.render_letter_grid = function () {
var _local3 = 0;
while (_local3 < this.grid_rows) {
var _local1 = 0;
while (_local1 < this.grid_columns) {
var _local2 = this.timeline[(("letter_" + _local3) + "_") + _local1];
_local2.field = this.letter_grid[_local3][_local1].letter;
if (this.letter_grid[_local3][_local1].drag_selected) {
_local2.gotoAndStop("Drag Selected");
} else if (this.letter_grid[_local3][_local1].letter_found) {
_local2.gotoAndStop("Found Selected");
} else {
_local2.gotoAndStop("Default");
}
_local1++;
}
_local3++;
}
};
WordSearch.prototype.render_word_bank = function () {
var _local2 = this;
_local2.word_bank.sort();
var word_spacing_y = (_local2.timeline.word_bank_area._height / (_local2.word_bank.length + 1));
var _local1 = 0;
while (_local1 < _local2.word_bank.length) {
_local2.timeline.attachMovie("word_bank_textfield", "word" + _local1, _local2.depth++);
var _local3 = _local2.timeline["word" + _local1];
_local3._x = _local2.timeline.word_bank_area._x;
_local3._y = _local2.timeline.word_bank_area._y + ((_local1 + 1) * word_spacing_y);
_local3.field = _local2.word_bank[_local1];
_local1++;
}
};
WordSearch.prototype.mouse_press = function () {
var _local1 = this;
_local1.correct_mouse_press = true;
if (!_local1.timeline.grid_area.hitTest(_root._xmouse, _root._ymouse, true)) {
_local1.correct_mouse_press = false;
} else {
_local1.mouse_down = true;
_local1.press_mc = _local1.get_closest_letter();
if (_local1.word_selection_type == "Circled") {
_local1.depth++;
_local1.timeline.attachMovie("circle_selection", "circle" + _local1.depth, _local1.depth);
_local1.current_circle_selection = _local1.timeline["circle" + _local1.depth];
_local1.current_circle_selection.from_mc = _local1.press_mc;
_local1.current_circle_selection.to_mc = _local1.press_mc;
var _local2 = new Color(_local1.current_circle_selection);
_local2.setRGB(_local1.drag_circle_color);
}
}
};
WordSearch.prototype.get_closest_letter = function () {
var _local1 = this;
var delta_x = Math.max(0, _local1.timeline._xmouse - (_local1.timeline.grid_area._x + (_local1.letter_spacing_x / 2)));
var delta_y = Math.max(0, _local1.timeline._ymouse - (_local1.timeline.grid_area._y + (_local1.letter_spacing_y / 2)));
var _local3 = Math.min(_local1.grid_rows - 1, Math.floor(delta_y / _local1.letter_spacing_y));
var _local2 = Math.min(_local1.grid_columns - 1, Math.floor(delta_x / _local1.letter_spacing_x));
return(_local1.timeline[(("letter_" + _local3) + "_") + _local2]);
};
WordSearch.prototype.mouse_release = function () {
var _local1 = this;
if (!_local1.correct_mouse_press) {
} else {
_local1.mouse_down = false;
_local1.release_mc = _local1.get_closest_proper_letter();
_local1.evaluate_guess();
_local1.set_word_path_property(_local1.press_mc, _local1.release_mc, "drag_selected", false);
_local1.render_letter_grid();
_local1.press_mc = undefined;
_local1.release_mc = undefined;
}
};
WordSearch.prototype.action = function () {
var _local1 = this;
if (_local1.mouse_down) {
_local1.render_dragged_word();
}
_local1.update_game_properties();
};
WordSearch.prototype.render_dragged_word = function () {
var _local1 = this;
if (_local1.word_selection_type == "Circled") {
_local1.render_circled_dragged_word();
} else {
_local1.render_dots_dragged_word();
}
};
WordSearch.prototype.render_circled_dragged_word = function () {
this.current_circle_selection.to_mc = this.get_closest_proper_letter();
};
WordSearch.prototype.render_dots_dragged_word = function () {
var _local1 = this;
var _local2 = _local1.get_closest_proper_letter();
_local1.set_word_path_property(_local1.press_mc, _local2, "drag_selected", true);
_local1.render_letter_grid();
_local1.set_word_path_property(_local1.press_mc, _local2, "drag_selected", false);
};
WordSearch.prototype.get_closest_proper_letter = function () {
var closest_mc = this.get_closest_letter();
var j1 = this.press_mc.index_j;
var _local3 = this.press_mc.index_k;
var j2 = closest_mc.index_j;
var k2 = closest_mc.index_k;
var _local1;
var _local2;
if (((Math.abs((j1 - j2) / (_local3 - k2)) == 1) || (Math.abs(j1 - j2) == 0)) || (Math.abs(_local3 - k2) == 0)) {
_local1 = j2;
_local2 = k2;
} else {
var angle = Math.abs((Math.atan2(j2 - j1, k2 - _local3) * 180) / Math.PI);
if ((angle < 22.5) || (angle > 157.5)) {
_local1 = j1;
_local2 = k2;
} else if ((angle > 67.5) && (angle < 112.5)) {
_local1 = j2;
_local2 = _local3;
} else {
_local1 = (Math.max(Math.abs(j2 - j1), Math.abs(k2 - _local3)) * Math.sign(j2 - j1)) + j1;
_local2 = (Math.max(Math.abs(j2 - j1), Math.abs(k2 - _local3)) * Math.sign(k2 - _local3)) + _local3;
}
}
_local1 = Math.max(0, _local1);
_local2 = Math.max(0, _local2);
_local1 = Math.min(this.grid_rows - 1, _local1);
_local2 = Math.min(this.grid_columns - 1, _local2);
return(this.timeline[(("letter_" + _local1) + "_") + _local2]);
};
WordSearch.prototype.set_word_path_property = function (from_mc, to_mc, prop, val) {
var inc_x = Math.sign(to_mc.index_k - from_mc.index_k);
var inc_y = Math.sign(to_mc.index_j - from_mc.index_j);
var dist_x = Math.abs(to_mc.index_k - from_mc.index_k);
var dist_y = Math.abs(to_mc.index_j - from_mc.index_j);
var dist = Math.max(dist_x, dist_y);
var _local1 = 0;
while (_local1 <= dist) {
var _local3 = from_mc.index_j + (_local1 * inc_y);
var _local2 = from_mc.index_k + (_local1 * inc_x);
this.letter_grid[_local3][_local2][prop] = val;
_local1++;
}
};
WordSearch.prototype.evaluate_guess = function () {
var _local1 = this;
var _local3 = _local1.calculate_word_path(_local1.press_mc, _local1.release_mc);
var _local2 = _local1.check_word_bank(_local3);
if (_local2 != -1) {
_local1.word_found(_local2);
} else {
_local1.wrong_word_found();
}
_local1.check_for_win();
};
WordSearch.prototype.word_found = function (bank_index) {
var _local1 = this;
_local1.timeline["word" + bank_index].gotoAndStop(2);
if (_local1.word_selection_type == "Dots") {
_local1.set_word_path_property(_local1.press_mc, _local1.release_mc, "letter_found", true);
_local1.set_word_path_property(_local1.press_mc, _local1.release_mc, "drag_selected", false);
}
_local1.score = _local1.score + _local1.correct_points;
if (Math.random() < _local1.special_sound_probability) {
_local1.timeline.special_correct_sounds.gotoAndStop(1 + Math.randi(1, _local1.timeline.special_correct_sounds._totalframes));
_local1.timeline.special_correct_sounds.gotoAndStop(1);
} else {
_local1.timeline.correct_sounds.gotoAndStop(1 + Math.randi(1, _local1.timeline.correct_sounds._totalframes));
_local1.timeline.correct_sounds.gotoAndStop(1);
}
};
WordSearch.prototype.wrong_word_found = function () {
var _local1 = this;
if (_local1.word_selection_type == "Dots") {
_local1.set_word_path_property(_local1.press_mc, _local1.release_mc, "drag_selected", false);
} else {
_local1.current_circle_selection.removeMovieClip();
}
_local1.score = _local1.score + _local1.incorrect_points;
if (Math.random() < _local1.special_sound_probability) {
_local1.timeline.special_incorrect_sounds.gotoAndStop(1 + Math.randi(1, _local1.timeline.special_incorrect_sounds._totalframes));
_local1.timeline.special_incorrect_sounds.gotoAndStop(1);
} else {
_local1.timeline.incorrect_sounds.gotoAndStop(1 + Math.randi(1, _local1.timeline.incorrect_sounds._totalframes));
_local1.timeline.incorrect_sounds.gotoAndStop(1);
}
};
WordSearch.prototype.calculate_word_path = function (from_mc, to_mc) {
var inc_x = Math.sign(to_mc.index_k - from_mc.index_k);
var inc_y = Math.sign(to_mc.index_j - from_mc.index_j);
var dist_x = Math.abs(to_mc.index_k - from_mc.index_k);
var dist_y = Math.abs(to_mc.index_j - from_mc.index_j);
var dist = Math.max(dist_x, dist_y);
var word_str = "";
var _local1 = 0;
while (_local1 <= dist) {
var _local3 = from_mc.index_j + (_local1 * inc_y);
var _local2 = from_mc.index_k + (_local1 * inc_x);
word_str = word_str + this.letter_grid[_local3][_local2].letter;
_local1++;
}
return(word_str);
};
WordSearch.prototype.check_word_bank = function (word) {
var _local3 = word;
var _local2 = 0;
while (_local2 < this.word_bank.length) {
var _local1 = this.timeline["word" + _local2];
if (((_local1.field == _local3) || (_local1.field == _local3.return_reverse())) && (_local1._currentframe == 1)) {
return(_local2);
}
if (((_local1.field.searchReplace(" ", "") == _local3) || (_local1.field.searchReplace(" ", "") == _local3.return_reverse())) && (_local1._currentframe == 1)) {
return(_local2);
}
_local2++;
}
return(-1);
};
WordSearch.prototype.check_for_win = function () {
var _local3 = this;
var _local1 = 0;
while (_local1 < _local3.word_bank.length) {
var _local2 = _local3.timeline["word" + _local1];
if (_local2._currentframe == 1) {
return;
}
_local1++;
}
_root.gotoAndStop("Win");
};
WordSearch.prototype.check_for_lose = function () {
};
WordSearch.prototype.update_game_properties = function () {
var _local1 = this;
_local1.timeline.score = _local1.score;
_root.score = _local1.score;
var _local3 = Math.floor((_local1.time_limit - (getTimer() - _local1.start_time)) / 1000);
if (_local3 < 0) {
_local3 = 0;
}
var min = Math.floor(_local3 / 60);
var _local2 = _local3 % 60;
if (_local2 <= 9) {
_local2 = "0" + _local2;
}
_local1.timeline.timer = (min + ":") + _local2;
if (_local1.timeline.timer == "0:00") {
if (_local1.show_unfound == "False") {
_root.gotoAndStop("Lose");
} else {
_local1.show_missed_words();
}
}
};
WordSearch.prototype.show_missed_words = function () {
var _local1 = this;
var j = 0;
while (j < _local1.answer_key.length) {
var _local2 = _local1.answer_key[j];
var found = false;
var _local3 = 0;
while (_local3 < _local1.word_bank.length) {
var word_mc = _local1.timeline["word" + _local3];
if ((word_mc._currentframe != 1) && (word_mc.field == _local2.word)) {
found = true;
}
_local3++;
}
if (!found) {
_local1.depth++;
_local1.timeline.attachMovie("circle_selection", "end_selection" + j, _local1.depth++);
var _mc = _local1.timeline["end_selection" + j];
var to_j = (_local2.start.j + ((_local2.length - 1) * _local2.increments.j));
var to_k = (_local2.start.k + ((_local2.length - 1) * _local2.increments.k));
_mc.from_mc = _local1.timeline[(("letter_" + _local2.start.j) + "_") + _local2.start.k];
_mc.to_mc = _local1.timeline[(("letter_" + to_j) + "_") + to_k];
var _color = new Color(_mc);
_color.setRGB(_local1.game_over_circle_color);
}
j++;
}
var j = 0;
while (j < _local1.word_bank.length) {
_local1.timeline["word" + j].removeMovieClip();
j++;
}
_local1.timeline.word_bank_area.gotoAndStop(2);
for (var n in _local1) {
_local1[n] = undefined;
}
};
this._x = 0;
this._y = 0;
game = new WordSearch();
Instance of Symbol 75 MovieClip "controller" in Symbol 102 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
onClipEvent (data) {
_parent.game.words = this.words.split("|");
var j = 0;
while (j < _parent.game.words.length) {
_parent.game.words[j] = _parent.game.words[j].toUpperCase();
j++;
}
_parent.game.initialize();
}
onClipEvent (mouseDown) {
_parent.game.mouse_press();
}
onClipEvent (mouseUp) {
_parent.game.mouse_release();
}
onClipEvent (enterFrame) {
_parent.game.action();
}
Symbol 112 Button
on (press) {
_root.gotoAndStop("Starting Screen");
}