Section 1
//CustomSharedObject (classes.CustomSharedObject)
package classes {
import flash.net.*;
public class CustomSharedObject {
public static var data:Object;
private static var ID:String;
private static var so:SharedObject;
public static function init(_arg1:String, _arg2:String=null):void{
ID = _arg1;
so = SharedObject.getLocal(ID, _arg2);
data = so.data;
}
public static function updateData(_arg1:Object):void{
var _local2:*;
for (_local2 in _arg1) {
so.data[_local2] = _arg1[_local2];
};
so.flush();
data = so.data;
}
public static function deleteData(_arg1:Object):void{
var _local2:*;
for (_local2 in _arg1) {
delete so.data[_local2];
};
so.flush();
data = so.data;
}
public static function checkData(_arg1:String, _arg2:Boolean=false, _arg3=null){
if (so.data[_arg1] != undefined){
return (so.data[_arg1]);
};
if (_arg2){
so.data[_arg1] = _arg3;
};
return (_arg3);
}
public static function clear():void{
so.clear();
so.flush();
data = so.data;
}
}
}//package classes
Section 2
//Settings (classes.Settings)
package classes {
public class Settings {
public static var propertyData:Object = {};
public static function set(_arg1:Object):void{
var _local2:*;
for (_local2 in _arg1) {
propertyData[_local2] = _arg1[_local2];
};
}
public static function get(_arg1:String){
if (propertyData[_arg1] == null){
throw (new Error((("Settings property:" + _arg1) + " not found")));
};
return (propertyData[_arg1]);
}
}
}//package classes
Section 3
//SoundControl (classes.SoundControl)
package classes {
import flash.utils.*;
import flash.media.*;
public class SoundControl {
private static var bgMusic:Sound;
public static var isSoundOn:Boolean = true;
private static var bgChannel:SoundChannel;
public static var overallVolume:int = 100;
public static function toggleSound(_arg1:Boolean):void{
var _local2:SoundTransform;
isSoundOn = _arg1;
if (isSoundOn){
_local2 = bgChannel.soundTransform;
_local2.volume = 0.2;
bgChannel.soundTransform = _local2;
} else {
_local2 = bgChannel.soundTransform;
_local2.volume = 0;
bgChannel.soundTransform = _local2;
};
}
public static function playSound(_arg1:String, _arg2:Number, _arg3:int=0):void{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:SoundTransform;
if (isSoundOn){
_local4 = getDefinitionByName(_arg1);
_local5 = new (_local4);
_local6 = _local5.play(0, _arg3);
_local7 = _local6.soundTransform;
_local7.volume = _arg2;
_local6.soundTransform = _local7;
};
}
public static function init():void{
var _local1:SoundTransform;
isSoundOn = CustomSharedObject.checkData("isSoundOn", true, true);
overallVolume = (isSoundOn) ? 100 : 0;
bgMusic = new BackgroundMusic1();
bgChannel = bgMusic.play(0, 99999);
_local1 = bgChannel.soundTransform;
_local1.volume = (isSoundOn) ? 0.2 : 0;
bgChannel.soundTransform = _local1;
}
}
}//package classes
Section 4
//None (fl.transitions.easing.None)
package fl.transitions.easing {
public class None {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.transitions.easing
Section 5
//Regular (fl.transitions.easing.Regular)
package fl.transitions.easing {
public class Regular {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
}
}//package fl.transitions.easing
Section 6
//Strong (fl.transitions.easing.Strong)
package fl.transitions.easing {
public class Strong {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
}
}//package fl.transitions.easing
Section 7
//Tween (fl.transitions.Tween)
package fl.transitions {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Tween extends EventDispatcher {
private var _position:Number;// = NAN
public var prevTime:Number;// = NAN
public var prevPos:Number;// = NAN
public var isPlaying:Boolean;// = false
public var begin:Number;// = NAN
private var _fps:Number;// = NAN
private var _time:Number;// = NAN
public var change:Number;// = NAN
private var _finish:Number;// = NAN
public var looping:Boolean;// = false
private var _intervalID:uint;// = 0
public var func:Function;
private var _timer:Timer;// = null
private var _startTime:Number;// = NAN
public var prop:String;// = ""
private var _duration:Number;// = NAN
public var obj:Object;// = null
public var useSeconds:Boolean;// = false
protected static var _mc:MovieClip = new MovieClip();
public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
isPlaying = false;
obj = null;
prop = "";
func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
};
begin = NaN;
change = NaN;
useSeconds = false;
prevTime = NaN;
prevPos = NaN;
looping = false;
_duration = NaN;
_time = NaN;
_fps = NaN;
_position = NaN;
_startTime = NaN;
_intervalID = 0;
_finish = NaN;
_timer = null;
super();
if (!arguments.length){
return;
};
this.obj = _arg1;
this.prop = _arg2;
this.begin = _arg4;
this.position = _arg4;
this.duration = _arg6;
this.useSeconds = _arg7;
if ((_arg3 is Function)){
this.func = _arg3;
};
this.finish = _arg5;
this._timer = new Timer(100);
this.start();
}
public function continueTo(_arg1:Number, _arg2:Number):void{
this.begin = this.position;
this.finish = _arg1;
if (!isNaN(_arg2)){
this.duration = _arg2;
};
this.start();
}
public function stop():void{
this.stopEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
}
private function fixTime():void{
if (this.useSeconds){
this._startTime = (getTimer() - (this._time * 1000));
};
}
public function set FPS(_arg1:Number):void{
var _local2:Boolean;
_local2 = this.isPlaying;
this.stopEnterFrame();
this._fps = _arg1;
if (_local2){
this.startEnterFrame();
};
}
public function get finish():Number{
return ((this.begin + this.change));
}
public function get duration():Number{
return (this._duration);
}
protected function startEnterFrame():void{
var _local1:Number;
if (isNaN(this._fps)){
_mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
} else {
_local1 = (1000 / this._fps);
this._timer.delay = _local1;
this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
this._timer.start();
};
this.isPlaying = true;
}
public function set time(_arg1:Number):void{
this.prevTime = this._time;
if (_arg1 > this.duration){
if (this.looping){
this.rewind((_arg1 - this._duration));
this.update();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
} else {
if (this.useSeconds){
this._time = this._duration;
this.update();
};
this.stop();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
};
} else {
if (_arg1 < 0){
this.rewind();
this.update();
} else {
this._time = _arg1;
this.update();
};
};
}
protected function stopEnterFrame():void{
if (isNaN(this._fps)){
_mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
} else {
this._timer.stop();
};
this.isPlaying = false;
}
public function getPosition(_arg1:Number=NaN):Number{
if (isNaN(_arg1)){
_arg1 = this._time;
};
return (this.func(_arg1, this.begin, this.change, this._duration));
}
public function set finish(_arg1:Number):void{
this.change = (_arg1 - this.begin);
}
public function set duration(_arg1:Number):void{
this._duration = ((_arg1)<=0) ? Infinity : _arg1;
}
public function setPosition(_arg1:Number):void{
this.prevPos = this._position;
if (this.prop.length){
this.obj[this.prop] = (this._position = _arg1);
};
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
}
public function resume():void{
this.fixTime();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
}
public function fforward():void{
this.time = this._duration;
this.fixTime();
}
protected function onEnterFrame(_arg1:Event):void{
this.nextFrame();
}
public function get position():Number{
return (this.getPosition(this._time));
}
public function yoyo():void{
this.continueTo(this.begin, this.time);
}
public function nextFrame():void{
if (this.useSeconds){
this.time = ((getTimer() - this._startTime) / 1000);
} else {
this.time = (this._time + 1);
};
}
protected function timerHandler(_arg1:TimerEvent):void{
this.nextFrame();
_arg1.updateAfterEvent();
}
public function get FPS():Number{
return (this._fps);
}
public function rewind(_arg1:Number=0):void{
this._time = _arg1;
this.fixTime();
this.update();
}
public function set position(_arg1:Number):void{
this.setPosition(_arg1);
}
public function get time():Number{
return (this._time);
}
private function update():void{
this.setPosition(this.getPosition(this._time));
}
public function start():void{
this.rewind();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
}
public function prevFrame():void{
if (!this.useSeconds){
this.time = (this._time - 1);
};
}
}
}//package fl.transitions
Section 8
//TweenEvent (fl.transitions.TweenEvent)
package fl.transitions {
import flash.events.*;
public class TweenEvent extends Event {
public var time:Number;// = NAN
public var position:Number;// = NAN
public static const MOTION_START:String = "motionStart";
public static const MOTION_STOP:String = "motionStop";
public static const MOTION_LOOP:String = "motionLoop";
public static const MOTION_CHANGE:String = "motionChange";
public static const MOTION_FINISH:String = "motionFinish";
public static const MOTION_RESUME:String = "motionResume";
public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
time = NaN;
position = NaN;
super(_arg1, _arg4, _arg5);
this.time = _arg2;
this.position = _arg3;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
}
}
}//package fl.transitions
Section 9
//Director (game.Director)
package game {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Director extends Sprite {
public var arrow4_mc:MovieClip;
public var arrow2_mc:MovieClip;
public var arrow5_mc:MovieClip;
private var selectedHex:Hex;
public var arrow3_mc:MovieClip;
public var arrow6_mc:MovieClip;
public var arrow1_mc:MovieClip;
public function Director():void{
var _local1:int;
super();
_local1 = 1;
while (_local1 <= 6) {
this[(("arrow" + _local1) + "_mc")].dir = _local1;
this[(("arrow" + _local1) + "_mc")].buttonMode = true;
this[(("arrow" + _local1) + "_mc")].addEventListener(MouseEvent.MOUSE_OVER, rollOverArrow);
this[(("arrow" + _local1) + "_mc")].addEventListener(MouseEvent.MOUSE_OUT, rollOutArrow);
this[(("arrow" + _local1) + "_mc")].addEventListener(MouseEvent.CLICK, selectDirection);
_local1++;
};
}
public function selectDirection(_arg1:MouseEvent):void{
selectedHex.move(_arg1.target.dir);
}
public function deactivate(_arg1:MouseEvent):void{
selectedHex.deselect();
visible = false;
stage.removeEventListener(MouseEvent.MOUSE_UP, deactivate);
}
public function rollOverArrow(_arg1:MouseEvent):void{
var _local2:*;
_local2 = _arg1.target;
_local2.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
public function activate(_arg1:Hex):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
selectedHex = _arg1;
selectedHex.select();
visible = true;
x = selectedHex.x;
y = selectedHex.y;
_local2 = ((selectedHex.col >> 16) & 0xFF);
_local3 = ((selectedHex.col >> 8) & 0xFF);
_local4 = ((selectedHex.col >> 0) & 0xFF);
_local5 = 1;
while (_local5 <= 6) {
this[(("arrow" + _local5) + "_mc")].transform.colorTransform = new ColorTransform((_local2 / 0xFF), (_local3 / 0xFF), (_local4 / 0xFF), 1, 0, 0, 0, 0);
_local5++;
};
stage.addEventListener(MouseEvent.MOUSE_UP, deactivate);
}
public function rollOutArrow(_arg1:MouseEvent):void{
var _local2:*;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = _arg1.target;
_local3 = ((selectedHex.col >> 16) & 0xFF);
_local4 = ((selectedHex.col >> 8) & 0xFF);
_local5 = ((selectedHex.col >> 0) & 0xFF);
_local2.transform.colorTransform = new ColorTransform((_local3 / 0xFF), (_local4 / 0xFF), (_local5 / 0xFF), 1, 0, 0, 0, 0);
}
}
}//package game
Section 10
//Game (game.Game)
package game {
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
import uinterface.*;
import classes.*;
import fl.transitions.easing.*;
import flash.geom.*;
public class Game extends Sprite {
private const FLOOR_TILE_HEIGHT:int = 26;
private const GRID_START_X:int = 272;
private const GRID_RADIUS:int = 4;
private const GRID_START_Y:int = 207;
private const GRID_GAP_X:Number = 46;
private const GRID_INC_X:Number = 12;
private const HEX_HEIGHT:int = 12;
private var gridList:Array;
private var fadeHexIndex:int;// = 0
public var level_mc:Level;
private var isEditor:Boolean;// = false
private var hexHint:MovieClip;
private var editorHexIconList:Array;
private var endTileList:Array;
public var mainmenu_but:SimpleButton;
private var hexList:Array;
private var theEndTile;
public var currentLevel:int;
private var director:Director;
public var editor_mc:MovieClip;
private var hexHolder:Sprite;
private var floorList:Array;
private var fadeEndTileIndex:int;// = 0
public var bg_mc:MovieClip;
private var currentLevelData:Object;
public var resetlevel_but:SimpleButton;
private var editorColourList:Array;
public function Game():void{
gridList = [];
hexList = [];
endTileList = [];
floorList = [];
fadeEndTileIndex = 0;
fadeHexIndex = 0;
isEditor = false;
editorColourList = [52479, 0xFFCC00, 0xCC00, 0xFF0000, 10066380, 0xFF9900, 16737996, 0x999900];
editorHexIconList = [];
super();
director = new Director();
director.visible = false;
hexHolder = new Sprite();
addChild(hexHolder);
if (isEditor){
drawFloor();
enableEditor();
} else {
editor_mc.visible = false;
};
mainmenu_but.addEventListener(MouseEvent.CLICK, onMainMenu);
resetlevel_but.addEventListener(MouseEvent.CLICK, onResetLevel);
}
public function disableHexes():void{
var _local1:int;
_local1 = 0;
while (_local1 < hexList.length) {
hexList[_local1].disable();
_local1++;
};
}
private function startFadeInHexes():void{
fadeHexIndex = 0;
fadeInHex(null);
}
public function removeEditorHexIcons():void{
var _local1:int;
var _local2:int;
_local1 = editor_mc.icons_mc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
editor_mc.icons_mc.removeChildAt(0);
_local2++;
};
}
private function clearEditor(_arg1:MouseEvent):void{
var _local2:int;
_local2 = 0;
while (_local2 < editorHexIconList.length) {
removeHex(editorHexIconList[_local2].hex);
_local2++;
};
editorHexIconList = [];
drawFloor();
removeEditorHexIcons();
drawEditorHexIcons();
}
public function removeHexHint():void{
if (hexHint != null){
removeChild(hexHint);
hexHint = null;
};
}
private function clearFloor():void{
var _local1:int;
var _local2:int;
gridList = [];
floorList = [];
endTileList = [];
_local1 = bg_mc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
bg_mc.removeChildAt(0);
_local2++;
};
}
private function drawHexes(_arg1:Boolean=false):void{
var _local2:int;
var _local3:*;
clearHexes();
_local2 = 0;
while (_local2 < currentLevelData.hexList.length) {
_local3 = drawHex(currentLevelData.hexList[_local2].x, currentLevelData.hexList[_local2].y, currentLevelData.hexList[_local2].z, currentLevelData.hexList[_local2].col, _arg1);
_local2++;
};
if (currentLevel == 1){
hexHint = new HexHint();
hexHint.x = hexHolder.getChildAt(0).x;
hexHint.y = hexHolder.getChildAt(0).y;
addChild(hexHint);
};
setHexDepths();
}
public function positionHex(_arg1:Hex, _arg2:int, _arg3:int, _arg4:int):void{
if ((_arg2 % 2) == 0){
_arg1.x = ((GRID_START_X + (_arg2 * GRID_GAP_X)) - (_arg3 * GRID_INC_X));
_arg1.y = (((GRID_START_Y + (_arg3 * FLOOR_TILE_HEIGHT)) - (FLOOR_TILE_HEIGHT / 2)) - (HEX_HEIGHT * _arg4));
} else {
_arg1.x = (((GRID_START_X + (_arg2 * GRID_GAP_X)) - (_arg3 * GRID_INC_X)) - 6);
_arg1.y = ((GRID_START_Y + (_arg3 * FLOOR_TILE_HEIGHT)) - (HEX_HEIGHT * _arg4));
};
}
public function setHexDepths():void{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = hexHolder.numChildren;
_local2 = 0;
while (_local2 < _local1) {
hexHolder.removeChildAt(0);
_local2++;
};
_local3 = 0;
while (_local3 < hexList.length) {
hexList[_local3].zPosX = Math.abs(hexList[_local3].posX);
hexList[_local3].zPosY = hexList[_local3].posY;
if ((hexList[_local3].zPosX % 2) == 1){
hexList[_local3].zPosY = (hexList[_local3].zPosY + 0.5);
hexList[_local3].zPosX--;
};
_local3++;
};
hexList.sortOn(["posZ", "zPosY", "zPosX"], [Array.NUMERIC, Array.NUMERIC, Array.NUMERIC]);
_local2 = 0;
while (_local2 < hexList.length) {
hexHolder.addChild(hexList[_local2]);
_local2++;
};
hexHolder.addChild(director);
}
private function drawHex(_arg1:int, _arg2:int, _arg3:int, _arg4:uint, _arg5:Boolean=false):Hex{
var _local6:Hex;
var _local7:int;
var _local8:int;
var _local9:int;
trace("Game - drawHex");
trace((" i:" + _arg1));
trace((" j:" + _arg2));
trace((" k:" + _arg3));
trace((" col:" + _arg4));
_local6 = new Hex(this, _arg1, _arg2, _arg3, _arg4);
_local7 = ((_arg4 >> 16) & 0xFF);
_local8 = ((_arg4 >> 8) & 0xFF);
_local9 = ((_arg4 >> 0) & 0xFF);
_local6.transform.colorTransform = new ColorTransform((_local7 / 0xFF), (_local8 / 0xFF), (_local9 / 0xFF), 1, 0, 0, 0, 0);
if (!_arg5){
_local6.alpha = 0;
} else {
_local6.alpha = 0.5;
};
positionHex(_local6, _arg1, _arg2, _arg3);
_local6.addEventListener(MouseEvent.CLICK, activateHex);
hexHolder.addChild(_local6);
hexList.push(_local6);
return (_local6);
}
private function exportEditor(_arg1:MouseEvent):void{
var _local2:String;
var _local3:int;
_local2 = "{endList:[";
_local3 = 0;
while (_local3 < editorHexIconList.length) {
_local2 = (_local2 + (((((("{x:" + editorHexIconList[_local3].endX) + ", y:") + editorHexIconList[_local3].endY) + ", col:") + editorHexIconList[_local3].hex.col) + "}"));
if (_local3 != (editorHexIconList.length - 1)){
_local2 = (_local2 + ", ");
};
_local3++;
};
_local2 = (_local2 + "], hexList:[");
_local3 = 0;
while (_local3 < editorHexIconList.length) {
_local2 = (_local2 + (((((("{x:" + editorHexIconList[_local3].pos_box.text.split(",")[0]) + ", y:") + editorHexIconList[_local3].pos_box.text.split(",")[1]) + ", z:0, type:0, col:") + editorHexIconList[_local3].hex.col) + "}"));
if (_local3 != (editorHexIconList.length - 1)){
_local2 = (_local2 + ", ");
};
_local3++;
};
_local2 = (_local2 + "]}");
trace(("export:\n" + _local2));
}
public function addEditorHex(_arg1:MouseEvent):void{
var _local2:Hex;
var _local3:*;
removeEditorHexIcons();
_local2 = drawHex(0, 0, 0, editorColourList[editorHexIconList.length]);
_local3 = new Editor_Hex();
_local3.hex = _local2;
_local3.endX = 4;
_local3.endY = 2;
_local3.pos_box.text = "0,0";
_local3.upd_start_but.addEventListener(MouseEvent.CLICK, updateStartPos);
_local3.upd_end_but.addEventListener(MouseEvent.CLICK, updateEndPos);
_local3.remove_but.addEventListener(MouseEvent.CLICK, removeEditorHex);
editorHexIconList.push(_local3);
drawEditorHexIcons();
drawFloor();
setHexDepths();
}
private function removeHex(_arg1:Hex):void{
var _local2:int;
_local2 = 0;
while (_local2 < hexList.length) {
if (hexList[_local2] == _arg1){
hexList[_local2].removeEventListener(MouseEvent.CLICK, activateHex);
hexHolder.removeChild(hexList[_local2]);
hexList.splice(_local2, 1);
break;
};
_local2++;
};
}
public function loadLevel(_arg1:int, _arg2:Boolean=false):void{
trace(("Game -loadLevel - id:" + _arg1));
currentLevel = _arg1;
currentLevelData = LevelData.getLevel((_arg1 - 1));
level_mc.levelnum_box.text = String(_arg1);
drawFloor(_arg2);
drawHexes(_arg2);
}
private function startFadeInEndTiles():void{
fadeEndTileIndex = 0;
fadeInEndTile(null);
}
public function removeEditorHex(_arg1:MouseEvent):void{
var _local2:int;
trace(("e.target.parent:" + _arg1.target.parent));
_local2 = 0;
while (_local2 < editorHexIconList.length) {
if (_arg1.target.parent == editorHexIconList[_local2]){
break;
};
_local2++;
};
removeHex(editorHexIconList[_local2].hex);
editorHexIconList.splice(_local2, 1);
drawFloor();
removeEditorHexIcons();
drawEditorHexIcons();
}
private function updateStartPos(_arg1:MouseEvent):void{
var _local2:Hex;
var _local3:*;
var _local4:*;
_local2 = _arg1.target.parent.hex;
_local3 = _arg1.target.parent.pos_box.text.split(",")[0];
_local4 = _arg1.target.parent.pos_box.text.split(",")[1];
_local2.posX = _local3;
_local2.posY = _local4;
positionHex(_local2, _local2.posX, _local2.posY, _local2.posZ);
}
private function drawFloor(_arg1:Boolean=false):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:*;
var _local8:ColorTransform;
clearFloor();
_local2 = (-(GRID_RADIUS) + 1);
while (_local2 <= (GRID_RADIUS - 1)) {
_local3 = (((GRID_RADIUS * 2) - 1) - Math.abs(_local2));
_local4 = -(Math.floor((_local3 / 2)));
_local5 = _local4;
while (_local5 < (_local3 + _local4)) {
drawFloorTile(_local2, _local5);
_local5++;
};
_local2++;
};
if (isEditor){
_local6 = 0;
while (_local6 < editorHexIconList.length) {
_local7 = drawFloorTile(editorHexIconList[_local6].endX, editorHexIconList[_local6].endY, _arg1, true, editorHexIconList[_local6].hex.col);
_local8 = _local7.fill_mc.transform.colorTransform;
_local8.color = editorHexIconList[_local6].hex.col;
_local7.fill_mc.transform.colorTransform = _local8;
_local6++;
};
} else {
_local6 = 0;
while (_local6 < currentLevelData.endList.length) {
_local7 = drawFloorTile(currentLevelData.endList[_local6].x, currentLevelData.endList[_local6].y, _arg1, true, currentLevelData.endList[_local6].col);
_local8 = _local7.fill_mc.transform.colorTransform;
_local8.color = currentLevelData.endList[_local6].col;
_local7.fill_mc.transform.colorTransform = _local8;
_local6++;
};
};
if (!_arg1){
startFadeInEndTiles();
};
}
public function removeFloorTarget():void{
if (currentLevel == 1){
theEndTile.hint_mc.visible = false;
};
}
private function fadeInHex(_arg1:TweenEvent):void{
if (fadeHexIndex < hexList.length){
SoundControl.playSound("HexAppear", 0.15);
fadeTween = new Tween(hexList[fadeHexIndex], "alpha", Regular.easeOut, 0, 0.5, 0.3, true);
fadeTween.addEventListener(TweenEvent.MOTION_FINISH, fadeInHex);
fadeHexIndex++;
};
}
public function drawEditorHexIcons():void{
var _local1:int;
var _local2:ColorTransform;
_local1 = 0;
while (_local1 < editorHexIconList.length) {
editorHexIconList[_local1].x = (30 + (_local1 * 50));
_local2 = editorHexIconList[_local1].colourbox_mc.transform.colorTransform;
_local2.color = editorHexIconList[_local1].hex.col;
editorHexIconList[_local1].colourbox_mc.transform.colorTransform = _local2;
editorHexIconList[_local1].col_box.text = editorHexIconList[_local1].hex.col;
editorHexIconList[_local1].endpos_box.text = ((editorHexIconList[_local1].endX + ",") + editorHexIconList[_local1].endY);
editor_mc.icons_mc.addChild(editorHexIconList[_local1]);
_local1++;
};
}
private function onMainMenu(_arg1:MouseEvent):void{
WindowManager.openWindow("Win_LoadLevel");
}
private function fadeInEndTile(_arg1:TweenEvent):void{
if (fadeEndTileIndex < endTileList.length){
SoundControl.playSound("FloorAppear", 0.25);
fadeTween = new Tween(endTileList[fadeEndTileIndex], "alpha", Regular.easeOut, 0, 1, 0.3, true);
fadeTween.addEventListener(TweenEvent.MOTION_FINISH, fadeInEndTile);
fadeEndTileIndex++;
} else {
startFadeInHexes();
};
}
public function checkLevelComplete():void{
var _local1:Boolean;
var _local2:int;
trace("Game - checkLevelComplete");
_local1 = true;
_local2 = 0;
while (_local2 < hexList.length) {
if (!hexList[_local2].isComplete){
_local1 = false;
break;
};
_local2++;
};
if (_local1){
completeLevel();
};
}
private function updateEndPos(_arg1:MouseEvent):void{
_arg1.target.parent.endX = _arg1.target.parent.endpos_box.text.split(",")[0];
_arg1.target.parent.endY = _arg1.target.parent.endpos_box.text.split(",")[1];
drawFloor();
}
private function activateHex(_arg1:MouseEvent):void{
var _local2:*;
_local2 = _arg1.target;
if (_local2.isEnabled){
director.activate(_local2);
};
}
private function completeLevel():void{
var _local1:Object;
_local1 = {};
_local1[(("isLevel" + currentLevel) + "Complete")] = true;
CustomSharedObject.updateData(_local1);
WindowManager.openWindow("Win_LevelComplete", currentLevel);
}
private function rotateFloor():void{
}
private function updateAllStartPos(_arg1:MouseEvent):void{
var _local2:int;
_local2 = 0;
while (_local2 < editorHexIconList.length) {
editorHexIconList[_local2].pos_box.text = ((editorHexIconList[_local2].hex.posX + ",") + editorHexIconList[_local2].hex.posY);
_local2++;
};
}
private function onResetLevel(_arg1:MouseEvent):void{
loadLevel(currentLevel, true);
}
public function checkSpace(_arg1:int, _arg2:int, _arg3:int):Boolean{
var _local4:int;
_local4 = 0;
while (_local4 < hexList.length) {
if ((((((hexList[_local4].posX == _arg1)) && ((hexList[_local4].posY == _arg2)))) && ((hexList[_local4].posZ == _arg3)))){
return (false);
};
_local4++;
};
if (gridList[_arg1] == null){
return (false);
};
if (gridList[_arg1][_arg2] == null){
return (false);
};
return (true);
}
public function enableEditor():void{
editor_mc.add_but.addEventListener(MouseEvent.CLICK, addEditorHex);
editor_mc.update_but.addEventListener(MouseEvent.CLICK, updateAllStartPos);
editor_mc.export_but.addEventListener(MouseEvent.CLICK, exportEditor);
editor_mc.clear_but.addEventListener(MouseEvent.CLICK, clearEditor);
editor_mc.reset_but.addEventListener(MouseEvent.CLICK, resetEditor);
}
private function clearHexes():void{
var _local1:int;
var _local2:int;
var _local3:*;
hexList = [];
_local1 = hexHolder.numChildren;
_local2 = 0;
while (_local2 < _local1) {
_local3 = hexHolder.getChildAt(0);
_local3.removeEventListener(MouseEvent.CLICK, activateHex);
hexHolder.removeChildAt(0);
_local2++;
};
}
public function enableHexes():void{
var _local1:int;
_local1 = 0;
while (_local1 < hexList.length) {
hexList[_local1].enable();
_local1++;
};
}
public function checkCompleteHex(_arg1:Hex, _arg2, _arg3, _arg4):Boolean{
if (isEditor){
return (false);
};
if (gridList[_arg2][_arg3].isEndTile){
if (gridList[_arg2][_arg3].endColour == _arg1.col){
return (true);
};
};
return (false);
}
private function drawFloorTile(_arg1:int, _arg2:int, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:uint=0):FloorTile{
var _local6:*;
var _local7:int;
_local6 = new FloorTile();
if ((_arg1 % 2) == 0){
_local6.x = ((GRID_START_X + (_arg1 * GRID_GAP_X)) - (_arg2 * GRID_INC_X));
_local6.y = ((GRID_START_Y + (_arg2 * FLOOR_TILE_HEIGHT)) - (FLOOR_TILE_HEIGHT / 2));
} else {
_local6.x = (((GRID_START_X + (_arg1 * GRID_GAP_X)) - (_arg2 * GRID_INC_X)) - 6);
_local6.y = (GRID_START_Y + (_arg2 * FLOOR_TILE_HEIGHT));
};
_local6.isEndTile = _arg4;
if (((_arg4) && (!(_arg3)))){
_local6.alpha = 0;
endTileList.push(_local6);
};
_local6.hint_mc.visible = false;
if (((_arg4) && ((currentLevel == 1)))){
theEndTile = _local6;
_local6.hint_mc.visible = true;
};
_local6.endColour = _arg5;
if (((((Math.abs(_arg1) % 2) == 1)) && ((_arg2 > 0)))){
_local7 = Math.max(Math.abs(_arg1), (Math.abs(_arg2) + 1));
} else {
_local7 = Math.max(Math.abs(_arg1), Math.abs(_arg2));
};
if ((((Math.abs(_arg1) == 2)) && ((Math.abs(_arg2) == 2)))){
_local7++;
};
if (floorList[_local7] == null){
floorList[_local7] = [];
};
floorList[_local7].push(_local6);
_local6.fill_mc.gotoAndStop((_local7 + 3));
bg_mc.addChild(_local6);
if (gridList[_arg1] == null){
gridList[_arg1] = [];
};
gridList[_arg1][_arg2] = _local6;
return (_local6);
}
private function resetEditor(_arg1:MouseEvent):void{
var _local2:int;
_local2 = 0;
while (_local2 < editorHexIconList.length) {
editorHexIconList[_local2].hex.posX = editorHexIconList[_local2].pos_box.text.split(",")[0];
editorHexIconList[_local2].hex.posY = editorHexIconList[_local2].pos_box.text.split(",")[1];
positionHex(editorHexIconList[_local2].hex, editorHexIconList[_local2].hex.posX, editorHexIconList[_local2].hex.posY, editorHexIconList[_local2].hex.posZ);
_local2++;
};
}
}
}//package game
Section 11
//Hex (game.Hex)
package game {
import flash.display.*;
import fl.transitions.*;
import classes.*;
import fl.transitions.easing.*;
import flash.filters.*;
public class Hex extends MovieClip {
private var moveXTween:Tween;
public var beam_mc:MovieClip;
private var _zPosX:Number;
private var _zPosY:Number;
private var _posX:int;
private var _posY:int;
public var isComplete:Boolean;// = false
private var _posZ:int;
private var dir:int;
public var isEnabled:Boolean;// = false
private var moveYTween:Tween;
private var directionList:Array;
private var _col:uint;
private var parentGame:Game;
private var isSelected:Boolean;// = false
private var movementList:Array;
private static const TWEEN_LEN:Number = 0.1;
public function Hex(_arg1:Game, _arg2:int, _arg3:int, _arg4:int, _arg5:uint):void{
isSelected = false;
isComplete = false;
isEnabled = false;
super();
addFrameScript(1, frame2, 6, frame7, 10, frame11, 15, frame16, 19, frame20, 24, frame25, 28, frame29);
parentGame = _arg1;
_posX = _arg2;
_posY = _arg3;
_posZ = _arg4;
_col = _arg5;
directionList = [{x:0, y:0, z:0}, {x:0, y:-1, z:0}, {x:1, y:-1, z:0}, {x:1, y:1, z:0}, {x:0, y:1, z:0}, {x:-1, y:1, z:0}, {x:-1, y:-1, z:0}];
movementList = [0, {xDist:12, yDist:-26}, {xDist:52, yDist:-13.5}, {xDist:40, yDist:13.5}, {xDist:-12, yDist:26}, {xDist:-52, yDist:13.5}, {xDist:-40, yDist:-13.5}];
enable();
beam_mc.visible = false;
mouseChildren = false;
}
private function doCompleteAnimation():void{
var _local1:*;
var _local2:Tween;
SoundControl.playSound("HexComplete", 0.6);
alpha = 1;
_local1 = new GlowFilter(col, 1, 8, 8, 2, 1);
filters = [_local1];
beam_mc.visible = true;
_local2 = new Tween(beam_mc, "alpha", Strong.easeOut, 0, 1, 0.3, true);
_local2.addEventListener(TweenEvent.MOTION_FINISH, doCompleteAnimation2);
}
public function select():void{
SoundControl.playSound("HexSelect", 0.1);
parentGame.removeHexHint();
isSelected = true;
}
public function set posX(_arg1:int):void{
_posX = _arg1;
}
public function set posZ(_arg1:int):void{
_posZ = _arg1;
}
public function get zPosX():Number{
return (_zPosX);
}
public function set posY(_arg1:int):void{
_posY = _arg1;
}
private function doCompleteAnimation2(_arg1:TweenEvent):void{
var _local2:Tween;
_local2 = new Tween(beam_mc, "alpha", Strong.easeIn, 1, 0, 0.3, true);
_local2.addEventListener(TweenEvent.MOTION_FINISH, doCompleteAnimation3);
}
public function set zPosX(_arg1:Number):void{
_zPosX = _arg1;
}
public function set zPosY(_arg1:Number):void{
_zPosY = _arg1;
}
public function doComplete():void{
var _local1:*;
trace("Hex - doComplete");
isComplete = true;
disable();
doCompleteAnimation();
parentGame.removeFloorTarget();
}
function frame7(){
startAnimation();
stop();
}
function frame25(){
startAnimation();
stop();
}
public function startAnimation():void{
moveXTween = null;
moveYTween = null;
moveXTween = new Tween(this, "x", None.easeNone, x, (x + movementList[dir].xDist), TWEEN_LEN, true);
moveYTween = new Tween(this, "y", None.easeNone, y, (y + movementList[dir].yDist), TWEEN_LEN, true);
moveXTween.addEventListener(TweenEvent.MOTION_FINISH, endMoveAnimation);
}
public function get posX():int{
return (_posX);
}
public function enable():void{
if (!isComplete){
buttonMode = true;
isEnabled = true;
};
}
public function get posZ():int{
return (_posZ);
}
private function endMoveAnimation(_arg1:TweenEvent):void{
parentGame.positionHex(this, _posX, _posY, _posZ);
parentGame.setHexDepths();
if (checkValidMove()){
startAnimation();
} else {
if (parentGame.checkCompleteHex(this, _posX, _posY, _posZ)){
doComplete();
};
doShrinkGrow("grow");
parentGame.enableHexes();
};
}
public function get posY():int{
return (_posY);
}
function frame11(){
gotoAndStop(2);
}
private function doCompleteAnimation3(_arg1:TweenEvent):void{
beam_mc.visible = false;
parentGame.checkLevelComplete();
}
public function get col():uint{
return (_col);
}
function frame20(){
gotoAndStop(2);
}
public function get zPosY():Number{
return (_zPosY);
}
function frame2(){
stop();
}
function frame29(){
gotoAndStop(2);
}
private function checkValidMove():Boolean{
var _local1:int;
if (((!((directionList[dir].x == 0))) && ((directionList[dir].y == 1)))){
if ((Math.abs(_posX) % 2) == 0){
_local1 = _posY;
} else {
_local1 = (_posY + directionList[dir].y);
};
} else {
if (((!((directionList[dir].x == 0))) && ((directionList[dir].y == -1)))){
if ((Math.abs(_posX) % 2) == 1){
_local1 = _posY;
} else {
_local1 = (_posY + directionList[dir].y);
};
} else {
_local1 = (_posY + directionList[dir].y);
};
};
if (parentGame.checkSpace((_posX + directionList[dir].x), _local1, (_posZ + directionList[dir].z))){
if (((!((directionList[dir].x == 0))) && ((directionList[dir].y == 1)))){
if ((Math.abs(_posX) % 2) == 0){
_posY = (_posY + 0);
} else {
_posY = (_posY + directionList[dir].y);
};
} else {
if (((!((directionList[dir].x == 0))) && ((directionList[dir].y == -1)))){
if ((Math.abs(_posX) % 2) == 1){
_posY = (_posY + 0);
} else {
_posY = (_posY + directionList[dir].y);
};
} else {
_posY = (_posY + directionList[dir].y);
};
};
_posX = (_posX + directionList[dir].x);
_posZ = (_posZ + directionList[dir].z);
return (true);
//unresolved jump
};
return (false);
}
private function doShrinkGrow(_arg1:String):void{
if ((((dir == 1)) || ((dir == 4)))){
gotoAndPlay((_arg1 + "1"));
} else {
if ((((dir == 2)) || ((dir == 5)))){
gotoAndPlay((_arg1 + "2"));
} else {
if ((((dir == 3)) || ((dir == 6)))){
gotoAndPlay((_arg1 + "3"));
};
};
};
}
public function deselect():void{
isSelected = false;
}
function frame16(){
startAnimation();
stop();
}
public function move(_arg1:int):void{
dir = _arg1;
if (checkValidMove()){
SoundControl.playSound("HexMove", 0.7);
parentGame.disableHexes();
doShrinkGrow("shrink");
};
}
public function disable():void{
buttonMode = false;
isEnabled = false;
}
}
}//package game
Section 12
//LevelData (game.LevelData)
package game {
public class LevelData {
private static const LEVEL_DATA:Array = [{endList:[{x:4, y:2, col:52479}], hexList:[{x:0, y:0, z:0, type:0, col:52479}]}, {endList:[{x:0, y:4, col:52479}, {x:4, y:1, col:0xFFCC00}], hexList:[{x:0, y:0, z:0, type:0, col:52479}, {x:0, y:1, z:0, type:0, col:0xFFCC00}]}, {endList:[{x:-4, y:0, col:52479}, {x:4, y:1, col:0xFFCC00}, {x:0, y:-4, col:0xCC00}], hexList:[{x:0, y:-3, z:0, type:0, col:52479}, {x:3, y:-2, z:0, type:0, col:0xFFCC00}, {x:-3, y:-2, z:0, type:0, col:0xCC00}]}, {endList:[{x:-4, y:2, col:52479}, {x:5, y:-3, col:0xFFCC00}, {x:4, y:-2, col:0xCC00}], hexList:[{x:0, y:0, z:0, type:0, col:52479}, {x:3, y:1, z:0, type:0, col:0xFFCC00}, {x:0, y:-3, z:0, type:0, col:0xCC00}]}, {endList:[{x:2, y:-1, col:52479}, {x:0, y:4, col:0xFFCC00}, {x:4, y:0, col:0xCC00}], hexList:[{x:-3, y:1, z:0, type:0, col:52479}, {x:-3, y:-2, z:0, type:0, col:0xFFCC00}, {x:0, y:-3, z:0, type:0, col:0xCC00}]}, {endList:[{x:0, y:2, col:52479}, {x:0, y:4, col:0xFFCC00}, {x:-3, y:-2, col:0xCC00}, {x:0, y:-2, col:0xFF0000}], hexList:[{x:0, y:-3, z:0, type:0, col:52479}, {x:0, y:-1, z:0, type:0, col:0xFFCC00}, {x:3, y:1, z:0, type:0, col:0xCC00}, {x:3, y:-2, z:0, type:0, col:0xFF0000}]}, {endList:[{x:0, y:3, col:52479}, {x:2, y:-1, col:0xFFCC00}, {x:-2, y:0, col:0xCC00}, {x:0, y:0, col:0xFF0000}], hexList:[{x:0, y:-1, z:0, type:0, col:52479}, {x:1, y:0, z:0, type:0, col:0xFFCC00}, {x:-3, y:-2, z:0, type:0, col:0xCC00}, {x:0, y:1, z:0, type:0, col:0xFF0000}]}, {endList:[{x:2, y:-3, col:52479}, {x:2, y:3, col:0xFFCC00}, {x:-4, y:0, col:0xCC00}], hexList:[{x:-3, y:-2, z:0, type:0, col:52479}, {x:3, y:-2, z:0, type:0, col:0xFFCC00}, {x:0, y:3, z:0, type:0, col:0xCC00}]}, {endList:[{x:-4, y:0, col:52479}, {x:-5, y:-1, col:0xFFCC00}, {x:0, y:4, col:0xCC00}, {x:4, y:0, col:0xFF0000}, {x:5, y:0, col:10066380}, {x:0, y:-4, col:0xFF9900}], hexList:[{x:3, y:1, z:0, type:0, col:52479}, {x:3, y:-2, z:0, type:0, col:0xFFCC00}, {x:0, y:3, z:0, type:0, col:0xCC00}, {x:-3, y:-2, z:0, type:0, col:0xFF0000}, {x:-3, y:1, z:0, type:0, col:10066380}, {x:0, y:-3, z:0, type:0, col:0xFF9900}]}, {endList:[{x:0, y:3, col:52479}, {x:0, y:0, col:0xFFCC00}, {x:1, y:-4, col:0xCC00}, {x:-1, y:-4, col:0xFF0000}, {x:0, y:-1, col:10066380}], hexList:[{x:0, y:-3, z:0, type:0, col:52479}, {x:-3, y:-2, z:0, type:0, col:0xFFCC00}, {x:1, y:2, z:0, type:0, col:0xCC00}, {x:-1, y:2, z:0, type:0, col:0xFF0000}, {x:3, y:-2, z:0, type:0, col:10066380}]}, {endList:[{x:1, y:0, col:52479}, {x:0, y:0, col:0xFFCC00}, {x:0, y:-2, col:0xCC00}, {x:-1, y:-1, col:0xFF0000}, {x:0, y:2, col:10066380}], hexList:[{x:3, y:-2, z:0, type:0, col:52479}, {x:3, y:-1, z:0, type:0, col:0xFFCC00}, {x:0, y:-3, z:0, type:0, col:0xCC00}, {x:3, y:1, z:0, type:0, col:0xFF0000}, {x:0, y:3, z:0, type:0, col:10066380}]}, {endList:[{x:-2, y:-1, col:52479}, {x:-2, y:1, col:0xFFCC00}, {x:0, y:-2, col:0xCC00}, {x:2, y:-1, col:0xFF0000}, {x:0, y:3, col:10066380}, {x:2, y:1, col:0xFF9900}], hexList:[{x:3, y:1, z:0, type:0, col:52479}, {x:3, y:-2, z:0, type:0, col:0xFFCC00}, {x:0, y:2, z:0, type:0, col:0xCC00}, {x:-3, y:1, z:0, type:0, col:0xFF0000}, {x:0, y:-3, z:0, type:0, col:10066380}, {x:-3, y:-2, z:0, type:0, col:0xFF9900}]}, {endList:[{x:0, y:0, col:52479}, {x:2, y:-1, col:0xFFCC00}, {x:-2, y:1, col:0xCC00}, {x:-1, y:0, col:0xFF0000}, {x:1, y:-1, col:10066380}], hexList:[{x:3, y:0, z:0, type:0, col:52479}, {x:-3, y:-1, z:0, type:0, col:0xFFCC00}, {x:3, y:1, z:0, type:0, col:0xCC00}, {x:0, y:3, z:0, type:0, col:0xFF0000}, {x:-3, y:-2, z:0, type:0, col:10066380}]}, {endList:[{x:-1, y:-1, col:52479}, {x:1, y:-1, col:0xFFCC00}, {x:1, y:0, col:0xCC00}], hexList:[{x:-3, y:1, z:0, type:0, col:52479}, {x:3, y:1, z:0, type:0, col:0xFFCC00}, {x:3, y:-2, z:0, type:0, col:0xCC00}]}, {endList:[{x:1, y:-1, col:52479}, {x:-1, y:0, col:0xFFCC00}, {x:0, y:-1, col:0xCC00}, {x:-1, y:-1, col:0xFF0000}, {x:-1, y:-2, col:10066380}], hexList:[{x:3, y:1, z:0, type:0, col:52479}, {x:0, y:3, z:0, type:0, col:0xFFCC00}, {x:2, y:1, z:0, type:0, col:0xCC00}, {x:0, y:2, z:0, type:0, col:0xFF0000}, {x:1, y:1, z:0, type:0, col:10066380}]}, {endList:[{x:-1, y:0, col:52479}, {x:1, y:-1, col:0xFFCC00}, {x:0, y:1, col:0xCC00}, {x:1, y:0, col:0xFF0000}, {x:-1, y:-1, col:10066380}, {x:0, y:-1, col:0xFF9900}], hexList:[{x:3, y:1, z:0, type:0, col:52479}, {x:-3, y:-2, z:0, type:0, col:0xFFCC00}, {x:3, y:-2, z:0, type:0, col:0xCC00}, {x:0, y:-3, z:0, type:0, col:0xFF0000}, {x:0, y:3, z:0, type:0, col:10066380}, {x:-3, y:1, z:0, type:0, col:0xFF9900}]}, {endList:[{x:1, y:1, col:52479}, {x:2, y:-1, col:0xFFCC00}, {x:-1, y:-1, col:0xCC00}, {x:-2, y:1, col:0xFF0000}, {x:-2, y:-1, col:10066380}, {x:2, y:1, col:0xFF9900}], hexList:[{x:3, y:1, z:0, type:0, col:52479}, {x:-3, y:-2, z:0, type:0, col:0xFFCC00}, {x:3, y:-2, z:0, type:0, col:0xCC00}, {x:0, y:-3, z:0, type:0, col:0xFF0000}, {x:0, y:3, z:0, type:0, col:10066380}, {x:-3, y:1, z:0, type:0, col:0xFF9900}]}, {endList:[{x:1, y:1, col:52479}, {x:-2, y:0, col:0xFFCC00}, {x:1, y:-2, col:0xCC00}, {x:4, y:0, col:0xFF0000}], hexList:[{x:3, y:1, z:0, type:0, col:52479}, {x:-3, y:-2, z:0, type:0, col:0xFFCC00}, {x:3, y:-2, z:0, type:0, col:0xCC00}, {x:-3, y:1, z:0, type:0, col:0xFF0000}]}];
private static var completedList:Array = [];
public static function getLevel(_arg1:int):Object{
return (LEVEL_DATA[_arg1]);
}
}
}//package game
Section 13
//BG_2 (game_fla.BG_2)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class BG_2 extends MovieClip {
public function BG_2(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package game_fla
Section 14
//Credits_16 (game_fla.Credits_16)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class Credits_16 extends MovieClip {
public function Credits_16(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package game_fla
Section 15
//Editor_50 (game_fla.Editor_50)
package game_fla {
import flash.display.*;
public dynamic class Editor_50 extends MovieClip {
public var add_but:SimpleButton;
public var update_but:SimpleButton;
public var export_but:SimpleButton;
public var reset_but:SimpleButton;
public var clear_but:SimpleButton;
public var icons_mc:MovieClip;
}
}//package game_fla
Section 16
//EyeLeft_10 (game_fla.EyeLeft_10)
package game_fla {
import flash.display.*;
public dynamic class EyeLeft_10 extends MovieClip {
public var lid_mc:MovieClip;
}
}//package game_fla
Section 17
//EyeLeft_11 (game_fla.EyeLeft_11)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class EyeLeft_11 extends MovieClip {
public function EyeLeft_11(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
play();
}
}
}//package game_fla
Section 18
//EyeRight_12 (game_fla.EyeRight_12)
package game_fla {
import flash.display.*;
public dynamic class EyeRight_12 extends MovieClip {
public var lid_mc:MovieClip;
}
}//package game_fla
Section 19
//Fill_41 (game_fla.Fill_41)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class Fill_41 extends MovieClip {
public function Fill_41(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package game_fla
Section 20
//Fox_9 (game_fla.Fox_9)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class Fox_9 extends MovieClip {
public var mainTimer:Timer;
public var eyeleft_mc:MovieClip;
public var eyeright_mc:MovieClip;
public function Fox_9(){
addFrameScript(0, frame1);
}
public function initBlink(_arg1:TimerEvent){
blink();
mainTimer.stop();
mainTimer = new Timer(4000);
mainTimer.addEventListener(TimerEvent.TIMER, blink);
}
public function blink(){
eyeleft_mc.lid_mc.gotoAndPlay("blink");
eyeright_mc.lid_mc.gotoAndPlay("blink");
}
function frame1(){
mainTimer = new Timer(1000, 1);
mainTimer.addEventListener(TimerEvent.TIMER, initBlink);
mainTimer.start();
}
public function clearMe(){
mainTimer.stop();
mainTimer = null;
}
}
}//package game_fla
Section 21
//HexBG_33 (game_fla.HexBG_33)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class HexBG_33 extends MovieClip {
public function HexBG_33(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package game_fla
Section 22
//Intro_1 (game_fla.Intro_1)
package game_fla {
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class Intro_1 extends MovieClip {
public var shadow_mc:MovieClip;
public var mask_mc:MovieClip;
public var mainlogo_mc:MovieClip;
public function Intro_1(){
addFrameScript(0, frame1);
}
public function startPreloader(){
var _local1:*;
_local1 = new Timer(1500, 1);
_local1.addEventListener(TimerEvent.TIMER, playGame);
_local1.start();
}
function frame1(){
mainlogo_mc.isMainLogo = true;
shadow_mc.isMainLogo = false;
root.stop();
mask_mc.cacheAsBitmap = true;
shadow_mc.cacheAsBitmap = true;
shadow_mc.mask = mask_mc;
}
public function onTweenFinished(_arg1:TweenEvent):void{
mainlogo_mc.fox_mc.clearMe();
shadow_mc.fox_mc.clearMe();
root.play();
}
public function playGame(_arg1){
var _local2:*;
_local2 = new Tween(this, "alpha", Regular.easeOut, this.alpha, 0, 0.5, true);
_local2.addEventListener(TweenEvent.MOTION_FINISH, onTweenFinished);
}
}
}//package game_fla
Section 23
//LevelCompleteMsg_39 (game_fla.LevelCompleteMsg_39)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class LevelCompleteMsg_39 extends MovieClip {
public function LevelCompleteMsg_39(){
addFrameScript(1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame2(){
stop();
}
}
}//package game_fla
Section 24
//LevelHexes_32 (game_fla.LevelHexes_32)
package game_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LevelHexes_32 extends MovieClip {
public var hexbg1_mc:MovieClip;
public var hexbg4_mc:MovieClip;
public var text2_box:TextField;
public var text4_box:TextField;
public var text6_box:TextField;
public var hexbg2_mc:MovieClip;
public var hexbg5_mc:MovieClip;
public var text1_box:TextField;
public var text3_box:TextField;
public var text5_box:TextField;
public var hexbg3_mc:MovieClip;
public var hexbg6_mc:MovieClip;
}
}//package game_fla
Section 25
//LevelHexes2_35 (game_fla.LevelHexes2_35)
package game_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LevelHexes2_35 extends MovieClip {
public var hexbg1_mc:MovieClip;
public var hexbg4_mc:MovieClip;
public var text2_box:TextField;
public var text4_box:TextField;
public var text6_box:TextField;
public var hexbg2_mc:MovieClip;
public var hexbg5_mc:MovieClip;
public var text1_box:TextField;
public var text3_box:TextField;
public var text5_box:TextField;
public var hexbg3_mc:MovieClip;
public var hexbg6_mc:MovieClip;
}
}//package game_fla
Section 26
//Logo_3 (game_fla.Logo_3)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class Logo_3 extends MovieClip {
public var fox_mc:MovieClip;
public function Logo_3(){
addFrameScript(86, frame87);
}
function frame87(){
stop();
if (name == "mainlogo_mc"){
parent.startPreloader();
};
}
}
}//package game_fla
Section 27
//Logo_6 (game_fla.Logo_6)
package game_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class Logo_6 extends MovieClip {
public function Logo_6(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package game_fla
Section 28
//MainTimeline (game_fla.MainTimeline)
package game_fla {
import flash.display.*;
import flash.events.*;
import game.*;
import uinterface.*;
import classes.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class MainTimeline extends MovieClip {
public var windowXML:XML;
public var settingsData;
public var logo_mc:MovieClip;
public var credit_mc:MovieClip;
public var game:Game;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function onRollOverCredit(_arg1:MouseEvent):void{
credit_mc.gotoAndStop(3);
}
public function onClickLogo(_arg1:MouseEvent):void{
navigateToURL(new URLRequest(Settings.get("sfgPath")));
}
public function onRollOutCredit(_arg1:MouseEvent):void{
credit_mc.gotoAndStop(2);
}
function frame3(){
settingsData = {};
settingsData.projectName = "HexVex";
settingsData.sfgPath = "http://www.stupidfoxgames.com/";
settingsData.cgiPath = "http://www.stupidfoxgames.com/cgi-bin/hexvex/";
settingsData.txtPath = "";
settingsData.gPath = "http://www.stupidfoxgames.com/hexvex/";
settingsData.isLocal = ((loaderInfo.url.slice(0, 4) == "file")) ? true : false;
Settings.set(settingsData);
CustomSharedObject.init(Settings.get("projectName"));
SoundControl.init();
game = new Game();
Settings.set({game:game});
game.visible = false;
addChild(game);
windowXML = <windows>
<window userCloseable='no'>
<name>Win_LoadLevel</name>
</window>
</windows>
;
WindowManager.init(stage, windowXML);
WindowManager.openWindow("Win_LoadLevel");
logo_mc.buttonMode = true;
logo_mc.info_mc.visible = false;
logo_mc.addEventListener(MouseEvent.CLICK, onClickLogo);
logo_mc.addEventListener(MouseEvent.MOUSE_OVER, onRollOverLogo);
logo_mc.addEventListener(MouseEvent.MOUSE_OUT, onRollOutLogo);
credit_mc.buttonMode = true;
credit_mc.addEventListener(MouseEvent.MOUSE_OVER, onRollOverCredit);
credit_mc.addEventListener(MouseEvent.MOUSE_OUT, onRollOutCredit);
stop();
}
function frame1(){
MochiBot.track(this, "c57c4568");
stop();
}
public function onRollOutLogo(_arg1:MouseEvent):void{
logo_mc.info_mc.visible = false;
}
function frame2(){
MochiAd.showPreGameAd({clip:root, id:"5aac3941d0ce591b", res:"600x440", background:0xFFFFFF, color:5474233, outline:5936848, no_bg:true});
}
public function onRollOverLogo(_arg1:MouseEvent):void{
logo_mc.info_mc.visible = true;
}
}
}//package game_fla
Section 29
//SoundToggle_17 (game_fla.SoundToggle_17)
package game_fla {
import flash.display.*;
import flash.events.*;
import classes.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.system.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.ui.*;
public dynamic class SoundToggle_17 extends MovieClip {
public var toggle_but:SimpleButton;
public function SoundToggle_17(){
addFrameScript(1, frame2, 2, frame3);
}
public function toggleSound(_arg1:MouseEvent):void{
if (CustomSharedObject.checkData("isSoundOn", true, true)){
SoundControl.toggleSound(false);
gotoAndStop(4);
CustomSharedObject.updateData({isSoundOn:false});
} else {
SoundControl.toggleSound(true);
gotoAndStop(3);
CustomSharedObject.updateData({isSoundOn:true});
};
}
function frame3(){
stop();
}
function frame2(){
if (CustomSharedObject.checkData("isSoundOn", true, true)){
gotoAndStop(3);
} else {
gotoAndStop(4);
};
toggle_but.addEventListener(MouseEvent.CLICK, toggleSound);
}
}
}//package game_fla
Section 30
//TopLeftLogo_14 (game_fla.TopLeftLogo_14)
package game_fla {
import flash.display.*;
public dynamic class TopLeftLogo_14 extends MovieClip {
public var info_mc:MovieClip;
}
}//package game_fla
Section 31
//Win_LevelComplete (uinterface.windows.Win_LevelComplete)
package uinterface.windows {
import flash.display.*;
import flash.events.*;
import uinterface.*;
import classes.*;
import flash.text.*;
import flash.net.*;
public class Win_LevelComplete extends Window {
private const HEIGHT:int = 155;
private const WIDTH:int = 350;
public var msg_mc:MovieClip;
public var playmoregames_but:SimpleButton;
public var nextlevel_but:SimpleButton;
public function init(_arg1:int=1){
var _local2:Boolean;
var _local3:*;
SoundControl.playSound("LevelComplete", 0.4);
_local2 = true;
_local3 = 1;
while (_local3 <= 18) {
if (!CustomSharedObject.checkData((("isLevel" + _local3) + "Complete"))){
_local2 = false;
break;
};
_local3++;
};
if (_local2){
msg_mc.gotoAndStop(3);
nextlevel_but.visible = false;
} else {
msg_mc.gotoAndStop(2);
};
nextlevel_but.addEventListener(MouseEvent.CLICK, onNextLevel);
playmoregames_but.addEventListener(MouseEvent.CLICK, onPlayMoreGames);
}
private function onNextLevel(_arg1:MouseEvent):void{
WindowManager.openWindow("Win_LoadLevel");
}
private function onPlayMoreGames(_arg1:MouseEvent):void{
navigateToURL(new URLRequest(Settings.get("sfgPath")));
}
}
}//package uinterface.windows
Section 32
//Win_LoadLevel (uinterface.windows.Win_LoadLevel)
package uinterface.windows {
import flash.display.*;
import flash.events.*;
import uinterface.*;
import classes.*;
import flash.text.*;
public class Win_LoadLevel extends Window {
private const HEIGHT:int = 155;
private const TITLE_ID:String = "Loading";
private const WIDTH:int = 350;
private var nextWindowParams:Object;
public var locked3_mc:MovieClip;
private var curLoadIndex:int;// = -1
public var icons3_mc:MovieClip;
private var loadList:Array;
public var icons1_mc:MovieClip;
private var labelList:Array;
private var nextWindow:String;
private var loadParamsList:Array;
public var locked2_mc:MovieClip;
public var icons2_mc:MovieClip;
public function Win_LoadLevel(){
curLoadIndex = -1;
loadList = [];
labelList = [];
loadParamsList = [];
super();
}
public function init(){
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:int;
_local1 = [0, true, true, true];
locked2_mc.visible = false;
locked3_mc.visible = false;
_local2 = 1;
while (_local2 <= 3) {
_local3 = 1;
while (_local3 <= 6) {
_local4 = ((6 * (_local2 - 1)) + _local3);
this[(("icons" + _local2) + "_mc")].mouseChildren = true;
this[(("icons" + _local2) + "_mc")][(("text" + _local3) + "_box")].text = _local4;
this[(("icons" + _local2) + "_mc")][(("text" + _local3) + "_box")].mouseEnabled = false;
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].id = _local4;
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].buttonMode = true;
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].addEventListener(MouseEvent.MOUSE_OVER, onHexRollOver);
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].addEventListener(MouseEvent.MOUSE_OUT, onHexRollOut);
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].addEventListener(MouseEvent.CLICK, onHexClick);
if (CustomSharedObject.checkData((("isLevel" + _local4) + "Complete"), true, false)){
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].previousState = "complete";
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].gotoAndStop("complete");
} else {
_local1[_local2] = false;
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].previousState = "incomplete";
this[(("icons" + _local2) + "_mc")][(("hexbg" + _local3) + "_mc")].gotoAndStop("incomplete");
};
_local3++;
};
if (((!((_local2 == 1))) && (!(_local1[(_local2 - 1)])))){
this[(("icons" + _local2) + "_mc")].alpha = 0.3;
this[(("locked" + _local2) + "_mc")].visible = true;
this[(("icons" + _local2) + "_mc")].mouseChildren = false;
};
_local2++;
};
}
private function onHexRollOut(_arg1:MouseEvent){
_arg1.target.gotoAndStop(_arg1.target.previousState);
}
private function onHexClick(_arg1:MouseEvent){
Settings.get("game").loadLevel(_arg1.target.id);
close();
}
public function refreshMsg():void{
}
private function onHexRollOver(_arg1:MouseEvent){
SoundControl.playSound("LevelRollOver", 0.2);
_arg1.target.gotoAndStop("rollover");
}
}
}//package uinterface.windows
Section 33
//Window (uinterface.windows.Window)
package uinterface.windows {
import flash.display.*;
import flash.events.*;
import uinterface.*;
import classes.*;
import flash.text.*;
import flash.filters.*;
public class Window extends MovieClip {
public const CLOSED:String = "closed";
public function enable():void{
mouseChildren = true;
}
public function resize(_arg1:int, _arg2:int, _arg3:String){
}
public function disable():void{
mouseChildren = false;
}
public function close():void{
dispatchEvent(new Event(CLOSED));
}
}
}//package uinterface.windows
Section 34
//WindowManager (uinterface.WindowManager)
package uinterface {
import flash.display.*;
import flash.events.*;
import classes.*;
import flash.utils.*;
import uinterface.windows.*;
import flash.filters.*;
public class WindowManager {
private static var stackList:Array = [];
private static var windowXML:XML;
private static var curWindowClass;
private static var curWindow:MovieClip;
private static var winDepth:int = 2000;
private static var prevWindowParams;
private static var curWindowID:int;
private static var myStage:Stage;
private static var prevWindowClass;
private static var curWindowParams;
public static function onWindowClose(_arg1:Event):void{
trace("WindowManager - onWindowClose");
myStage.removeChild(curWindow);
curWindow = null;
doNoWindowProcedure();
}
public static function openWindow(_arg1:String, ... _args):void{
var _local3:*;
stackList = [_arg1];
if (_arg1 == "Win_LoadLevel"){
Settings.get("game").visible = false;
};
if (curWindow != null){
myStage.removeChild(curWindow);
};
_local3 = getDefinitionByName(("uinterface.windows." + _arg1));
curWindow = new (_local3);
curWindow.init.apply(null, _args);
myStage.addChild(curWindow);
curWindow.addEventListener(curWindow.CLOSED, onWindowClose);
}
public static function init(_arg1:Stage, _arg2:XML):void{
myStage = _arg1;
windowXML = _arg2;
}
public static function openPreviousWindow(){
openWindow(prevWindowClass, prevWindowParams);
}
private static function doNoWindowProcedure():void{
trace("WindowManager - doNoWindowProcedure");
Settings.get("game").visible = true;
}
}
}//package uinterface
Section 35
//BackgroundMusic1 (BackgroundMusic1)
package {
import flash.media.*;
public dynamic class BackgroundMusic1 extends Sound {
}
}//package
Section 36
//Editor_Hex (Editor_Hex)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Editor_Hex extends MovieClip {
public var upd_end_but:SimpleButton;
public var endpos_box:TextField;
public var colourbox_mc:MovieClip;
public var remove_but:SimpleButton;
public var upd_start_but:SimpleButton;
public var pos_box:TextField;
public var col_box:TextField;
}
}//package
Section 37
//FloorAppear (FloorAppear)
package {
import flash.media.*;
public dynamic class FloorAppear extends Sound {
}
}//package
Section 38
//FloorTile (FloorTile)
package {
import flash.display.*;
public dynamic class FloorTile extends Sprite {
public var hint_mc:MovieClip;
public var outline_mc:MovieClip;
public var fill_mc:MovieClip;
}
}//package
Section 39
//HexAppear (HexAppear)
package {
import flash.media.*;
public dynamic class HexAppear extends Sound {
}
}//package
Section 40
//HexComplete (HexComplete)
package {
import flash.media.*;
public dynamic class HexComplete extends Sound {
}
}//package
Section 41
//HexHint (HexHint)
package {
import flash.display.*;
public dynamic class HexHint extends MovieClip {
}
}//package
Section 42
//HexMove (HexMove)
package {
import flash.media.*;
public dynamic class HexMove extends Sound {
}
}//package
Section 43
//HexSelect (HexSelect)
package {
import flash.media.*;
public dynamic class HexSelect extends Sound {
}
}//package
Section 44
//Level (Level)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level extends MovieClip {
public var levelnum_box:TextField;
}
}//package
Section 45
//LevelComplete (LevelComplete)
package {
import flash.media.*;
public dynamic class LevelComplete extends Sound {
}
}//package
Section 46
//LevelRollOver (LevelRollOver)
package {
import flash.media.*;
public dynamic class LevelRollOver extends Sound {
}
}//package
Section 47
//LevelSelect (LevelSelect)
package {
import flash.media.*;
public dynamic class LevelSelect extends Sound {
}
}//package
Section 48
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.1");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
_arg1.removeChild(_arg1._mochiad);
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
mc.removeEventListener(Event.ENTER_FRAME, f);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 49
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 50
//Score (Score)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Score extends MovieClip {
public var score_box:TextField;
}
}//package