Frame 1
_title._visible = false;
var game = new NumbersGame(_root);
game.Initialize(new Array(box0, box1, box2, box3, box4, box5, box6, box7, box8), _title, txt_Score);
_root.onEnterFrame = function () {
game.Update();
};
stop();
Instance of Symbol 54 MovieClip [NumberBox] "box0" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "L";
}
Instance of Symbol 54 MovieClip [NumberBox] "box1" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "";
}
Instance of Symbol 54 MovieClip [NumberBox] "box2" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "";
}
Instance of Symbol 54 MovieClip [NumberBox] "box3" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "V";
}
Instance of Symbol 54 MovieClip [NumberBox] "box4" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "";
}
Instance of Symbol 54 MovieClip [NumberBox] "box5" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "";
}
Instance of Symbol 54 MovieClip [NumberBox] "box6" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "L";
}
Instance of Symbol 54 MovieClip [NumberBox] "box7" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "0";
}
Instance of Symbol 54 MovieClip [NumberBox] "box8" in Frame 1
//component parameters
onClipEvent (construct) {
_boxtext = "1";
}
Symbol 21 MovieClip [Check] Frame 1
stop();
Symbol 21 MovieClip [Check] Frame 25
stop();
Symbol 21 MovieClip [Check] Frame 40
gotoAndStop ("default");
Symbol 24 MovieClip [Strike] Frame 1
#initclip 24
Object.registerClass("Strike", StrikeBox);
#endinitclip
stop();
Symbol 24 MovieClip [Strike] Frame 25
stop();
Symbol 24 MovieClip [Strike] Frame 40
gotoAndStop ("default");
Symbol 24 MovieClip [Strike] Frame 70
stop();
Symbol 28 MovieClip [Text Overlay] Frame 1
#initclip 20
Object.registerClass("Text Overlay", TextOverlay);
#endinitclip
Symbol 31 MovieClip [Message] Frame 1
#initclip 21
Object.registerClass("Message", NumberBox);
#endinitclip
Symbol 35 MovieClip [Title] Frame 1
#initclip 22
Object.registerClass("Title", NumberBox);
#endinitclip
Symbol 54 MovieClip [NumberBox] Frame 1
#initclip 23
Object.registerClass("NumberBox", NumberBox);
#endinitclip
stop();
Symbol 54 MovieClip [NumberBox] Frame 10
stop();
Symbol 54 MovieClip [NumberBox] Frame 31
stop();
Symbol 54 MovieClip [NumberBox] Frame 36
gotoAndPlay (32);
Symbol 54 MovieClip [NumberBox] Frame 40
stop();
Symbol 54 MovieClip [NumberBox] Frame 65
stop();
Symbol 60 MovieClip [__Packages.NumbersGame] Frame 0
class NumbersGame
{
var _out, _animationQueue, _levelMissCount, _maxMiss, _stdAnimSpeed, _requiredStreakToReclaimStrike, _score, _bonusStep, _nextBonus, _boxes, _title, _scoreIndicator, _levelPatterns, _messageBox, _roundResult, _perfectStreak;
function NumbersGame (out_) {
_out = out_;
_animationQueue = new AnimationQueue();
_levelMissCount = new Array();
_maxMiss = 3;
_stdAnimSpeed = 8;
_requiredStreakToReclaimStrike = 5;
_score = 0;
_bonusStep = 10;
_nextBonus = _bonusStep;
_roundsPerLevel = 5;
_maxLevel = 7;
}
function Initialize(boxes_, title_, scoreIndicator_) {
_boxes = boxes_;
_title = title_;
_scoreIndicator = scoreIndicator_;
var _local2 = 0;
while (_local2 < _boxes.length) {
var _local3 = GetDefaultBoxText(_local2);
_boxes[_local2].SetDefaultText(_local3);
_boxes[_local2].SetSoundID("Tone" + _local3);
_boxes[_local2].Hide();
_boxes[_local2].ResetText();
_local2++;
}
SetDefaultBoxText();
_title.Hide();
InitializeStrikes();
InitializeMessageBox();
_levelPatterns = [[3, 3, 3, 3], [3, 4, 3, 4, 3], [4, 4, 4, 4], [5, 4, 5, 4, 5], [5, 5, 5, 5, 5], [5, 6, 4, 5, 6], [5, 6, 5, 6, 5, 6], [3, 4, 5, 6, 7], [5, 5, 6, 6, 7, 7], [6, 7, 6, 7, 6, 7, 6, 7], [7, 7, 7, 7, 7, 7, 7], [5, 6, 7, 8, 5, 6, 7, 8], [7, 7, 8, 8, 7, 7, 8, 8], [8, 8, 8, 5, 8], [8, 8, 4, 8, 8, 5, 8, 8, 6, 8], [8, 8, 8, 8, 8, 8, 8, 8], [8, 9, 8, 9, 8, 9], [9, 9, 9, 9], [9, 8, 9, 9, 9, 8, 9], [9, 9, 9, 9, 9, 9, 9, 9, 9]];
Reset();
}
function InitializeStrikes() {
var _local5 = _roundsPerLevel;
var _local4 = (Stage.width - 50) / _local5;
var _local2 = 1;
while (_local2 <= _local5) {
var _local3 = "Strike_" + _local2.toString();
_out.attachMovie("Strike", _local3, _out.getNextHighestDepth());
_out[_local3]._x = ((25 + (_local4 * (_local2 - 1))) + (_local4 / 2)) - 15;
_out[_local3]._y = 290;
_local2++;
}
}
function InitializeChecks() {
var _local4 = 250 / _requiredStreakToReclaimStrike;
var _local2 = 1;
while (_local2 <= _requiredStreakToReclaimStrike) {
var _local3 = "Check_" + _local2.toString();
_out.attachMovie("Check", _local3, _out.getNextHighestDepth());
_out[_local3]._x = 325;
_out[_local3]._y = ((25 + (_local4 * (_local2 - 1))) + (_local4 / 2)) - 15;
_local2++;
}
}
function InitializeMessageBox() {
_messageBox = NumberBox(_out.attachMovie("Message", "Message", _out.getNextHighestDepth()));
_messageBox.SetSoundID("Bonus");
_messageBox.Hide();
}
function get Score() {
return(_score);
}
function set Score(score_) {
_score = score_;
_scoreIndicator.text = score_.toString();
//return(Score);
}
function GetDefaultBoxText(index_) {
var _local2 = GetNumberFromBoxIndex(index_);
return(_local2.toString());
}
function SetDefaultBoxText() {
for (var _local2 in _boxes) {
_boxes[_local2].ResetText();
}
}
function Update() {
if (_gameRunning && (_animationQueue.IsDone())) {
if (_levelRunning) {
RunPuzzle(GetPuzzleForLevel(_currentLevel));
} else {
RunLevel(++_currentLevel);
}
}
_animationQueue.Update();
if (_animationQueue.IsDone()) {
DoneAnimating();
}
}
function DoneAnimating() {
}
function Q(behavior_) {
_animationQueue.Add(behavior_);
}
function PutQ(behavior_) {
_animationQueue.Insert(0, behavior_);
}
function GetPuzzleForLevel(level_) {
var _local1 = level_ + 2;
return(new NumberSequence(_local1, level_));
}
function RunLevel(level_) {
if (level_ > _maxLevel) {
_gameOver = true;
_animationQueue.Clear();
ShowGameEnd();
return(undefined);
}
_currentRound = 0;
_levelMissCount[_currentLevel] = 0;
_roundResult = new Array();
var _local2 = 1;
while (_local2 <= _roundsPerLevel) {
_roundResult[_local2] = undefined;
_local2++;
}
AnnounceLevel(level_);
RunPuzzle(GetPuzzleForLevel(level_));
_levelRunning = true;
}
function GetPuzzlesForLevel(level_) {
var _local4 = new Array();
var _local3 = _levelPatterns[level_ - 1];
var _local2 = 0;
while (_local2 < _local3.length) {
_local4.push(new NumberSequence(_local3[_local2], level_));
_local2++;
}
return(_local4);
}
function RunPuzzle(puzzle_) {
_currentRound++;
ClearBoard();
var _local6 = _stdAnimSpeed + (_maxLevel - puzzle_.__get__Level());
var _local3 = 0;
while (_local3 < puzzle_.__get__Length()) {
var _local4 = puzzle_.GetElement(_local3, false) - 1;
var _local5 = GetDefaultBoxText(_local4);
Q(new AppearWithSoundBehavior(_boxes[_local4], _local5, _local6));
_local3++;
}
_local3 = 0;
while (_local3 < puzzle_.__get__Length()) {
var _local4 = puzzle_.GetElement(_local3, true);
Q(new WaitForNumberPressBehavior(this, puzzle_, _boxes[_local4 - 1], int(GetDefaultBoxText(_local4 - 1))));
_local3++;
}
}
function ClearBoard() {
var _local2 = _stdAnimSpeed / 4;
Q(new DisappearBehavior(_messageBox, _local2));
Q(new DisappearBehavior(_title, _local2));
for (var _local3 in _boxes) {
Q(new DisappearBehavior(_boxes[_local3], _local2));
}
}
function GetNumberFromBoxIndex(index_) {
if ((index_ >= 0) && (index_ <= 2)) {
return(index_ + 7);
}
if ((index_ >= 6) && (index_ <= 8)) {
return(index_ - 5);
}
return(index_ + 1);
}
function GetBoxIndexFromNumber(number_) {
if ((number_ >= 7) && (number_ <= 9)) {
return(number_ - 6);
}
if ((number_ >= 1) && (number_ <= 3)) {
return(number_ + 6);
}
return(number_);
}
function ShowTitle() {
var _local3 = _stdAnimSpeed;
ClearBoard();
_scoreIndicator.text = "";
var _local4 = [new PlaySoundBehavior("Open"), new GenericBehavior(function () {
_root._title.BringToFront();
_root.txt_Instructions.text = "Enter the number sequences in reverse order\nThree strikes on one level and you're out\nTry to beat all 7 levels";
_root.txt_Instructions._visible = true;
}), new AppearBehavior(_title, "S3QUENC3R", _local3), new AppearBehavior(_boxes[0], "S", _local3), new AppearBehavior(_boxes[1], "3", _local3), new AppearBehavior(_boxes[2], "Q", _local3), new AppearBehavior(_boxes[3], "U", _local3), new AppearBehavior(_boxes[4], "E", _local3), new AppearBehavior(_boxes[5], "N", _local3), new AppearBehavior(_boxes[6], "C", _local3), new AppearBehavior(_boxes[7], "3", _local3), new AppearBehavior(_boxes[8], "R", _local3)];
Q(new MultiBehavior(_local4, true));
Q(new WaitForKeyPressBehavior());
Q(new GenericBehavior(function () {
_root.txt_Instructions._visible = false;
}));
_gameRunning = true;
}
function ShowGameOver() {
var _local2 = _stdAnimSpeed;
ClearBoard();
Q(new AppearBehavior(_boxes[0], "G", _local2));
Q(new AppearBehavior(_boxes[1], "A", _local2));
Q(new AppearBehavior(_boxes[2], "M", _local2));
Q(new AppearBehavior(_boxes[3], "E", _local2));
Q(new AppearBehavior(_boxes[5], "O", _local2));
Q(new AppearBehavior(_boxes[6], "V", _local2));
Q(new AppearBehavior(_boxes[7], "E", _local2));
Q(new AppearBehavior(_boxes[8], "R", _local2));
Q(new CancelableSleepBehavior(_stdAnimSpeed * 10, Reset, this));
_gameRunning = false;
}
function PlaySound(soundID_) {
var _local2 = new Sound(_out);
_local2.attachSound(soundID_);
_local2.start();
}
function AnnounceLevel(level_) {
ClearBoard();
var _local3 = level_.toString();
var _local5 = "0";
var _local4 = "0";
if (_local3.length == 1) {
_local4 = _local3;
} else if (_local3.length == 2) {
_local5 = _local3.substr(0, 1);
_local4 = _local3.substr(1, 1);
} else {
throw new Error(("Level too long (" + _local3) + ")");
}
var _local2 = _stdAnimSpeed / 2;
Q(new GenericBehavior(function (p) {
p.ResetStrikes();
}, this));
Q(new AppearBehavior(_boxes[0], "L", _local2));
Q(new AppearBehavior(_boxes[3], "E", _local2));
Q(new AppearBehavior(_boxes[6], "V", _local2));
Q(new AppearBehavior(_boxes[7], "E", _local2));
Q(new AppearBehavior(_boxes[8], "L", _local2));
Q(new AppearBehavior(_boxes[2], _local4, _local2));
Q(new CancelableSleepBehavior(_stdAnimSpeed * 5));
}
function ApplyBonus(puzzle_) {
FlashPuzzle(puzzle_);
Score = Score + (25 * _currentLevel);
}
function PuzzleMatch(matched_, puzzle_, number_) {
if (matched_) {
_matchCount++;
puzzle_.__set__MatchCount((puzzle_.__get__MatchCount()+1));
} else {
PlaySound("Mistake");
_missCount++;
puzzle_.__set__MissCount((puzzle_.__get__MissCount()+1));
Score = Score - puzzle_.MissCount;
if (puzzle_.__get__MissCount() == 1) {
_levelMissCount[puzzle_.__get__Level()]++;
SetRoundResult(_currentRound, false);
}
}
if ((puzzle_.__get__MissCount() + puzzle_.__get__MatchCount()) == puzzle_.__get__Length()) {
_puzzleCount++;
if (puzzle_.__get__MatchCount() == puzzle_.__get__Length()) {
SetRoundResult(_currentRound, true);
_perfectCount++;
_perfectStreak++;
Score = Score + (puzzle_.__get__Length() + _perfectStreak);
} else {
_perfectStreak = 0;
Score = Score + Math.max(1, puzzle_.__get__Length() - puzzle_.__get__MissCount());
}
if (_currentRound >= _roundsPerLevel) {
trace("streak: " + _perfectStreak.toString());
if ((_levelMissCount[_currentLevel] == 0) || (_levelMissCount[_currentLevel] == undefined)) {
ApplyBonus(puzzle_);
} else {
AdvanceLevel();
}
}
}
if (_levelMissCount[_currentLevel] >= Math.ceil(_roundsPerLevel / 2)) {
_animationQueue.Clear();
ShowGameOver();
}
}
function SetRoundResult(round_, perfect_) {
if (perfect_) {
ShowCheck(round_);
} else {
ShowStrike(round_);
}
}
function AdvanceLevel() {
_levelRunning = false;
}
function FlashPuzzle(puzzle_) {
var _local6 = new Array();
var _local2 = 0;
while (_local2 < puzzle_.__get__Length()) {
var _local4 = puzzle_.GetElement(_local2, false) - 1;
var _local3 = _boxes[_local4];
_local6.push(new FlashBehavior(_local3, _stdAnimSpeed * 5));
_local2++;
}
_local6.push(new PlaySoundBehavior("Bonus"));
_local6.push(new CancelableSleepBehavior(_stdAnimSpeed * 6, AdvanceLevel, this));
Q(new MultiBehavior(_local6, true));
}
function GetBox(number_) {
return(_boxes[number_ - 1]);
}
function GetStrike(number_) {
return(StrikeBox(_out["Strike_" + number_.toString()]));
}
function ShowStrike(number_) {
GetStrike(number_).ShowStrike();
}
function ShowCheck(number_) {
GetStrike(number_).ShowCheck();
}
function ResetStrike(number_) {
var _local2 = GetStrike(number_);
_local2.Clear();
}
function ResetStrikes() {
var _local2 = 1;
while (_local2 <= _roundsPerLevel) {
ResetStrike(_local2);
_local2++;
}
}
function IsGameOver() {
return(_gameOver);
}
function ShowGameEnd() {
ClearBoard();
var _local2 = _stdAnimSpeed;
var _local3 = _local2 * 5;
Q(new AppearBehavior(_boxes[0], "Y", _local2));
Q(new AppearBehavior(_boxes[1], "O", _local2));
Q(new AppearBehavior(_boxes[2], "U", _local2));
Q(new AppearBehavior(_boxes[8], "N", _local2));
Q(new AppearBehavior(_boxes[7], "I", _local2));
Q(new AppearBehavior(_boxes[6], "W", _local2));
Q(new MultiBehavior([new FlashBehavior(_boxes[0], _local3), new FlashBehavior(_boxes[1], _local3), new FlashBehavior(_boxes[2], _local3), new FlashBehavior(_boxes[8], _local3), new FlashBehavior(_boxes[7], _local3), new FlashBehavior(_boxes[6], _local3), new PlaySoundBehavior("YouWin")], true));
Q(new CancelableSleepBehavior(_local2 * 10));
ShowGameOver();
}
function Reset() {
_missCount = 0;
_matchCount = 0;
_currentLevel = 0;
_perfectCount = 0;
_puzzleCount = 0;
_perfectStreak = 0;
var _local2 = 1;
while (_local2 <= _roundsPerLevel) {
ResetStrike(_local2);
_local2++;
}
_gameOver = false;
_levelRunning = false;
Score = (0);
ShowTitle();
}
var _gameRunning = false;
var _levelRunning = false;
var _gameOver = false;
var _currentLevel = 0;
var _currentRound = 0;
var _roundsPerLevel = 0;
var _maxLevel = 0;
var _matchCount = 0;
var _missCount = 0;
var _perfectCount = 0;
var _puzzleCount = 0;
}
Symbol 61 MovieClip [__Packages.AnimationQueue] Frame 0
class AnimationQueue
{
var _behaviorQueue;
function AnimationQueue () {
_behaviorQueue = new Array();
}
function Add(behavior_) {
_behaviorQueue.push(behavior_);
}
function Insert(index_, behavior_) {
if (index_ >= _behaviorQueue.length) {
throw new Error(("Index (" + index_.toString()) + ") out of range");
}
_behaviorQueue.splice(index_, 0, behavior_);
}
function IsDone() {
return(_behaviorQueue.length == 0);
}
function mytrace(msg_) {
if (_traceOn) {
trace(msg_);
}
}
function Clear() {
mytrace("CLR:");
var _local2 = _behaviorQueue.length - 1;
while (_local2 >= 0) {
mytrace("ABT: " + _behaviorQueue[_local2]);
_behaviorQueue[_local2].Abort();
_local2--;
}
_behaviorQueue = new Array();
_initializedFirst = false;
}
function Update() {
if (!IsDone()) {
var _local2 = _behaviorQueue[0];
if (!_initializedFirst) {
mytrace("BGN: " + _local2);
_local2.Initialize();
_initializedFirst = true;
}
if (!_local2.Update()) {
mytrace("END: " + _local2.toString());
_behaviorQueue.splice(0, 1);
mytrace("BGN: " + _behaviorQueue[0].toString());
_behaviorQueue[0].Initialize();
}
}
if (IsDone()) {
_initializedFirst = false;
}
return(!IsDone());
}
function toString() {
return("ANIMATION QUEUE: " + _behaviorQueue.toString());
}
var _initializedFirst = false;
var _traceOn = false;
}
Symbol 62 MovieClip [__Packages.IBehavior] Frame 0
interface IBehavior
{
}
Symbol 63 MovieClip [__Packages.NumberBox] Frame 0
class NumberBox extends MovieClip
{
var _lit, _hidden, _strikeShown, _sound, _soundID, _defaultText, _boxtext, _good, swapDepths, gotoAndPlay, gotoAndStop, _alpha, _visible;
function NumberBox () {
super();
_lit = false;
_hidden = false;
_strikeShown = false;
_sound = new Sound();
}
function SetSoundID(soundID_) {
_soundID = soundID_;
_sound.attachSound(_soundID);
}
function PlaySound() {
_sound.start();
}
function SetDefaultText(text_) {
_defaultText = text_;
if (undefined == _boxtext) {
_boxtext = _defaultText;
}
}
function Light(good_) {
_lit = true;
_good = good_;
if (_good) {
swapDepths(1000);
(gotoAndPlay("lit"));// not popped
}
}
function Unlight() {
_lit = false;
(gotoAndStop(1));// not popped
}
function Flash() {
_lit = true;
(gotoAndPlay("flash"));// not popped
}
function Unflash() {
Unlight();
}
function Dim() {
(gotoAndStop("dimmed"));// not popped
}
function ShowStrike(dimmed_) {
_strikeShown = true;
ResetText();
(gotoAndPlay("strike"));// not popped
Unhide();
if (dimmed_) {
_alpha = 50;
}
}
function Hide() {
_alpha = 0;
_hidden = true;
_visible = false;
}
function Unhide() {
_alpha = 100;
_visible = true;
_hidden = false;
}
function IsHidden() {
return(_hidden);
}
function get Text() {
return(_boxtext);
}
function set Text(v_) {
_boxtext = v_;
//return(Text);
}
function ResetText() {
_boxtext = _defaultText;
}
function AddAlpha(v_) {
if (!_visible) {
_visible = true;
}
_alpha = _alpha + v_;
}
function BringToFront() {
swapDepths(1000);
}
}
Symbol 64 MovieClip [__Packages.NumberSequence] Frame 0
class NumberSequence
{
var _length, _lvl, _matchCount, _missCount, _sequence, _numberFlags;
function NumberSequence (length_, level_) {
_length = length_;
_lvl = level_;
_matchCount = 0;
_missCount = 0;
_sequence = GenerateSequenceArray(length_);
_numberFlags = 0;
var _local2 = 0;
while (_local2 < _sequence.length) {
_numberFlags = _numberFlags + Math.pow(2, _sequence[_local2]);
_local2++;
}
}
function get Level() {
return(_lvl);
}
function get MatchCount() {
return(_matchCount);
}
function set MatchCount(count_) {
_matchCount = count_;
//return(MatchCount);
}
function get MissCount() {
return(_missCount);
}
function set MissCount(count_) {
_missCount = count_;
//return(MissCount);
}
function GetElement(index_, reverse_) {
if (index_ > (_length - 1)) {
throw new Error(((("Index (" + index_.toString()) + ") greater than sequence length (") + _length.toString()) + ")");
}
if (!reverse_) {
return(_sequence[index_]);
}
return(_sequence[(_length - index_) - 1]);
}
function GenerateSequenceArray(length_) {
var _local5 = new Array();
var _local1 = new Array();
for (var _local3 in _elements) {
_local1.push(_elements[_local3]);
}
var _local3 = 0;
while (_local3 < length_) {
var _local2 = Dice.Roll(0, _local1.length - 1);
var _local4 = _local1[_local2];
_local5.push(_local4);
_local1.splice(_local2, 1);
_local3++;
}
return(_local5);
}
function get Length() {
return(_length);
}
function Contains(n_) {
var _local2 = (_numberFlags & Math.pow(2, n_)) != 0;
return(_local2);
}
static var _elements = [1, 2, 3, 4, 5, 6, 7, 8, 9];
}
Symbol 65 MovieClip [__Packages.Dice] Frame 0
class Dice
{
function Dice () {
}
static function ChooseOneOf() {
if (arguments.length == 0) {
throw new Error("No arguments passed to ChooseOneOf");
}
var _local2 = Roll(0, arguments.length - 1);
return(arguments[_local2]);
}
static function Roll(min_, max_) {
return(Math.floor(Math.random() * ((max_ - min_) + 1)) + min_);
}
}
Symbol 66 MovieClip [__Packages.AppearBehavior] Frame 0
class AppearBehavior implements IBehavior
{
var _t;
function AppearBehavior (target_, text_, duration_) {
_duration = ((duration_ == undefined) ? 10 : (duration_));
_text = text_;
_t = target_;
}
function Initialize() {
if ((_text != null) && (_text != undefined)) {
_t.__set__Text(_text);
}
_step = (_finalAlpha - _t._alpha) / _duration;
_t._alpha = 0;
_t._visible = true;
_t.Unlight();
}
function Update() {
_c++;
if (_c <= _duration) {
_t.AddAlpha(_step);
return(true);
}
_t.Unhide();
return(false);
}
function Abort() {
}
function get Target() {
return(_t);
}
function toString() {
return((((_t._name + " [APPEAR \"") + _text) + "\"] step ") + _c.toString());
}
var _duration = 0;
var _step = 0;
var _c = 0;
var _finalAlpha = 100;
var _text = "";
}
Symbol 67 MovieClip [__Packages.AppearWithSoundBehavior] Frame 0
class AppearWithSoundBehavior extends AppearBehavior
{
var __get__Target;
function AppearWithSoundBehavior (target_, text_, duration_) {
super(target_, text_, duration_);
}
function Initialize() {
super.Initialize();
__get__Target().PlaySound();
}
function toString() {
return("[APPEARWITHSOUNDBEHAVIOR]");
}
}
Symbol 68 MovieClip [__Packages.WaitForNumberPressBehavior] Frame 0
class WaitForNumberPressBehavior implements IBehavior
{
var _game, _puzzle, _target, _nextBehavior;
function WaitForNumberPressBehavior (game_, puzzle_, target_, number_) {
_game = game_;
_puzzle = puzzle_;
_target = target_;
_number = number_;
_keyCode = CODE_0 + _number;
_nextBehavior = null;
}
function onKeyDown() {
var _local2 = Key.getCode();
if ((_local2 >= (CODE_0 + 1)) && (_local2 <= (CODE_0 + 9))) {
var _local3 = _local2 - CODE_0;
_match = _local3 == _number;
_target.Light(_match);
if (!_match) {
var _local4 = _game.GetBoxIndexFromNumber(_local3);
var _local6 = !_puzzle.Contains(_local4);
var _local5 = _game.GetBox(_local4);
_local5.ShowStrike(_local6);
} else {
_target.PlaySound();
}
_keyPressed = true;
}
}
function Initialize() {
_listener = new Object();
_listener.onKeyDown = mx.utils.Delegate.create(this, onKeyDown);
Key.addListener(_listener);
}
function Update() {
if (_keyPressed) {
_game.PuzzleMatch(_match, _puzzle, _number);
if (_match) {
Abort();
return(false);
}
if (_game.IsGameOver()) {
Abort();
return(false);
}
_keyPressed = false;
return(true);
}
return(true);
}
function Abort() {
Key.removeListener(_listener);
}
function toString() {
return(("[WAITFORNUMBERPRESS (" + _number.toString()) + ")]");
}
function Clone() {
return(new WaitForNumberPressBehavior(_game, _puzzle, _target, _number));
}
var _keyPressed = false;
var _listener = null;
var _number = -1;
var _keyCode = -1;
var _match = undefined;
static var CODE_0 = 96;
}
Symbol 69 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 70 MovieClip [__Packages.DisappearBehavior] Frame 0
class DisappearBehavior implements IBehavior
{
var _target;
function DisappearBehavior (target_, duration_) {
_duration = duration_;
_target = target_;
}
function get Target() {
return(_target);
}
function Initialize() {
_step = (_target._alpha - _finalAlpha) / _duration;
}
function Update() {
if (_target.IsHidden()) {
return(false);
}
_c++;
if (_c <= _duration) {
_target._alpha = _target._alpha - _step;
return(true);
}
_target._alpha = _finalAlpha;
_target.Hide();
_target.Unlight();
return(false);
}
function Abort() {
}
function toString() {
return((_target._name + " [DISAPPEAR] step ") + _c.toString());
}
var _duration = 0;
var _step = 0;
var _c = 0;
var _finalAlpha = 0;
}
Symbol 71 MovieClip [__Packages.PlaySoundBehavior] Frame 0
class PlaySoundBehavior implements IBehavior
{
var _soundID, _done, _s;
function PlaySoundBehavior (soundID_) {
_soundID = soundID_;
_done = false;
_s = new Sound();
_s.attachSound(_soundID);
}
function Initialize() {
_s.onSoundComplete = mx.utils.Delegate.create(this, function () {
this._done = true;
});
_s.start();
}
function Update() {
return(!_done);
}
function Abort() {
_s.stop();
_done = true;
}
function toString() {
return(("[PLAYSOUND(" + _soundID) + ")]");
}
}
Symbol 72 MovieClip [__Packages.GenericBehavior] Frame 0
class GenericBehavior implements IBehavior
{
var _function, _param;
function GenericBehavior (function_, param_) {
_function = function_;
_param = param_;
}
function Initialize() {
if (undefined != _param) {
_function(_param);
} else {
_function();
}
}
function Update() {
return(false);
}
function Abort() {
}
function toString() {
return("[GENERICBEHAVIOR]");
}
}
Symbol 73 MovieClip [__Packages.MultiBehavior] Frame 0
class MultiBehavior implements IBehavior
{
var _behaviors, _waitAll;
function MultiBehavior (behaviors_, waitAll_, waitIndex_) {
_behaviors = behaviors_;
_waitAll = ((undefined == waitAll_) ? true : (waitAll_));
_doneFlags = 0;
_waitIndex = ((undefined == waitIndex_) ? -1 : (waitIndex_));
}
function Initialize() {
var _local2 = 0;
while (_local2 < _behaviors.length) {
var _local3 = _behaviors[_local2];
_local3.Initialize();
_local2++;
}
}
function Update() {
var _local2;
var _local4 = 0;
while (_local4 < _behaviors.length) {
var _local3 = _behaviors[_local4].Update();
if (_waitIndex > -1) {
if (_local4 == _waitIndex) {
_local2 = _local3;
}
} else if (undefined == _local2) {
_local2 = _local3;
} else if (_waitAll) {
_local2 = _local2 || (_local3);
} else {
_local2 = _local2 && (_local3);
}
if (!_local3) {
}
_local4++;
}
return(_local2);
}
function Abort() {
var _local2 = 0;
while (_local2 < _behaviors.length) {
var _local3 = _behaviors[_local2];
_local3.Abort();
_local2++;
}
}
function toString() {
return(("[MULTIBEHAVIOR: ( " + _behaviors) + " )]");
}
var _doneFlags = 0;
var _waitIndex = -1;
}
Symbol 74 MovieClip [__Packages.WaitForKeyPressBehavior] Frame 0
class WaitForKeyPressBehavior implements IBehavior
{
var _callback, _scopeObject;
function WaitForKeyPressBehavior (callback_, scopeObject_) {
_callback = callback_;
_scopeObject = scopeObject_;
}
function onKeyDown() {
_keyPressed = true;
}
function Initialize() {
_listener = new Object();
_listener.onKeyDown = mx.utils.Delegate.create(this, onKeyDown);
Key.addListener(_listener);
}
function Update() {
if (_keyPressed) {
Abort();
return(false);
}
return(true);
}
function Abort() {
Key.removeListener(_listener);
ExecuteCallback();
}
function ExecuteCallback() {
if (undefined != _callback) {
_callback.call(_scopeObject);
}
}
function toString() {
return("[WAITFORKEYPRESS]");
}
var _keyPressed = false;
var _listener = null;
}
Symbol 75 MovieClip [__Packages.CancelableSleepBehavior] Frame 0
class CancelableSleepBehavior extends WaitForKeyPressBehavior
{
var ExecuteCallback;
function CancelableSleepBehavior (sleep_, callback_, scopeObject_) {
super(callback_, scopeObject_);
_sleep = sleep_;
_c = 0;
}
function Update() {
if ((++_c) > _sleep) {
ExecuteCallback();
return(false);
}
return(super.Update());
}
function toString() {
return(("[CANCELABLESLEEP(" + _sleep.toString()) + ")]");
}
var _sleep = 0;
var _c = 0;
}
Symbol 76 MovieClip [__Packages.FlashBehavior] Frame 0
class FlashBehavior implements IBehavior
{
var _target, _duration, _c;
function FlashBehavior (target_, duration_) {
_target = target_;
_duration = duration_;
_c = 0;
}
function Initialize() {
_target.Flash();
}
function Update() {
if ((++_c) <= _duration) {
return(true);
}
Abort();
return(false);
}
function Abort() {
trace(toString() + " aborting");
_target.Unflash();
}
function toString() {
return(_target._name + " [FLASHBEHAVIOR]");
}
}
Symbol 77 MovieClip [__Packages.StrikeBox] Frame 0
class StrikeBox extends MovieClip
{
var _state, gotoAndPlay, gotoAndStop;
function StrikeBox () {
super();
_state = STATE_DEFAULT;
}
function ShowStrike() {
(gotoAndPlay("strikeout"));// not popped
_state = STATE_STRIKE;
}
function ShowCheck() {
(gotoAndPlay("check"));// not popped
_state = STATE_CHECK;
}
function Clear() {
(gotoAndStop("default"));// not popped
_state = STATE_DEFAULT;
}
static var STATE_DEFAULT = 1;
static var STATE_CHECK = 2;
static var STATE_STRIKE = 3;
}
Symbol 78 MovieClip [__Packages.TextOverlay] Frame 0
class TextOverlay extends NumberBox
{
function TextOverlay (text_) {
super(text_);
}
}