Section 1
//Timeline_16 (_fla.Timeline_16)
package _fla {
import flash.display.*;
public dynamic class Timeline_16 extends MovieClip {
public var _rabbit:Rabbit;
public function Timeline_16(){
addFrameScript(15, frame16);
}
function frame16(){
gotoAndStop(1);
}
}
}//package _fla
Section 2
//Timeline_5 (_fla.Timeline_5)
package _fla {
import flash.display.*;
public dynamic class Timeline_5 extends MovieClip {
public function Timeline_5(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package _fla
Section 3
//Timeline_6 (_fla.Timeline_6)
package _fla {
import flash.display.*;
public dynamic class Timeline_6 extends MovieClip {
public function Timeline_6(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package _fla
Section 4
//PowerBar (ass.common.PowerBar)
package ass.common {
import flash.display.*;
public class PowerBar extends MovieClip {
public function PowerBar():void{
initView();
initEvent();
}
private function initEvent():void{
}
private function initView():void{
this.stop();
}
}
}//package ass.common
Section 5
//TimeBar (ass.common.TimeBar)
package ass.common {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class TimeBar extends MovieClip {
private var timer:Timer;
public var _time:MovieClip;
private var time:int;// = 0
private var __time:MovieClip;
public function TimeBar():void{
}
private function initEvent():void{
timer.addEventListener(TimerEvent.TIMER, timeHandler);
}
private function initView():void{
__time = (getChildByName("_time") as MovieClip);
timer = new Timer(1000);
timer.start();
}
public function timing():void{
initView();
initEvent();
}
private function timeHandler(_arg1:TimerEvent):void{
time++;
__time.width = (__time.width - 1);
if (time > 180){
timer.stop();
this.dispatchEvent(new Event("TIMEOUT"));
};
}
}
}//package ass.common
Section 6
//Hero (ass.hero.Hero)
package ass.hero {
import flash.events.*;
import flash.display.*;
import ass.rabbit.*;
public class Hero extends MovieClip {
public var _eyes:MovieClip;
private var _speed:int;// = 30
private var __rabbit:MovieClip;
public var speedY:Number;// = 0
public var speedX:Number;// = 1
public var _rabbit:CaughtRabbit;
public var rabbit:MovieClip;
public function Hero():void{
addFrameScript(4, frame5, 9, frame10, 21, frame22, 33, frame34);
initView();
initEvent();
}
function frame10(){
stop();
}
public function get speed():int{
return (_speed);
}
private function initEvent():void{
}
function frame22(){
gotoAndStop(1);
}
public function set speed(_arg1:int):void{
_speed = _arg1;
if (((__rabbit.dist_x) && (__rabbit.distance))){
speedX = ((_speed * __rabbit.dist_x) / __rabbit.distance);
speedY = ((_speed * __rabbit.dist_y) / __rabbit.distance);
};
}
function frame5(){
stop();
}
private function initView():void{
this.stop();
}
public function shootReady():void{
__rabbit = (getChildByName("_rabbit") as MovieClip);
if (__rabbit){
if (((__rabbit.distance) && ((__rabbit.dist_x > 100)))){
rabbit = (__rabbit.clone() as MovieClip);
rabbit.rotation = __rabbit.rotation;
rabbit.x = (__rabbit.x + this.x);
rabbit.y = (__rabbit.y + this.y);
this.parent.addChild(rabbit);
rabbit.stopTurnRound();
this.dispatchEvent(new Event("SHOOTING"));
};
};
}
function frame34(){
gotoAndStop(1);
}
}
}//package ass.hero
Section 7
//CaughtRabbit (ass.rabbit.CaughtRabbit)
package ass.rabbit {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class CaughtRabbit extends MovieClip {
public var distance:Number;
private var _rX:Number;
private var _rY:Number;
public var _rabbitHitArea:MovieClip;
private var _preR:int;
public var dist_y:Number;
public var dist_x:Number;
public function CaughtRabbit():void{
addFrameScript(0, frame1);
initView();
this.addEventListener(Event.ADDED_TO_STAGE, initEvent);
}
function frame1(){
stop();
}
private function initView():void{
var _local1:Point = this.localToGlobal(new Point(0, 0));
_rX = _local1.x;
_rY = _local1.y;
}
public function stopTurnRound():void{
stage.removeEventListener(Event.ENTER_FRAME, rotationHandler);
}
private function initEvent(_arg1:Event):void{
stage.addEventListener(Event.ENTER_FRAME, rotationHandler);
}
private function rotationHandler(_arg1:Event):void{
dist_x = (_arg1.target.mouseX - _rX);
dist_y = (_arg1.target.mouseY - _rY);
distance = Math.sqrt(((dist_x * dist_x) + (dist_y * dist_y)));
_preR = Math.floor((((Math.atan2(dist_y, dist_x) * 180) / Math.PI) + 45));
if ((((_preR < 50)) && ((_preR > 0)))){
this.rotation = _preR;
};
}
public function clone():CaughtRabbit{
return (new CaughtRabbit());
}
}
}//package ass.rabbit
Section 8
//DragTarget (ass.target.DragTarget)
package ass.target {
import flash.events.*;
import flash.display.*;
public class DragTarget extends MovieClip {
public var levelSpeed:int;// = 2
public var _target:MovieClip;
private var __target:MovieClip;
public var _dragSpeed:int;// = 2
public function DragTarget():void{
}
public function startDragTarget():void{
initView();
initEvent();
}
private function initEvent():void{
stage.addEventListener(Event.ENTER_FRAME, dragHandler, false, 0, true);
}
public function stopDragTarget():void{
stage.removeEventListener(Event.ENTER_FRAME, dragHandler);
}
private function initView():void{
__target = (getChildByName("_target") as MovieClip);
var _local1:Sprite = new Sprite();
_local1.graphics.beginFill(0xCCCCCC);
_local1.graphics.drawRect(-5, 30, 80, 390);
_local1.graphics.endFill();
addChild(_local1);
__target.mask = _local1;
}
private function dragHandler(_arg1:Event):void{
_dragSpeed = ((_dragSpeed > 0)) ? levelSpeed : -(levelSpeed);
__target.y = (__target.y - _dragSpeed);
if ((((__target.y < -200)) || ((__target.y > 0)))){
_dragSpeed = -(_dragSpeed);
};
}
}
}//package ass.target
Section 9
//GameView (ass.GameView)
package ass {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import ass.common.*;
import ass.hero.*;
import ass.target.*;
import flash.geom.*;
import flash.ui.*;
public class GameView extends MovieClip {
private var _levelUp:MovieClip;
public var _pointCount:TextField;
private var _totalHit:int;// = 0
private var __targetHitArea:MovieClip;
private var _tf:TextFormat;
private var _gameover:Boolean;// = false
private var _catchRabbitMc:MovieClip;
public var _powerBar:PowerBar;
private var __hitRate:TextField;
private var __timeBar:MovieClip;
public var __pointCount:TextField;
private var timer:Timer;
private var shootMusic:Sound;
private var pointMc:MovieClip;
public var _plane:MovieClip;
private var __rabbitHitArea:MovieClip;
private var __target:MovieClip;
public var _hole1:MovieClip;
public var _hole2:MovieClip;
public var _hole3:MovieClip;
public var _hole4:MovieClip;
public var _xiaoLei:Hero;
private var hitTargetMusic:Sound;
private var handStyle:MovieClip;
public var _dragTarget:DragTarget;
private var _level:int;// = 1
private var point:int;// = 10
private var __hole1:MovieClip;
private var __hole2:MovieClip;
private var __hole3:MovieClip;
private var __hole4:MovieClip;
private var backgroundMusic:Sound;
private var _totalThrow:int;// = 0
private var __powerBar:MovieClip;
private var _mcMask:Sprite;
private var __dragTarget:MovieClip;
public var _timeBar:TimeBar;
public var _channel:SoundChannel;
private var _rect1:Rectangle;
private var _rect2:Rectangle;
private var __xiaoLei:MovieClip;
public var _hitRate:TextField;
private var gameOverMusic:Sound;
public var _chongWu:MovieClip;
private var _displacement:Number;
private var _hitTargetRabbit:MovieClip;
public function GameView():void{
_channel = new SoundChannel();
_channel.stop();
backgroundMusic = new BackgroundMusic();
_channel = backgroundMusic.play(0, int.MAX_VALUE);
shootMusic = new ShootMusic();
hitTargetMusic = new HitTargetMusic();
gameOverMusic = new GameOverMusic();
this.addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, init);
initView();
initEvent();
}
private function shootHandler(_arg1:Event):void{
this.removeEventListener(MouseEvent.MOUSE_DOWN, shootReady);
shootMusic.play();
_totalThrow++;
__powerBar.stop();
var _local2:Array = __powerBar.currentLabel.split("_");
switch (int(_local2[1])){
case 1:
__xiaoLei.speed = 20;
point = 30;
break;
case 2:
__xiaoLei.speed = 23;
point = 20;
break;
case 3:
__xiaoLei.speed = 26;
point = 20;
break;
case 4:
__xiaoLei.speed = 29;
point = 20;
break;
case 5:
__xiaoLei.speed = 32;
point = 20;
break;
case 6:
__xiaoLei.speed = 35;
point = 20;
break;
case 7:
__xiaoLei.speed = 38;
point = 30;
break;
case 8:
__xiaoLei.speed = 41;
point = 20;
break;
case 9:
__xiaoLei.speed = 44;
point = 20;
break;
case 10:
__xiaoLei.speed = 55;
point = 50;
break;
default:
break;
};
if (__xiaoLei.rabbit){
__rabbitHitArea = (__xiaoLei.rabbit.getChildByName("_rabbitHitArea") as MovieClip);
__targetHitArea = (__target.getChildByName("_targetHitArea") as MovieClip);
this.addEventListener(Event.ENTER_FRAME, shooting);
};
__xiaoLei.gotoAndPlay("_shoot");
}
private function mouseMoveHandler(_arg1:Event):void{
handStyle.x = (mouseX - (handStyle.width / 2));
handStyle.y = (mouseY - (handStyle.height / 2));
}
public function hideMouseMC():void{
if (handStyle != null){
handStyle.visible = false;
};
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
handStyle.gotoAndStop(2);
}
private function shooting(_arg1:Event):void{
var _local2:String;
var _local3:int;
if (((__rabbitHitArea) && (__targetHitArea))){
if (__xiaoLei.speed == 55){
__xiaoLei.rabbit.gotoAndStop(2);
};
__xiaoLei.rabbit.x = (__xiaoLei.rabbit.x + __xiaoLei.speedX);
__xiaoLei.rabbit.y = (__xiaoLei.rabbit.y + __xiaoLei.speedY);
if (__rabbitHitArea.hitTestObject(__targetHitArea)){
hitTargetMusic.play();
_totalHit++;
handStyle.visible = true;
_rect1 = __rabbitHitArea.getBounds(__rabbitHitArea.stage);
_rect2 = __targetHitArea.getBounds(__targetHitArea.stage);
_displacement = (__xiaoLei.rabbit.y - _rect1.y);
_hitTargetRabbit = new HitTargetRabbit();
_hitTargetRabbit.x = __xiaoLei.rabbit.x;
_hitTargetRabbit.y = __xiaoLei.rabbit.y;
_hitTargetRabbit.rotation = (__xiaoLei.rabbit.rotation - 45);
this.addChild(_hitTargetRabbit);
switch (point){
case 20:
pointMc = new Twenty();
break;
case 30:
pointMc = new Thirty();
break;
case 50:
pointMc = new Fifty();
break;
default:
pointMc = new Twenty();
break;
};
pointMc.x = (_hitTargetRabbit.x + 80);
pointMc.y = (_hitTargetRabbit.y - 100);
this.addChild(pointMc);
this.removeEventListener(Event.ENTER_FRAME, shooting);
this.removeChild(__xiaoLei.rabbit);
__xiaoLei.rabbit = null;
_local2 = String((int(__pointCount.text) + point));
__pointCount.text = _local2;
dispatchEvent(new Event("NewScore"));
_local3 = _level;
if (int(_local2) < 50){
_level = 1;
__dragTarget.levelSpeed = 2;
} else {
if ((((int(_local2) >= 50)) && ((int(_local2) < 100)))){
_level = 2;
__dragTarget.levelSpeed = 4;
} else {
if ((((int(_local2) >= 100)) && ((int(_local2) < 200)))){
_level = 3;
__dragTarget.levelSpeed = 6;
} else {
if ((((int(_local2) >= 200)) && ((int(_local2) < 300)))){
_level = 4;
__dragTarget.levelSpeed = 8;
} else {
if ((((int(_local2) >= 300)) && ((int(_local2) < 450)))){
_level = 5;
__dragTarget.levelSpeed = 10;
} else {
if ((((int(_local2) >= 450)) && ((int(_local2) < 600)))){
_level = 6;
__dragTarget.levelSpeed = 12;
} else {
if ((((int(_local2) >= 600)) && ((int(_local2) < 750)))){
_level = 7;
__dragTarget.levelSpeed = 14;
} else {
if ((((int(_local2) >= 750)) && ((int(_local2) < 900)))){
_level = 8;
__dragTarget.levelSpeed = 16;
} else {
if ((((int(_local2) >= 900)) && ((int(_local2) < 1200)))){
_level = 9;
__dragTarget.levelSpeed = 18;
};
};
};
};
};
};
};
};
};
if (_local3 != _level){
_levelUp = new LevelUp();
_levelUp.x = 250;
_levelUp.y = 150;
addChild(_levelUp);
};
this.addEventListener(Event.ENTER_FRAME, endShootHandler, false, 0, true);
__hitRate.text = (Math.round(((_totalHit / _totalThrow) * 100)) + "%");
__xiaoLei.gotoAndPlay("_smile");
this.addEventListener(MouseEvent.MOUSE_DOWN, shootReady);
} else {
if (__xiaoLei.rabbit.x > 600){
__powerBar.gotoAndStop(1);
handStyle.visible = true;
this.removeEventListener(Event.ENTER_FRAME, shooting);
this.removeChild(__xiaoLei.rabbit);
__xiaoLei.rabbit = null;
timer.start();
__hitRate.text = (Math.round(((_totalHit / _totalThrow) * 100)) + "%");
__xiaoLei.gotoAndPlay("_angry");
this.addEventListener(MouseEvent.MOUSE_DOWN, shootReady);
};
};
};
}
private function initEvent():void{
__hole1.addEventListener(MouseEvent.MOUSE_DOWN, catchRabbitHandler);
__hole2.addEventListener(MouseEvent.MOUSE_DOWN, catchRabbitHandler);
__hole3.addEventListener(MouseEvent.MOUSE_DOWN, catchRabbitHandler);
__hole4.addEventListener(MouseEvent.MOUSE_DOWN, catchRabbitHandler);
stage.addEventListener(Event.ENTER_FRAME, mouseMoveHandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUpHandler);
timer.addEventListener(TimerEvent.TIMER, timeHandler);
__xiaoLei.addEventListener("SHOOTING", shootHandler);
__timeBar.addEventListener("TIMEOUT", gameOverHandler);
}
private function playHandler(_arg1:Event):void{
if (_arg1.currentTarget.currentLabel == "_end"){
_arg1.currentTarget.stop();
_arg1.currentTarget.removeEventListener(Event.ENTER_FRAME, playHandler);
_arg1.currentTarget.parent.removeChild(_mcMask);
_mcMask = null;
_arg1.currentTarget.parent.removeChild(_catchRabbitMc);
_catchRabbitMc = null;
if (!_gameover){
__xiaoLei.play();
__powerBar.play();
this.addEventListener(MouseEvent.MOUSE_DOWN, shootReady);
};
};
}
private function gameOverHandler(_arg1:Event):void{
_channel.stop();
_channel = gameOverMusic.play();
backgroundMusic = null;
_channel = null;
var _local2:MovieClip = new Ending();
_local2.x = 100;
_local2.y = 100;
addChild(_local2);
_gameover = true;
timer.removeEventListener(TimerEvent.TIMER, timeHandler);
__hole1.removeEventListener(MouseEvent.MOUSE_DOWN, catchRabbitHandler);
__hole2.removeEventListener(MouseEvent.MOUSE_DOWN, catchRabbitHandler);
__hole3.removeEventListener(MouseEvent.MOUSE_DOWN, catchRabbitHandler);
__hole4.removeEventListener(MouseEvent.MOUSE_DOWN, catchRabbitHandler);
__xiaoLei.removeEventListener("SHOOTING", shootHandler);
if (__xiaoLei.rabbit){
__xiaoLei.rabbit.stopTurnRound();
};
__dragTarget.stopDragTarget();
timer.reset();
__hole1.gotoAndStop(1);
__hole2.gotoAndStop(1);
__hole3.gotoAndStop(1);
__hole4.gotoAndStop(1);
__xiaoLei.gotoAndStop(1);
__powerBar.gotoAndStop(1);
handStyle.visible = true;
var _local3:MovieClip = (getChildByName("_plane") as MovieClip);
var _local4:MovieClip = (getChildByName("_chongWu") as MovieClip);
var _local5:MovieClip = (_local4.getChildByName("_head") as MovieClip);
var _local6:MovieClip = (__xiaoLei.getChildByName("_eyes") as MovieClip);
_local3.stop();
_local4.stop();
_local5.stop();
if (_local6){
_local6.stop();
};
dispatchEvent(new Event("GameOver"));
}
private function endShootHandler(_arg1:Event):void{
var _local2:Point = __target.localToGlobal(new Point(__targetHitArea.x, __targetHitArea.y));
_hitTargetRabbit.y = ((_local2.y + (_rect1.y - _rect2.y)) + _displacement);
if (_hitTargetRabbit.currentLabel == "_end"){
__powerBar.gotoAndStop(1);
if (_levelUp){
this.removeChild(_levelUp);
_levelUp = null;
};
this.removeEventListener(Event.ENTER_FRAME, endShootHandler);
this.removeChild(_hitTargetRabbit);
_hitTargetRabbit = null;
this.removeChild(pointMc);
pointMc = null;
timer.start();
};
}
private function timeHandler(_arg1:TimerEvent):void{
switch (Math.floor(((Math.random() * 4) + 1))){
case 1:
__hole1.play();
break;
case 2:
__hole2.play();
break;
case 3:
__hole3.play();
break;
case 4:
__hole4.play();
break;
default:
break;
};
}
private function shootReady(_arg1:MouseEvent){
__xiaoLei.shootReady();
}
private function onMouseUpHandler(_arg1:MouseEvent):void{
handStyle.gotoAndStop(1);
}
private function catchRabbitHandler(_arg1:MouseEvent):void{
if (_arg1.target.name == "_rabbit"){
timer.reset();
handStyle.visible = false;
__hole1.gotoAndStop(1);
__hole2.gotoAndStop(1);
__hole3.gotoAndStop(1);
__hole4.gotoAndStop(1);
_catchRabbitMc = new CatchRabbitMc();
_catchRabbitMc.x = -5;
_catchRabbitMc.y = -150;
_catchRabbitMc.addEventListener(Event.ENTER_FRAME, playHandler);
_arg1.currentTarget.addChildAt(_catchRabbitMc, 0);
_mcMask = new Sprite();
_mcMask.graphics.beginFill(0xCCCCCC);
_mcMask.graphics.drawRect(0, -225, 98, 230);
_mcMask.graphics.endFill();
_arg1.currentTarget.addChildAt(_mcMask, 1);
_catchRabbitMc.mask = _mcMask;
};
}
private function initView():void{
Mouse.hide();
handStyle = new HandStyle();
handStyle.mouseEnabled = false;
handStyle.mouseChildren = false;
handStyle.stop();
addChild(handStyle);
_tf = new TextFormat("方正卡通简体", 25, 5124632, true);
__hole1 = (this.getChildByName("_hole1") as MovieClip);
__hole1.gotoAndStop(1);
__hole2 = (getChildByName("_hole2") as MovieClip);
__hole2.gotoAndStop(1);
__hole3 = (getChildByName("_hole3") as MovieClip);
__hole3.gotoAndStop(1);
__hole4 = (getChildByName("_hole4") as MovieClip);
__hole4.gotoAndStop(1);
__xiaoLei = (getChildByName("_xiaoLei") as MovieClip);
__dragTarget = (getChildByName("_dragTarget") as MovieClip);
__target = (__dragTarget.getChildByName("_target") as MovieClip);
__powerBar = (getChildByName("_powerBar") as MovieClip);
__timeBar = (getChildByName("_timeBar") as MovieClip);
__hitRate = (getChildByName("_hitRate") as TextField);
__pointCount = (getChildByName("_pointCount") as TextField);
__dragTarget.startDragTarget();
__timeBar.timing();
timer = new Timer(500);
timer.start();
}
}
}//package ass
Section 10
//Main (ass.Main)
package ass {
import flash.events.*;
import flash.display.*;
import mochi.as3.*;
import flash.media.*;
import flash.ui.*;
public class Main extends MovieClip {
public var _storyView:StoryView;
private var _channel:SoundChannel;
private var __startView:MovieClip;
private var _openningMusic:Sound;
private var btnSound:Sound;
public var _mochiads_game_id:String;// = "7947e5762fed494f"
private var _score:int;
private var _gameView:MovieClip;
private var __storyView:MovieClip;
public var _ver:String;// = "V1.2-20100809"
private var _helpView:MovieClip;
private var _btnChannel:SoundChannel;
public var _startView:StartView;
private var __helpBtn:MovieClip;
public function Main():void{
this.addEventListener(Event.ADDED_TO_STAGE, addToStageHandler);
}
private function returnHandler(_arg1:MouseEvent):void{
_btnChannel.stop();
_btnChannel = btnSound.play();
_helpView.addEventListener(Event.ENTER_FRAME, returnBack, false, 0, true);
}
private function initStory():void{
var __nextBtn:SimpleButton;
this.removeChild(__startView);
__startView = null;
try {
__storyView = (getChildByName("_storyView") as MovieClip);
__nextBtn = (__storyView.getChildByName("_nextBtn") as SimpleButton);
__nextBtn.addEventListener(MouseEvent.CLICK, initGame, false, 0, true);
} catch(e:Error) {
__storyView = new StoryView();
__storyView.x = -36.5;
__storyView.y = -10.6;
addChild(__storyView);
__nextBtn = (__storyView.getChildByName("_nextBtn") as SimpleButton);
__nextBtn.addEventListener(MouseEvent.CLICK, initGame, false, 0, true);
};
}
private function helpHandler(_arg1:MouseEvent):void{
_btnChannel.stop();
_btnChannel = btnSound.play();
MovieClip(_arg1.currentTarget).gotoAndStop(1);
__helpBtn.removeEventListener(MouseEvent.MOUSE_UP, helpHandler);
_helpView = new HelpView();
_helpView.x = 25;
_helpView.y = -13;
addChild(_helpView);
var _local2:MovieClip = (_helpView.getChildByName("_helpPanel") as MovieClip);
var _local3:SimpleButton = (_local2.getChildByName("_returnBtn") as SimpleButton);
_local3.addEventListener(MouseEvent.MOUSE_DOWN, returnHandler, false, 0, true);
}
private function gameOverHandler(_arg1:Event){
var e = _arg1;
if (_gameView != null){
_gameView.hideMouseMC();
};
Mouse.show();
var replayer:DisplayObject = new ((this.loaderInfo.applicationDomain.getDefinition("Replayer") as Class));
replayer.x = 300;
replayer.y = 320;
addChild(replayer);
var o:Object = {n:[3, 11, 0, 6, 1, 14, 11, 2, 7, 1, 7, 3, 1, 15, 15, 6], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, score:_score});
replayer.addEventListener(MouseEvent.CLICK, replayGame, false, 0, true);
dispatchEvent(new Event("Game_Over"));
}
private function onStartBtnUp(_arg1:MouseEvent){
initStory();
dispatchEvent(new Event("Game_Start"));
}
public function initSence(){
_score = 0;
if (_gameView){
if (_gameView._channel){
_gameView._channel.stop();
};
};
while (this.numChildren > 0) {
this.removeChildAt((this.numChildren - 1));
};
Mouse.show();
_channel.stop();
_channel = _openningMusic.play(0, int.MAX_VALUE);
__startView = new StartView();
__startView.x = -59.1;
__startView.y = -45.9;
addChild(__startView);
var __startBtn:MovieClip = (__startView.getChildByName("_startBtn") as MovieClip);
__startBtn.buttonMode = true;
__startBtn.stop();
__startBtn.addEventListener(MouseEvent.MOUSE_DOWN, onStartBtnDown);
__startBtn.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
MovieClip(_arg1.target).gotoAndStop(1);
});
__startBtn.addEventListener(MouseEvent.MOUSE_UP, onStartBtnUp, false, 0, true);
__helpBtn = (__startView.getChildByName("_helpBtn") as MovieClip);
__helpBtn.buttonMode = true;
__helpBtn.stop();
__helpBtn.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:MouseEvent){
MovieClip(_arg1.target).gotoAndStop(2);
});
__helpBtn.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
MovieClip(_arg1.target).gotoAndStop(1);
});
__helpBtn.addEventListener(MouseEvent.MOUSE_UP, helpHandler, false, 0, true);
}
private function onStartBtnDown(_arg1:MouseEvent){
_channel.stop();
_btnChannel.stop();
_btnChannel = btnSound.play();
MovieClip(_arg1.currentTarget).gotoAndStop(2);
}
public function get Score():int{
return (_score);
}
private function initGame(_arg1:MouseEvent):void{
_btnChannel.stop();
_btnChannel = btnSound.play();
this.removeChild(__storyView);
__storyView = null;
_gameView = new GameView();
_gameView.addEventListener("NewScore", setNewScore, false, 0, true);
_gameView.addEventListener("GameOver", gameOverHandler, false, 0, true);
addChild(_gameView);
}
private function setNewScore(_arg1:Event){
_score = int(_arg1.currentTarget.__pointCount.text);
}
public function start(){
initStory();
}
private function addToStageHandler(_arg1:Event){
this.removeEventListener(Event.ADDED_TO_STAGE, addToStageHandler);
stage.quality = StageQuality.HIGH;
_channel = new SoundChannel();
_btnChannel = new SoundChannel();
_openningMusic = new OpenningMusic();
btnSound = new BtnSound();
MochiServices.connect("7947e5762fed494f", root);
initStart();
}
private function initStart():void{
_channel.stop();
_channel = _openningMusic.play(0, int.MAX_VALUE);
__startView = (getChildByName("_startView") as MovieClip);
var __startBtn:MovieClip = (__startView.getChildByName("_startBtn") as MovieClip);
__startBtn.buttonMode = true;
__startBtn.stop();
__startBtn.addEventListener(MouseEvent.MOUSE_DOWN, onStartBtnDown);
__startBtn.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
MovieClip(_arg1.target).gotoAndStop(1);
});
__startBtn.addEventListener(MouseEvent.MOUSE_UP, onStartBtnUp, false, 0, true);
__helpBtn = (__startView.getChildByName("_helpBtn") as MovieClip);
__helpBtn.buttonMode = true;
__helpBtn.stop();
__helpBtn.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:MouseEvent){
MovieClip(_arg1.target).gotoAndStop(2);
});
__helpBtn.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
MovieClip(_arg1.target).gotoAndStop(1);
});
__helpBtn.addEventListener(MouseEvent.MOUSE_UP, helpHandler, false, 0, true);
}
private function returnBack(_arg1:Event):void{
_helpView.prevFrame();
if (_helpView.currentFrame == 1){
_helpView.removeEventListener(Event.ENTER_FRAME, returnBack);
this.removeChild(_helpView);
_helpView = null;
__helpBtn.addEventListener(MouseEvent.MOUSE_UP, helpHandler, false, 0, true);
};
}
public function replayGame(_arg1:MouseEvent){
if (_arg1.currentTarget){
removeChild((_arg1.currentTarget as DisplayObject));
};
initSence();
}
}
}//package ass
Section 11
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const NO_USER:String = "NoUser";
public static const IO_ERROR:String = "IOError";
public static const ITEM_NEW:String = "ItemNew";
public static const ITEM_OWNED:String = "ItemOwned";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const STORE_SHOW:String = "StoreShow";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _inventory:MochiInventory;
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function showStore(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function requestFunding(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFunding", _arg1);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 12
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
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 reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _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 get value():Number{
return (Number(this.toString()));
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 13
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
}
}//package mochi.as3
Section 14
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local4:Object;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
}
}//package mochi.as3
Section 15
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _names:Array;
private var _syncID:Number;
private var _consumableProperties:Object;
private var _storeSync:Object;
private var _outstandingID:Number;
private var _syncPending:Boolean;
public static const READY:String = "InvReady";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
private static const KEY_SALT:String = " syncMaint";
public static const WRITTEN:String = "InvWritten";
public static const NOT_READY:String = "InvNotReady";
public static const VALUE_ERROR:String = "InvValueError";
private static const CONSUMER_KEY:String = "MochiConsumables";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (((_arg1.privateProperties) && (_arg1.privateProperties.consumable))){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[(_local2 + KEY_SALT)].value);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 16
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
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){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
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.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
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 _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local2:Object = {};
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) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 17
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.geom.*;
import flash.system.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _queue:Array;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _nextCallbackID:Number;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var _callbacks:Object;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = 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 _callbacks[cb];
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
};
if (_clip != null){
if (_callbacks != null){
_callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_nextCallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local4:int;
var _local14:Loader;
var _local3:Array = [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];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_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 detach(_arg1:Event):void{
var _local2:LoaderInfo = LoaderInfo(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, detach);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.removeEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
private static function loadLCBridgeComplete(_arg1:Event):void{
var _local2:Loader = LoaderInfo(_arg1.target).loader;
_mochiLocalConnection = MovieClip(_local2.content);
listen();
}
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 {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
} 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(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.9.1 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_queue))){
while (_queue.length > 0) {
_local2 = _queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _callbacks[_local2.callbackID];
};
delete _callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _arg1.event;
switch (_local2){
case "services":
MochiServices.triggerEvent(_arg1.event, _arg1.args);
break;
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "social":
MochiSocial.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function urlOptions(_arg1:Object):Object{
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_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 addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var avm1Click:DisplayObject;
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;
var vars:Object = 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);
var s = "?";
var i:Number = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://link.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = 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 setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_clip.parent){
_clip.parent.removeChild(_clip);
};
if (_arg1 != null){
if ((_arg1 is DisplayObjectContainer)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is DisplayObjectContainer)){
DisplayObjectContainer(_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 loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
public static function get childClip():Object{
return (_clip);
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift());
};
};
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
private static function loadLCBridge(_arg1:Object):void{
var _local2:Loader = new Loader();
var _local3:String = (_servURL + _mochiLC);
var _local4:URLRequest = new URLRequest(_local3);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local2.load(_local4);
_arg1.addChild(_local2);
}
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{
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local3:String = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local3 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local3);
_clip = new MovieClip();
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local4:URLRequest = new URLRequest(_local3);
var _local5:URLVariables = new URLVariables();
_local5.listenLC = _listenChannelName;
_local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local5.api_version = getVersion();
if (widget){
_local5.widget = true;
};
_local4.data = _local5;
_loader.load(_local4);
_clip.addChild(_loader);
_sendChannel = new LocalConnection();
_queue = [];
_nextCallbackID = 0;
_callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
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 bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((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 connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
} else {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
};
}
}
}//package mochi.as3
Section 18
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const ACTION_CANCELED:String = "onCancel";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const FRIEND_LIST:String = "FriendsList";
public static const PROFILE_DATA:String = "ProfileData";
public static const GAMEPLAY_DATA:String = "GameplayData";
public static const ACTION_COMPLETE:String = "onComplete";
public static const LOGIN_SHOW:String = "LoginShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const USER_INFO:String = "UserInfo";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const ERROR:String = "Error";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static var _user_info:Object = null;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function requestFan(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFan", _arg1);
}
public static function postToStream(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_postToStream", _arg1);
}
public static function getFriendsList(_arg1:Object=null):void{
MochiServices.send("social_getFriendsList", _arg1);
}
public static function requestLogin(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestLogin", _arg1);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("social_saveUserProperties", _arg1);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function inviteFriends(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_inviteFriends", _arg1);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_showLoginWidget", {options:_arg1});
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function hideLoginWidget():void{
MochiServices.send("social_hideLoginWidget");
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 19
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var callback:Function;// = null
public var operation:String;// = null
public var error:Event;// = null
public var data;// = null
public var _loader:URLLoader;
public var key:String;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function getEvent():void{
request("get", serialize(null));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 20
//111 (111)
package {
import flash.display.*;
public dynamic class 111 extends MovieClip {
}
}//package
Section 21
//BackgroundMusic (BackgroundMusic)
package {
import flash.media.*;
public dynamic class BackgroundMusic extends Sound {
}
}//package
Section 22
//BtnSound (BtnSound)
package {
import flash.media.*;
public dynamic class BtnSound extends Sound {
}
}//package
Section 23
//CatchRabbitMc (CatchRabbitMc)
package {
import flash.display.*;
public dynamic class CatchRabbitMc extends MovieClip {
}
}//package
Section 24
//Ending (Ending)
package {
import flash.display.*;
public dynamic class Ending extends MovieClip {
public function Ending(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package
Section 25
//Fifty (Fifty)
package {
import flash.display.*;
public dynamic class Fifty extends MovieClip {
}
}//package
Section 26
//GameOverMusic (GameOverMusic)
package {
import flash.media.*;
public dynamic class GameOverMusic extends Sound {
}
}//package
Section 27
//HandStyle (HandStyle)
package {
import flash.display.*;
public dynamic class HandStyle extends MovieClip {
}
}//package
Section 28
//HelpView (HelpView)
package {
import flash.display.*;
public dynamic class HelpView extends MovieClip {
public var _helpPanel:MovieClip;
public function HelpView(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
}
}
}//package
Section 29
//HitTargetMusic (HitTargetMusic)
package {
import flash.media.*;
public dynamic class HitTargetMusic extends Sound {
}
}//package
Section 30
//HitTargetRabbit (HitTargetRabbit)
package {
import flash.display.*;
public dynamic class HitTargetRabbit extends MovieClip {
public function HitTargetRabbit(){
addFrameScript(21, frame22);
}
function frame22(){
stop();
}
}
}//package
Section 31
//LevelUp (LevelUp)
package {
import flash.display.*;
public dynamic class LevelUp extends MovieClip {
public function LevelUp(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package
Section 32
//OpenningMusic (OpenningMusic)
package {
import flash.media.*;
public dynamic class OpenningMusic extends Sound {
}
}//package
Section 33
//Rabbit (Rabbit)
package {
import flash.display.*;
public dynamic class Rabbit extends MovieClip {
}
}//package
Section 34
//Replayer (Replayer)
package {
import flash.display.*;
public dynamic class Replayer extends SimpleButton {
}
}//package
Section 35
//ShootMusic (ShootMusic)
package {
import flash.media.*;
public dynamic class ShootMusic extends Sound {
}
}//package
Section 36
//StartView (StartView)
package {
import flash.display.*;
import flash.text.*;
public dynamic class StartView extends MovieClip {
public var _copyright:TextField;
public var _startBtn:MovieClip;
public var _helpBtn:MovieClip;
}
}//package
Section 37
//StoryView (StoryView)
package {
import flash.display.*;
public dynamic class StoryView extends MovieClip {
public var _nextBtn:SimpleButton;
}
}//package
Section 38
//Thirty (Thirty)
package {
import flash.display.*;
public dynamic class Thirty extends MovieClip {
}
}//package
Section 39
//Twenty (Twenty)
package {
import flash.display.*;
public dynamic class Twenty extends MovieClip {
}
}//package