Section 1
//bodyshop_56 (knight_fla.bodyshop_56)
package knight_fla {
import flash.display.*;
public dynamic class bodyshop_56 extends MovieClip {
public function bodyshop_56(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package knight_fla
Section 2
//cageclose_18 (knight_fla.cageclose_18)
package knight_fla {
import flash.display.*;
public dynamic class cageclose_18 extends MovieClip {
public function cageclose_18(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package knight_fla
Section 3
//description_54 (knight_fla.description_54)
package knight_fla {
import flash.display.*;
import flash.text.*;
public dynamic class description_54 extends MovieClip {
public var txt:TextField;
}
}//package knight_fla
Section 4
//equip_9 (knight_fla.equip_9)
package knight_fla {
import flash.display.*;
public dynamic class equip_9 extends MovieClip {
public function equip_9(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package knight_fla
Section 5
//headShop_57 (knight_fla.headShop_57)
package knight_fla {
import flash.display.*;
public dynamic class headShop_57 extends MovieClip {
public function headShop_57(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package knight_fla
Section 6
//Inst_45 (knight_fla.Inst_45)
package knight_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Inst_45 extends MovieClip {
public var Life:MovieClip;
public var sandTop:MovieClip;
public var T_mana:TextField;
public var T_gold:TextField;
public var sandBottom:MovieClip;
public var T_level:TextField;
public function Inst_45(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package knight_fla
Section 7
//knightshop_55 (knight_fla.knightshop_55)
package knight_fla {
import flash.display.*;
public dynamic class knightshop_55 extends MovieClip {
public var armor:MovieClip;
public var helmet:MovieClip;
public var sword:MovieClip;
public function knightshop_55(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package knight_fla
Section 8
//Life2_31 (knight_fla.Life2_31)
package knight_fla {
import flash.display.*;
public dynamic class Life2_31 extends MovieClip {
public var bar:MovieClip;
}
}//package knight_fla
Section 9
//progressBar_2 (knight_fla.progressBar_2)
package knight_fla {
import flash.display.*;
import flash.text.*;
public dynamic class progressBar_2 extends MovieClip {
public var bar:MovieClip;
public var T:TextField;
}
}//package knight_fla
Section 10
//swordshop_58 (knight_fla.swordshop_58)
package knight_fla {
import flash.display.*;
public dynamic class swordshop_58 extends MovieClip {
public function swordshop_58(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package knight_fla
Section 11
//MochiDigits (mochi.MochiDigits)
package mochi {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi
Section 12
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 13
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.geom.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__ms_";
private static var _servicesURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
public static var netup:Boolean = true;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime()));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
};
return (_local2);
}
public static function getVersion():String{
return ("1.43");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
public static function get id():String{
return (_id);
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_listenChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
trace("connected!");
_connecting = false;
_connected = true;
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var vars:URLVariables;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servicesURL != undefined){
_servicesURL = urlOptions(clip).servicesURL;
};
MochiServices.allowDomains(_servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor((Math.random() * 99999))));
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_servicesURL);
vars = new URLVariables();
vars.listenLC = _listenChannelName;
vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options;
req.data = vars;
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 14
//axe (axe)
package {
import flash.media.*;
public dynamic class axe extends Sound {
}
}//package
Section 15
//Bat (Bat)
package {
import flash.display.*;
import flash.events.*;
public class Bat extends MovieClip {
public var __speed:Number;
public var __statePlay:StatePlay;
public var __speedX:Number;
public var __Move:Function;
static const BOTTOM:Number = 470;
static const TOP:Number = 20;
public function Init0(_arg1:StatePlay):void{
__statePlay = _arg1;
Init();
this.addEventListener(Event.ENTER_FRAME, BatFall);
__Move = BatFall;
}
public function BatFall(_arg1:Event):void{
__Move = BatFall;
this.y = (this.y + __speed);
if (BatHitKnight() == true){
__statePlay.KillKnight();
};
if (BatIsDead() == true){
KillBat();
};
if (this.y > BOTTOM){
this.removeEventListener(Event.ENTER_FRAME, BatFall);
this.addEventListener(Event.ENTER_FRAME, BatRise);
__Move = BatRise;
};
}
public function BatIsDead():Boolean{
var _local1:int;
if (this.y > 400){
_local1 = ((this.x - __statePlay.__knight.x) * __statePlay.__knight.scaleX);
if (__statePlay.__knight.__hit == true){
if ((((0 < _local1)) && ((_local1 < 70)))){
return (true);
};
};
};
return (false);
}
public function Stop():void{
if (__Move != null){
this.removeEventListener(Event.ENTER_FRAME, __Move);
};
}
public function Init():void{
trace("Init Bat");
this.gotoAndPlay(1);
this.x = (Math.random() * 550);
this.y = TOP;
if (Math.random() > 0.5){
this.scaleX = -1;
} else {
this.scaleX = 1;
};
__speed = ((Math.random() * 3) + 5);
__speedX = (-(this.scaleX) * ((Math.random() * 3) + 1));
}
public function Clean():void{
if (__Move != null){
this.removeEventListener(Event.ENTER_FRAME, __Move);
};
this.parent.removeChild(this);
}
public function BatDie(_arg1:Event):void{
__Move = BatDie;
if (this.currentLabel == "finish"){
this.removeEventListener(Event.ENTER_FRAME, BatDie);
Init();
this.addEventListener(Event.ENTER_FRAME, BatFall);
__Move = BatFall;
};
}
public function BatRise(_arg1:Event):void{
__Move = BatRise;
this.y = (this.y - __speed);
if (BatHitKnight() == true){
__statePlay.KillKnight();
};
if (BatIsDead() == true){
KillBat();
};
if (this.y < TOP){
this.removeEventListener(Event.ENTER_FRAME, BatRise);
Init();
this.addEventListener(Event.ENTER_FRAME, BatFall);
__Move = BatFall;
};
}
public function BatHitKnight():Boolean{
if (__statePlay.__knight.__immune){
return (false);
};
if (this.y > 400){
if (Math.abs((__statePlay.__knight.x - this.x)) < 20){
return (true);
};
};
return (false);
}
public function KillBat():void{
this.gotoAndPlay("die");
if (__statePlay.__main.SFX_ON == true){
__statePlay.__main.SFX_BAT_DIE.play();
};
this.removeEventListener(Event.ENTER_FRAME, __Move);
this.addEventListener(Event.ENTER_FRAME, BatDie);
__Move = BatDie;
__statePlay.__deadbats++;
__statePlay.__main.Score = (__statePlay.__main.Score + (__statePlay.__main.BatPrice * __statePlay.__main.Sword));
__statePlay.__panel.T_Score.text = __statePlay.__main.Score;
__statePlay.__main.Gold = (__statePlay.__main.Gold + (__statePlay.__main.BatPrice * __statePlay.__main.Sword));
__statePlay.__panel.T_gold.text = __statePlay.__main.Gold;
}
public function Freeze():void{
trace("freeze bat");
trace(("__Move = " + __Move));
if (__Move != null){
this.removeEventListener(Event.ENTER_FRAME, __Move);
};
if (this.currentFrame == 10){
gotoAndStop(1);
} else {
this.stop();
};
}
}
}//package
Section 16
//Bat01 (Bat01)
package {
import flash.events.*;
public class Bat01 extends Bat {
public function Bat01(){
addFrameScript(9, frame10, 19, frame20);
super();
}
override public function Init0(_arg1:StatePlay):void{
super.Init0(_arg1);
}
override public function BatFall(_arg1:Event):void{
super.BatFall(_arg1);
this.x = (this.x + __speedX);
}
function frame10(){
gotoAndPlay(1);
}
function frame20(){
stop();
}
override public function BatRise(_arg1:Event):void{
super.BatRise(_arg1);
this.x = (this.x + __speedX);
}
}
}//package
Section 17
//Bat02 (Bat02)
package {
import flash.events.*;
public class Bat02 extends Bat {
public function Bat02(){
addFrameScript(9, frame10, 19, frame20);
super();
}
override public function Init0(_arg1:StatePlay):void{
super.Init0(_arg1);
}
override public function BatFall(_arg1:Event):void{
super.BatFall(_arg1);
}
override public function Init():void{
super.Init();
__speedX = 0;
}
function frame10(){
gotoAndPlay(1);
}
function frame20(){
stop();
}
override public function BatRise(_arg1:Event):void{
super.BatRise(_arg1);
}
}
}//package
Section 18
//Bat03 (Bat03)
package {
import flash.events.*;
public class Bat03 extends Bat {
public var X0:Number;
public var X:Number;
public var k:Number;
public var d:Number;
public var F:Number;
public function Bat03(){
addFrameScript(9, frame10, 19, frame20);
super();
}
override public function Init0(_arg1:StatePlay):void{
super.Init0(_arg1);
X0 = this.x;
d = 40;
k = 0.03;
F = 0;
__speedX = 0;
}
override public function BatFall(_arg1:Event):void{
super.BatFall(_arg1);
F = (k * ((X0 + d) - this.x));
__speedX = (__speedX + F);
this.x = (this.x + __speedX);
this.scaleX = (-(__speedX) / Math.abs(__speedX));
}
override public function Init():void{
super.Init();
X0 = this.x;
d = (10 + (Math.random() * 40));
F = 0;
__speedX = 0;
}
function frame10(){
gotoAndPlay(1);
}
override public function BatRise(_arg1:Event):void{
super.BatRise(_arg1);
F = (k * ((X0 + d) - this.x));
__speedX = (__speedX + F);
this.x = (this.x + __speedX);
this.scaleX = (-(__speedX) / Math.abs(__speedX));
}
function frame20(){
stop();
}
}
}//package
Section 19
//batdie (batdie)
package {
import flash.media.*;
public dynamic class batdie extends Sound {
}
}//package
Section 20
//ButtonBase (ButtonBase)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class ButtonBase extends MovieClip {
protected var __id:int;
protected var __mouseOverCb:Function;
protected var __mouseClickCb:Function;
protected var __mouseOutCb:Function;
protected var __isSelected:Boolean;
protected var __isFocusedOn:Boolean;
protected var __isEnabled:Boolean;
public function ButtonBase(){
__isEnabled = false;
__mouseOverCb = MouseOverCb;
__mouseOutCb = MouseOutCb;
__mouseClickCb = MouseClickCb;
this.mouseChildren = false;
Enable(true);
Select(false);
FocusOn(false);
}
public function set _mouseClickCb(_arg1:Function):void{
this.removeEventListener(MouseEvent.CLICK, __mouseClickCb);
__mouseClickCb = _arg1;
this.addEventListener(MouseEvent.CLICK, __mouseClickCb);
}
public function Select(_arg1:Boolean):void{
__isSelected = _arg1;
}
public function set _mouseOverCb(_arg1:Function):void{
this.removeEventListener(MouseEvent.MOUSE_OVER, __mouseOverCb);
__mouseOverCb = _arg1;
this.addEventListener(MouseEvent.MOUSE_OVER, __mouseOverCb);
}
protected function MouseOverCb(_arg1:MouseEvent):void{
this.gotoAndStop(2);
}
public function get _mouseOutCb():Function{
return (__mouseOutCb);
}
public function set _id(_arg1:int):void{
__id = _arg1;
}
public function set _labelText(_arg1:String):void{
var _local2:TextField;
_local2 = (this.getChildByName("label_txt") as TextField);
_local2.text = _arg1;
}
public function get _mouseClickCb():Function{
return (__mouseClickCb);
}
public function set _mouseOutCb(_arg1:Function):void{
this.removeEventListener(MouseEvent.MOUSE_OUT, __mouseOutCb);
__mouseOutCb = _arg1;
this.addEventListener(MouseEvent.MOUSE_OUT, __mouseOutCb);
}
public function get _mouseOverCb():Function{
return (__mouseOverCb);
}
public function FocusOn(_arg1:Boolean):void{
__isFocusedOn = _arg1;
}
public function get _id():int{
return (__id);
}
public function Enable(_arg1:Boolean):void{
__isEnabled = _arg1;
if (true == _arg1){
this.addEventListener(MouseEvent.MOUSE_OVER, __mouseOverCb);
this.addEventListener(MouseEvent.MOUSE_OUT, __mouseOutCb);
this.addEventListener(MouseEvent.CLICK, __mouseClickCb);
} else {
this.removeEventListener(MouseEvent.MOUSE_OVER, __mouseOverCb);
this.removeEventListener(MouseEvent.MOUSE_OUT, __mouseOutCb);
this.removeEventListener(MouseEvent.CLICK, __mouseClickCb);
};
this.buttonMode = __isEnabled;
this.useHandCursor = __isEnabled;
}
public function get _labelText():String{
var _local1:TextField;
_local1 = (this.getChildByName("label_txt") as TextField);
return (_local1.text);
}
protected function MouseClickCb(_arg1:MouseEvent):void{
}
protected function MouseOutCb(_arg1:MouseEvent):void{
this.gotoAndStop(1);
}
public function Destroy():void{
}
}
}//package
Section 21
//ButtonControl (ButtonControl)
package {
public class ButtonControl extends ButtonBase {
public function ButtonControl(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package
Section 22
//ButtonMenu (ButtonMenu)
package {
import flash.text.*;
public class ButtonMenu extends ButtonBase {
public var label_txt:TextField;
public function ButtonMenu(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package
Section 23
//ButtonMenu02 (ButtonMenu02)
package {
import flash.display.*;
public class ButtonMenu02 extends ButtonBase {
public var mark:MovieClip;
public function ButtonMenu02(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package
Section 24
//ButtonShop (ButtonShop)
package {
import flash.display.*;
import flash.text.*;
public class ButtonShop extends ButtonBase {
public var equip:MovieClip;
public var label_txt:TextField;
public function ButtonShop(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package
Section 25
//ButtonWood (ButtonWood)
package {
import flash.text.*;
public class ButtonWood extends ButtonBase {
public var label_txt:TextField;
public function ButtonWood(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package
Section 26
//Cage (Cage)
package {
import flash.display.*;
import flash.events.*;
public class Cage extends MovieClip {
const DECAY:Number = 0.97;
const SPRING_FACTOR:Number = 0.02;
public var PUSH_FACTOR:Number;
public var __power:int;
public var __statePlay:StatePlay;
public var __cageForce:Number;
public var cage_mc:MovieClip;
public function Cage(){
addFrameScript(15, frame16, 64, frame65);
}
function frame65(){
stop();
}
public function SwingLeft():void{
__cageForce = (__cageForce + PUSH_FACTOR);
this.addEventListener(Event.ENTER_FRAME, SwingEnterFrame);
}
public function SwingEnterFrame(_arg1:Event):void{
this.rotation = (this.rotation + __cageForce);
__cageForce = (__cageForce - (SPRING_FACTOR * this.rotation));
__cageForce = (__cageForce * DECAY);
}
public function Clean():void{
if (this.hasEventListener(Event.ENTER_FRAME)){
this.removeEventListener(Event.ENTER_FRAME, SwingEnterFrame);
};
__statePlay.__LayerCage.removeChild(this);
}
public function Init(_arg1:StatePlay, _arg2:int):void{
__statePlay = _arg1;
this.x = (Math.random() * 550);
this.y = -40;
__power = 5;
__cageForce = 0;
PUSH_FACTOR = (__statePlay.__main.Sword / 2);
this.cage_mc.gotoAndStop(_arg2);
}
function frame16(){
stop();
}
public function Freeze():void{
if (this.hasEventListener(Event.ENTER_FRAME)){
this.removeEventListener(Event.ENTER_FRAME, SwingEnterFrame);
};
this.stop();
}
public function SwingRight():void{
__cageForce = (__cageForce - PUSH_FACTOR);
this.addEventListener(Event.ENTER_FRAME, SwingEnterFrame);
}
}
}//package
Section 27
//cageopen (cageopen)
package {
import flash.media.*;
public dynamic class cageopen extends Sound {
}
}//package
Section 28
//Clock (Clock)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Clock extends MovieClip {
public var sandTop:MovieClip;
public var T1:int;
public var T0:int;
public var F:Function;
public var T_total:int;
public var __statePlay:StatePlay;
public var sandBottom:MovieClip;
public function Clock(){
addFrameScript(10, frame11);
}
public function Clean():void{
trace("stop clock");
if (F != null){
this.removeEventListener(Event.ENTER_FRAME, F);
};
}
public function Init(_arg1:StatePlay, _arg2:int):void{
__statePlay = _arg1;
T_total = _arg2;
T0 = getTimer();
this.addEventListener(Event.ENTER_FRAME, sandRotate);
}
public function sandDrop(_arg1:Event):void{
F = sandDrop;
T1 = getTimer();
this.sandTop.scaleY = (1 - ((T1 - T0) / T_total));
this.sandBottom.scaleY = ((T1 - T0) / T_total);
if ((T1 - T0) > T_total){
Clean();
trace("Win Level");
__statePlay.WinLevel();
};
}
function frame11(){
stop();
}
public function sandRotate(_arg1:Event):void{
F = sandRotate;
if (this.currentLabel == "finish"){
this.removeEventListener(Event.ENTER_FRAME, sandRotate);
this.addEventListener(Event.ENTER_FRAME, sandDrop);
};
}
}
}//package
Section 29
//coins (coins)
package {
import flash.media.*;
public dynamic class coins extends Sound {
}
}//package
Section 30
//die (die)
package {
import flash.media.*;
public dynamic class die extends Sound {
}
}//package
Section 31
//fairy (fairy)
package {
import flash.media.*;
public dynamic class fairy extends Sound {
}
}//package
Section 32
//Knight (Knight)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.ui.*;
public class Knight extends MovieClip {
public var __stage:Stage;
public var __fall:Boolean;
public var __immune:Boolean;
public var __AllowHit:Boolean;
public var __BlinkId:uint;
public var __statePlay:StatePlay;
public var __hit:Boolean;
public var __moveL:Boolean;
public var __moveR:Boolean;
public var __magic:Boolean;
public function knightMove(_arg1:KeyboardEvent):void{
if (__magic){
return;
};
if (__fall){
return;
};
switch (_arg1.keyCode){
case Keyboard.LEFT:
__moveL = true;
break;
case Keyboard.RIGHT:
__moveR = true;
break;
case Keyboard.SPACE:
if (__AllowHit == true){
__statePlay.Hit();
this.gotoAndPlay("hit");
__hit = true;
__AllowHit = false;
};
break;
case Keyboard.UP:
if ((((__statePlay.__main.Mana > 0)) && ((__magic == false)))){
this.gotoAndPlay("magic");
if (__statePlay.__main.SFX_ON == true){
__statePlay.__main.SFX_THUNDER.play();
};
__statePlay.__main.Mana--;
__magic = true;
__immune = true;
};
break;
};
}
public function Clean():void{
this.alpha = 1;
clearInterval(__BlinkId);
CleanEvents();
}
public function Init(_arg1:StatePlay, _arg2:Stage):void{
trace("knight");
__hit = false;
__AllowHit = true;
__fall = false;
__moveR = false;
__moveL = false;
__immune = false;
__stage = _arg2;
__statePlay = _arg1;
this.x = 200;
this.y = 472;
this.y = _arg1.__main.FloorY;
__stage.addEventListener(KeyboardEvent.KEY_DOWN, knightMove);
__stage.addEventListener(KeyboardEvent.KEY_UP, knightStop);
__stage.addEventListener(Event.ENTER_FRAME, knightEnterFrame);
}
public function knightStop(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.LEFT:
__moveL = false;
break;
case Keyboard.RIGHT:
__moveR = false;
break;
case Keyboard.SPACE:
__AllowHit = true;
break;
};
}
public function Blink():void{
this.alpha = (1.5 - this.alpha);
trace("Blink");
}
public function StopImmune():void{
__immune = false;
this.alpha = 1;
clearInterval(__BlinkId);
trace("Stop Blink");
}
public function Die():void{
this.gotoAndStop("die");
CleanEvents();
__hit = false;
__immune = true;
}
public function CleanEvents():void{
if (__stage.hasEventListener(Event.ENTER_FRAME)){
__stage.removeEventListener(Event.ENTER_FRAME, knightEnterFrame);
};
if (__stage.hasEventListener(KeyboardEvent.KEY_DOWN)){
__stage.removeEventListener(KeyboardEvent.KEY_DOWN, knightMove);
};
if (__stage.hasEventListener(KeyboardEvent.KEY_UP)){
__stage.removeEventListener(KeyboardEvent.KEY_UP, knightStop);
};
}
public function Freeze():void{
CleanEvents();
if (this.currentFrame == 11){
gotoAndStop(1);
} else {
this.stop();
};
}
public function Immune():void{
__immune = true;
setTimeout(StopImmune, (3 * 1000));
__BlinkId = setInterval(Blink, 50);
}
public function Fall():void{
this.gotoAndPlay("fall");
__fall = true;
}
public function knightEnterFrame(_arg1:Event):void{
if (this.currentFrame == 1){
trace("__hit = false");
__hit = false;
__fall = false;
};
if (__fall){
return;
};
if (((__magic) && ((this.currentLabel == "light")))){
trace("Light");
__statePlay.KillAllBats();
clearInterval(__statePlay.__InitId);
};
if ((((this.currentLabel == "light end")) && (__magic))){
trace("light end");
__statePlay.InitAllBats();
__magic = false;
__immune = false;
};
if (__magic){
return;
};
if (((__moveL) && ((this.x > 20)))){
this.x = (this.x - 5);
this.scaleX = -1;
};
if (((__moveR) && ((this.x < 530)))){
this.x = (this.x + 5);
this.scaleX = 1;
};
if (__hit){
return;
};
if (__fall){
return;
};
if (((((__moveL) || (__moveR))) && (!(((__moveL) && (__moveR)))))){
this.nextFrame();
} else {
this.gotoAndStop("stand");
};
}
}
}//package
Section 33
//Knight01 (Knight01)
package {
import flash.display.*;
public class Knight01 extends Knight {
public function Knight01(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 34
//Knight02 (Knight02)
package {
import flash.display.*;
public class Knight02 extends Knight {
public function Knight02(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 35
//Knight03 (Knight03)
package {
import flash.display.*;
public class Knight03 extends Knight {
public function Knight03(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 36
//Knight04 (Knight04)
package {
import flash.display.*;
public class Knight04 extends Knight {
public function Knight04(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 37
//Knight05 (Knight05)
package {
import flash.display.*;
public class Knight05 extends Knight {
public function Knight05(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 38
//Knight06 (Knight06)
package {
import flash.display.*;
public class Knight06 extends Knight {
public function Knight06(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 39
//Knight07 (Knight07)
package {
import flash.display.*;
public class Knight07 extends Knight {
public function Knight07(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 40
//Knight08 (Knight08)
package {
import flash.display.*;
public class Knight08 extends Knight {
public function Knight08(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 41
//Knight09 (Knight09)
package {
import flash.display.*;
public class Knight09 extends Knight {
public function Knight09(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 42
//Knight10 (Knight10)
package {
import flash.display.*;
public class Knight10 extends Knight {
public function Knight10(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 43
//Knight11 (Knight11)
package {
import flash.display.*;
public class Knight11 extends Knight {
public function Knight11(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 44
//Knight12 (Knight12)
package {
import flash.display.*;
public class Knight12 extends Knight {
public function Knight12(){
addFrameScript(0, frame1, 10, frame11, 14, frame15, 30, frame31, 31, frame32, 66, frame67);
super();
}
override public function Init(_arg1:StatePlay, _arg2:Stage):void{
super.Init(_arg1, _arg2);
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndPlay("move");
}
function frame31(){
gotoAndStop(1);
}
function frame32(){
stop();
}
function frame67(){
gotoAndStop(1);
}
}
}//package
Section 45
//main (main)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.text.*;
public dynamic class main extends MovieClip {
public var CH_01:SoundChannel;
public var CH_02:SoundChannel;
public var SFX_AXE:Sound;
public var FreePrincess:int;
public var NumberOfBats:Array;
public var LevelTime:int;
public var MUSIC_ON:Boolean;
public var BatPrice:int;
public var __stateMachine:StateMachine;
public var SFX_OUCH:Sound;
public var Mana:int;
public var MUSIC_01:Sound;
public var Gold:int;
public var MUSIC_02:Sound;
public var Score:int;
public var Helmet:int;
public var progressBar:MovieClip;
public var SFX_SWORD_HIT:Sound;
public var HelmetPrice:int;
public var SFX_THUNDER:Sound;
public var SFX_SCREAM:Sound;
public var Life:int;
public var Armor:int;
public var SFX_BAT_DIE:Sound;
public var PrincessPrice:int;
public var FreePrincessArray:Array;
public var PotionPrice:int;
public var Level:uint;
public var ArmorPrice:int;
public var SwordPrice:int;
public var SFX_SWORD:Sound;
public var SFX_COINS:Sound;
public var SFX_DIE:Sound;
public var SFX_CAGE_OPEN:Sound;
public var LifePrice:int;
public var Bats01:Array;
public var Bats02:Array;
public var Bats03:Array;
public var MOCHI:Boolean;
public var TotalLevels:int;
public var GoldenBats:Array;
public var Sword:int;
public var FloorY:uint;
public var SFX_ON:Boolean;
public function main(){
var myOptions:Object;
super();
addFrameScript(2, frame3);
trace("main");
MOCHI = false;
stop();
myOptions = {id:"c23727d6214f5c39", res:"550x600", clip:root, ad_started:function ():void{
}, ad_finished:function ():void{
gotoAndStop(3);
Complete();
}};
if (MOCHI){
progressBar.alpha = 0;
MochiAd.showPreGameAd(myOptions);
} else {
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, OnProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, OnComplete);
};
}
public function OnComplete(_arg1:Event):void{
this.gotoAndStop(3);
Complete();
}
function frame3(){
stop();
}
public function OnProgress(_arg1:ProgressEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = _arg1.target.bytesLoaded;
_local3 = _arg1.target.bytesTotal;
this.progressBar.bar.scaleX = (_local2 / _local3);
this.progressBar.T.text = ((Math.floor(((_local2 / _local3) * 100)) + 1) + "%");
}
public function Complete():void{
var _local1:int;
FloorY = 477;
PotionPrice = 300;
SwordPrice = 400;
HelmetPrice = 450;
ArmorPrice = 750;
LifePrice = 150;
PrincessPrice = 20;
BatPrice = 3;
LevelTime = 30;
TotalLevels = 25;
NumberOfBats = new Array(TotalLevels);
Bats02 = new Array(1, 3, 4, 0, 2, 4, 4, 0, 0, 2, 4, 4, 4, 2, 8, 10, 10, 0, 7, 7, 12, 0, 0, 2, 7);
Bats01 = new Array(0, 0, 0, 3, 3, 4, 6, 0, 0, 2, 2, 4, 2, 2, 2, 5, 0, 5, 0, 2, 0, 12, 0, 7, 7);
Bats03 = new Array(0, 0, 0, 0, 0, 0, 0, 2, 4, 1, 1, 1, 3, 5, 1, 0, 3, 5, 5, 5, 0, 0, 12, 7, 7);
_local1 = 0;
while (_local1 < TotalLevels) {
NumberOfBats[_local1] = ((Bats01[_local1] + Bats02[_local1]) + Bats03[_local1]);
_local1++;
};
MUSIC_ON = true;
MUSIC_01 = new fairy();
MUSIC_02 = new monsters();
SFX_ON = true;
SFX_SWORD_HIT = new swordhit();
SFX_COINS = new coins();
SFX_SWORD = new sword();
SFX_SCREAM = new scream();
SFX_THUNDER = new thunder();
SFX_OUCH = new ouch();
SFX_DIE = new die();
SFX_AXE = new axe();
SFX_BAT_DIE = new batdie();
SFX_CAGE_OPEN = new cageopen();
__stateMachine = new StateMachine(this);
__stateMachine.SetState(StateMachine.MENU);
}
}
}//package
Section 46
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.7");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
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_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
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 unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
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{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
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_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
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;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_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.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_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 _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];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_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++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
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 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);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
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;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
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 runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
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 _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 adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
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 sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
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_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
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);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
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{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
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.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
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)) || (!(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;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_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);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_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{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
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 {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 47
//monsters (monsters)
package {
import flash.media.*;
public dynamic class monsters extends Sound {
}
}//package
Section 48
//ouch (ouch)
package {
import flash.media.*;
public dynamic class ouch extends Sound {
}
}//package
Section 49
//Panel (Panel)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Panel extends MovieClip {
public var clock:Clock;
public var Life:MovieClip;
public var T_mana:TextField;
public var T_gold:TextField;
public var T_Score:TextField;
public var T_level:TextField;
}
}//package
Section 50
//Princess (Princess)
package {
import flash.display.*;
import flash.events.*;
public class Princess extends MovieClip {
public var __statePlay:StatePlay;
public var __PrincessMove:Function;
public function Princess(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
public function Clean():void{
if (this.hasEventListener(Event.ENTER_FRAME)){
this.removeEventListener(Event.ENTER_FRAME, __PrincessMove);
};
__statePlay.__LayerCage.removeChild(this);
__statePlay.__princess = null;
}
public function Init(_arg1:StatePlay, _arg2:Number, _arg3:int):void{
__statePlay = _arg1;
this.x = _arg2;
this.y = 472;
this.y = _arg1.__main.FloorY;
this.gotoAndPlay(("princess" + _arg3));
if (this.x > 275){
__PrincessMove = PrincessMoveLeft;
} else {
__PrincessMove = PrincessMoveRight;
this.scaleX = -1;
};
this.addEventListener(Event.ENTER_FRAME, __PrincessMove);
}
public function PrincessMoveLeft(_arg1:Event):void{
this.x = (this.x - 5);
if (this.x < 0){
Clean();
};
}
function frame10(){
gotoAndPlay("princess2");
}
function frame15(){
gotoAndPlay("princess3");
}
function frame5(){
gotoAndPlay("princess1");
}
public function PrincessMoveRight(_arg1:Event):void{
this.x = (this.x + 5);
if (this.x > 550){
Clean();
};
}
public function Freeze():void{
if (this.hasEventListener(Event.ENTER_FRAME)){
this.removeEventListener(Event.ENTER_FRAME, __PrincessMove);
};
this.stop();
if (this.currentFrame == 5){
this.gotoAndStop(1);
};
if (this.currentFrame == 10){
this.gotoAndStop(6);
};
if (this.currentFrame == 15){
this.gotoAndStop(11);
};
}
}
}//package
Section 51
//princessWin (princessWin)
package {
import flash.display.*;
import flash.events.*;
public class princessWin extends MovieClip {
public var __parent:MovieClip;
public function princessWin(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
public function Clear():void{
removeEventListener(Event.ENTER_FRAME, Move);
__parent.__LayerPrincess.removeChild(this);
}
public function Init(_arg1:MovieClip, _arg2:int):void{
__parent = MovieClip(_arg1);
this.x = 550;
this.y = 460;
switch (_arg2){
case 1:
this.gotoAndPlay("princess1");
break;
case 2:
this.gotoAndPlay("princess2");
break;
case 3:
this.gotoAndPlay("princess3");
break;
};
this.addEventListener(Event.ENTER_FRAME, Move);
}
function frame10(){
gotoAndPlay("princess2");
}
function frame15(){
gotoAndPlay("princess3");
}
function frame5(){
gotoAndPlay("princess1");
}
public function PickRandomPrincess():void{
var _local1:Number;
_local1 = (Math.random() * 3);
if ((((_local1 >= 0)) && ((_local1 < 1)))){
this.gotoAndPlay("princess1");
};
if ((((_local1 >= 1)) && ((_local1 < 2)))){
this.gotoAndPlay("princess2");
};
if ((((_local1 >= 2)) && ((_local1 < 3)))){
this.gotoAndPlay("princess3");
};
}
public function Move(_arg1:Event):void{
this.x = (this.x - 5);
this.y = __parent.__earth[Math.floor((this.x / 11))];
if (this.x < 0){
Clear();
};
}
}
}//package
Section 52
//scream (scream)
package {
import flash.media.*;
public dynamic class scream extends Sound {
}
}//package
Section 53
//StateBase (StateBase)
package {
import flash.display.*;
public class StateBase extends MovieClip {
protected var __stateMachine:StateMachine;
public function Clean():void{
trace("Clean");
}
public function Init(_arg1:StateMachine):void{
trace("Init");
__stateMachine = _arg1;
}
}
}//package
Section 54
//StateGameOver (StateGameOver)
package {
import flash.display.*;
import flash.events.*;
import mochi.*;
import flash.text.*;
public class StateGameOver extends StateBase {
public var __btnMenu:ButtonBase;
public var freetxt:TextField;
public var __main:MovieClip;
public var btnMenu:ButtonMenu;
override public function Clean():void{
super.Clean();
if (__main.MUSIC_ON){
__main.CH_01.stop();
};
}
override public function Init(_arg1:StateMachine):void{
var myOptions:Object;
var stateMachine = _arg1;
super.Init(stateMachine);
__btnMenu = (this.btnMenu as ButtonBase);
__main = MovieClip(stateMachine.__main);
this.freetxt.text = (this.freetxt.text = __main.FreePrincess.toString());
if (__main.MUSIC_ON){
__main.CH_01 = __main.MUSIC_01.play();
};
__btnMenu._mouseClickCb = GoToMenu;
__btnMenu._labelText = "Menu";
if (__main.MOCHI){
MochiServices.connect("c23727d6214f5c39", root);
myOptions = {boardID:"21df77e412afa6a5", score:__main.Score, onClose:function ():void{
trace("close highscores");
}};
MochiScores.showLeaderboard(myOptions);
};
}
public function GoToMenu(_arg1:MouseEvent):void{
__stateMachine.SetState(StateMachine.MENU);
}
}
}//package
Section 55
//StateHighscores (StateHighscores)
package {
import flash.display.*;
import mochi.*;
public class StateHighscores extends StateBase {
public var __main:MovieClip;
override public function Clean():void{
super.Clean();
}
override public function Init(_arg1:StateMachine):void{
var _local2:Object;
super.Init(_arg1);
__main = MovieClip(_arg1.__main);
trace("Highscores");
MochiServices.connect("c23727d6214f5c39", root);
_local2 = {boardID:"21df77e412afa6a5", onClose:backToMenu};
MochiScores.showLeaderboard(_local2);
}
public function backToMenu():void{
__stateMachine.SetState(StateMachine.MENU);
}
}
}//package
Section 56
//StateInstructions (StateInstructions)
package {
import flash.display.*;
import flash.events.*;
public class StateInstructions extends StateBase {
public var __inst:MovieClip;
public var btnBack:ButtonMenu;
public var btnNext:ButtonControl;
public var inst:MovieClip;
public var __btnBack:ButtonMenu;
public var __btnNext:ButtonControl;
public var btnPrev:ButtonControl;
public var __btnPrev:ButtonControl;
public function Next(_arg1:MouseEvent):void{
trace("next");
__inst.nextFrame();
__btnPrev.alpha = 1;
if (__inst.currentLabel == "last"){
__btnNext.alpha = 0.2;
};
}
override public function Clean():void{
super.Clean();
}
override public function Init(_arg1:StateMachine):void{
super.Init(_arg1);
__btnBack = (this.btnBack as ButtonMenu);
__btnNext = (this.btnNext as ButtonControl);
__btnPrev = (this.btnPrev as ButtonControl);
__inst = MovieClip(this.inst);
__inst.gotoAndStop(1);
__btnBack._mouseClickCb = GoToMenu;
__btnBack._labelText = "Back";
__btnNext._mouseClickCb = Next;
__btnPrev._mouseClickCb = Prev;
}
public function Prev(_arg1:MouseEvent):void{
trace("prev");
__inst.prevFrame();
__btnNext.alpha = 1;
if (__inst.currentLabel == "first"){
__btnPrev.alpha = 0.2;
};
}
public function GoToMenu(_arg1:MouseEvent):void{
__stateMachine.SetState(StateMachine.MENU);
}
}
}//package
Section 57
//StateIntro (StateIntro)
package {
import flash.events.*;
import flash.utils.*;
public class StateIntro extends StateBase {
public function StateIntro(){
addFrameScript(199, frame200);
super();
}
override public function Clean():void{
super.Clean();
if (this.hasEventListener(Event.ENTER_FRAME) == true){
this.removeEventListener(Event.ENTER_FRAME, EnterFrame);
};
this.stop();
}
function frame200(){
stop();
}
override public function Init(_arg1:StateMachine):void{
super.Init(_arg1);
this.addEventListener(Event.ENTER_FRAME, EnterFrame);
}
public function Play():void{
__stateMachine.SetState(StateMachine.PLAY);
}
public function EnterFrame(_arg1:Event):void{
if (this.currentLabel == "finish"){
setTimeout(Play, 3000);
this.removeEventListener(Event.ENTER_FRAME, EnterFrame);
};
}
}
}//package
Section 58
//StateMachine (StateMachine)
package {
import flash.display.*;
public class StateMachine {
private var __state:StateBase;
public var __main:MovieClip;
public static const HIGHSCORES:String = "highscores";
public static const INSTRUCTIONS:String = "instructions";
public static const GAMEOVER:String = "gameover";
public static const PLAY:String = "play";
public static const SHOP:String = "shop";
public static const INTRO:String = "intro";
public static const WIN:String = "win";
public static const MENU:String = "menu";
public function StateMachine(_arg1:MovieClip){
__state = null;
__main = MovieClip(_arg1);
}
public function SetState(_arg1:String):void{
if (__state != null){
__state.Clean();
__main.removeChild(__state);
};
switch (_arg1){
case MENU:
__state = new StateMenu();
break;
case PLAY:
__state = new StatePlay();
break;
case GAMEOVER:
__state = new StateGameOver();
break;
case SHOP:
__state = new StateShop();
break;
case WIN:
__state = new StateWin();
break;
case INTRO:
__state = new StateIntro();
break;
case INSTRUCTIONS:
__state = new StateInstructions();
break;
case HIGHSCORES:
__state = new StateHighscores();
break;
};
if (__state != null){
__main.addChild(__state);
__state.Init(this);
};
}
}
}//package
Section 59
//StateMenu (StateMenu)
package {
import flash.display.*;
import flash.events.*;
import mochi.*;
public class StateMenu extends StateBase {
public var __btnMusic:ButtonMenu02;
public var btnMusic:ButtonMenu02;
public var btnInstructions:ButtonMenu;
public var __btnInstructions:ButtonMenu;
public var __btnSFX:ButtonMenu02;
public var btnSFX:ButtonMenu02;
public var __main:MovieClip;
public var btnPlay:ButtonMenu;
public var btnHighscores:ButtonMenu;
public var __btnPlay:ButtonMenu;
public var __btnHighscores:ButtonMenu;
private function Music(_arg1:MouseEvent):void{
if (__main.MUSIC_ON == true){
__main.MUSIC_ON = false;
__main.CH_01.stop();
} else {
__main.MUSIC_ON = true;
__main.CH_01 = __main.MUSIC_01.play(0, 100);
};
if (__main.MUSIC_ON == true){
__btnMusic.mark.gotoAndStop(1);
} else {
__btnMusic.mark.gotoAndStop(2);
};
}
private function gotoHighscores(_arg1:MouseEvent):void{
if (__main.MOCHI){
__stateMachine.SetState(StateMachine.HIGHSCORES);
};
}
override public function Clean():void{
super.Clean();
__main.CH_01.stop();
__btnPlay.Enable(false);
}
override public function Init(_arg1:StateMachine):void{
var stateMachine = _arg1;
super.Init(stateMachine);
__main = MovieClip(stateMachine.__main);
trace("Menu");
__btnPlay = (this.btnPlay as ButtonMenu);
__btnPlay._mouseClickCb = playGame;
__btnPlay._labelText = "Play";
__btnInstructions = (this.btnInstructions as ButtonMenu);
__btnInstructions._mouseClickCb = Instructions;
__btnInstructions._labelText = "Guide";
__btnHighscores = (this.btnHighscores as ButtonMenu);
__btnHighscores._mouseClickCb = gotoHighscores;
__btnHighscores._labelText = "Scores";
if (__main.MOCHI == false){
__btnHighscores.enabled = false;
__btnHighscores.alpha = 0;
};
__btnSFX = (this.btnSFX as ButtonMenu02);
__btnSFX._mouseClickCb = SFX;
if (__main.MUSIC_ON){
__main.CH_01 = __main.MUSIC_01.play(0, 100);
};
if (__main.SFX_ON == true){
__btnSFX.mark.gotoAndStop(1);
} else {
__btnSFX.mark.gotoAndStop(2);
};
__btnMusic = (this.btnMusic as ButtonMenu02);
__btnMusic._mouseClickCb = Music;
if (__main.MUSIC_ON == true){
__btnMusic.mark.gotoAndStop(1);
} else {
__btnMusic.mark.gotoAndStop(2);
};
var _local3 = __main;
with (_local3) {
Level = 0;
Mana = 0;
Life = 100;
Sword = 1;
Armor = 1;
Helmet = 1;
Gold = 0;
FreePrincess = 0;
Score = 0;
FreePrincessArray = null;
FreePrincessArray = new Array();
};
}
private function playGame(_arg1:MouseEvent):void{
__stateMachine.SetState(StateMachine.INTRO);
}
private function SFX(_arg1:MouseEvent):void{
if (__main.SFX_ON == true){
__main.SFX_ON = false;
} else {
__main.SFX_ON = true;
};
if (__main.SFX_ON == true){
__btnSFX.mark.gotoAndStop(1);
} else {
__btnSFX.mark.gotoAndStop(2);
};
}
private function Instructions(_arg1:MouseEvent):void{
__stateMachine.SetState(StateMachine.INSTRUCTIONS);
}
}
}//package
Section 60
//StatePlay (StatePlay)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class StatePlay extends StateBase {
public var musicID:uint;
public var panel:Panel;
public var __panel:MovieClip;
public var __clock:Clock;
public var __LayerPanel:Sprite;
public var __bat:Array;
public var __LayerKnight:Sprite;
public var __LayerForground:Sprite;
public var __princess:Princess;
public var __LayerBackground:Sprite;
public var __knight:Knight;
public var __freeze:Boolean;
public var __deadbats:uint;
public var __DropPrincess:Number;
public var __totalBats:uint;
public var __princessNum:int;
public var __InitId:uint;
public var __btnNext:ButtonWood;
public var __main:MovieClip;
public var __maxBats:uint;
public var __LayerCage:Sprite;
public var __cage:Cage;
public var __summery:MovieClip;
public var __addBat:Number;
public var __freePrincess:uint;
public var __LayerBats:Sprite;
private function startMusic():void{
if (__main.MUSIC_ON){
__main.CH_02 = __main.MUSIC_02.play();
};
}
public function GameOver():void{
trace("GameOver");
trace(("__stateMachine = " + __stateMachine));
__stateMachine.SetState(StateMachine.GAMEOVER);
}
public function InitAllBats():void{
var _local1:int;
trace("InitAllBats");
_local1 = 0;
while (_local1 < __totalBats) {
if (__bat[_local1] != null){
__bat[_local1].Clean();
__bat[_local1] = null;
};
_local1++;
};
__totalBats = 0;
clearInterval(__InitId);
__InitId = setInterval(initBat01, 1000);
trace(("__InitId = " + __InitId));
}
override public function Clean():void{
var _local1:int;
super.Clean();
clearInterval(__InitId);
if (__main.MUSIC_ON){
__main.CH_02.stop();
};
if (this.hasEventListener(Event.ENTER_FRAME)){
this.removeEventListener(Event.ENTER_FRAME, PlayEnterFrame);
};
_local1 = 0;
while (_local1 < __totalBats) {
if (__bat[_local1] != null){
__bat[_local1].Clean();
};
_local1++;
};
__knight.Clean();
trace(("__princess = " + __princess));
if (__princess != null){
__princess.Clean();
};
__clock.Clean();
if (__btnNext != null){
__btnNext.Enable(false);
};
this.removeChild(__LayerBackground);
this.removeChild(__LayerCage);
this.removeChild(__LayerKnight);
this.removeChild(__LayerBats);
this.removeChild(__LayerForground);
this.removeChild(__LayerPanel);
}
override public function Init(_arg1:StateMachine):void{
var _local2:uint;
super.Init(_arg1);
__main = MovieClip(_arg1.__main);
__main.Level++;
__maxBats = __main.NumberOfBats[(__main.Level - 1)];
__LayerBackground = new Sprite();
__LayerCage = new Sprite();
__LayerKnight = new Sprite();
__LayerBats = new Sprite();
__LayerForground = new Sprite();
__LayerPanel = new Sprite();
this.addChild(__LayerBackground);
this.addChild(__LayerCage);
this.addChild(__LayerKnight);
this.addChild(__LayerBats);
this.addChild(__LayerForground);
this.addChild(__LayerPanel);
__main.CH_01.stop();
musicID = setTimeout(startMusic, 2000);
CreateKnight();
__panel = MovieClip(this.panel);
__LayerPanel.addChild(__panel);
__panel.Life.bar.scaleY = (__main.Life / 100);
__clock = (__panel.clock as Clock);
__clock.Init(this, (__main.LevelTime * 1000));
__totalBats = 0;
__freePrincess = 0;
__deadbats = 0;
__DropPrincess = (50 + (Math.random() * 100));
__panel.T_level.text = ((__main.Level + "/") + __main.TotalLevels);
__panel.T_gold.text = __main.Gold;
__panel.T_Score.text = __main.Score;
__bat = new Array(__maxBats);
stage.focus = null;
this.addEventListener(Event.ENTER_FRAME, PlayEnterFrame);
__InitId = setInterval(initBat01, 500);
__freeze = false;
}
public function GoToShop(_arg1:MouseEvent):void{
if (__main.Level < 20){
__stateMachine.SetState(StateMachine.SHOP);
} else {
__stateMachine.SetState(StateMachine.PLAY);
};
}
public function initBat01():void{
trace("Function initBat");
if (__totalBats < __main.Bats01[(__main.Level - 1)]){
__bat[__totalBats] = new Bat01();
__bat[__totalBats].Init0(this);
__LayerBats.addChild(__bat[__totalBats]);
__totalBats++;
} else {
clearInterval(__InitId);
__InitId = setInterval(initBat02, 1000);
};
}
public function initBat03():void{
trace("Function initBat");
if (__totalBats < __main.NumberOfBats[(__main.Level - 1)]){
__bat[__totalBats] = new Bat03();
__bat[__totalBats].Init0(this);
__LayerBats.addChild(__bat[__totalBats]);
__totalBats++;
} else {
clearInterval(__InitId);
};
}
public function Hit():void{
var _local1:int;
trace("Hit");
trace(("__cage = " + __cage));
if (__main.SFX_ON == true){
if (__main.Sword < 3){
__main.SFX_SWORD.play();
} else {
__main.SFX_AXE.play();
};
};
if (((!((__cage == null))) && ((__cage.currentLabel == "close")))){
_local1 = ((__cage.x - __knight.x) * __knight.scaleX);
trace(("distance = " + _local1));
if ((((0 < _local1)) && ((_local1 < 80)))){
switch (__main.Sword){
case 1:
__cage.__power--;
break;
case 2:
__cage.__power = (__cage.__power - 2);
break;
case 3:
__cage.__power = (__cage.__power - 5);
break;
};
if (__cage.__power <= 0){
__cage.gotoAndPlay("open");
if (__main.SFX_ON == true){
__main.SFX_CAGE_OPEN.play();
};
__princess = new Princess();
__princess.Init(this, __cage.x, __princessNum);
__LayerCage.addChild(__princess);
__freePrincess++;
__main.FreePrincess++;
__main.FreePrincessArray.push(__princessNum);
__main.Score = (__main.Score + (__main.PrincessPrice + ((__main.Sword - 1) * 10)));
__panel.T_Score.text = __main.Score;
__main.Gold = (__main.Gold + (__main.PrincessPrice + ((__main.Sword - 1) * 10)));
__panel.T_gold.text = __main.Gold;
};
if (__main.SFX_ON == true){
__main.SFX_SWORD_HIT.play();
};
if ((__knight.x - __cage.x) > 0){
__cage.SwingLeft();
} else {
__cage.SwingRight();
};
};
};
}
public function KillKnight():void{
if (__main.Life <= 0){
return;
};
__main.Life = (__main.Life - 13);
if (__main.Helmet == 1){
__main.Life = (__main.Life - 4);
};
if (__main.Armor == 1){
__main.Life = (__main.Life - 7);
};
__main.Score = Math.max((__main.Score - 40), 0);
__panel.T_Score.text = __main.Score;
if (__main.Life < 0){
__main.Life = 0;
};
trace(("Life = " + __main.Life));
__panel.Life.bar.scaleY = (__main.Life / 100);
if (__main.Life > 0){
__knight.Fall();
__knight.Immune();
if (__main.SFX_ON == true){
__main.SFX_OUCH.play();
};
} else {
__knight.Die();
if (__main.SFX_ON == true){
__main.SFX_DIE.play();
};
__clock.Clean();
trace("setTimeout(GameOver, 5000)");
setTimeout(GameOver, 5000);
};
}
public function Win(_arg1:MouseEvent):void{
__stateMachine.SetState(StateMachine.WIN);
}
public function CreateKnight():void{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = __main.Armor;
_local2 = __main.Helmet;
_local3 = __main.Sword;
if ((((((_local1 == 1)) && ((_local2 == 1)))) && ((_local3 == 1)))){
__knight = new Knight01();
};
if ((((((_local1 == 1)) && ((_local2 == 2)))) && ((_local3 == 1)))){
__knight = new Knight02();
};
if ((((((_local1 == 2)) && ((_local2 == 1)))) && ((_local3 == 1)))){
__knight = new Knight03();
};
if ((((((_local1 == 2)) && ((_local2 == 2)))) && ((_local3 == 1)))){
__knight = new Knight04();
};
if ((((((_local1 == 1)) && ((_local2 == 1)))) && ((_local3 == 2)))){
__knight = new Knight05();
};
if ((((((_local1 == 1)) && ((_local2 == 2)))) && ((_local3 == 2)))){
__knight = new Knight06();
};
if ((((((_local1 == 2)) && ((_local2 == 1)))) && ((_local3 == 2)))){
__knight = new Knight07();
};
if ((((((_local1 == 2)) && ((_local2 == 2)))) && ((_local3 == 2)))){
__knight = new Knight08();
};
if ((((((_local1 == 1)) && ((_local2 == 1)))) && ((_local3 == 3)))){
__knight = new Knight09();
};
if ((((((_local1 == 1)) && ((_local2 == 2)))) && ((_local3 == 3)))){
__knight = new Knight10();
};
if ((((((_local1 == 2)) && ((_local2 == 1)))) && ((_local3 == 3)))){
__knight = new Knight11();
};
if ((((((_local1 == 2)) && ((_local2 == 2)))) && ((_local3 == 3)))){
__knight = new Knight12();
};
__knight.Init(this, stage);
__LayerKnight.addChild(__knight);
__knight.cacheAsBitmap = true;
}
public function Freeze():void{
var _local1:int;
__freeze = true;
trace("freeze");
if (this.hasEventListener(Event.ENTER_FRAME)){
this.removeEventListener(Event.ENTER_FRAME, PlayEnterFrame);
};
__knight.Freeze();
clearInterval(__InitId);
_local1 = 0;
while (_local1 < __totalBats) {
trace(((("bat " + _local1) + " = ") + __bat[_local1]));
if (__bat[_local1] != null){
__bat[_local1].Freeze();
};
_local1++;
};
if (__princess != null){
__princess.Freeze();
};
if (__cage != null){
__cage.Freeze();
};
__summery = new Summery();
this.__LayerForground.addChild(__summery);
__summery.x = 275;
__summery.y = 200;
__summery.T_level.text = __main.Level;
__summery.T_princess.text = __freePrincess;
__summery.T_bats.text = __deadbats;
__summery.T_gold.text = ((__deadbats * (__main.BatPrice * __main.Sword)) + (__freePrincess * (__main.PrincessPrice + ((__main.Sword - 1) * 10))));
__summery.T_batPrice.text = (__main.BatPrice * __main.Sword);
__summery.T_princessPrice.text = (__main.PrincessPrice + ((__main.Sword - 1) * 10));
__btnNext = (__summery.btnNext as ButtonWood);
__btnNext._labelText = "Next";
if (__main.Level == __main.TotalLevels){
__btnNext._mouseClickCb = Win;
} else {
__btnNext._mouseClickCb = GoToShop;
};
}
public function WinLevel():void{
trace("winLeveL");
Freeze();
}
public function initBat02():void{
trace("Function initBat");
if (__totalBats < (__main.Bats01[(__main.Level - 1)] + __main.Bats02[(__main.Level - 1)])){
__bat[__totalBats] = new Bat02();
__bat[__totalBats].Init0(this);
__LayerBats.addChild(__bat[__totalBats]);
__totalBats++;
} else {
clearInterval(__InitId);
__InitId = setInterval(initBat03, 1000);
};
}
public function KillAllBats():void{
var _local1:int;
_local1 = 0;
while (_local1 < __totalBats) {
if (__bat[_local1] != null){
__bat[_local1].gotoAndPlay("die");
__bat[_local1].Stop();
__deadbats++;
__main.Score = (__main.Score + (__main.BatPrice * __main.Sword));
__panel.T_Score.text = __main.Score;
__main.Gold = (__main.Gold + (__main.BatPrice * __main.Sword));
__panel.T_gold.text = __main.Gold;
};
_local1++;
};
}
public function PlayEnterFrame(_arg1:Event):void{
__panel.T_mana.text = __main.Mana;
if (__cage == null){
__DropPrincess--;
if (__DropPrincess < 0){
__DropPrincess = 1000000;
if (__main.SFX_ON == true){
__main.SFX_SCREAM.play();
};
__princessNum = (Math.floor((Math.random() * 3)) + 1);
__cage = new Cage();
__cage.Init(this, __princessNum);
__LayerCage.addChild(__cage);
};
} else {
if (__cage.currentLabel == "finish"){
__cage.Clean();
__cage = null;
__DropPrincess = (50 + (Math.random() * 100));
};
};
}
}
}//package
Section 61
//StateShop (StateShop)
package {
import flash.display.*;
import flash.events.*;
public class StateShop extends StateBase {
public var panel:Panel;
public var description:MovieClip;
public var __description:MovieClip;
public var __panel:MovieClip;
public var __knight:MovieClip;
private var __TERERE_ARRAY:Array;
public var __w2:ButtonShop;
public var __w3:ButtonShop;
public var __w4:ButtonShop;
public var w1:ButtonShop;
public var w4:ButtonShop;
public var __main:MovieClip;
public var knight:MovieClip;
public var btnPlay:ButtonWood;
public var w2:ButtonShop;
public var __w5:ButtonShop;
public var w3:ButtonShop;
public var warning:MovieClip;
public var __w1:ButtonShop;
public var __btnPlay:ButtonBase;
public var w5:ButtonShop;
public function StateShop(){
__TERERE_ARRAY = ["- magic potion\n- increase your mana by one", "- golden helmet\n- stronger protection from bats", "- golden sword\nearn more gold for rescueing princesses and slashing bats\n- stronger strikes on cage", "- golden armor\n- stronger protection from bats", "- life potion\n- increase your life by 10%"];
super();
}
override public function Clean():void{
super.Clean();
__btnPlay.Enable(false);
__w1.Enable(false);
__w2.Enable(false);
__w3.Enable(false);
__w4.Enable(false);
__w5.Enable(false);
}
override public function Init(_arg1:StateMachine):void{
super.Init(_arg1);
__main = MovieClip(_arg1.__main);
__knight = MovieClip(this.knight);
__panel = MovieClip(this.panel);
__description = MovieClip(this.description);
trace("Shop");
if (__main.MUSIC_ON){
__main.CH_01 = __main.MUSIC_01.play(0, 100);
__main.CH_02.stop();
};
__btnPlay = (this.btnPlay as ButtonBase);
__btnPlay._mouseClickCb = PlayGame;
__btnPlay._labelText = "Play";
__w1 = (this.w1 as ButtonShop);
__w2 = (this.w2 as ButtonShop);
__w3 = (this.w3 as ButtonShop);
__w4 = (this.w4 as ButtonShop);
__w5 = (this.w5 as ButtonShop);
__w1._mouseClickCb = W1;
__w2._mouseClickCb = W2;
__w3._mouseClickCb = W3;
__w4._mouseClickCb = W4;
__w5._mouseClickCb = W5;
__w1._mouseOverCb = WOverCb;
__w2._mouseOverCb = WOverCb;
__w3._mouseOverCb = WOverCb;
__w4._mouseOverCb = WOverCb;
__w5._mouseOverCb = WOverCb;
__w1._mouseOutCb = WOutCb;
__w2._mouseOutCb = WOutCb;
__w3._mouseOutCb = WOutCb;
__w4._mouseOutCb = WOutCb;
__w5._mouseOutCb = WOutCb;
__w1._labelText = __main.PotionPrice;
__w2._labelText = __main.HelmetPrice;
__w3._labelText = __main.SwordPrice;
__w4._labelText = __main.ArmorPrice;
__w5._labelText = __main.LifePrice;
__w1._id = 0;
__w2._id = 1;
__w3._id = 2;
__w4._id = 3;
__w5._id = 4;
EquipKnight();
if (__main.Level == 19){
__main.Life = 100;
} else {
this.warning.alpha = 0;
};
__panel.Life.bar.scaleY = (__main.Life / 100);
__panel.T_level.text = (((__main.Level + 1) + "/") + __main.TotalLevels);
__panel.T_Score.text = __main.Score;
__panel.T_gold.text = __main.Gold;
__panel.T_mana.text = __main.Mana;
__panel.clock.gotoAndStop(11);
__panel.clock.sandTop.scaleY = 0;
__panel.clock.sandBottom.scaleY = 1;
__TERERE_ARRAY.push(this.description.txt.text);
}
public function WOutCb(_arg1:MouseEvent):void{
_arg1.target.gotoAndStop(1);
this.description.txt.text = __TERERE_ARRAY[5];
}
private function PlayGame(_arg1:MouseEvent):void{
__stateMachine.SetState(StateMachine.PLAY);
}
public function WOverCb(_arg1:MouseEvent):void{
var _local2:int;
_local2 = ButtonBase(_arg1.target)._id;
_arg1.target.gotoAndStop(2);
trace(("id = " + _local2));
trace(("__TERERE_ARRAY[id] = " + __TERERE_ARRAY[_local2]));
this.description.txt.text = __TERERE_ARRAY[_local2];
}
public function W1(_arg1:MouseEvent):void{
if (__main.Gold < __main.PotionPrice){
return;
};
__main.Gold = (__main.Gold - __main.PotionPrice);
__main.Mana++;
__panel.T_gold.text = __main.Gold;
__panel.T_mana.text = __main.Mana;
if (__main.SFX_ON == true){
__main.SFX_COINS.play();
};
}
public function W2(_arg1:MouseEvent):void{
if ((((__main.Gold < __main.HelmetPrice)) || ((__main.Helmet == 2)))){
return;
};
__main.Gold = (__main.Gold - __main.HelmetPrice);
__main.Helmet = 2;
__panel.T_gold.text = __main.Gold;
EquipKnight();
if (__main.SFX_ON == true){
__main.SFX_COINS.play();
};
}
public function EquipKnight():void{
var _local2 = __knight;
with (_local2) {
if (__main.Sword < 3){
__knight.gotoAndStop(1);
} else {
__knight.gotoAndStop(2);
};
helmet.gotoAndStop(__main.Helmet);
armor.gotoAndStop(__main.Armor);
sword.gotoAndStop(__main.Sword);
};
__w1.equip.gotoAndStop("magic");
__w5.equip.gotoAndStop("life");
switch (__main.Helmet){
case 1:
__w2.equip.gotoAndStop("helmet");
break;
case 2:
__w2.equip.gotoAndStop("close");
break;
};
switch (__main.Sword){
case 1:
__w3.equip.gotoAndStop("sword02");
break;
case 2:
__w3.equip.gotoAndStop("sword03");
break;
case 3:
__w3.equip.gotoAndStop("close");
break;
};
switch (__main.Armor){
case 1:
__w4.equip.gotoAndStop("armor");
break;
case 2:
__w4.equip.gotoAndStop("close");
break;
};
}
public function W3(_arg1:MouseEvent):void{
if ((((__main.Gold < __main.SwordPrice)) || ((__main.Sword == 3)))){
return;
};
__main.Gold = (__main.Gold - __main.SwordPrice);
__main.Sword++;
__panel.T_gold.text = __main.Gold;
EquipKnight();
if (__main.SFX_ON == true){
__main.SFX_COINS.play();
};
}
public function W5(_arg1:MouseEvent):void{
if ((((__main.Gold < __main.LifePrice)) || ((__main.Life == 100)))){
return;
};
__main.Gold = (__main.Gold - __main.LifePrice);
__main.Life = (__main.Life + 10);
if (__main.Life > 100){
__main.Life = 100;
};
__panel.T_gold.text = __main.Gold;
__panel.Life.bar.scaleY = (__main.Life / 100);
EquipKnight();
if (__main.SFX_ON == true){
__main.SFX_COINS.play();
};
}
public function W4(_arg1:MouseEvent):void{
if ((((__main.Gold < __main.ArmorPrice)) || ((__main.Armor == 2)))){
return;
};
__main.Gold = (__main.Gold - __main.ArmorPrice);
__main.Armor = 2;
__panel.T_gold.text = __main.Gold;
EquipKnight();
if (__main.SFX_ON == true){
__main.SFX_COINS.play();
};
}
}
}//package
Section 62
//StateWin (StateWin)
package {
import flash.display.*;
import flash.events.*;
import mochi.*;
import flash.text.*;
import flash.utils.*;
public class StateWin extends StateBase {
public var __count:int;
public var __LayerForground:Sprite;
public var __princess:MovieClip;
public var __earth:Array;
public var T_count:TextField;
public var __FreePrincessArray:Array;
public var __btnMenu:ButtonMenu;
public var freetxt:TextField;
public var forground:MovieClip;
public var __knight:MovieClip;
public var __IntervalID:int;
public var __main:MovieClip;
public var knight:MovieClip;
public var __freePrincess:int;
public var btnMenu:ButtonMenu;
public var __LayerPrincess:Sprite;
override public function Clean():void{
super.Clean();
__FreePrincessArray = null;
clearInterval(__IntervalID);
if (__main.MUSIC_ON){
__main.CH_01.stop();
};
}
public function AddPrincess():void{
if (__freePrincess > 0){
__princess = new princessWin();
__princess.Init(this, __FreePrincessArray[__count]);
__LayerPrincess.addChild(__princess);
__count++;
__freePrincess--;
};
this.T_count.text = (__count + " ...");
if (__freePrincess <= 0){
this.T_count.text = "piece\nof cake";
clearInterval(__IntervalID);
};
}
override public function Init(_arg1:StateMachine):void{
var myOptions:Object;
var stateMachine = _arg1;
super.Init(stateMachine);
__main = MovieClip(stateMachine.__main);
__freePrincess = stateMachine.__main.FreePrincess;
__FreePrincessArray = stateMachine.__main.FreePrincessArray;
if (__main.MUSIC_ON){
__main.CH_01 = __main.MUSIC_01.play(0, 100);
};
__count = 0;
this.freetxt.text = __freePrincess.toString();
__IntervalID = setInterval(AddPrincess, 400);
__LayerPrincess = new Sprite();
__LayerForground = new Sprite();
this.addChild(__LayerPrincess);
this.addChild(__LayerForground);
__LayerForground.addChild(this.forground);
__earth = new Array(460, 460, 461, 463, 464, 466, 467, 468, 469, 470, 471, 471, 472, 472, 472, 473, 473, 473, 472, 472, 472, 471, 471, 470, 469, 468, 467, 466, 465, 463, 462, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, 461);
__knight = MovieClip(this.knight);
EquipKnight();
__btnMenu = (this.btnMenu as ButtonMenu);
__btnMenu._mouseClickCb = GoToMenu;
__btnMenu._labelText = "Again";
if (__main.MOCHI){
MochiServices.connect("c23727d6214f5c39", root);
myOptions = {boardID:"21df77e412afa6a5", score:__main.Score, onClose:function ():void{
trace("close highscores");
}};
MochiScores.showLeaderboard(myOptions);
};
}
public function GoToMenu(_arg1:MouseEvent):void{
__stateMachine.SetState(StateMachine.MENU);
}
public function EquipKnight():void{
var _local2 = __knight;
with (_local2) {
if (__main.Sword < 3){
__knight.gotoAndStop(1);
} else {
__knight.gotoAndStop(2);
};
helmet.gotoAndStop(__main.Helmet);
armor.gotoAndStop(__main.Armor);
sword.gotoAndStop(__main.Sword);
};
}
}
}//package
Section 63
//Summery (Summery)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Summery extends MovieClip {
public var T_bats:TextField;
public var T_princess:TextField;
public var T_gold:TextField;
public var btnNext:ButtonWood;
public var T_princessPrice:TextField;
public var T_batPrice:TextField;
public var T_level:TextField;
}
}//package
Section 64
//sword (sword)
package {
import flash.media.*;
public dynamic class sword extends Sound {
}
}//package
Section 65
//swordhit (swordhit)
package {
import flash.media.*;
public dynamic class swordhit extends Sound {
}
}//package
Section 66
//thunder (thunder)
package {
import flash.media.*;
public dynamic class thunder extends Sound {
}
}//package