Section 1
//ag_intro_mc_74 (BoozeUp_fla.ag_intro_mc_74)
package BoozeUp_fla {
import flash.display.*;
public dynamic class ag_intro_mc_74 extends MovieClip {
public function ag_intro_mc_74(){
addFrameScript(0, frame1, 224, frame225);
}
function frame1(){
gotoAndPlay(2);
}
function frame225(){
stop();
}
}
}//package BoozeUp_fla
Section 2
//heartClip_68 (BoozeUp_fla.heartClip_68)
package BoozeUp_fla {
import flash.display.*;
public dynamic class heartClip_68 extends MovieClip {
public function heartClip_68(){
addFrameScript(79, frame80);
}
function frame80(){
stop();
}
}
}//package BoozeUp_fla
Section 3
//heartPopClip_69 (BoozeUp_fla.heartPopClip_69)
package BoozeUp_fla {
import flash.display.*;
public dynamic class heartPopClip_69 extends MovieClip {
public function heartPopClip_69(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package BoozeUp_fla
Section 4
//logoClip_17 (BoozeUp_fla.logoClip_17)
package BoozeUp_fla {
import flash.events.*;
import flash.display.*;
public dynamic class logoClip_17 extends MovieClip {
public function logoClip_17(){
addFrameScript(0, frame1, 179, frame180);
}
function frame1(){
this.dispatchEvent(new Event("AnimDone"));
}
function frame180(){
gotoAndPlay("loop");
}
}
}//package BoozeUp_fla
Section 5
//PreloadAssets_7 (BoozeUp_fla.PreloadAssets_7)
package BoozeUp_fla {
import flash.display.*;
public dynamic class PreloadAssets_7 extends MovieClip {
public function PreloadAssets_7(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package BoozeUp_fla
Section 6
//SFXHolder_53 (BoozeUp_fla.SFXHolder_53)
package BoozeUp_fla {
import flash.display.*;
public dynamic class SFXHolder_53 extends MovieClip {
public function SFXHolder_53(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package BoozeUp_fla
Section 7
//winB_67 (BoozeUp_fla.winB_67)
package BoozeUp_fla {
import flash.media.*;
import flash.events.*;
import flash.display.*;
import customclasses.*;
public dynamic class winB_67 extends MovieClip {
public var sfxKissStart:Sound;
public var sfxKissEnd:Sound;
public var sfxLongPuke:Sound;
public var sfxPop:Sound;
public function winB_67(){
addFrameScript(54, frame55, 228, frame229, 341, frame342, 500, frame501, 542, frame543);
}
function frame55(){
sfxKissStart = new SFXKissStart();
sfxKissStart.play(0, 0, new SoundTransform(Game.SFX_VOL));
}
function frame229(){
sfxKissEnd = new SFXKissEnd();
sfxKissEnd.play(0, 0, new SoundTransform(Game.SFX_VOL));
}
function frame342(){
sfxLongPuke = new SFXFinalSick();
sfxLongPuke.play(0, 0, new SoundTransform(3));
}
function frame501(){
sfxPop = new SFXPop();
sfxPop.play(0, 0, new SoundTransform(Game.SFX_VOL));
}
function frame543(){
stop();
this.dispatchEvent(new Event("Anim done"));
}
}
}//package BoozeUp_fla
Section 8
//AnimPopSpikeTile (customclasses.AnimPopSpikeTile)
package customclasses {
import flash.display.*;
import gmd.utils.*;
public class AnimPopSpikeTile extends AnimTile {
public var killFrame:Boolean;
private var isTriggered:Boolean;
public function AnimPopSpikeTile(_arg1:BitmapData, _arg2:int){
super(_arg1, _arg2);
this.init();
}
private function init():void{
this.addLoop(0, [0], false);
this.addLoop(1, [0, 0, 0, 0, 0, 0, 0, 1, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0], false);
this.play(0);
this.isTriggered = false;
this.killFrame = false;
this.addEventListener(AnimEvent.LOOP_COMPLETE, onAnimComplete, false, 0, true);
}
override public function update():void{
super.update();
this.killFrame = (this.frame == 4);
}
override public function set frame(_arg1:int):void{
super.frame = _arg1;
}
public function trigger():Boolean{
if (!this.isTriggered){
this.play(1);
this.isTriggered = true;
return (true);
};
return (false);
}
private function onAnimComplete(_arg1:AnimEvent):void{
this.isTriggered = false;
}
}
}//package customclasses
Section 9
//AnimSpringTile (customclasses.AnimSpringTile)
package customclasses {
import flash.display.*;
public class AnimSpringTile extends AnimTile {
public function AnimSpringTile(_arg1:BitmapData, _arg2:int){
super(_arg1, _arg2);
this.init();
}
private function init():void{
this.addLoop(0, [0], false);
this.addLoop(1, [1, 1, 2, 2, 3, 3, 4, 4, 3, 3, 0], false);
this.play(0);
}
public function trigger():void{
this.play(1);
}
}
}//package customclasses
Section 10
//AnimTile (customclasses.AnimTile)
package customclasses {
import flash.display.*;
import gmd.utils.*;
public class AnimTile extends AnimSprite {
public var tileId:int;
public function AnimTile(_arg1:BitmapData, _arg2:int){
super(_arg1, Level.TILE_WIDTH, Level.TILE_WIDTH, int((_arg1.width / Level.TILE_WIDTH)), 1);
this.tileId = _arg2;
}
}
}//package customclasses
Section 11
//BoozeUp (customclasses.BoozeUp)
package customclasses {
import flash.media.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import gmd.framework.*;
import flash.net.*;
import flash.system.*;
public class BoozeUp extends Application {
public var LoaderBar:LoadBar;
public var LoadingMuteBtn:MuteButton;
private var game:Game;
private var isGameReady:Boolean;// = false
public var isFirstPlay:Boolean;
public var isFirstFinish:Boolean;// = false
private var isLevelListLoaded:Boolean;// = false
private var isAppLoaded:Boolean;// = false
private var currentLevel:int;
public var scoreResult:String;
public var deathCount:int;
public var pintCount:int;
public var pukeCount:int;
public var longestPuke:int;
public var musicManager:MusicManager;
private var abs;
public static const MAX_LEVELS:int = 50;
public static const INITIAL_LEVELS_UNLOCKED:int = 5;
public static const MAX_MEDALS:int = 45;
public static const MEDAL_BRONZE:int = 0;
public static const MEDAL_SILVER:int = 1;
public static const MEDAL_GOLD:int = 2;
public static const MAX_PINTS:int = 700;
public static var levelList:XML;
public function BoozeUp(){
var _local1:ByteArray;
var _local2:String;
addFrameScript(0, frame1, 9, frame10, 19, frame20);
super(640, 472, false);
this.addEventListener(AppEvent.LOAD_BEGIN, onLoadBegin);
this.addEventListener(AppEvent.LOAD_PROGRESS, onLoading);
this.addEventListener(AppEvent.LOAD_COMPLETE, onLoadComplete);
this.addEventListener(AppEvent.APP_READY, onAppReady);
_local1 = new LevelData.LevelList();
_local2 = _local1.readUTFBytes(_local1.length);
levelList = new XML(_local2);
this.isLevelListLoaded = true;
this.addEventListener(ScreenEvent.BUTTON_CLICKED, onButtonClicked);
this.addEventListener(ScreenEvent.SCREEN_OUT, onScreenOut, false, 0, true);
this.addEventListener(ScreenEvent.SCREEN_REVEAL, onScreenReveal, false, 0, true);
this.addEventListener(Event.ADDED, onButtonAdded);
}
public function get isGameComplete():Boolean{
var _local1:String = this.settings.getValue("gameComplete");
if (!_local1){
_local1 = "0";
};
return ((_local1 == "1"));
}
public function get isCheatActive():Boolean{
var _local1:String = this.settings.getValue("cheatActivated");
if (!_local1){
_local1 = "0";
};
return ((_local1 == "1"));
}
public function set isCheatActive(_arg1:Boolean):void{
var _local2:Sound;
if (_arg1){
this.settings.setValue("cheatActivated", "1");
this.settings.setValue("levelsCleared", String(MAX_LEVELS));
_local2 = new SFXCheat();
_local2.play(0, 0, new SoundTransform(Game.SFX_VOL));
} else {
this.settings.setValue("cheatActivated", "0");
};
}
public function get levelsComplete():int{
return (int(this.settings.getValue("levelsCleared")));
}
public function getMedal(_arg1:int):int{
var _local2:Array = this.settings.retrieveArray("levelScores");
return (_local2[(_arg1 - 1)][1]);
}
public function get silverCount():int{
var _local1:int;
var _local2:Array = this.settings.retrieveArray("levelScores");
var _local3:int;
while (_local3 < _local2.length) {
if ((((_local2[_local3][1] == MEDAL_SILVER)) || ((_local2[_local3][1] == MEDAL_GOLD)))){
_local1++;
};
_local3++;
};
return (_local1);
}
public function get goldCount():int{
var _local1:int;
var _local2:Array = this.settings.retrieveArray("levelScores");
var _local3:int;
while (_local3 < _local2.length) {
if (_local2[_local3][1] == MEDAL_GOLD){
_local1++;
};
_local3++;
};
return (_local1);
}
public function get totalBestTime():int{
var _local1:int;
var _local2:Array = this.settings.retrieveArray("levelScores");
var _local3:int;
while (_local3 < _local2.length) {
_local1 = (_local1 + int(_local2[_local3][2]));
_local3++;
};
return (_local1);
}
public function get totalScore():int{
var _local1:int;
var _local2:Array = this.settings.retrieveArray("levelScores");
var _local3:int;
while (_local3 < _local2.length) {
_local1 = (_local1 + int(_local2[_local3][0]));
_local3++;
};
return (_local1);
}
public function get megaPukeSetting():Boolean{
return ((this.settings.getValue("megaPuke") == "1"));
}
public function set megaPukeSetting(_arg1:Boolean):void{
var _local2:String;
if (_arg1){
_local2 = "1";
} else {
_local2 = "0";
};
this.settings.setValue("megaPuke", _local2);
}
public function get waterfallPukeSetting():Boolean{
return ((this.settings.getValue("waterfallPuke") == "1"));
}
public function set waterfallPukeSetting(_arg1:Boolean):void{
var _local2:String;
if (_arg1){
_local2 = "1";
} else {
_local2 = "0";
};
this.settings.setValue("waterfallPuke", _local2);
}
public function get rainbowPukeSetting():Boolean{
return ((this.settings.getValue("rainbowPuke") == "1"));
}
public function set rainbowPukeSetting(_arg1:Boolean):void{
var _local2:String;
if (_arg1){
_local2 = "1";
} else {
_local2 = "0";
};
this.settings.setValue("rainbowPuke", _local2);
}
public function clearLevel(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if (_arg1 > this.levelsComplete){
this.settings.setValue("levelsCleared", String(_arg1));
};
var _local5:Array = this.settings.retrieveArray("levelScores");
if (_arg2 > _local5[(_arg1 - 1)][0]){
_local5[(_arg1 - 1)][0] = _arg2;
_local5[(_arg1 - 1)][1] = _arg3;
this.settings.storeArray("levelScores", _local5);
};
if (_arg4 < _local5[(_arg1 - 1)][2]){
_local5[(_arg1 - 1)][2] = _arg4;
this.settings.storeArray("levelScores", _local5);
};
_local5 = this.settings.retrieveArray("levelScores");
this.apiServicesCustomEvent(("LevelComplete" + _arg1), _arg3);
this.apiServicesEndPlay();
this.updateStatistics();
}
private function updateStatistics():void{
this.settings.setValue("deathCount", String(this.deathCount));
this.settings.setValue("pintCount", String(this.pintCount));
this.settings.setValue("pukeCount", String(this.pukeCount));
this.settings.setValue("longestPuke", String(this.longestPuke));
}
private function initSettings():void{
if (!this.settings.getValue("levelsCleared")){
this.settings.setValue("levelsCleared", String((INITIAL_LEVELS_UNLOCKED - 1)));
};
var _local1:Array = this.settings.retrieveArray("levelScores");
if (!_local1){
_local1 = new Array(MAX_LEVELS);
};
var _local2:int;
while (_local2 < _local1.length) {
if (!_local1[_local2]){
_local1[_local2] = new Array(0, MEDAL_BRONZE, 3600000);
};
if (_local1[_local2][0] == undefined){
_local1[_local2][0] = 0;
};
if (_local1[_local2][1] == undefined){
_local1[_local2][1] = MEDAL_BRONZE;
};
if (_local1[_local2][2] == undefined){
_local1[_local2][2] = 3600000;
};
_local2++;
};
this.settings.storeArray("levelScores", _local1);
if (!this.settings.getValue("gameComplete")){
this.settings.setValue("gameComplete", String(0));
};
if (!this.settings.getValue("deathCount")){
this.settings.setValue("deathCount", String(0));
};
this.deathCount = int(this.settings.getValue("deathCount"));
if (!this.settings.getValue("cheatActivated")){
this.settings.setValue("cheatActivated", String(0));
};
if (this.settings.getValue("megaPuke") == null){
this.settings.setValue("megaPuke", String(0));
};
if (this.settings.getValue("waterfallPuke") == null){
this.settings.setValue("waterfallPuke", String(0));
};
if (this.settings.getValue("rainbowPuke") == null){
this.settings.setValue("rainbowPuke", String(0));
};
if (!this.settings.getValue("pintCount")){
this.settings.setValue("pintCount", String(0));
};
this.pintCount = int(this.settings.getValue("pintCount"));
if (!this.settings.getValue("pukeCount")){
this.settings.setValue("pukeCount", String(0));
};
this.pukeCount = int(this.settings.getValue("pukeCount"));
if (!this.settings.getValue("longestPuke")){
this.settings.setValue("longestPuke", String(0));
};
this.longestPuke = int(this.settings.getValue("longestPuke"));
}
override protected function onFirstRun():void{
this.apiServicesCustomEvent("FirstPlay", 1);
}
private function onLoadBegin(_arg1:AppEvent):void{
this.removeEventListener(AppEvent.LOAD_BEGIN, onLoadBegin);
var _local2 = "http://agi.armorgames.com/assets/agi/ABS.swf";
Security.allowDomain(_local2);
var _local3:URLRequest = new URLRequest(_local2);
var _local4:Loader = new Loader();
_local4.contentLoaderInfo.addEventListener(Event.COMPLETE, onABSLoaded);
_local4.load(_local3);
}
function onABSLoaded(_arg1:Event):void{
this.abs = _arg1.currentTarget.content;
addChild(this.abs);
if (!this.isAppLoaded){
this.abs.show({x:170, y:65, style:"dark", border:true});
};
}
private function onLoading(_arg1:AppEvent):void{
if (this.LoaderBar){
this.LoaderBar.percentLoaded = _arg1.percentLoaded;
};
}
private function onLoadComplete(_arg1:AppEvent):void{
this.removeEventListener(AppEvent.LOAD_PROGRESS, onLoading);
this.removeEventListener(AppEvent.LOAD_COMPLETE, onLoadComplete);
if (this.LoadingMuteBtn){
this.LoadingMuteBtn.removeEventListener(MouseEvent.CLICK, onLoaderMuteClicked);
};
if (this.abs){
this.abs.hide();
};
this.isAppLoaded = true;
if (this.isLevelListLoaded){
this.gotoAndStop("Ready");
};
}
private function onLevelListLoaded(_arg1:Event):void{
_arg1.target.removeEventListener(Event.COMPLETE, this.onLevelListLoaded);
levelList = new XML(_arg1.target.data);
this.isLevelListLoaded = true;
if (this.isAppLoaded){
this.gotoAndStop("Ready");
};
}
private function onAppReady(_arg1:AppEvent):void{
this.removeEventListener(AppEvent.APP_READY, onAppReady);
this.initSettings();
this.isFirstPlay = this.settings.firstRun;
this.gotoScreen("customclasses.SponsorScreen");
}
private function onButtonAdded(_arg1:Event):void{
if (_arg1.target.name == "LoadingMuteBtn"){
this.removeEventListener(Event.ADDED, onButtonAdded);
_arg1.target.addEventListener(MouseEvent.CLICK, onLoaderMuteClicked);
};
}
private function onLoaderMuteClicked(_arg1:MouseEvent):void{
this.mute = _arg1.currentTarget.mute;
}
private function onButtonClicked(_arg1:ScreenEvent):void{
var _local3:Sound;
var _local4:Sound;
var _local2:Sound = new SFXButtonSelect();
switch (_arg1.name){
case "Play":
if (this.isGameReady){
_local3 = new SFXStartGame();
_local3.play(0, 0, new SoundTransform(Game.SFX_VOL));
this.musicManager.restoreLoopSync("Bass1");
this.gotoScreen("customclasses.LevelSelectScreen");
};
break;
case "PlayAgain":
_local2.play();
this.unloadMenu();
break;
case "StartLevel":
if (this.isGameReady){
_local4 = new SFXStartLevel();
_local4.play(0, 0, new SoundTransform(3));
this.unloadMenu();
this.game.HUDVisible = true;
this.currentLevel = int(_arg1.param);
this.game.startLevel(this.currentLevel);
};
break;
case "Mute":
this.mute = TitleScreen(this.screen).TitleMuteBtn.mute;
break;
case "LevelSelectMute":
this.mute = LevelSelectScreen(this.screen).LevelSelectMuteBtn.mute;
break;
case "CreditsMute":
this.mute = CreditScreen(this.screen).CreditsMuteBtn.mute;
break;
case "Title":
_local2.play(0, 0, new SoundTransform(Game.SFX_VOL));
this.gotoScreen("customclasses.TitleScreen");
break;
case "QuitYes":
_local2.play(0, 0, new SoundTransform(Game.SFX_VOL));
this.clearPopUps();
this.game.HUDVisible = false;
this.currentLevel = 1;
this.game.startLevel(this.currentLevel, true);
this.musicManager.muteLoopSync("Melody");
this.musicManager.muteLoopSync("Piano1");
this.musicManager.muteLoopSync("Piano2");
this.musicManager.muteLoopSync("Bass2");
this.musicManager.muteLoopSync("Trumpet");
this.musicManager.restoreLoopSync("Bass1");
this.musicManager.restoreLoopSync("Drums");
this.gotoScreen("customclasses.TitleScreen");
break;
case "QuitNo":
_local2.play(0, 0, new SoundTransform(Game.SFX_VOL));
this.clearPopUps();
this.game.pause(false);
this.game.resume();
break;
case "MegaPuke":
if (_arg1.param == "On"){
this.game.setReward(Game.REWARD_MEGAPUKE);
} else {
this.game.clearReward(Game.REWARD_MEGAPUKE);
};
break;
case "WaterfallPuke":
if (_arg1.param == "On"){
this.game.setReward(Game.REWARD_WATERFALLPUKE);
} else {
this.game.clearReward(Game.REWARD_WATERFALLPUKE);
};
break;
case "RainbowPuke":
if (_arg1.param == "On"){
this.game.setReward(Game.REWARD_TECHNICOLORYAWN);
} else {
this.game.clearReward(Game.REWARD_TECHNICOLORYAWN);
};
break;
};
}
private function onScreenOut(_arg1:ScreenEvent):void{
switch (_arg1.name){
case "Credits":
case "SponsorAnim":
this.gotoScreen("customclasses.TitleScreen");
break;
case "GameCompleteAnim":
this.gotoScreen("customclasses.EndTextScreen");
break;
case "EndText":
this.game.HUDVisible = false;
this.currentLevel = 1;
this.game.startLevel(this.currentLevel, true);
this.musicManager.muteLoopSync("Melody");
this.musicManager.muteLoopSync("Piano1");
this.musicManager.muteLoopSync("Piano2");
this.musicManager.muteLoopSync("Bass2");
this.musicManager.muteLoopSync("Trumpet");
this.musicManager.restoreLoopSync("Bass1");
this.musicManager.restoreLoopSync("Drums");
this.gotoScreen("customclasses.TitleScreen");
break;
};
}
private function onScreenReveal(_arg1:ScreenEvent):void{
var _local2:SoundTransform;
switch (_arg1.name){
case "SponsorAnim":
this.musicManager = new MusicManager();
this.musicManager.addLoop("Melody", new SFXMelody());
this.musicManager.addLoop("Drums", new SFXDrums(), 12000);
this.musicManager.addLoop("Bass1", new SFXBass1(), 12000);
this.musicManager.addLoop("Bass2", new SFXBass2(), 12000);
this.musicManager.addLoop("Piano1", new SFXPiano1(), 12000);
this.musicManager.addLoop("Piano2", new SFXPiano2(), 12000);
this.musicManager.addLoop("Trumpet", new SFXTrumpet());
_local2 = new SoundTransform(0.2);
this.musicManager.setLoopTransform("Melody", _local2);
this.musicManager.setLoopTransform("Drums", _local2);
this.musicManager.setLoopTransform("Bass1", _local2);
this.musicManager.setLoopTransform("Bass2", _local2);
this.musicManager.setLoopTransform("Piano1", _local2);
this.musicManager.setLoopTransform("Piano2", _local2);
this.musicManager.setLoopTransform("Trumpet", _local2);
this.musicManager.muteLoop("Melody");
this.musicManager.muteLoop("Piano1");
this.musicManager.muteLoop("Piano2");
this.musicManager.muteLoop("Bass1");
this.musicManager.muteLoop("Bass2");
this.musicManager.muteLoop("Trumpet");
this.game = new Game();
this.game.addEventListener(AppEvent.GAME_READY, onGameReady);
this.game.addEventListener(AppEvent.LEVEL_COMPLETE, onLevelComplete);
this.addChildAt(this.game, 0);
break;
};
}
private function onGameReady(_arg1:AppEvent):void{
this.removeEventListener(AppEvent.GAME_READY, onGameReady);
this.game.HUDVisible = false;
this.currentLevel = 1;
this.game.startLevel(this.currentLevel, true);
this.musicManager.play();
this.isGameReady = true;
}
private function onLevelComplete(_arg1:AppEvent):void{
var _local2:String = this.game.getResult();
var _local3:Array = _local2.split(",");
this.clearLevel(this.currentLevel, int(_local3[0]), int(_local3[1]), int(_local3[2]));
if (++this.currentLevel <= MAX_LEVELS){
this.game.startLevel(this.currentLevel);
} else {
if (!this.isGameComplete){
this.isFirstFinish = true;
};
this.settings.setValue("gameComplete", String(1));
this.game.pause(true);
this.gotoScreen("customclasses.GameCompleteScreen");
};
}
function frame1(){
stop();
}
function frame10(){
stop();
}
function frame20(){
stop();
this.dispatchEvent(new AppEvent(AppEvent.APP_READY));
}
}
}//package customclasses
Section 12
//CreditScreen (customclasses.CreditScreen)
package customclasses {
import flash.events.*;
import flash.display.*;
import gmd.framework.*;
public class CreditScreen extends Screen {
public var PlayButton:MovieClip;
public var CreditsMuteBtn:MuteButton;
public function CreditScreen(){
addFrameScript(199, frame200);
this.PlayButton.addEventListener(MouseEvent.CLICK, onPlayClicked, false, 0, true);
this.CreditsMuteBtn.addEventListener(MouseEvent.CLICK, onMuteClicked);
}
private function onPlayClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.SCREEN_OUT, "Credits"));
}
private function onMuteClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "CreditsMute"));
}
function frame200(){
this.dispatchEvent(new ScreenEvent(ScreenEvent.SCREEN_OUT, "Credits"));
}
}
}//package customclasses
Section 13
//EndTextScreen (customclasses.EndTextScreen)
package customclasses {
import flash.events.*;
import flash.display.*;
import gmd.framework.*;
public class EndTextScreen extends Screen {
public var Message:MovieClip;
private var isFadeOut:Boolean;// = false
private static const END_COPY_FIRST:String = "Remember in the real world projectile vomit is not a great way to get around! By the way there's new options on the title screen.";
private static const END_COPY_FIRSTCHEAT:String = "Remember in the real world projectile vomit is not a great way to get around! Looks like you've had your reward already cheater!";
private static const END_COPY_NORMAL:String = "Back for more eh? You'll need to earn some more medals to unlock the other puke modes.";
private static const END_COPY_NORMALCHEAT:String = "Back for more eh? You haven't got enough medals for the other puke modes but you've got them already haven't you Cheaty McCheat!";
private static const END_COPY_SILVER:String = "Wow, that was some impressive quaffing! In fact we're impressed enough to unlock Waterfall Puke mode for you!";
private static const END_COPY_SILVERCHEAT:String = "Wow, that was some impressive quaffing! If you hadn't cheated already we'd give you the Waterfall Puke mode – instead you get nothing!";
private static const END_COPY_GOLD:String = "Wow, an alarming piece of binge drinking! I'm speechless and you should be too. Here's the Rainbow Puke mode for some psychedelic fun.";
private static const END_COPY_GOLDCHEAT:String = "Wow, an alarming piece of binge drinking! You cheated your way to Rainbow Puke mode so this is just a bit of an anti-climax now isn't it?";
public function EndTextScreen(){
addFrameScript(390, frame391, 489, frame490);
this.addEventListener(MouseEvent.CLICK, onScreenClicked, false, 0, true);
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.addEventListener(Event.ADDED, onChildAdded, false, 0, true);
}
private function onAddedToStage(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
BoozeUp(this.parent).musicManager.muteAll();
BoozeUp(this.parent).musicManager.restoreLoop("Drums");
}
private function onChildAdded(_arg1:Event):void{
if (_arg1.target.name == "Message"){
if (BoozeUp(this.parent).isCheatActive){
if (BoozeUp(this.parent).goldCount >= BoozeUp.MAX_MEDALS){
_arg1.target.Value.text = END_COPY_GOLDCHEAT;
} else {
if (BoozeUp(this.parent).silverCount >= BoozeUp.MAX_MEDALS){
_arg1.target.Value.text = END_COPY_SILVERCHEAT;
} else {
if (BoozeUp(this.parent).isFirstFinish){
_arg1.target.Value.text = END_COPY_FIRSTCHEAT;
} else {
_arg1.target.Value.text = END_COPY_NORMALCHEAT;
};
};
};
} else {
if (BoozeUp(this.parent).goldCount >= BoozeUp.MAX_MEDALS){
_arg1.target.Value.text = END_COPY_GOLD;
} else {
if (BoozeUp(this.parent).silverCount >= BoozeUp.MAX_MEDALS){
_arg1.target.Value.text = END_COPY_SILVER;
} else {
if (BoozeUp(this.parent).isFirstFinish){
_arg1.target.Value.text = END_COPY_FIRST;
} else {
_arg1.target.Value.text = END_COPY_NORMAL;
};
};
};
};
};
}
private function onScreenClicked(_arg1:MouseEvent):void{
if (!this.isFadeOut){
this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
this.gotoAndPlay("out");
this.isFadeOut = true;
};
}
private function onKeyPressed(_arg1:KeyboardEvent):void{
if (!this.isFadeOut){
this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
this.gotoAndPlay("out");
this.isFadeOut = true;
};
}
function frame391(){
stop();
}
function frame490(){
stop();
this.dispatchEvent(new ScreenEvent(ScreenEvent.SCREEN_OUT, "EndText"));
}
}
}//package customclasses
Section 14
//Game (customclasses.Game)
package customclasses {
import flash.media.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import gmd.framework.*;
import flash.text.*;
import flash.ui.*;
public class Game extends GameTemplate {
private var isInitialised:Boolean;
private var isViewMode:Boolean;
private var level:Level;
private var canvas:Bitmap;
private var canvasBitmapData:BitmapData;
private var pukeEffect:PukeMan;
private var scrollOffsetX:int;// = -27
private var scrollOffsetY:int;// = -26
private var scrollSpeedX:int;// = 0
private var scrollSpeedY:int;// = 0
private var playerAsset:BitmapData;
private var shadowAsset:BitmapData;
private var playerController:Player;
private var playerVisible:Boolean;
private var playerExiting:Boolean;
private var isExitAnim:Boolean;
private var isLeftHeld:Boolean;
private var isRightHeld:Boolean;
private var isJumpHeld:Boolean;
private var totalScore:int;
private var levelScore:int;
private var livesLeft:int;
private var levelId:int;
private var isDoorUnlocked:Boolean;
private var pukeCounter:int;
private var levelTimer:int;
private var clearTime:int;
private var pukeTimer:int;
private var alreadyHovering:Boolean;
private var HUDPuke:PukeBar;
private var HUDPints:PintCounter;
private var HUDStage:StageHUD;
private var HUDMute:MuteButton;
private var HUDQuit:MovieClip;
private var HUDRetry:MovieClip;
private var HUDTitle:LevelTitle;
private var exitClip:MovieClip;
private var exitBitmapData:BitmapData;
private var doorAnimFrame:int;// = 0
private var entryBitmapData:BitmapData;
private var entryClip:MovieClip;
private var sfxButtonClick:Sound;
private var sfxCollect:Sound;
private var sfxDeath:Sound;
private var sfxBoings:Array;
private var sfxSpikes:Array;
private var isEditMode:Boolean;
private var isMouseDown:Boolean;
private var isShowLevelDesc:Boolean;
private var currTileId:int;
private var tilePalette:TilePalette;
private var levelDesc:TextField;
public static const CANVAS_WIDTH:int = 640;
public static const CANVAS_HEIGHT:int = 472;
public static const REWARD_TECHNICOLORYAWN:String = "Technicolor yawn";
public static const REWARD_MEGAPUKE:String = "Mega puke";
public static const REWARD_WATERFALLPUKE:String = "Waterfall puke";
private static const CANVAS_OFFSET_X:int = -27;
private static const CANVAS_OFFSET_Y:int = -26;
private static const SCROLL_SPEED_X:int = 5;
private static const SCROLL_SPEED_Y:int = 5;
private static const EXIT_OFFSET_X:int = 0;
private static const EXIT_OFFSET_Y:int = -18;
private static const ENTRY_OFFSET_X:int = 0;
private static const ENTRY_OFFSET_Y:int = -18;
private static const PLAYER_POS_OFFSET_X:int = -24;
private static const SHADOW_OFFSET_X:int = 4;
private static const SHADOW_OFFSET_Y:int = 21;
private static const HUD_PUKE_X:int = 8;
private static const HUD_PUKE_Y:int = 0;
private static const HUD_PINTS_X:int = 10;
private static const HUD_PINTS_Y:int = 29;
private static const HUD_STAGE_X:int = 524;
private static const HUD_STAGE_Y:int = 0;
private static const HUD_MUTE_X:int = 592;
private static const HUD_MUTE_Y:int = 40;
private static const HUD_QUIT_X:int = 546;
private static const HUD_QUIT_Y:int = 40;
private static const HUD_RETRY_X:int = 543;
private static const HUD_RETRY_Y:int = 445;
private static const HUD_TITLE_X:int = 0;
private static const HUD_TITLE_Y:int = 0;
public static const SFX_VOL:int = 5;
private static const MAX_HOVER:int = 90;
private static const PINT_BOOST:int = 10;
private static const COLOUR_YELLOW:int = 15123728;
private static const COLOUR_ORANGE:int = 14852410;
private static const COLOUR_BROWN:int = 12099085;
private static const COLOUR_RED:int = 0xFF0000;
private static const COLOUR_GREEN:int = 0xFF00;
private static const COLOUR_INDIGO:int = 52479;
private static const COLOUR_BLUE:int = 0xFF;
private static const COLOUR_VIOLET:int = 0x6600FF;
private static const exitDoorFrames:Array = [0, 0, 48, 48, 96, 96];
public function Game(){
this.isInitialised = false;
this.visible = false;
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.canvasBitmapData = new BitmapData(CANVAS_WIDTH, CANVAS_HEIGHT, true);
this.canvas = new Bitmap(this.canvasBitmapData);
this.addChild(this.canvas);
this.entryClip = new EnterDoorAnim();
this.entryClip.scaleX = 2;
this.entryClip.scaleY = 2;
this.entryClip.addEventListener("EntryDone", onEntryAnimDone);
this.entryClip.addEventListener("Door close", onEntrySound);
this.entryClip.addEventListener("Door open", onExitSound);
this.entryClip.gotoAndStop("Idle");
this.addChild(this.entryClip);
this.HUDPuke = new PukeBar();
this.HUDPuke.x = HUD_PUKE_X;
this.HUDPuke.y = HUD_PUKE_Y;
this.HUDPuke.scaleX = 2;
this.HUDPuke.scaleY = 2;
this.HUDPuke.maxLevel = MAX_HOVER;
this.addChild(this.HUDPuke);
this.HUDPints = new PintCounter();
this.HUDPints.x = HUD_PINTS_X;
this.HUDPints.y = HUD_PINTS_Y;
this.HUDPints.scaleX = 2;
this.HUDPints.scaleY = 2;
this.HUDStage = new StageHUD();
this.HUDStage.x = HUD_STAGE_X;
this.HUDStage.y = HUD_STAGE_Y;
this.HUDStage.scaleX = 2;
this.HUDStage.scaleY = 2;
this.addChild(this.HUDStage);
this.HUDMute = new MuteButton();
this.HUDMute.x = HUD_MUTE_X;
this.HUDMute.y = HUD_MUTE_Y;
this.HUDMute.scaleX = 2;
this.HUDMute.scaleY = 2;
this.HUDMute.mute = BoozeUp(this.parent).mute;
this.HUDMute.addEventListener(MouseEvent.CLICK, onMuteClicked, false, 0, true);
this.addChild(this.HUDMute);
this.HUDQuit = new QuitButton();
this.HUDQuit.x = HUD_QUIT_X;
this.HUDQuit.y = HUD_QUIT_Y;
this.HUDQuit.scaleX = 2;
this.HUDQuit.scaleY = 2;
this.HUDQuit.addEventListener(MouseEvent.CLICK, onQuitClicked, false, 0, true);
this.addChild(this.HUDQuit);
this.HUDRetry = new RetryButton();
this.HUDRetry.x = HUD_PINTS_X;
this.HUDRetry.y = HUD_QUIT_Y;
this.HUDRetry.addEventListener(MouseEvent.CLICK, onRetryClicked, false, 0, true);
this.addChild(this.HUDRetry);
this.HUDTitle = new LevelTitle();
this.HUDTitle.x = HUD_TITLE_X;
this.HUDTitle.y = HUD_TITLE_Y;
this.addChild(this.HUDTitle);
var _local2:Matrix = new Matrix();
_local2.scale(2, 2);
var _local3:BitmapData = new PlayerAsset(0, 0);
this.playerAsset = new BitmapData((_local3.width * 2), (_local3.height * 2), true, 0);
this.playerAsset.draw(_local3, _local2);
var _local4:BitmapData = new PlayerShadow(0, 0);
this.shadowAsset = new BitmapData((_local4.width * 2), (_local4.height * 2), true, 0);
this.shadowAsset.draw(_local4, _local2);
var _local5:BitmapData = new ExitDoor(0, 0);
this.exitBitmapData = new BitmapData((_local5.width * 2), (_local5.height * 2), true, 0);
this.exitBitmapData.draw(_local5, _local2);
var _local6:BitmapData = new EnterDoor(0, 0);
this.entryBitmapData = new BitmapData((_local6.width * 2), (_local6.height * 2), true, 0);
this.entryBitmapData.draw(_local6, _local2);
this.stage.addEventListener(KeyboardEvent.KEY_UP, onKeyReleased, false, 0, true);
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed, false, 0, true);
this.level = new Level();
this.level.addEventListener("Level load complete", this.levelLoaded);
this.pukeEffect = new PukeMan(this.level);
this.pukeEffect.addColour(COLOUR_BROWN, 9);
this.pukeEffect.addColour(COLOUR_ORANGE, 7);
this.pukeEffect.addColour(COLOUR_YELLOW, 0);
this.playerController = new Player(this.level, this.pukeEffect);
this.sfxButtonClick = new SFXButtonSelect();
this.sfxCollect = new SFXCollect();
this.sfxDeath = new SFXDeath();
this.sfxBoings = new Array();
this.sfxBoings.push(new SFXBoingA());
this.sfxBoings.push(new SFXBoingB());
this.sfxBoings.push(new SFXBoingC());
this.sfxSpikes = new Array();
this.sfxSpikes.push(new SFXSpikePopA());
this.sfxSpikes.push(new SFXSpikePopB());
this.sfxSpikes.push(new SFXSpikePopC());
this.totalScore = 0;
this.isEditMode = false;
this.isMouseDown = false;
this.isShowLevelDesc = false;
this.currTileId = 1;
this.isInitialised = true;
this.dispatchEvent(new AppEvent(AppEvent.GAME_READY));
}
public function get HUDVisible():Boolean{
return (this.HUDPuke.visible);
}
public function set HUDVisible(_arg1:Boolean):void{
this.HUDPuke.visible = _arg1;
this.HUDPints.visible = _arg1;
this.HUDStage.visible = _arg1;
this.HUDMute.visible = _arg1;
this.HUDQuit.visible = _arg1;
this.HUDRetry.visible = _arg1;
this.HUDTitle.visible = _arg1;
}
public function startLevel(_arg1:int, _arg2:Boolean=false):void{
if (!_arg2){
BoozeUp(this.parent).apiServicesCustomEvent("StartLevel", _arg1);
BoozeUp(this.parent).apiServicesStartPlay();
};
this.HUDMute.mute = BoozeUp(this.parent).mute;
this.pause(true);
if (this.isInitialised){
this.levelId = _arg1;
this.isViewMode = _arg2;
this.pukeEffect.reset();
this.playerVisible = false;
this.level.load(_arg1);
} else {
trace("You can't call startLevel before the game is properly initialised");
};
}
private function resetLevel(_arg1:Boolean=true):void{
this.level.reset();
this.pukeEffect.reset();
this.exitClip.x = (((this.level.exitCol * Level.TILE_WIDTH) + this.scrollOffsetX) + EXIT_OFFSET_X);
this.exitClip.y = ((((this.level.exitRow * Level.TILE_HEIGHT) + this.scrollOffsetY) + Level.TILE_OFFSET) + EXIT_OFFSET_Y);
if (this.level.exitType == Level.EXIT_NO_GIRL){
this.exitClip.gotoAndPlay("IdleNoPuke");
} else {
if (this.level.exitType == Level.EXIT_GIRL_WAITING){
this.exitClip.gotoAndPlay("Idle");
};
};
this.level.collectables[(this.level.exitCol - 1)][this.level.exitRow] = "ExitTile";
this.entryClip.x = (((this.level.startCol * Level.TILE_WIDTH) + this.scrollOffsetX) + ENTRY_OFFSET_X);
this.entryClip.y = ((((this.level.startRow * Level.TILE_HEIGHT) + this.scrollOffsetY) + Level.TILE_OFFSET) + ENTRY_OFFSET_Y);
this.entryClip.visible = true;
this.entryClip.gotoAndStop("Idle");
if (this.level.targetScore < 1){
this.doorAnimFrame = 5;
this.isDoorUnlocked = true;
} else {
this.doorAnimFrame = 0;
this.isDoorUnlocked = false;
};
this.isLeftHeld = false;
this.isRightHeld = false;
this.isJumpHeld = false;
this.levelScore = 0;
this.pukeCounter = 0;
this.alreadyHovering = false;
this.playerController.reset();
this.playerController.setTile(this.level.startCol, this.level.startRow);
this.playerVisible = false;
this.playerExiting = false;
this.isExitAnim = false;
this.HUDPuke.level = 0;
this.HUDPints.collected = this.levelScore;
this.HUDStage.setStage(this.levelId);
if (!this.isViewMode){
this.HUDTitle.title = this.level.levelTitle;
this.HUDTitle.subTitle = this.level.levelSubTitle;
if (_arg1){
this.HUDTitle.trigger();
} else {
this.HUDTitle.state = LevelTitle.TITLE_DONE;
};
};
this.levelTimer = getTimer();
this.render();
}
public function resume():void{
this.exitClip.play();
}
override public function getResult():String{
var _local1:int;
if ((((this.level.silverScore == 0)) || ((this.level.goldScore == 0)))){
_local1 = BoozeUp.MEDAL_BRONZE;
} else {
if (this.levelScore >= this.level.goldScore){
_local1 = BoozeUp.MEDAL_GOLD;
} else {
if (this.levelScore >= this.level.silverScore){
_local1 = BoozeUp.MEDAL_SILVER;
} else {
_local1 = BoozeUp.MEDAL_BRONZE;
};
};
};
return (((((String(this.levelScore) + ",") + String(_local1)) + ",") + String(this.clearTime)));
}
public function setReward(_arg1:String):void{
switch (_arg1){
case REWARD_WATERFALLPUKE:
this.playerController.pukeAmount = 20;
break;
case REWARD_TECHNICOLORYAWN:
this.pukeEffect.resetColours();
this.pukeEffect.addColour(COLOUR_RED, 9);
this.pukeEffect.addColour(COLOUR_YELLOW, 7);
this.pukeEffect.addColour(COLOUR_GREEN, 4);
this.pukeEffect.addColour(COLOUR_BLUE, 2);
this.pukeEffect.addColour(COLOUR_VIOLET, 0);
break;
case REWARD_MEGAPUKE:
this.pukeEffect.size = 6;
break;
};
}
public function clearReward(_arg1:String):void{
switch (_arg1){
case REWARD_WATERFALLPUKE:
this.playerController.pukeAmount = 1;
break;
case REWARD_TECHNICOLORYAWN:
this.pukeEffect.resetColours();
this.pukeEffect.addColour(COLOUR_BROWN, 9);
this.pukeEffect.addColour(COLOUR_ORANGE, 7);
this.pukeEffect.addColour(COLOUR_YELLOW, 0);
break;
case REWARD_MEGAPUKE:
this.pukeEffect.size = 2;
break;
};
}
override public function cleanUp():void{
super.cleanUp();
this.exitClip.removeEventListener("ExitDone", onExitAnimDone);
this.exitClip.removeEventListener("Short sick", onExitSound);
this.exitClip.removeEventListener("Girl no", onExitSound);
this.exitClip.removeEventListener("Pop", onExitSound);
this.exitClip.removeEventListener("Door close", onExitSound);
this.exitClip.removeEventListener("Girl close", onExitSound);
this.exitClip.removeEventListener("Door open", onExitSound);
this.exitClip.removeEventListener("Girl sick", onExitSound);
this.exitClip.removeEventListener(PukeEvent.SPAWN, onPukeSpawn);
this.entryClip.removeEventListener("EntryDone", onEntryAnimDone);
this.entryClip.removeEventListener("EntryDone", onEntryAnimDone);
this.entryClip.removeEventListener("Door close", onEntrySound);
this.entryClip.removeEventListener("Door open", onExitSound);
this.HUDMute.removeEventListener(MouseEvent.CLICK, onMuteClicked);
this.HUDQuit.removeEventListener(MouseEvent.CLICK, onQuitClicked);
this.HUDRetry.removeEventListener(MouseEvent.CLICK, onRetryClicked);
this.tilePalette.removeEventListener(TileChangeEvent.TILE_CHANGE, onTileChange);
this.stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyReleased);
this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
this.level.removeEventListener("Level load complete", this.levelLoaded);
this.level.unload();
this.level = null;
this.pukeEffect.reset();
this.pukeEffect = null;
this.canvasBitmapData.dispose();
this.canvasBitmapData = null;
this.playerAsset.dispose();
this.playerAsset = null;
}
public function levelLoaded(_arg1:Event):void{
var _local2:int;
this.createExitClip((this.levelId == BoozeUp.MAX_LEVELS));
this.exitClip.x = (((this.level.exitCol * Level.TILE_WIDTH) + this.scrollOffsetX) + EXIT_OFFSET_X);
this.exitClip.y = ((((this.level.exitRow * Level.TILE_HEIGHT) + this.scrollOffsetY) + Level.TILE_OFFSET) + EXIT_OFFSET_Y);
if (this.level.exitType == Level.EXIT_NO_GIRL){
this.exitClip.gotoAndPlay("IdleNoPuke");
} else {
if (this.level.exitType == Level.EXIT_GIRL_WAITING){
this.exitClip.gotoAndPlay("Idle");
};
};
this.level.collectables[(this.level.exitCol - 1)][this.level.exitRow] = "ExitTile";
this.entryClip.x = (((this.level.startCol * Level.TILE_WIDTH) + this.scrollOffsetX) + ENTRY_OFFSET_X);
this.entryClip.y = ((((this.level.startRow * Level.TILE_HEIGHT) + this.scrollOffsetY) + Level.TILE_OFFSET) + ENTRY_OFFSET_Y);
this.entryClip.gotoAndStop("Idle");
this.entryClip.visible = true;
if (this.level.targetScore < 1){
this.doorAnimFrame = 5;
this.isDoorUnlocked = true;
} else {
this.doorAnimFrame = 0;
this.isDoorUnlocked = false;
};
this.isLeftHeld = false;
this.isRightHeld = false;
this.isJumpHeld = false;
this.levelScore = 0;
this.pukeCounter = 0;
this.alreadyHovering = false;
this.playerController.reset();
this.playerController.setTile(this.level.startCol, this.level.startRow);
this.playerVisible = false;
this.playerExiting = false;
this.isExitAnim = false;
this.HUDPuke.level = 0;
this.HUDPints.collected = this.levelScore;
this.HUDStage.setStage(this.levelId);
if (!this.isViewMode){
this.HUDTitle.title = this.level.levelTitle;
this.HUDTitle.subTitle = this.level.levelSubTitle;
this.HUDTitle.trigger();
_local2 = 0;
while (_local2 < this.level.muteTracks.length) {
BoozeUp(this.parent).musicManager.muteLoopSync(this.level.muteTracks[_local2]);
_local2++;
};
_local2 = 0;
while (_local2 < this.level.triggerTracks.length) {
BoozeUp(this.parent).musicManager.restoreLoopSync(this.level.triggerTracks[_local2]);
_local2++;
};
};
this.render();
this.visible = true;
this.levelTimer = getTimer();
if (!this.isViewMode){
this.pause(false);
};
}
private function createExitClip(_arg1:Boolean):void{
if (this.exitClip){
this.removeChild(this.exitClip);
this.exitClip = null;
};
if (_arg1){
this.exitClip = new ExitFinal();
} else {
this.exitClip = new Exit();
};
this.exitClip.scaleX = 2;
this.exitClip.scaleY = 2;
this.exitClip.addEventListener("ExitDone", onExitAnimDone);
this.exitClip.addEventListener("Short sick", onExitSound);
this.exitClip.addEventListener("Girl no", onExitSound);
this.exitClip.addEventListener("Pop", onExitSound);
this.exitClip.addEventListener("Door close", onExitSound);
this.exitClip.addEventListener("Girl close", onExitSound);
this.exitClip.addEventListener("Door open", onExitSound);
this.exitClip.addEventListener("Girl sick", onExitSound);
this.exitClip.addEventListener(PukeEvent.SPAWN, onPukeSpawn);
this.addChildAt(this.exitClip, (this.getChildIndex(this.canvas) + 1));
}
override protected function gameLoop():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Point;
var _local5:int;
var _local6:SoundChannel;
var _local7:Sound;
var _local8:SoundChannel;
var _local9:SoundChannel;
switch (this.HUDTitle.state){
case LevelTitle.TITLE_FADE_IN:
case LevelTitle.TITLE_FADE_OUT:
case LevelTitle.TITLE_WAITING:
case LevelTitle.WAIT_ENTER:
return;
case LevelTitle.TITLE_DONE:
this.entryClip.gotoAndPlay("Enter");
this.HUDTitle.state = LevelTitle.WAIT_ENTER;
return;
default:
break;
};
this.scrollOffsetX = (this.scrollOffsetX + this.scrollSpeedX);
this.scrollOffsetY = (this.scrollOffsetY + this.scrollSpeedY);
this.exitClip.x = (((this.level.exitCol * Level.TILE_WIDTH) + this.scrollOffsetX) + EXIT_OFFSET_X);
this.exitClip.y = ((((this.level.exitRow * Level.TILE_HEIGHT) + this.scrollOffsetY) + Level.TILE_OFFSET) + EXIT_OFFSET_Y);
this.entryClip.x = (((this.level.startCol * Level.TILE_WIDTH) + this.scrollOffsetX) + ENTRY_OFFSET_X);
this.entryClip.y = ((((this.level.startRow * Level.TILE_HEIGHT) + this.scrollOffsetY) + Level.TILE_OFFSET) + ENTRY_OFFSET_Y);
if (this.playerExiting){
_local2 = (this.playerController.pos.x + this.scrollOffsetX);
if (_local2 > (this.exitClip.x + PLAYER_POS_OFFSET_X)){
this.playerController.left();
} else {
if (_local2 < (this.exitClip.x + PLAYER_POS_OFFSET_X)){
this.playerController.right();
};
};
this.playerController.update();
_local2 = (this.playerController.pos.x + this.scrollOffsetX);
if (Math.abs((_local2 - (this.exitClip.x + PLAYER_POS_OFFSET_X))) < 3){
this.playerVisible = false;
this.playerExiting = false;
this.isExitAnim = true;
if (this.level.exitType == Level.EXIT_GIRL_WAITING){
this.exitClip.gotoAndPlay("ExitAnimPuke");
} else {
this.exitClip.gotoAndPlay("ExitAnimNoPuke");
};
};
this.render();
return;
};
if (this.isExitAnim){
this.render();
return;
};
if (this.isLeftHeld){
this.playerController.left();
};
if (this.isRightHeld){
this.playerController.right();
};
if (this.isJumpHeld){
this.playerController.jump();
this.HUDPuke.level = this.playerController.hoverTime;
if (this.playerController.isHovering){
if ((++this.pukeCounter % PINT_BOOST) == 0){
BoozeUp(this.parent).pukeCount++;
};
if (!this.alreadyHovering){
this.pukeTimer = getTimer();
this.alreadyHovering = true;
};
};
};
if (((!(this.playerController.isHovering)) && (this.alreadyHovering))){
this.alreadyHovering = false;
_local3 = (getTimer() - this.pukeTimer);
if (_local3 > BoozeUp(this.parent).longestPuke){
BoozeUp(this.parent).longestPuke = _local3;
};
};
if (!this.playerController.update()){
this.resetLevel(false);
return;
};
if (!this.playerController.isDead){
_local4 = this.playerController.getTile();
_local1 = 0;
while (_local1 < 2) {
switch (String(this.level.collectables[_local4.x][_local4.y])){
case "PintTile":
_local6 = this.sfxCollect.play();
_local6.soundTransform = new SoundTransform(0.6, this.playerController.pan);
this.level.collectables[_local4.x][_local4.y] = "";
this.level.levelData[_local4.x][_local4.y] = 0;
this.levelScore++;
this.HUDPints.collected = this.levelScore;
if (this.levelScore >= this.level.targetScore){
if (!this.isDoorUnlocked){
_local7 = new SFXTaDaa();
_local8 = _local7.play();
_local8.soundTransform = new SoundTransform(SFX_VOL);
};
this.isDoorUnlocked = true;
};
this.playerController.hoverTime = (this.playerController.hoverTime + PINT_BOOST);
if (this.playerController.hoverTime > MAX_HOVER){
this.playerController.hoverTime = MAX_HOVER;
};
this.HUDPuke.level = this.playerController.hoverTime;
BoozeUp(this.parent).pintCount++;
break;
case "SpikeTile":
case "InvertSpikeTile":
_local6 = this.sfxDeath.play();
_local6.soundTransform = new SoundTransform(SFX_VOL, this.playerController.pan);
BoozeUp(this.parent).apiServicesCustomEvent("LostLife", this.levelId);
BoozeUp(this.parent).deathCount++;
this.playerController.die();
break;
case "PopSpikeTile":
_local5 = (Math.abs(this.level.levelData[_local4.x][_local4.y]) - 1);
if (this.level.animTileList[_local5].trigger()){
_local9 = this.sfxSpikes[Math.floor((Math.random() * this.sfxSpikes.length))].play();
_local9.soundTransform = new SoundTransform(SFX_VOL, this.playerController.pan);
};
if (this.level.animTileList[_local5].killFrame){
_local6 = this.sfxDeath.play();
_local6.soundTransform = new SoundTransform(SFX_VOL, this.playerController.pan);
BoozeUp(this.parent).apiServicesCustomEvent("LostLife", this.levelId);
BoozeUp(this.parent).deathCount++;
this.playerController.die();
};
break;
case "SpringTile":
_local6 = this.sfxBoings[Math.floor((Math.random() * this.sfxBoings.length))].play();
_local6.soundTransform = new SoundTransform(3, this.playerController.pan);
this.playerController.bounce();
_local5 = (Math.abs(this.level.levelData[_local4.x][_local4.y]) - 1);
this.level.animTileList[_local5].trigger();
break;
case "ExitTile":
if (this.levelScore >= this.level.targetScore){
this.playerExiting = true;
this.clearTime = (getTimer() - this.levelTimer);
return;
};
break;
};
_local4 = this.playerController.headTile();
_local1++;
};
};
_local1 = 0;
while (_local1 < this.level.animTileList.length) {
this.level.animTileList[_local1].update();
_local1++;
};
this.render();
}
private function render():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local9:int;
var _local10:int;
this.canvasBitmapData.copyPixels(this.level.bk, new Rectangle(0, 0, 640, 472), new Point(0, 0));
var _local4:int = this.scrollOffsetX;
var _local5:int = (this.scrollOffsetY + Level.TILE_OFFSET);
var _local6:Rectangle = new Rectangle(0, 0, Level.TILE_WIDTH, Level.TILE_WIDTH);
var _local7:Point = new Point();
var _local8:int;
this.pukeEffect.update(_local4, _local5);
_local2 = (Level.LEVEL_HEIGHT - 1);
while (_local2 >= 0) {
_local1 = 0;
while (_local1 < Level.LEVEL_WIDTH) {
_local3 = this.level.levelData[_local1][_local2];
if (_local3 > 0){
_local7.x = ((_local1 * Level.TILE_WIDTH) + _local4);
_local7.y = (((_local2 * Level.TILE_HEIGHT) + Level.TILE_OFFSET) + _local5);
this.canvasBitmapData.copyPixels(this.level.tileList[_local3], _local6, _local7, null, null, true);
} else {
if (_local3 < 0){
_local3 = (Math.abs(_local3) - 1);
_local7.x = ((_local1 * Level.TILE_WIDTH) + _local4);
_local7.y = (((_local2 * Level.TILE_HEIGHT) + Level.TILE_OFFSET) + _local5);
this.canvasBitmapData.copyPixels(this.level.animTileList[_local3].bitmapData, this.level.animTileList[_local3].rect, _local7, null, null, true);
};
};
_local1++;
};
if (this.level.exitRow == _local2){
if (this.isDoorUnlocked){
if (++this.doorAnimFrame > 5){
this.doorAnimFrame = 5;
};
};
this.canvasBitmapData.copyPixels(this.exitBitmapData, new Rectangle(exitDoorFrames[this.doorAnimFrame], 0, 22, 34), new Point(this.exitClip.x, this.exitClip.y), null, null, true);
};
if (this.level.startRow == _local2){
_local7.x = (((this.level.startCol * Level.TILE_WIDTH) + _local4) + EXIT_OFFSET_X);
_local7.y = (((this.level.startRow * Level.TILE_HEIGHT) + _local5) + EXIT_OFFSET_Y);
this.canvasBitmapData.copyPixels(this.entryBitmapData, new Rectangle(0, 0, this.entryBitmapData.width, this.entryBitmapData.height), _local7, null, null, true);
};
if ((this.playerController.row - 1) == _local2){
_local8 = ((_local2 - 2) * Level.TILE_HEIGHT);
_local7.x = 0;
_local7.y = _local8;
this.canvasBitmapData.copyPixels(this.pukeEffect.overlay, new Rectangle(0, _local7.y, Game.CANVAS_WIDTH, (Game.CANVAS_HEIGHT - _local8)), _local7, null, null, true);
if (this.playerVisible){
_local9 = ((this.playerController.pos.x + Player.WIDTH_DIV2) / Level.TILE_WIDTH);
_local10 = ((this.playerController.pos.y + Player.PLAYER_HEIGHT) / Level.TILE_HEIGHT);
if (this.level.statics[_local9][_local10]){
_local7.x = ((this.playerController.pos.x + _local4) + SHADOW_OFFSET_X);
_local7.y = ((this.playerController.pos.y + _local5) + SHADOW_OFFSET_Y);
this.canvasBitmapData.copyPixels(this.shadowAsset, new Rectangle(0, 0, this.shadowAsset.width, this.shadowAsset.height), _local7, null, null, true);
};
_local7.x = (this.playerController.pos.x + _local4);
_local7.y = (this.playerController.pos.y + _local5);
this.canvasBitmapData.copyPixels(this.playerAsset, this.playerController.rect, _local7, null, null, true);
};
};
_local2--;
};
_local7.x = 0;
_local7.y = 0;
this.canvasBitmapData.copyPixels(this.pukeEffect.overlay, new Rectangle(0, 0, Game.CANVAS_WIDTH, _local8), _local7, null, null, true);
this.pukeEffect.render(this.canvasBitmapData, _local4, _local5);
}
private function setEditMode(_arg1:Boolean):void{
this.isEditMode = _arg1;
this.tilePalette.visible = _arg1;
}
private function showLevelDescription(_arg1:Boolean):void{
if (_arg1){
this.levelDesc = new TextField();
this.levelDesc.width = this.canvas.width;
this.levelDesc.height = this.canvas.height;
this.levelDesc.text = this.level.editGetLevelDescription();
this.addChild(this.levelDesc);
} else {
this.removeChild(this.levelDesc);
this.levelDesc = null;
};
this.isShowLevelDesc = _arg1;
}
private function onPukeSpawn(_arg1:PukeEvent):void{
var _local2:int = (this.exitClip.x - this.scrollOffsetX);
var _local3:int = ((this.exitClip.y - this.scrollOffsetY) + Level.TILE_OFFSET);
this.pukeEffect.spawn((_local2 + _arg1.x), (_local3 + _arg1.y), 3);
}
private function onExitSound(_arg1:Event):void{
var _local2:Sound;
var _local3:SoundChannel;
switch (_arg1.type){
case "Short sick":
_local2 = new SFXShortSick();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(SFX_VOL, this.playerController.pan);
break;
case "Girl no":
_local2 = new SFXGirlNo();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(SFX_VOL, this.playerController.pan);
break;
case "Pop":
_local2 = new SFXPop();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(SFX_VOL, this.playerController.pan);
break;
case "Girl close":
_local2 = new SFXDoorClose();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(SFX_VOL, this.playerController.pan);
break;
case "Door close":
_local2 = new SFXDoorClose();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(1.5, this.playerController.pan);
break;
case "Door open":
_local2 = new SFXDoorOpen();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(1.5, this.playerController.pan);
break;
case "Girl sick":
_local2 = new SFXGirlSick();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(SFX_VOL, this.playerController.pan);
BoozeUp(this.parent).musicManager.fadeOut(3000);
break;
};
}
private function onEntrySound(_arg1:Event):void{
var _local2:Sound;
var _local3:SoundChannel;
switch (_arg1.type){
case "Door close":
_local2 = new SFXDoorClose();
_local3 = _local2.play();
_local3.soundTransform = new SoundTransform(1.5, this.playerController.pan);
break;
};
}
private function onExitAnimDone(_arg1:Event):void{
this.totalScore = (this.totalScore + this.levelScore);
this.dispatchEvent(new AppEvent(AppEvent.LEVEL_COMPLETE));
}
private function onEntryAnimDone(_arg1:Event):void{
this.entryClip.visible = false;
this.playerVisible = true;
this.render();
this.HUDTitle.state = LevelTitle.TITLE_IDLE;
}
private function onKeyReleased(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.LEFT:
this.isLeftHeld = false;
break;
case Keyboard.RIGHT:
this.isRightHeld = false;
break;
case Keyboard.SPACE:
this.isJumpHeld = false;
break;
case 87:
case 65:
case 83:
case 68:
break;
};
}
private function onKeyPressed(_arg1:KeyboardEvent):void{
if ((((this.HUDTitle.state == LevelTitle.TITLE_FADE_IN)) || ((this.HUDTitle.state == LevelTitle.TITLE_WAITING)))){
this.HUDTitle.dismiss();
};
switch (_arg1.keyCode){
case Keyboard.LEFT:
this.isLeftHeld = true;
break;
case Keyboard.RIGHT:
this.isRightHeld = true;
break;
case Keyboard.SPACE:
this.isJumpHeld = true;
break;
case 87:
break;
case 65:
break;
case 83:
break;
case 68:
break;
case 69:
break;
case 88:
break;
case 78:
break;
case 82:
this.resetLevel();
BoozeUp(this.parent).apiServicesCustomEvent("RetryLevel", this.levelId);
break;
case 84:
break;
};
}
private function onTileChange(_arg1:TileChangeEvent):void{
this.currTileId = _arg1.tileId;
}
private function onMouseDown(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (((this.isEditMode) && (!(this.isShowLevelDesc)))){
if (!this.tilePalette.hitTestPoint(this.canvas.mouseX, this.canvas.mouseY, false)){
this.isMouseDown = true;
_local2 = ((this.canvas.mouseX - this.scrollOffsetX) / Level.TILE_WIDTH);
_local3 = (((this.canvas.mouseY - this.scrollOffsetY) - Level.TILE_OFFSET) / Level.TILE_HEIGHT);
this.level.editSetTile(_local2, _local3, this.currTileId);
};
};
}
private function onMouseUp(_arg1:MouseEvent):void{
this.isMouseDown = false;
}
private function onMouseMove(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (((this.isEditMode) && (this.isMouseDown))){
_local2 = ((this.canvas.mouseX - this.scrollOffsetX) / Level.TILE_WIDTH);
_local3 = (((this.canvas.mouseY - this.scrollOffsetY) - Level.TILE_OFFSET) / Level.TILE_HEIGHT);
this.level.editSetTile(_local2, _local3, this.currTileId);
};
}
private function onRetryClicked(_arg1:MouseEvent):void{
this.sfxButtonClick.play(0, 0, new SoundTransform(SFX_VOL));
BoozeUp(this.parent).apiServicesCustomEvent("RetryLevel", this.levelId);
this.resetLevel();
}
private function onMuteClicked(_arg1:MouseEvent):void{
this.sfxButtonClick.play(0, 0, new SoundTransform(SFX_VOL));
BoozeUp(this.parent).mute = this.HUDMute.mute;
}
private function onQuitClicked(_arg1:MouseEvent):void{
this.sfxButtonClick.play(0, 0, new SoundTransform(SFX_VOL));
this.pause(true);
if (this.isExitAnim){
this.exitClip.stop();
};
BoozeUp(this.parent).showPopUp("customclasses.QuitPopUp");
}
}
}//package customclasses
Section 15
//GameCompleteScreen (customclasses.GameCompleteScreen)
package customclasses {
import flash.events.*;
import flash.display.*;
import gmd.framework.*;
public class GameCompleteScreen extends Screen {
public var AnimHolder:MovieClip;
private static const X_POS:int = -13;
private static const Y_POS:int = 114;
public function GameCompleteScreen(){
addFrameScript(7, frame8);
this.x = X_POS;
this.y = Y_POS;
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
var _local2:MovieClip = (this.AnimHolder.getChildByName("AnimContainer") as MovieClip);
_local2.addEventListener("Anim done", onAnimDone, false, 0, true);
}
private function onPlayAgainClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "PlayAgain"));
}
private function onTitleClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "Title"));
}
private function onAnimDone(_arg1:Event):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.SCREEN_OUT, "GameCompleteAnim"));
}
function frame8(){
stop();
}
}
}//package customclasses
Section 16
//GenericButton (customclasses.GenericButton)
package customclasses {
import flash.media.*;
import flash.events.*;
import flash.display.*;
public class GenericButton extends MovieClip {
private var sfxOver:Sound;
public function GenericButton(){
this.gotoAndStop("Normal");
this.sfxOver = new SFXOver();
this.addEventListener(MouseEvent.ROLL_OVER, onRollOver, false, 0, true);
this.addEventListener(MouseEvent.ROLL_OUT, onRollOut, false, 0, true);
}
private function onRollOut(_arg1:MouseEvent):void{
this.gotoAndStop("Normal");
}
private function onRollOver(_arg1:MouseEvent):void{
this.sfxOver.play(0, 0, new SoundTransform(2));
this.gotoAndStop("Over");
}
}
}//package customclasses
Section 17
//Level (customclasses.Level)
package customclasses {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import gmd.utils.*;
public class Level extends EventDispatcher {
public var levelData:Array;
public var statics:Array;
public var collectables:Array;
public var tileList:Array;
public var animTileList:Array;
public var bk:BitmapData;
private var spawnCol:int;
private var spawnRow:int;
public var exitCol:int;
public var exitRow:int;
public var targetScore:int;
public var silverScore:int;
public var goldScore:int;
public var exitType:String;
public var levelTitle:String;
public var levelSubTitle:String;
public var muteTracks:Array;
public var triggerTracks:Array;
private var levelDesc:XML;
public static const EXIT_NO_GIRL:String = "NoGirl";
public static const EXIT_GIRL_WAITING:String = "GirlWaiting";
public static const LEVEL_WIDTH:int = 29;
public static const LEVEL_HEIGHT:int = 36;
public static const TILE_WIDTH:int = 24;
public static const TILE_HEIGHT:int = 14;
public static const TILE_OFFSET:int = -6;
public function Level(){
var _local2:AnimSpringTile;
var _local3:AnimPopSpikeTile;
super();
this.levelData = new Array();
this.statics = new Array();
this.collectables = new Array();
var _local1:int;
while (_local1 < LEVEL_WIDTH) {
this.levelData.push(new Array(LEVEL_HEIGHT));
this.statics.push(new Array(LEVEL_HEIGHT));
this.collectables.push(new Array(LEVEL_HEIGHT));
_local1++;
};
this.tileList = new Array();
this.animTileList = new Array();
this.muteTracks = new Array();
this.triggerTracks = new Array();
}
public function unload():void{
var _local1:int;
var _local2:int;
var _local3:BitmapData;
var _local4:AnimSprite;
if (this.bk){
this.bk.dispose();
this.bk = null;
};
while (this.tileList.length > 0) {
_local3 = (this.tileList.pop() as BitmapData);
if (_local3){
_local3.dispose();
};
};
while (this.animTileList.length > 0) {
_local4 = (this.animTileList.pop() as AnimSprite);
if (_local4){
_local4.bitmapData.dispose();
};
};
_local1 = 0;
while (_local1 < LEVEL_WIDTH) {
_local2 = 0;
while (_local2 < LEVEL_HEIGHT) {
this.levelData[_local1][_local2] = int(0);
this.statics[_local1][_local2] = false;
this.collectables[_local1][_local2] = "";
_local2++;
};
_local1++;
};
while (this.muteTracks.length > 0) {
this.muteTracks.pop();
};
while (this.triggerTracks.length > 0) {
this.triggerTracks.pop();
};
}
public function load(_arg1:int):void{
var levelFilename:String;
var levelIdx = _arg1;
this.unload();
levelFilename = BoozeUp.levelList.level.(@id == levelIdx);
this.levelDesc = this.getLevelDefinition(levelFilename);
this.parseLevelXML(this.levelDesc);
this.dispatchEvent(new Event("Level load complete"));
}
public function reset():void{
this.unload();
this.parseLevelXML(this.levelDesc);
}
public function get startCol():int{
return (this.spawnCol);
}
public function get startRow():int{
return (this.spawnRow);
}
private function onXMLLoaded(_arg1:Event):void{
_arg1.target.removeEventListener(Event.COMPLETE, this.onXMLLoaded);
this.levelDesc = new XML(_arg1.target.data);
this.parseLevelXML(this.levelDesc);
this.dispatchEvent(new Event("Level load complete"));
}
private function getLevelDefinition(_arg1:String):XML{
var _local2:ByteArray;
switch (_arg1){
case "level1.xml":
_local2 = new LevelData.Level1();
break;
case "level2.xml":
_local2 = new LevelData.Level2();
break;
case "level3.xml":
_local2 = new LevelData.Level3();
break;
case "level4.xml":
_local2 = new LevelData.Level4();
break;
case "level5.xml":
_local2 = new LevelData.Level5();
break;
case "level6.xml":
_local2 = new LevelData.Level6();
break;
case "level7.xml":
_local2 = new LevelData.Level7();
break;
case "level8.xml":
_local2 = new LevelData.Level8();
break;
case "level9.xml":
_local2 = new LevelData.Level9();
break;
case "level10.xml":
_local2 = new LevelData.Level10();
break;
case "level11.xml":
_local2 = new LevelData.Level11();
break;
case "level12.xml":
_local2 = new LevelData.Level12();
break;
case "level13.xml":
_local2 = new LevelData.Level13();
break;
case "level14.xml":
_local2 = new LevelData.Level14();
break;
case "level15.xml":
_local2 = new LevelData.Level15();
break;
case "level16.xml":
_local2 = new LevelData.Level16();
break;
case "level17.xml":
_local2 = new LevelData.Level17();
break;
case "level18.xml":
_local2 = new LevelData.Level18();
break;
case "level19.xml":
_local2 = new LevelData.Level19();
break;
case "level20.xml":
_local2 = new LevelData.Level20();
break;
case "level21.xml":
_local2 = new LevelData.Level21();
break;
case "level22.xml":
_local2 = new LevelData.Level22();
break;
case "level23.xml":
_local2 = new LevelData.Level23();
break;
case "level24.xml":
_local2 = new LevelData.Level24();
break;
case "level25.xml":
_local2 = new LevelData.Level25();
break;
case "level26.xml":
_local2 = new LevelData.Level26();
break;
case "level27.xml":
_local2 = new LevelData.Level27();
break;
case "level28.xml":
_local2 = new LevelData.Level28();
break;
case "level29.xml":
_local2 = new LevelData.Level29();
break;
case "level30.xml":
_local2 = new LevelData.Level30();
break;
case "level31.xml":
_local2 = new LevelData.Level31();
break;
case "level32.xml":
_local2 = new LevelData.Level32();
break;
case "level33.xml":
_local2 = new LevelData.Level33();
break;
case "level34.xml":
_local2 = new LevelData.Level34();
break;
case "level35.xml":
_local2 = new LevelData.Level35();
break;
case "level36.xml":
_local2 = new LevelData.Level36();
break;
case "level37.xml":
_local2 = new LevelData.Level37();
break;
case "level38.xml":
_local2 = new LevelData.Level38();
break;
case "level39.xml":
_local2 = new LevelData.Level39();
break;
case "level40.xml":
_local2 = new LevelData.Level40();
break;
case "level41.xml":
_local2 = new LevelData.Level41();
break;
case "level42.xml":
_local2 = new LevelData.Level42();
break;
case "level43.xml":
_local2 = new LevelData.Level43();
break;
case "level44.xml":
_local2 = new LevelData.Level44();
break;
case "level45.xml":
_local2 = new LevelData.Level45();
break;
case "level46.xml":
_local2 = new LevelData.Level46();
break;
case "level47.xml":
_local2 = new LevelData.Level47();
break;
case "level48.xml":
_local2 = new LevelData.Level48();
break;
case "level49.xml":
_local2 = new LevelData.Level49();
break;
case "level50.xml":
_local2 = new LevelData.Level50();
break;
default:
trace("Level not found");
return (null);
};
var _local3:String = _local2.readUTFBytes(_local2.length);
var _local4:XML = new XML(_local3);
return (_local4);
}
private function parseLevelXML(_arg1:XML):void{
var track:XML;
var matrix:Matrix;
var bkClass:Class;
var bkAsset:BitmapData;
var tileClass:Class;
var tileAsset:BitmapData;
var scaledTile:BitmapData;
var tileDef:XML;
var rowList:Array;
var rowIdx:int;
var rowLen:int;
var animTileClass:Class;
var i:int;
var row:XML;
var tileClassName:String;
var levelDefinition = _arg1;
this.targetScore = levelDefinition.lc.@score;
this.silverScore = levelDefinition.silverScore;
this.goldScore = levelDefinition.goldScore;
this.exitType = levelDefinition.exitType;
this.levelTitle = this.parseNewLines(levelDefinition.title.line.(@id == 1));
this.levelSubTitle = this.parseNewLines(levelDefinition.title.line.(@id == 2));
for each (track in levelDefinition.music.mute.track) {
this.muteTracks.push(track);
};
for each (track in levelDefinition.music.trigger.track) {
this.triggerTracks.push(track);
};
matrix = new Matrix();
matrix.scale(2, 2);
bkClass = (getDefinitionByName(levelDefinition.bk.@asset) as Class);
bkAsset = (new bkClass(0, 0) as BitmapData);
this.bk = new BitmapData((bkAsset.width * 2), (bkAsset.height * 2), true);
this.bk.draw(bkAsset, matrix);
this.tileList = new Array();
for each (tileDef in levelDefinition.t) {
if (tileDef.@visible == "true"){
tileClass = (getDefinitionByName(tileDef.@asset) as Class);
tileAsset = (new tileClass(0, 0) as BitmapData);
scaledTile = new BitmapData((tileAsset.width * 2), (tileAsset.height * 2), true, 0);
scaledTile.draw(tileAsset, matrix);
this.tileList[tileDef.@idx] = scaledTile;
continue;
};
};
for each (row in levelDefinition.r) {
rowIdx = (row.@idx - 1);
rowList = row.toString().split(",");
rowLen = rowList.length;
i = 0;
for (;i < rowLen;(this.statics[i][rowIdx] = (levelDefinition.t.(@idx == rowList[i]).@statics == "true")), if (levelDefinition.t.(@idx == rowList[i]).@entity == "PlayerStart"){
this.spawnCol = i;
this.spawnRow = rowIdx;
}, if (levelDefinition.t.(@idx == rowList[i]).@asset == "ExitTile"){
this.exitCol = i;
this.exitRow = rowIdx;
}, if ((((levelDefinition.t.(@idx == rowList[i]).@entity == "Collectable")) || ((levelDefinition.t.(@idx == rowList[i]).@entity == "Interactive")))){
this.collectables[i][rowIdx] = levelDefinition.t.(@idx == rowList[i]).@asset;
}, (i = (i + 1))) {
if (levelDefinition.t.(@idx == rowList[i]).@visible == "true"){
if (levelDefinition.t.(@idx == rowList[i]).@entity == "Interactive"){
tileClassName = ("customclasses.Anim" + levelDefinition.t.(@idx == rowList[i]).@asset);
animTileClass = (getDefinitionByName(tileClassName) as Class);
this.animTileList.push((new animTileClass(this.tileList[rowList[i]], rowList[i]) as AnimTile));
this.levelData[i][rowIdx] = -(this.animTileList.length);
} else {
this.levelData[i][rowIdx] = int(rowList[i]);
};
continue;
};
};
};
}
public function editSetTile(_arg1:int, _arg2:int, _arg3:int):void{
var tileClassName:String;
var animTileClass:Class;
var col = _arg1;
var row = _arg2;
var tileId = _arg3;
if ((((((((col < 0)) || ((col >= LEVEL_WIDTH)))) || ((row < 0)))) || ((row >= LEVEL_HEIGHT)))){
return;
};
if (tileId == 0){
this.levelData[col][row] = 0;
this.statics[col][row] = 0;
this.collectables[col][row] = 0;
return;
};
if (this.levelDesc.t.(@idx == tileId).@entity == "Interactive"){
tileClassName = ("customclasses.Anim" + this.levelDesc.t.(@idx == tileId).@asset);
animTileClass = (getDefinitionByName(tileClassName) as Class);
this.animTileList.push((new animTileClass(this.tileList[tileId], tileId) as AnimTile));
this.levelData[col][row] = -(this.animTileList.length);
} else {
this.levelData[col][row] = tileId;
};
this.statics[col][row] = (this.levelDesc.t.(@idx == tileId).@statics == "true");
if (this.levelDesc.t.(@idx == tileId).@entity == "PlayerStart"){
this.editSetTile(this.spawnCol, this.spawnRow, 0);
this.spawnCol = col;
this.spawnRow = row;
};
if (this.levelDesc.t.(@idx == tileId).@asset == "ExitTile"){
this.editSetTile(this.exitCol, this.exitRow, 0);
this.exitCol = col;
this.exitRow = row;
};
if ((((this.levelDesc.t.(@idx == tileId).@entity == "Collectable")) || ((this.levelDesc.t.(@idx == tileId).@entity == "Interactive")))){
this.collectables[col][row] = this.levelDesc.t.(@idx == tileId).@asset;
};
}
public function editGetLevelDescription():String{
this.editTakeSnapshot();
return (this.levelDesc.toString());
}
public function editTakeSnapshot():void{
var _local2:XML;
var _local3:int;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:XML;
var _local1:XML = new XML("<level></level>");
_local1.appendChild(this.levelDesc.bk);
_local1.appendChild(this.levelDesc.title);
_local1.appendChild(this.levelDesc.lc);
_local1.appendChild(this.levelDesc.silverScore);
_local1.appendChild(this.levelDesc.goldScore);
_local1.appendChild(this.levelDesc.exitType);
_local1.appendChild(this.levelDesc.music);
for each (_local2 in this.levelDesc.t) {
_local1.appendChild(_local2);
};
_local3 = 0;
while (_local3 < this.levelData[0].length) {
_local4 = "";
_local6 = 0;
while (_local6 < this.levelData.length) {
if (this.levelData[_local6][_local3] >= 0){
_local4 = (_local4 + String(this.levelData[_local6][_local3]));
} else {
_local5 = (Math.abs(this.levelData[_local6][_local3]) - 1);
_local4 = (_local4 + String(this.animTileList[_local5].tileId));
};
if (_local6 < (this.levelData.length - 1)){
_local4 = (_local4 + ",");
};
_local6++;
};
_local7 = new XML((((("<r idx='" + (_local3 + 1)) + "'>") + _local4) + "</r>"));
_local1.appendChild(_local7);
_local3++;
};
this.levelDesc = _local1;
}
public function editRestoreSnapshot():void{
this.unload();
this.parseLevelXML(this.levelDesc);
}
private function parseNewLines(_arg1:String):String{
var _local2 = "";
var _local3:int;
while (_local3 < _arg1.length) {
if (_arg1.charAt(_local3) != "\\"){
_local2 = (_local2 + _arg1.charAt(_local3));
} else {
if (_arg1.charAt((_local3 + 1)) == "n"){
_local2 = (_local2 + "\n");
_local3++;
};
};
_local3++;
};
return (_local2);
}
}
}//package customclasses
Section 18
//LevelData (customclasses.LevelData)
package customclasses {
public class LevelData {
public static const LevelList:Class = LevelData_LevelList;
public static const Level1:Class = LevelData_Level1;
public static const Level2:Class = LevelData_Level2;
public static const Level3:Class = LevelData_Level3;
public static const Level4:Class = LevelData_Level4;
public static const Level5:Class = LevelData_Level5;
public static const Level6:Class = LevelData_Level6;
public static const Level7:Class = LevelData_Level7;
public static const Level8:Class = LevelData_Level8;
public static const Level9:Class = LevelData_Level9;
public static const Level10:Class = LevelData_Level10;
public static const Level11:Class = LevelData_Level11;
public static const Level12:Class = LevelData_Level12;
public static const Level13:Class = LevelData_Level13;
public static const Level14:Class = LevelData_Level14;
public static const Level15:Class = LevelData_Level15;
public static const Level16:Class = LevelData_Level16;
public static const Level17:Class = LevelData_Level17;
public static const Level18:Class = LevelData_Level18;
public static const Level19:Class = LevelData_Level19;
public static const Level20:Class = LevelData_Level20;
public static const Level21:Class = LevelData_Level21;
public static const Level22:Class = LevelData_Level22;
public static const Level23:Class = LevelData_Level23;
public static const Level24:Class = LevelData_Level24;
public static const Level25:Class = LevelData_Level25;
public static const Level26:Class = LevelData_Level26;
public static const Level27:Class = LevelData_Level27;
public static const Level28:Class = LevelData_Level28;
public static const Level29:Class = LevelData_Level29;
public static const Level30:Class = LevelData_Level30;
public static const Level31:Class = LevelData_Level31;
public static const Level32:Class = LevelData_Level32;
public static const Level33:Class = LevelData_Level33;
public static const Level34:Class = LevelData_Level34;
public static const Level35:Class = LevelData_Level35;
public static const Level36:Class = LevelData_Level36;
public static const Level37:Class = LevelData_Level37;
public static const Level38:Class = LevelData_Level38;
public static const Level39:Class = LevelData_Level39;
public static const Level40:Class = LevelData_Level40;
public static const Level41:Class = LevelData_Level41;
public static const Level42:Class = LevelData_Level42;
public static const Level43:Class = LevelData_Level43;
public static const Level44:Class = LevelData_Level44;
public static const Level45:Class = LevelData_Level45;
public static const Level46:Class = LevelData_Level46;
public static const Level47:Class = LevelData_Level47;
public static const Level48:Class = LevelData_Level48;
public static const Level49:Class = LevelData_Level49;
public static const Level50:Class = LevelData_Level50;
}
}//package customclasses
Section 19
//LevelData_Level1 (customclasses.LevelData_Level1)
package customclasses {
import mx.core.*;
public class LevelData_Level1 extends ByteArrayAsset {
}
}//package customclasses
Section 20
//LevelData_Level10 (customclasses.LevelData_Level10)
package customclasses {
import mx.core.*;
public class LevelData_Level10 extends ByteArrayAsset {
}
}//package customclasses
Section 21
//LevelData_Level11 (customclasses.LevelData_Level11)
package customclasses {
import mx.core.*;
public class LevelData_Level11 extends ByteArrayAsset {
}
}//package customclasses
Section 22
//LevelData_Level12 (customclasses.LevelData_Level12)
package customclasses {
import mx.core.*;
public class LevelData_Level12 extends ByteArrayAsset {
}
}//package customclasses
Section 23
//LevelData_Level13 (customclasses.LevelData_Level13)
package customclasses {
import mx.core.*;
public class LevelData_Level13 extends ByteArrayAsset {
}
}//package customclasses
Section 24
//LevelData_Level14 (customclasses.LevelData_Level14)
package customclasses {
import mx.core.*;
public class LevelData_Level14 extends ByteArrayAsset {
}
}//package customclasses
Section 25
//LevelData_Level15 (customclasses.LevelData_Level15)
package customclasses {
import mx.core.*;
public class LevelData_Level15 extends ByteArrayAsset {
}
}//package customclasses
Section 26
//LevelData_Level16 (customclasses.LevelData_Level16)
package customclasses {
import mx.core.*;
public class LevelData_Level16 extends ByteArrayAsset {
}
}//package customclasses
Section 27
//LevelData_Level17 (customclasses.LevelData_Level17)
package customclasses {
import mx.core.*;
public class LevelData_Level17 extends ByteArrayAsset {
}
}//package customclasses
Section 28
//LevelData_Level18 (customclasses.LevelData_Level18)
package customclasses {
import mx.core.*;
public class LevelData_Level18 extends ByteArrayAsset {
}
}//package customclasses
Section 29
//LevelData_Level19 (customclasses.LevelData_Level19)
package customclasses {
import mx.core.*;
public class LevelData_Level19 extends ByteArrayAsset {
}
}//package customclasses
Section 30
//LevelData_Level2 (customclasses.LevelData_Level2)
package customclasses {
import mx.core.*;
public class LevelData_Level2 extends ByteArrayAsset {
}
}//package customclasses
Section 31
//LevelData_Level20 (customclasses.LevelData_Level20)
package customclasses {
import mx.core.*;
public class LevelData_Level20 extends ByteArrayAsset {
}
}//package customclasses
Section 32
//LevelData_Level21 (customclasses.LevelData_Level21)
package customclasses {
import mx.core.*;
public class LevelData_Level21 extends ByteArrayAsset {
}
}//package customclasses
Section 33
//LevelData_Level22 (customclasses.LevelData_Level22)
package customclasses {
import mx.core.*;
public class LevelData_Level22 extends ByteArrayAsset {
}
}//package customclasses
Section 34
//LevelData_Level23 (customclasses.LevelData_Level23)
package customclasses {
import mx.core.*;
public class LevelData_Level23 extends ByteArrayAsset {
}
}//package customclasses
Section 35
//LevelData_Level24 (customclasses.LevelData_Level24)
package customclasses {
import mx.core.*;
public class LevelData_Level24 extends ByteArrayAsset {
}
}//package customclasses
Section 36
//LevelData_Level25 (customclasses.LevelData_Level25)
package customclasses {
import mx.core.*;
public class LevelData_Level25 extends ByteArrayAsset {
}
}//package customclasses
Section 37
//LevelData_Level26 (customclasses.LevelData_Level26)
package customclasses {
import mx.core.*;
public class LevelData_Level26 extends ByteArrayAsset {
}
}//package customclasses
Section 38
//LevelData_Level27 (customclasses.LevelData_Level27)
package customclasses {
import mx.core.*;
public class LevelData_Level27 extends ByteArrayAsset {
}
}//package customclasses
Section 39
//LevelData_Level28 (customclasses.LevelData_Level28)
package customclasses {
import mx.core.*;
public class LevelData_Level28 extends ByteArrayAsset {
}
}//package customclasses
Section 40
//LevelData_Level29 (customclasses.LevelData_Level29)
package customclasses {
import mx.core.*;
public class LevelData_Level29 extends ByteArrayAsset {
}
}//package customclasses
Section 41
//LevelData_Level3 (customclasses.LevelData_Level3)
package customclasses {
import mx.core.*;
public class LevelData_Level3 extends ByteArrayAsset {
}
}//package customclasses
Section 42
//LevelData_Level30 (customclasses.LevelData_Level30)
package customclasses {
import mx.core.*;
public class LevelData_Level30 extends ByteArrayAsset {
}
}//package customclasses
Section 43
//LevelData_Level31 (customclasses.LevelData_Level31)
package customclasses {
import mx.core.*;
public class LevelData_Level31 extends ByteArrayAsset {
}
}//package customclasses
Section 44
//LevelData_Level32 (customclasses.LevelData_Level32)
package customclasses {
import mx.core.*;
public class LevelData_Level32 extends ByteArrayAsset {
}
}//package customclasses
Section 45
//LevelData_Level33 (customclasses.LevelData_Level33)
package customclasses {
import mx.core.*;
public class LevelData_Level33 extends ByteArrayAsset {
}
}//package customclasses
Section 46
//LevelData_Level34 (customclasses.LevelData_Level34)
package customclasses {
import mx.core.*;
public class LevelData_Level34 extends ByteArrayAsset {
}
}//package customclasses
Section 47
//LevelData_Level35 (customclasses.LevelData_Level35)
package customclasses {
import mx.core.*;
public class LevelData_Level35 extends ByteArrayAsset {
}
}//package customclasses
Section 48
//LevelData_Level36 (customclasses.LevelData_Level36)
package customclasses {
import mx.core.*;
public class LevelData_Level36 extends ByteArrayAsset {
}
}//package customclasses
Section 49
//LevelData_Level37 (customclasses.LevelData_Level37)
package customclasses {
import mx.core.*;
public class LevelData_Level37 extends ByteArrayAsset {
}
}//package customclasses
Section 50
//LevelData_Level38 (customclasses.LevelData_Level38)
package customclasses {
import mx.core.*;
public class LevelData_Level38 extends ByteArrayAsset {
}
}//package customclasses
Section 51
//LevelData_Level39 (customclasses.LevelData_Level39)
package customclasses {
import mx.core.*;
public class LevelData_Level39 extends ByteArrayAsset {
}
}//package customclasses
Section 52
//LevelData_Level4 (customclasses.LevelData_Level4)
package customclasses {
import mx.core.*;
public class LevelData_Level4 extends ByteArrayAsset {
}
}//package customclasses
Section 53
//LevelData_Level40 (customclasses.LevelData_Level40)
package customclasses {
import mx.core.*;
public class LevelData_Level40 extends ByteArrayAsset {
}
}//package customclasses
Section 54
//LevelData_Level41 (customclasses.LevelData_Level41)
package customclasses {
import mx.core.*;
public class LevelData_Level41 extends ByteArrayAsset {
}
}//package customclasses
Section 55
//LevelData_Level42 (customclasses.LevelData_Level42)
package customclasses {
import mx.core.*;
public class LevelData_Level42 extends ByteArrayAsset {
}
}//package customclasses
Section 56
//LevelData_Level43 (customclasses.LevelData_Level43)
package customclasses {
import mx.core.*;
public class LevelData_Level43 extends ByteArrayAsset {
}
}//package customclasses
Section 57
//LevelData_Level44 (customclasses.LevelData_Level44)
package customclasses {
import mx.core.*;
public class LevelData_Level44 extends ByteArrayAsset {
}
}//package customclasses
Section 58
//LevelData_Level45 (customclasses.LevelData_Level45)
package customclasses {
import mx.core.*;
public class LevelData_Level45 extends ByteArrayAsset {
}
}//package customclasses
Section 59
//LevelData_Level46 (customclasses.LevelData_Level46)
package customclasses {
import mx.core.*;
public class LevelData_Level46 extends ByteArrayAsset {
}
}//package customclasses
Section 60
//LevelData_Level47 (customclasses.LevelData_Level47)
package customclasses {
import mx.core.*;
public class LevelData_Level47 extends ByteArrayAsset {
}
}//package customclasses
Section 61
//LevelData_Level48 (customclasses.LevelData_Level48)
package customclasses {
import mx.core.*;
public class LevelData_Level48 extends ByteArrayAsset {
}
}//package customclasses
Section 62
//LevelData_Level49 (customclasses.LevelData_Level49)
package customclasses {
import mx.core.*;
public class LevelData_Level49 extends ByteArrayAsset {
}
}//package customclasses
Section 63
//LevelData_Level5 (customclasses.LevelData_Level5)
package customclasses {
import mx.core.*;
public class LevelData_Level5 extends ByteArrayAsset {
}
}//package customclasses
Section 64
//LevelData_Level50 (customclasses.LevelData_Level50)
package customclasses {
import mx.core.*;
public class LevelData_Level50 extends ByteArrayAsset {
}
}//package customclasses
Section 65
//LevelData_Level6 (customclasses.LevelData_Level6)
package customclasses {
import mx.core.*;
public class LevelData_Level6 extends ByteArrayAsset {
}
}//package customclasses
Section 66
//LevelData_Level7 (customclasses.LevelData_Level7)
package customclasses {
import mx.core.*;
public class LevelData_Level7 extends ByteArrayAsset {
}
}//package customclasses
Section 67
//LevelData_Level8 (customclasses.LevelData_Level8)
package customclasses {
import mx.core.*;
public class LevelData_Level8 extends ByteArrayAsset {
}
}//package customclasses
Section 68
//LevelData_Level9 (customclasses.LevelData_Level9)
package customclasses {
import mx.core.*;
public class LevelData_Level9 extends ByteArrayAsset {
}
}//package customclasses
Section 69
//LevelData_LevelList (customclasses.LevelData_LevelList)
package customclasses {
import mx.core.*;
public class LevelData_LevelList extends ByteArrayAsset {
}
}//package customclasses
Section 70
//LevelSelectScreen (customclasses.LevelSelectScreen)
package customclasses {
import flash.events.*;
import flash.display.*;
import gmd.framework.*;
import flash.text.*;
public class LevelSelectScreen extends Screen {
public var ButtonHolder:MovieClip;
public var LevelSelectMuteBtn:MuteButton;
private static const X_POS:int = 31;
private static const Y_POS:int = 45;
public function LevelSelectScreen(){
addFrameScript(20, frame21);
this.x = (X_POS * 2);
this.y = (Y_POS * 2);
this.scaleX = 2;
this.scaleY = 2;
this.ButtonHolder.addEventListener(MouseEvent.CLICK, onLevelButtonClicked);
this.LevelSelectMuteBtn.addEventListener(MouseEvent.CLICK, onMuteClicked);
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(_arg1:Event):void{
var _local2:MovieClip;
var _local3:SimpleButton;
var _local4:SimpleButton;
var _local5:SimpleButton;
var _local9:String;
var _local12:int;
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.LevelSelectMuteBtn.mute = BoozeUp(this.parent).mute;
var _local6 = 1;
while (_local6 <= BoozeUp.MAX_LEVELS) {
_local2 = (this.ButtonHolder.getChildByName(("Lock" + String(_local6))) as MovieClip);
_local3 = (this.ButtonHolder.getChildByName(("Level" + String(_local6))) as SimpleButton);
_local4 = (this.ButtonHolder.getChildByName(("Silver" + String(_local6))) as SimpleButton);
_local5 = (this.ButtonHolder.getChildByName(("Gold" + String(_local6))) as SimpleButton);
this.setButtonText(_local3, String(_local6));
this.setButtonText(_local4, String(_local6));
this.setButtonText(_local5, String(_local6));
if (_local6 <= (BoozeUp(this.parent).levelsComplete + 1)){
_local2.visible = false;
_local3.visible = false;
_local4.visible = false;
_local5.visible = false;
switch (BoozeUp(this.parent).getMedal(_local6)){
case BoozeUp.MEDAL_BRONZE:
_local3.visible = true;
break;
case BoozeUp.MEDAL_SILVER:
_local4.visible = true;
break;
case BoozeUp.MEDAL_GOLD:
_local5.visible = true;
break;
};
} else {
_local2.visible = true;
_local3.visible = false;
_local4.visible = false;
_local5.visible = false;
};
_local6++;
};
var _local7:TextField = (this.ButtonHolder.getChildByName("BeersCollected") as TextField);
_local7.text = ((String(BoozeUp(this.parent).totalScore) + " / ") + String(BoozeUp.MAX_PINTS));
var _local8:TextField = (this.ButtonHolder.getChildByName("PukeTotal") as TextField);
_local8.text = String(BoozeUp(this.parent).pukeCount);
var _local10:Number = (int(((BoozeUp(this.parent).longestPuke / 1000) * 100)) / 100);
if (_local10 <= 0){
_local9 = "0.00";
} else {
_local9 = String(_local10);
_local12 = _local9.indexOf(".");
if (_local12 == -1){
_local9 = (_local9 + ".00");
} else {
if ((_local9.length - _local12) <= 2){
_local9 = (_local9 + "0");
};
};
};
var _local11:TextField = (this.ButtonHolder.getChildByName("PukeTime") as TextField);
_local11.text = _local9;
}
private function setButtonText(_arg1:SimpleButton, _arg2:String):void{
var _local3:int;
var _local4:DisplayObject;
_local3 = 0;
while (_local3 < Sprite(_arg1.upState).numChildren) {
_local4 = Sprite(_arg1.upState).getChildAt(_local3);
if ((_local4 is TextField)){
TextField(_local4).text = _arg2;
};
_local3++;
};
_local3 = 0;
while (_local3 < Sprite(_arg1.downState).numChildren) {
_local4 = Sprite(_arg1.downState).getChildAt(_local3);
if ((_local4 is TextField)){
TextField(_local4).text = _arg2;
};
_local3++;
};
_local3 = 0;
while (_local3 < Sprite(_arg1.overState).numChildren) {
_local4 = Sprite(_arg1.overState).getChildAt(_local3);
if ((_local4 is TextField)){
TextField(_local4).text = _arg2;
};
_local3++;
};
}
private function onLevelButtonClicked(_arg1:MouseEvent):void{
var _local2:String;
var _local3:String = _arg1.target.name;
if (_local3.substr(0, 5) == "Level"){
_local2 = _local3.substring(5, _local3.length);
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "StartLevel", _local2));
} else {
if (_local3.substr(0, 6) == "Silver"){
_local2 = _local3.substring(6, _local3.length);
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "StartLevel", _local2));
} else {
if (_local3.substr(0, 4) == "Gold"){
_local2 = _local3.substring(4, _local3.length);
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "StartLevel", _local2));
};
};
};
}
private function onMuteClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "LevelSelectMute"));
}
function frame21(){
stop();
}
}
}//package customclasses
Section 71
//LevelTitle (customclasses.LevelTitle)
package customclasses {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class LevelTitle extends MovieClip {
private var levelTitle:String;
private var levelSubTitle:String;
public var MessageHolder:MovieClip;
public var state:String;// = "Title idle"
public static const WAIT_ENTER:String = "Wait enter";
public static const TITLE_FADE_IN:String = "Title fade in";
public static const TITLE_FADE_OUT:String = "Title fade out";
public static const TITLE_WAITING:String = "Title waiting";
public static const TITLE_IDLE:String = "Title idle";
public static const TITLE_DONE:String = "Title done";
public function LevelTitle(){
addFrameScript(0, frame1, 22, frame23, 100, frame101, 114, frame115);
this.visible = false;
this.addEventListener(Event.ADDED, onChildAdded, false, 0, true);
this.addEventListener("Title in", onTitleIn, false, 0, true);
this.addEventListener("Title out", onTitleOut, false, 0, true);
this.addEventListener("Title done", onTitleDone, false, 0, true);
}
private function onChildAdded(_arg1:Event):void{
var _local2:TextField;
var _local3:TextField;
var _local4:MovieClip;
switch (_arg1.target.name){
case "LevelTitle":
_arg1.target.text = this.levelTitle;
break;
case "LevelSubTitle":
_arg1.target.text = this.levelSubTitle;
break;
case "MessageHolder":
_local2 = (_arg1.target.getChildByName("LevelTitle") as TextField);
_local3 = (_arg1.target.getChildByName("LevelSubTitle") as TextField);
_local4 = (_arg1.target.getChildByName("LineObj") as MovieClip);
if (((((_local2) && (_local3))) && (_local4))){
if (_local2.textWidth >= _local3.textWidth){
_local4.width = _local2.textWidth;
} else {
_local4.width = _local3.textWidth;
};
};
break;
};
}
private function onTitleIn(_arg1:Event):void{
this.state = TITLE_WAITING;
}
private function onTitleOut(_arg1:Event):void{
this.state = TITLE_FADE_OUT;
}
private function onTitleDone(_arg1:Event):void{
this.state = TITLE_DONE;
this.visible = false;
}
public function trigger():void{
this.visible = true;
this.gotoAndPlay(2);
this.state = TITLE_FADE_IN;
}
public function dismiss():void{
this.gotoAndPlay("out");
this.state = TITLE_FADE_OUT;
}
public function set title(_arg1:String):void{
this.levelTitle = _arg1;
}
public function set subTitle(_arg1:String):void{
this.levelSubTitle = _arg1;
}
function frame1(){
stop();
}
function frame23(){
this.dispatchEvent(new Event("Title in"));
}
function frame101(){
this.dispatchEvent(new Event("Title out"));
}
function frame115(){
this.dispatchEvent(new Event("Title done"));
}
}
}//package customclasses
Section 72
//LoadBar (customclasses.LoadBar)
package customclasses {
import flash.display.*;
import gmd.framework.*;
public class LoadBar extends MovieClip implements ILoadingProgress {
public var Bar:MovieClip;
public function LoadBar(){
this.percentLoaded = 0;
}
public function set percentLoaded(_arg1:Number):void{
var _local2:MovieClip = (this.getChildByName("Bar") as MovieClip);
if (_local2){
_local2.scaleX = (_arg1 / 100);
};
}
}
}//package customclasses
Section 73
//MusicManager (customclasses.MusicManager)
package customclasses {
import flash.media.*;
import flash.events.*;
import flash.utils.*;
public class MusicManager {
public var syncFreq:int;// = 33
private var loopIds:Array;
private var soundsList:Array;
private var channelsList:Array;
private var transformsList:Array;
private var muteList:Array;
private var durations:Array;
private var loopsWaiting:Array;
private var layerCount:int;
private var muteTransform:SoundTransform;
private var syncTimer:Timer;
private var offsetTime:int;
private var fadeType:int;
private var fadeRate:Number;
private var fadeVol:Number;
private static const ATTACK_TIME:int = 100;
private static const LOOP_FOREVER:int = 9999999;
private static const NOT_WAITING:String = "Not waiting";
private static const WAITING_MUTE:String = "Waiting mute";
private static const WAITING_RESTORE:String = "Waiting restore";
public function MusicManager(){
this.loopIds = new Array();
this.soundsList = new Array();
this.channelsList = new Array();
this.transformsList = new Array();
this.muteList = new Array();
this.durations = new Array();
this.loopsWaiting = new Array();
this.layerCount = 0;
this.fadeType = 0;
this.fadeRate = 0;
this.fadeVol = 0;
this.muteTransform = new SoundTransform(0);
this.syncTimer = new Timer(this.syncFreq);
this.syncTimer.addEventListener(TimerEvent.TIMER, onTick, false, 0, true);
this.syncTimer.start();
}
public function addLoop(_arg1:String, _arg2:Sound, _arg3:int=-1):void{
this.loopIds.push(_arg1);
this.soundsList.push(_arg2);
this.channelsList.push(null);
this.transformsList.push(new SoundTransform());
this.muteList.push(false);
if (_arg3 < 0){
this.durations.push(_arg2.length);
} else {
this.durations.push(_arg3);
};
this.loopsWaiting.push(NOT_WAITING);
this.layerCount++;
}
public function play():void{
var _local1:int;
this.stop();
this.soundsList[0].play(0, LOOP_FOREVER, this.muteTransform);
var _local2:int;
var _local3:int;
while (_local3 < this.layerCount) {
_local1 = getTimer();
this.channelsList[_local3] = Sound(this.soundsList[_local3]).play(0, LOOP_FOREVER, this.muteTransform);
_local2 = (_local2 + (getTimer() - _local1));
_local3++;
};
_local3 = 0;
while (_local3 < this.layerCount) {
if (!this.muteList[_local3]){
this.channelsList[_local3].soundTransform = this.transformsList[_local3];
};
_local3++;
};
this.offsetTime = getTimer();
}
public function stop():void{
var _local1:int;
while (_local1 < this.layerCount) {
if (this.channelsList[_local1]){
SoundChannel(this.channelsList[_local1]).stop();
this.channelsList[_local1] = null;
};
_local1++;
};
}
public function get fadeState():int{
return (this.fadeType);
}
public function fadeOut(_arg1:int):void{
var _local2:Number = 0;
var _local3:int;
while (_local3 < this.layerCount) {
if (SoundChannel(this.channelsList[_local3]).soundTransform.volume > _local2){
_local2 = SoundChannel(this.channelsList[_local3]).soundTransform.volume;
};
_local3++;
};
this.fadeRate = (_local2 / (_arg1 / this.syncFreq));
this.fadeType = -1;
this.fadeVol = _local2;
}
public function fadeIn(_arg1:int):void{
var _local2:Number = 0;
var _local3:int;
while (_local3 < this.layerCount) {
if (SoundTransform(this.transformsList[_local3]).volume > _local2){
_local2 = SoundTransform(this.transformsList[_local3]).volume;
};
_local3++;
};
this.fadeRate = (_local2 / (_arg1 / this.syncFreq));
this.fadeType = 1;
this.fadeVol = 0;
}
public function muteAll():void{
var _local1:int;
while (_local1 < this.layerCount) {
this.muteLoop(this.loopIds[_local1]);
_local1++;
};
}
public function muteLoop(_arg1:String):void{
var _local2 = -1;
var _local3:int;
while (_local3 < this.layerCount) {
if (this.loopIds[_local3] == _arg1){
_local2 = _local3;
break;
};
_local3++;
};
if (_local2 < 0){
return;
};
if (this.channelsList[_local2]){
this.channelsList[_local2].soundTransform = this.muteTransform;
};
this.muteList[_local2] = true;
}
public function restoreLoop(_arg1:String):void{
var _local2 = -1;
var _local3:int;
while (_local3 < this.layerCount) {
if (this.loopIds[_local3] == _arg1){
_local2 = _local3;
break;
};
_local3++;
};
if (_local2 < 0){
return;
};
if (this.muteList[_local2]){
if (this.channelsList[_local2]){
this.channelsList[_local2].soundTransform = this.transformsList[_local2];
};
};
this.muteList[_local2] = false;
}
public function restoreLoopSync(_arg1:String):void{
var _local2 = -1;
var _local3:int;
while (_local3 < this.layerCount) {
if (this.loopIds[_local3] == _arg1){
_local2 = _local3;
break;
};
_local3++;
};
if (_local2 < 0){
return;
};
if (this.muteList[_local2]){
this.loopsWaiting[_local2] = WAITING_RESTORE;
};
}
public function muteLoopSync(_arg1:String):void{
var _local2 = -1;
var _local3:int;
while (_local3 < this.layerCount) {
if (this.loopIds[_local3] == _arg1){
_local2 = _local3;
break;
};
_local3++;
};
if (_local2 < 0){
return;
};
if (!this.muteList[_local2]){
this.loopsWaiting[_local2] = WAITING_MUTE;
};
}
public function setLoopTransform(_arg1:String, _arg2:SoundTransform):void{
var _local3 = -1;
var _local4:int;
while (_local4 < this.layerCount) {
if (this.loopIds[_local4] == _arg1){
_local3 = _local4;
break;
};
_local4++;
};
if (_local3 < 0){
return;
};
this.transformsList[_local3] = _arg2;
if (((!(this.muteList[_local3])) && (this.channelsList[_local3]))){
this.channelsList[_local3].soundTransform = _arg2;
};
}
private function onTick(_arg1:TimerEvent):void{
var _local2:int;
var _local4:SoundTransform;
var _local3:int;
while (_local3 < this.layerCount) {
if (((this.channelsList[_local3]) && (!((this.loopsWaiting[_local3] == NOT_WAITING))))){
_local2 = (this.channelsList[0].position % this.durations[_local3]);
if (((((_local2 - ATTACK_TIME) <= this.syncFreq)) || (((_local2 + ATTACK_TIME) >= (this.durations[_local3] - this.syncFreq))))){
if (this.loopsWaiting[_local3] == WAITING_RESTORE){
this.channelsList[_local3].soundTransform = this.transformsList[_local3];
this.muteList[_local3] = false;
} else {
if (this.loopsWaiting[_local3] == WAITING_MUTE){
this.channelsList[_local3].soundTransform = this.muteTransform;
this.muteList[_local3] = true;
};
};
this.loopsWaiting[_local3] = NOT_WAITING;
};
};
_local3++;
};
var _local5:Boolean;
if (this.fadeType > 0){
_local3 = 0;
while (_local3 < this.layerCount) {
if (((!(this.muteList[_local3])) && ((SoundChannel(this.channelsList[_local3]).soundTransform.volume < SoundTransform(this.transformsList[_local3]).volume)))){
_local4 = SoundChannel(this.channelsList[_local3]).soundTransform;
_local4.volume = this.fadeVol;
this.fadeVol = (this.fadeVol + this.fadeRate);
if (_local4.volume > SoundTransform(this.transformsList[_local3]).volume){
SoundChannel(this.channelsList[_local3]).soundTransform = this.transformsList[_local3];
} else {
SoundChannel(this.channelsList[_local3]).soundTransform = _local4;
_local5 = true;
};
};
_local3++;
};
if (!_local5){
this.fadeType = 0;
};
} else {
if (this.fadeType < 0){
_local3 = 0;
while (_local3 < this.layerCount) {
if (((!(this.muteList[_local3])) && ((SoundChannel(this.channelsList[_local3]).soundTransform.volume > 0)))){
_local4 = SoundChannel(this.channelsList[_local3]).soundTransform;
_local4.volume = this.fadeVol;
this.fadeVol = (this.fadeVol - this.fadeRate);
if (_local4.volume < 0){
SoundChannel(this.channelsList[_local3]).soundTransform = this.muteTransform;
} else {
SoundChannel(this.channelsList[_local3]).soundTransform = _local4;
_local5 = true;
};
};
_local3++;
};
if (!_local5){
this.fadeType = 0;
};
};
};
}
}
}//package customclasses
Section 74
//MuteButton (customclasses.MuteButton)
package customclasses {
import flash.media.*;
import flash.events.*;
import flash.display.*;
public class MuteButton extends MovieClip {
private var isMute:Boolean;
private var isOver:Boolean;
private var sfxOver:Sound;
public function MuteButton(){
this.isMute = false;
this.isOver = false;
this.sfxOver = new SFXOver();
this.addEventListener(MouseEvent.ROLL_OVER, onRollOver, false, 0, true);
this.addEventListener(MouseEvent.ROLL_OUT, onRollOut, false, 0, true);
this.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
this.updateState();
}
public function set mute(_arg1:Boolean):void{
this.isMute = _arg1;
this.updateState();
}
public function get mute():Boolean{
return (this.isMute);
}
private function updateState():void{
if (!this.isMute){
if (this.isOver){
this.gotoAndStop("On_Over");
} else {
this.gotoAndStop("On");
};
} else {
if (this.isOver){
this.gotoAndStop("Off_Over");
} else {
this.gotoAndStop("Off");
};
};
}
private function onRollOver(_arg1:MouseEvent):void{
this.sfxOver.play(0, 0, new SoundTransform(Game.SFX_VOL));
this.isOver = true;
this.updateState();
}
private function onRollOut(_arg1:MouseEvent):void{
this.isOver = false;
this.updateState();
}
private function onClick(_arg1:MouseEvent):void{
this.isMute = !(this.isMute);
this.updateState();
}
}
}//package customclasses
Section 75
//PintCounter (customclasses.PintCounter)
package customclasses {
import flash.display.*;
import flash.text.*;
public class PintCounter extends MovieClip {
public var Value:TextField;
public function set collected(_arg1:int):void{
this.Value.text = String(_arg1);
}
}
}//package customclasses
Section 76
//Player (customclasses.Player)
package customclasses {
import flash.media.*;
import flash.events.*;
import flash.geom.*;
public class Player {
private var SFX_VOL:int;// = 5
public var pos:Rectangle;
public var rect:Rectangle;
public var hoverTime:int;
public var isDead:Boolean;
public var pukeAmount:int;// = 1
private var animFrame:int;
private var animLoop:Array;
private var animState:String;
private var velocity:Point;
private var isGrounded:Boolean;
public var isHovering:Boolean;
private var levelRef:Level;
private var pukeManRef:PukeMan;
private var leftAction:Boolean;
private var rightAction:Boolean;
private var jumpAction:Boolean;
private var jumpLatch:Boolean;
private var hoverReady:Boolean;
private var gameNotified:Boolean;
private var sfxJumps:Array;
private var sfxSick:Array;
private var sickChannel:SoundChannel;
private var isSickSound:Boolean;
private static const CANVAS_MID_X:int = 320;
public static const PLAYER_WIDTH:int = 22;
public static const PLAYER_HEIGHT:int = 24;
public static const WIDTH_DIV2:int = 11;
public static const HEIGHT_DIV2:int = 12;
private static const FALL_MARGIN:int = 100;
private static const MID_POINT1:int = 8;
private static const MID_POINT2:int = 16;
private static const LEFT_EDGE:int = 2;
private static const RIGHT_EDGE:int = 20;
private static const TOP_EDGE:int = 0;
private static const Y_COLLISION_OFFSET:int = 1;
private static const COLLIDE_STEP_X:int = (Level.TILE_WIDTH - 2);
private static const COLLIDE_STEP_Y:int = (Level.TILE_HEIGHT - 2);
private static const FRAME_WIDTH:int = 22;
private static const FRAME_HEIGHT:int = 24;
private static const PAGE_COLUMNS:int = 6;
private static const INACTIVE:Array = [0];
private static const JUMP_LEFT:Array = [7, 7, 7, 7, 6, -1];
private static const JUMP_RIGHT:Array = [9, 9, 9, 9, 10, -1];
private static const JUMP_STRAIGHT:Array = [0, 0, 0, 0, 8, -1];
private static const WALK_LEFT:Array = [14, 14, 13, 13, 12, 12, 13, 13];
private static const WALK_RIGHT:Array = [15, 15, 16, 16, 17, 17, 16, 16];
private static const HOVER:Array = [18, 19, 20];
private static const DEATH:Array = [8, 8, 8, 0, 0, 0];
private static const STATE_INACTIVE:String = "inactive";
private static const STATE_WALKING_LEFT:String = "walking left";
private static const STATE_WALKING_RIGHT:String = "walking right";
private static const STATE_JUMPING_LEFT:String = "jumping left";
private static const STATE_JUMPING_RIGHT:String = "jumping right";
private static const STATE_JUMPING_STRAIGHT:String = "jumping straight";
private static const STATE_HOVERING:String = "hovering";
private static const STATE_DEATH:String = "death";
private static const GRAVITY_STRENGTH:Number = 2.5;
private static const RUN_FORCE:Number = 2;
private static const JUMP_FORCE:Number = -13.5;
private static const BOUNCE_FORCE:Number = -20;
private static const HOVER_FORCE:Number = -1.8;
private static const HOVER_BOOST:Number = -9;
private static const FLOOR_DRAG:Number = 0.75;
private static const DEATH_DRAG:Number = 0.85;
private static const REST_THRESHOLD:Number = 0.9;
private static const MAX_Y_SPEED:int = 35;
public function Player(_arg1:Level, _arg2:PukeMan){
this.levelRef = _arg1;
this.pukeManRef = _arg2;
this.pos = new Rectangle(0, 0, PLAYER_WIDTH, PLAYER_HEIGHT);
this.velocity = new Point(0, 0);
this.rect = new Rectangle();
this.sfxJumps = new Array();
this.sfxJumps.push(new SFXJumpA());
this.sfxJumps.push(new SFXJumpB());
this.sfxJumps.push(new SFXJumpC());
this.sfxSick = new Array();
this.sfxSick.push(new SFXSickA());
this.sfxSick.push(new SFXSickB());
this.sfxSick.push(new SFXSickC());
this.sickChannel = this.sfxSick[0].play();
this.sickChannel.stop();
this.reset();
}
public function reset():void{
this.pos.x = 0;
this.pos.y = 0;
this.velocity.x = 0;
this.velocity.y = 0;
this.isGrounded = false;
this.isHovering = false;
this.hoverReady = false;
this.jumpLatch = false;
this.hoverTime = 0;
this.isSickSound = false;
this.leftAction = false;
this.rightAction = false;
this.jumpAction = false;
this.isDead = false;
this.gameNotified = false;
this.setAnimState(STATE_INACTIVE);
}
public function update():Boolean{
var _local1:SoundChannel;
if (this.isDead){
this.velocity.x = (this.velocity.x * DEATH_DRAG);
} else {
this.velocity.x = (this.velocity.x * FLOOR_DRAG);
if (Math.abs(this.velocity.x) < REST_THRESHOLD){
this.velocity.x = 0;
};
};
if (this.leftAction){
this.velocity.x = (this.velocity.x - RUN_FORCE);
} else {
if (this.rightAction){
this.velocity.x = (this.velocity.x + RUN_FORCE);
};
};
if (this.jumpAction){
if (((this.isGrounded) && (!(this.jumpLatch)))){
_local1 = this.sfxJumps[Math.floor((Math.random() * this.sfxJumps.length))].play();
_local1.soundTransform = new SoundTransform(SFX_VOL, this.pan);
this.velocity.y = (this.velocity.y + JUMP_FORCE);
this.jumpLatch = true;
} else {
if (((this.hoverReady) && ((this.hoverTime > 0)))){
if (!this.isHovering){
this.sickChannel = this.sfxSick[Math.floor((Math.random() * this.sfxSick.length))].play();
this.sickChannel.soundTransform = new SoundTransform(SFX_VOL, this.pan);
this.sickChannel.addEventListener(Event.SOUND_COMPLETE, onSickLoopComplete, false, 0, true);
this.isSickSound = true;
this.velocity.y = HOVER_BOOST;
this.isHovering = true;
};
if (!this.isSickSound){
this.sickChannel = this.sfxSick[Math.floor((Math.random() * this.sfxSick.length))].play();
this.sickChannel.soundTransform = new SoundTransform(SFX_VOL, this.pan);
this.sickChannel.addEventListener(Event.SOUND_COMPLETE, onSickLoopComplete, false, 0, true);
this.isSickSound = true;
} else {
this.sickChannel.soundTransform = new SoundTransform(SFX_VOL, this.pan);
};
this.velocity.y = (this.velocity.y + HOVER_FORCE);
this.pukeManRef.spawn((this.pos.x + WIDTH_DIV2), (this.pos.y + 5), this.pukeAmount);
this.hoverTime--;
};
};
} else {
if (this.jumpLatch){
this.hoverReady = true;
};
this.sickChannel.stop();
this.sickChannel.removeEventListener(Event.SOUND_COMPLETE, onSickLoopComplete);
};
if (!this.isGrounded){
this.velocity.y = (this.velocity.y + GRAVITY_STRENGTH);
if (this.velocity.y > MAX_Y_SPEED){
this.velocity.y = MAX_Y_SPEED;
};
};
if (!this.isDead){
this.movePlayer();
} else {
this.pos.x = (this.pos.x + this.velocity.x);
this.pos.y = (this.pos.y + this.velocity.y);
};
if (this.isDead){
this.setAnimState(STATE_DEATH);
} else {
if (this.isHovering){
this.setAnimState(STATE_HOVERING);
} else {
if (this.velocity.x > 0){
if (this.isGrounded){
this.setAnimState(STATE_WALKING_RIGHT);
} else {
this.setAnimState(STATE_JUMPING_RIGHT);
};
} else {
if (this.velocity.x < 0){
if (this.isGrounded){
this.setAnimState(STATE_WALKING_LEFT);
} else {
this.setAnimState(STATE_JUMPING_LEFT);
};
} else {
if (this.isGrounded){
this.setAnimState(STATE_INACTIVE);
} else {
this.setAnimState(STATE_JUMPING_STRAIGHT);
};
};
};
};
};
this.leftAction = false;
this.rightAction = false;
this.jumpAction = false;
return ((this.pos.y < (Game.CANVAS_HEIGHT + FALL_MARGIN)));
}
private function onSickLoopComplete(_arg1:Event):void{
_arg1.target.removeEventListener(Event.SOUND_COMPLETE, onSickLoopComplete);
this.sickChannel = this.sfxSick[Math.floor((Math.random() * this.sfxSick.length))].play();
this.sickChannel.soundTransform = new SoundTransform(SFX_VOL, this.pan);
this.sickChannel.addEventListener(Event.SOUND_COMPLETE, onSickLoopComplete, false, 0, true);
}
public function left():void{
if (!this.isDead){
this.leftAction = true;
};
}
public function right():void{
if (!this.isDead){
this.rightAction = true;
};
}
public function jump():void{
if (!this.isDead){
this.jumpAction = true;
};
}
public function bounce():void{
if (!this.isDead){
this.velocity.y = BOUNCE_FORCE;
this.hoverReady = true;
this.jumpLatch = true;
};
}
public function die():void{
if (!this.isDead){
this.velocity.y = JUMP_FORCE;
this.isGrounded = false;
this.setAnimState(STATE_DEATH);
};
this.isDead = true;
}
public function setPos(_arg1:int, _arg2:int):void{
this.pos.x = _arg1;
this.pos.y = _arg2;
}
public function get row():int{
return (((this.pos.y + PLAYER_HEIGHT) / Level.TILE_HEIGHT));
}
public function get pan():Number{
return (((this.pos.x - CANVAS_MID_X) / CANVAS_MID_X));
}
public function getTile():Point{
var _local1:int = ((this.pos.x + WIDTH_DIV2) / Level.TILE_WIDTH);
var _local2:int = ((this.pos.y + HEIGHT_DIV2) / Level.TILE_HEIGHT);
var _local3:Point = new Point(_local1, _local2);
return (_local3);
}
public function headTile():Point{
var _local1:int = ((this.pos.x + WIDTH_DIV2) / Level.TILE_WIDTH);
var _local2:int = ((this.pos.y + TOP_EDGE) / Level.TILE_HEIGHT);
var _local3:Point = new Point(_local1, _local2);
return (_local3);
}
public function setTile(_arg1:int, _arg2:int):void{
this.pos.x = (_arg1 * Level.TILE_WIDTH);
this.pos.y = (((_arg2 * Level.TILE_HEIGHT) - PLAYER_HEIGHT) + Level.TILE_HEIGHT);
}
private function setAnimState(_arg1:String):void{
if (_arg1 == this.animState){
this.animFrame++;
if (this.animFrame >= this.animLoop.length){
this.animFrame = 0;
};
if (this.animLoop[this.animFrame] == -1){
this.animFrame--;
};
} else {
switch (_arg1){
case STATE_INACTIVE:
this.animLoop = INACTIVE;
break;
case STATE_WALKING_LEFT:
this.animLoop = WALK_LEFT;
break;
case STATE_WALKING_RIGHT:
this.animLoop = WALK_RIGHT;
break;
case STATE_JUMPING_LEFT:
this.animLoop = JUMP_LEFT;
break;
case STATE_JUMPING_RIGHT:
this.animLoop = JUMP_RIGHT;
break;
case STATE_JUMPING_STRAIGHT:
this.animLoop = JUMP_STRAIGHT;
break;
case STATE_HOVERING:
this.animLoop = HOVER;
break;
case STATE_DEATH:
this.animLoop = DEATH;
break;
};
this.animFrame = 0;
};
this.animState = _arg1;
this.setFrame(this.animLoop[this.animFrame]);
}
private function setFrame(_arg1:int):void{
this.rect.x = ((_arg1 % PAGE_COLUMNS) * FRAME_WIDTH);
this.rect.y = (Math.floor((_arg1 / PAGE_COLUMNS)) * FRAME_HEIGHT);
this.rect.width = FRAME_WIDTH;
this.rect.height = FRAME_HEIGHT;
}
private function movePlayer():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:Boolean;
var _local15:int;
var _local19:int;
var _local22:int;
var _local23:Boolean;
if (this.velocity.x != 0){
_local23 = (this.velocity.x > 0);
if (_local23){
_local1 = RIGHT_EDGE;
} else {
_local1 = LEFT_EDGE;
};
_local3 = (this.pos.y + MID_POINT1);
_local4 = (this.pos.y + MID_POINT2);
_local11 = Math.abs((this.velocity.x / COLLIDE_STEP_X));
_local13 = (this.velocity.x % COLLIDE_STEP_X);
_local14 = false;
_local12 = 0;
while (_local12 <= _local11) {
if (_local23){
_local15 = ((_local12 * COLLIDE_STEP_X) + _local13);
} else {
_local15 = (-((_local12 * COLLIDE_STEP_X)) + _local13);
};
_local2 = ((this.pos.x + _local15) + _local1);
_local7 = (_local2 / Level.TILE_WIDTH);
_local9 = (_local3 / Level.TILE_HEIGHT);
_local10 = (_local4 / Level.TILE_HEIGHT);
if (((this.levelRef.statics[_local7][_local9]) || (this.levelRef.statics[_local7][_local10]))){
_local5 = (_local7 * Level.TILE_WIDTH);
_local6 = (_local2 - _local5);
if (_local23){
this.pos.x = (this.pos.x + ((_local15 - _local6) - 1));
} else {
this.pos.x = (this.pos.x + (_local15 + (Level.TILE_WIDTH - _local6)));
};
this.velocity.x = 0;
_local14 = true;
break;
};
_local12++;
};
if (!_local14){
this.pos.x = (this.pos.x + this.velocity.x);
};
};
var _local16 = (this.velocity.y < 0);
var _local17:int = ((this.pos.x + LEFT_EDGE) + Y_COLLISION_OFFSET);
var _local18:int = ((this.pos.x + RIGHT_EDGE) - Y_COLLISION_OFFSET);
var _local20:int = ((this.pos.x + LEFT_EDGE) + Y_COLLISION_OFFSET);
var _local21:int = ((this.pos.x + RIGHT_EDGE) - Y_COLLISION_OFFSET);
_local11 = Math.abs((this.velocity.y / COLLIDE_STEP_Y));
_local13 = (this.velocity.y % COLLIDE_STEP_Y);
_local14 = false;
_local12 = 0;
while (_local12 <= _local11) {
if (_local16){
_local15 = (-((_local12 * COLLIDE_STEP_Y)) + _local13);
} else {
_local15 = ((_local12 * COLLIDE_STEP_Y) + _local13);
};
if (_local16){
_local19 = ((this.pos.y + _local15) + TOP_EDGE);
_local7 = (_local17 / Level.TILE_WIDTH);
_local8 = (_local18 / Level.TILE_WIDTH);
_local9 = (_local19 / Level.TILE_HEIGHT);
if (((this.levelRef.statics[_local7][_local9]) || (this.levelRef.statics[_local8][_local9]))){
_local5 = (_local9 * Level.TILE_HEIGHT);
_local6 = (_local19 - _local5);
this.pos.y = (this.pos.y + (_local15 + (Level.TILE_HEIGHT - _local6)));
this.velocity.y = 0;
_local14 = true;
break;
};
} else {
_local22 = ((this.pos.y + _local15) + PLAYER_HEIGHT);
_local7 = (_local20 / Level.TILE_WIDTH);
_local8 = (_local21 / Level.TILE_WIDTH);
_local9 = (_local22 / Level.TILE_HEIGHT);
if (((this.levelRef.statics[_local7][_local9]) || (this.levelRef.statics[_local8][_local9]))){
_local5 = (_local9 * Level.TILE_HEIGHT);
_local6 = (_local22 - _local5);
this.pos.y = (this.pos.y + (_local15 - _local6));
this.velocity.y = 0;
_local14 = true;
break;
};
};
_local12++;
};
if (!_local14){
this.pos.y = (this.pos.y + this.velocity.y);
};
this.pos.x = Math.round(this.pos.x);
this.pos.y = Math.round(this.pos.y);
_local7 = ((this.pos.x + LEFT_EDGE) / Level.TILE_WIDTH);
_local9 = ((this.pos.y + PLAYER_HEIGHT) / Level.TILE_HEIGHT);
_local8 = ((this.pos.x + RIGHT_EDGE) / Level.TILE_WIDTH);
_local10 = _local9;
this.isGrounded = ((this.levelRef.statics[_local7][_local9]) || (this.levelRef.statics[_local8][_local10]));
if (this.isGrounded){
this.isHovering = false;
this.hoverReady = false;
if (!this.jumpAction){
this.jumpLatch = false;
};
this.sickChannel.stop();
this.sickChannel.removeEventListener(Event.SOUND_COMPLETE, onSickLoopComplete);
};
}
}
}//package customclasses
Section 77
//PukeBar (customclasses.PukeBar)
package customclasses {
import flash.display.*;
public class PukeBar extends MovieClip {
public var BarClip:MovieClip;
private var max:Number;// = 0
private static const MIN_POS:int = -176;
private static const MAX_POS:int = 1;
public function set maxLevel(_arg1:int):void{
this.max = _arg1;
}
public function set level(_arg1:Number):void{
var _local2:Number = (_arg1 / max);
this.BarClip.Bar.x = Math.round(((MIN_POS - MAX_POS) * (1 - _local2)));
}
}
}//package customclasses
Section 78
//PukeEvent (customclasses.PukeEvent)
package customclasses {
import flash.events.*;
public class PukeEvent extends Event {
public var x:int;
public var y:int;
public static const SPAWN:String = "Spawn";
public function PukeEvent(_arg1:String, _arg2:int=0, _arg3:int=0){
super(_arg1);
this.x = _arg2;
this.y = _arg3;
}
override public function clone():Event{
return (new PukeEvent(this.type, this.x, this.y));
}
override public function toString():String{
return (formatToString("PukeEvent", "type", "x", "y", "bubbles", "cancelable", "eventPhase"));
}
}
}//package customclasses
Section 79
//PukeMan (customclasses.PukeMan)
package customclasses {
import flash.display.*;
import flash.geom.*;
public class PukeMan {
public var overlay:BitmapData;
private var activeList:Array;
private var levelRef:Level;
private var colourList:Array;
private var rect:Rectangle;
private static const FALL_SPEED:Number = 8;
private static const DRIP_SPEED:Number = 1;
private static const DARKEN_FACTOR:Number = 0.8;
private static const COLLISION_OFFSET:int = 5;
private static const TILE_EDGE_DIST:int = 3;
private static const WIDTH:int = 2;
private static const HEIGHT:int = 2;
public function PukeMan(_arg1:Level){
this.levelRef = _arg1;
this.activeList = new Array();
this.colourList = new Array();
this.rect = new Rectangle();
this.rect.width = WIDTH;
this.rect.height = HEIGHT;
this.overlay = new BitmapData(Game.CANVAS_WIDTH, Game.CANVAS_HEIGHT, true, 0);
}
public function reset():void{
this.activeList.splice(0);
this.overlay.fillRect(new Rectangle(0, 0, this.overlay.width, this.overlay.height), 0);
}
public function update(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:PukeParticle;
var _local11:Number;
var _local10:int;
while (_local10 < this.activeList.length) {
_local9 = this.activeList[_local10];
if (((((((_local9.y + _arg2) > Game.CANVAS_HEIGHT)) || (((_local9.x + _arg1) < 0)))) || (((_local9.x + _arg1) > Game.CANVAS_WIDTH)))){
this.activeList.splice(_local10, 1);
_local10--;
} else {
switch (_local9.type){
case PukeParticle.TYPE_FALLING:
_local9.y = (_local9.y + FALL_SPEED);
_local7 = (_local9.x / Level.TILE_WIDTH);
_local8 = ((_local9.y + COLLISION_OFFSET) / Level.TILE_HEIGHT);
if (this.levelRef.statics[_local7][_local8]){
_local11 = Math.random();
if (_local11 > 0.6){
_local9.type = PukeParticle.TYPE_FLOWING;
_local9.vx = ((Math.random() * 4) - 2);
} else {
if (_local11 > 0.1){
_local9.type = PukeParticle.TYPE_DRIPPING;
} else {
_local9.type = PukeParticle.TYPE_SPLASHING;
_local9.vx = ((Math.random() * 8) - 4);
_local9.vy = -((1 + (Math.random() * 4)));
};
};
} else {
if ((((this.levelRef.collectables[_local7][_local8] == "SpikeTile")) || ((this.levelRef.collectables[_local7][_local8] == "SpringTile")))){
if (Math.random() > 0.6){
_local9.type = PukeParticle.TYPE_SPLASHING;
_local9.vx = ((Math.random() * 8) - 4);
_local9.vy = -((1 + (Math.random() * 4)));
} else {
this.activeList.splice(_local10, 1);
_local10--;
break;
};
};
};
break;
case PukeParticle.TYPE_DRIPPING:
_local9.y = (_local9.y + DRIP_SPEED);
this.rect.x = (_local9.x + _arg1);
this.rect.y = (_local9.y + _arg2);
_local3 = (_local9.colour + 4278190080);
_local7 = (_local9.x / Level.TILE_WIDTH);
_local8 = (_local9.y / Level.TILE_HEIGHT);
if (this.levelRef.statics[_local7][_local8]){
if (!(this.overlay.getPixel32(rect.x, rect.y) & 4278190080)){
if ((_local9.y - (_local8 * Level.TILE_HEIGHT)) > TILE_EDGE_DIST){
_local4 = int((((_local3 & 0xFF0000) >> 16) * DARKEN_FACTOR));
_local5 = int((((_local3 & 0xFF00) >> 8) * DARKEN_FACTOR));
_local6 = int(((_local3 & 0xFF) * DARKEN_FACTOR));
_local3 = ((((_local4 << 16) + (_local5 << 8)) + _local6) + 4278190080);
};
this.overlay.fillRect(this.rect, _local3);
this.activeList.splice(_local10, 1);
_local10--;
};
} else {
_local9.type = PukeParticle.TYPE_FALLING;
};
break;
case PukeParticle.TYPE_FLOWING:
_local9.x = (_local9.x + _local9.vx);
_local9.vx = (_local9.vx * 0.95);
if (Math.abs(_local9.vx) < 0.5){
_local9.vx = 0;
if (Math.random() > 0.7){
_local9.type = PukeParticle.TYPE_DRIPPING;
} else {
if ((_local9.y - (_local8 * Level.TILE_HEIGHT)) > TILE_EDGE_DIST){
_local4 = int((((_local3 & 0xFF0000) >> 16) * DARKEN_FACTOR));
_local5 = int((((_local3 & 0xFF00) >> 8) * DARKEN_FACTOR));
_local6 = int(((_local3 & 0xFF) * DARKEN_FACTOR));
_local3 = ((((_local4 << 16) + (_local5 << 8)) + _local6) + 4278190080);
};
this.rect.x = (_local9.x + _arg1);
this.rect.y = (_local9.y + _arg2);
_local3 = (_local9.colour + 4278190080);
this.overlay.fillRect(this.rect, _local3);
this.activeList.splice(_local10, 1);
_local10--;
};
} else {
_local7 = (_local9.x / Level.TILE_WIDTH);
_local8 = (_local9.y / Level.TILE_HEIGHT);
if (!this.levelRef.statics[_local7][_local8]){
_local9.type = PukeParticle.TYPE_FALLING;
} else {
if (((((_local8 - 1) >= 0)) && (this.levelRef.statics[_local7][(_local8 - 1)]))){
_local9.type = PukeParticle.TYPE_DRIPPING;
};
};
};
break;
case PukeParticle.TYPE_SPLASHING:
_local9.x = (_local9.x + _local9.vx);
_local9.y = (_local9.y + _local9.vy);
_local9.vx = (_local9.vx * 0.7);
if (Math.abs(_local9.vx) < 1){
_local9.vx = 0;
};
_local9.vy = (_local9.vy + 1);
if (_local9.vy > FALL_SPEED){
_local9.type = PukeParticle.TYPE_FALLING;
};
break;
};
};
_local10++;
};
}
public function render(_arg1:BitmapData, _arg2:int, _arg3:int):void{
var _local5:int;
var _local6:PukeParticle;
var _local4:int = this.activeList.length;
var _local7:int;
while (_local7 < _local4) {
_local6 = this.activeList[_local7];
this.rect.x = (_local6.x + _arg2);
this.rect.y = (_local6.y + _arg3);
_local5 = (_local6.colour + 4278190080);
_arg1.fillRect(this.rect, _local5);
_local7++;
};
}
public function spawn(_arg1:int, _arg2:int, _arg3:int=1):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int = _arg2;
var _local10:int = (5 + (Math.random() * 8));
_local5 = 0;
while (_local5 < _local10) {
_local4 = (2 + Math.round((Math.random() * 3)));
_local8 = (_arg1 - _local4);
_local9 = (_local9 + 2);
_local6 = 0;
while (_local6 < _local4) {
_local7 = 0;
while (_local7 < _arg3) {
this.activeList.push(new PukeParticle(_local8, _local9, this.getColour()));
_local7++;
};
_local8 = (_local8 + 2);
_local6++;
};
_local5++;
};
}
public function set size(_arg1:int):void{
this.rect.width = _arg1;
this.rect.height = _arg1;
}
public function addColour(_arg1:int, _arg2:int):void{
this.colourList.push(new Array(_arg1, _arg2));
}
public function resetColours():void{
this.colourList.splice(0);
}
private function getColour():int{
var _local1 = 0xFFFFFF;
var _local2:int = this.colourList.length;
var _local3:int = Math.round((Math.random() * 10));
var _local4:int;
while (_local4 < _local2) {
if (_local3 >= this.colourList[_local4][1]){
_local1 = this.colourList[_local4][0];
break;
};
_local4++;
};
return (_local1);
}
}
}//package customclasses
Section 80
//PukeParticle (customclasses.PukeParticle)
package customclasses {
import flash.geom.*;
public class PukeParticle extends Point {
public var colour:uint;
public var type:String;
public var vx:Number;
public var vy:Number;
public static const TYPE_FALLING:String = "Type falling";
public static const TYPE_DRIPPING:String = "Type dripping";
public static const TYPE_SPLASHING:String = "Type splashing";
public static const TYPE_FLOWING:String = "Type flowing";
public function PukeParticle(_arg1:Number=0, _arg2:Number=0, _arg3:int=1){
super(_arg1, _arg2);
this.colour = _arg3;
this.type = TYPE_FALLING;
this.vx = 0;
this.vy = 0;
}
}
}//package customclasses
Section 81
//QuitPopUp (customclasses.QuitPopUp)
package customclasses {
import flash.events.*;
import flash.display.*;
import gmd.framework.*;
public class QuitPopUp extends Screen {
public var YesBtn:MovieClip;
public var NoBtn:MovieClip;
public function QuitPopUp(){
this.YesBtn.addEventListener(MouseEvent.CLICK, onYesBtnClicked);
this.NoBtn.addEventListener(MouseEvent.CLICK, onNoBtnClicked);
}
private function onYesBtnClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "QuitYes"));
}
private function onNoBtnClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "QuitNo"));
}
}
}//package customclasses
Section 82
//SponsorScreen (customclasses.SponsorScreen)
package customclasses {
import flash.events.*;
import flash.display.*;
import gmd.framework.*;
public class SponsorScreen extends Screen {
public var AnimHolder:MovieClip;
public function SponsorScreen(){
addFrameScript(222, frame223, 238, frame239);
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.addEventListener("Anim done", onAnimDone, false, 0, true);
this.addEventListener("Anim reveal", onAnimReveal, false, 0, true);
}
private function onAnimDone(_arg1:Event):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.SCREEN_OUT, "SponsorAnim"));
}
private function onAnimReveal(_arg1:Event):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.SCREEN_REVEAL, "SponsorAnim"));
}
function frame223(){
this.dispatchEvent(new Event("Anim reveal"));
}
function frame239(){
stop();
this.dispatchEvent(new Event("Anim done"));
}
}
}//package customclasses
Section 83
//StageHUD (customclasses.StageHUD)
package customclasses {
import flash.display.*;
import flash.text.*;
public class StageHUD extends MovieClip {
public var Value:TextField;
public function StageHUD(){
this.Value.text = "00";
}
public function setStage(_arg1:int):void{
if (_arg1 < 10){
this.Value.text = ("0" + String(_arg1));
} else {
this.Value.text = String(_arg1);
};
}
}
}//package customclasses
Section 84
//TileChangeEvent (customclasses.TileChangeEvent)
package customclasses {
import flash.events.*;
public class TileChangeEvent extends Event {
public var tileId:Number;
public static const TILE_CHANGE:String = "Tile change";
public function TileChangeEvent(_arg1:String, _arg2:int){
super(_arg1);
this.tileId = _arg2;
}
override public function clone():Event{
return (new TileChangeEvent(this.type, this.tileId));
}
override public function toString():String{
return (formatToString("TileChangeEvent", "type", "tileId", "bubbles", "cancelable", "eventPhase"));
}
}
}//package customclasses
Section 85
//TilePalette (customclasses.TilePalette)
package customclasses {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class TilePalette extends Sprite {
private var tileCount:int;
private static const TILE_SIZE:int = 24;
public function TilePalette(){
this.init();
}
public function init():void{
var _local6:DisplayObject;
while (this.numChildren > 0) {
_local6 = this.getChildAt(0);
_local6.removeEventListener(MouseEvent.CLICK, onMouseClicked);
this.removeChild(_local6);
};
var _local1:Matrix = new Matrix();
_local1.scale(2, 2);
var _local2:BitmapData = new DeleteTile(0, 0);
var _local3:BitmapData = new BitmapData(TILE_SIZE, TILE_SIZE);
_local3.draw(_local2, _local1);
var _local4:Bitmap = new Bitmap(_local3);
var _local5:Sprite = new Sprite();
_local5.name = "0";
_local5.addEventListener(MouseEvent.CLICK, onMouseClicked, false, 0, true);
_local5.addChild(_local4);
this.addChild(_local5);
this.tileCount = 1;
}
public function addTileType(_arg1:int, _arg2:BitmapData):void{
var _local3:Bitmap;
var _local5:BitmapData;
if (_arg2.width > TILE_SIZE){
_local5 = new BitmapData(TILE_SIZE, TILE_SIZE, true);
_local5.copyPixels(_arg2, new Rectangle(0, 0, TILE_SIZE, TILE_SIZE), new Point(0, 0));
_local3 = new Bitmap(_local5);
} else {
_local3 = new Bitmap(_arg2);
};
var _local4:Sprite = new Sprite();
_local4.name = String(_arg1);
_local4.x = (this.tileCount * TILE_SIZE);
_local4.addEventListener(MouseEvent.CLICK, onMouseClicked, false, 0, true);
_local4.addChild(_local3);
this.addChild(_local4);
this.tileCount++;
}
private function onMouseClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new TileChangeEvent(TileChangeEvent.TILE_CHANGE, int(_arg1.currentTarget.name)));
}
}
}//package customclasses
Section 86
//TitleScreen (customclasses.TitleScreen)
package customclasses {
import flash.events.*;
import flash.display.*;
import gmd.framework.*;
import flash.net.*;
public class TitleScreen extends Screen {
public var PlayButton:SimpleButton;
public var TitleMuteBtn:MuteButton;
public var VersionStamp:MovieClip;
public var MegaPukeOption:MovieClip;
public var WaterfallPukeOption:MovieClip;
public var RainbowPukeOption:MovieClip;
public var MoreGamesButton:SimpleButton;
public var ArmorGamesButton:SimpleButton;
public var TwitterButton:SimpleButton;
public var FacebookButton:SimpleButton;
public var MonsterAndMonsterButton:SimpleButton;
public var LogoAnim:MovieClip;
private var isMegaPukeEnabled:Boolean;
private var isWaterfallPukeEnabled:Boolean;
private var isRainbowPukeEnabled:Boolean;
private var codeEntered:String;// = ""
private static const CHEAT:String = "abrakebabra";
public function TitleScreen(){
this.PlayButton.addEventListener(MouseEvent.CLICK, onPlayClicked, false, 0, true);
this.TitleMuteBtn.addEventListener(MouseEvent.CLICK, onMuteClicked, false, 0, true);
this.MegaPukeOption.addEventListener(MouseEvent.CLICK, onToggleMegaPuke, false, 0, true);
this.WaterfallPukeOption.addEventListener(MouseEvent.CLICK, onToggleWaterfallPuke, false, 0, true);
this.RainbowPukeOption.addEventListener(MouseEvent.CLICK, onToggleRainbowPuke, false, 0, true);
this.MoreGamesButton.addEventListener(MouseEvent.CLICK, onMoreGamesClicked, false, 0, true);
this.ArmorGamesButton.addEventListener(MouseEvent.CLICK, onArmorGamesClicked, false, 0, true);
this.TwitterButton.addEventListener(MouseEvent.CLICK, onTwitterClicked, false, 0, true);
this.FacebookButton.addEventListener(MouseEvent.CLICK, onFacebookClicked, false, 0, true);
this.MonsterAndMonsterButton.addEventListener(MouseEvent.CLICK, onMonsterAndMonsterClicked, false, 0, true);
this.LogoAnim.addEventListener("AnimDone", onAnimDone, false, 0, true);
this.PlayButton.visible = false;
this.MoreGamesButton.visible = false;
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
this.TitleMuteBtn.mute = BoozeUp(this.parent).mute;
if (BoozeUp(this.parent).megaPukeSetting){
this.MegaPukeOption.gotoAndStop("On");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "MegaPuke", "On"));
} else {
this.MegaPukeOption.gotoAndStop("Off");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "MegaPuke", "Off"));
};
this.isMegaPukeEnabled = true;
if (BoozeUp(this.parent).waterfallPukeSetting){
this.WaterfallPukeOption.gotoAndStop("On");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "WaterfallPuke", "On"));
} else {
this.WaterfallPukeOption.gotoAndStop("Off");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "WaterfallPuke", "Off"));
};
if (BoozeUp(this.parent).rainbowPukeSetting){
this.RainbowPukeOption.gotoAndStop("On");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "RainbowPuke", "On"));
} else {
this.RainbowPukeOption.gotoAndStop("Off");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "RainbowPuke", "Off"));
};
if (!BoozeUp(this.parent).isGameComplete){
this.MegaPukeOption.visible = false;
this.WaterfallPukeOption.visible = false;
this.RainbowPukeOption.visible = false;
};
if (BoozeUp(this.parent).silverCount < BoozeUp.MAX_MEDALS){
this.WaterfallPukeOption.gotoAndStop("Locked");
this.isWaterfallPukeEnabled = false;
};
if (BoozeUp(this.parent).goldCount < BoozeUp.MAX_MEDALS){
this.RainbowPukeOption.gotoAndStop("Locked");
this.isRainbowPukeEnabled = false;
};
if (BoozeUp(this.parent).isCheatActive){
this.activateCheat();
};
this.VersionStamp.Value.text = "Flash 1.0";
}
private function activateCheat():void{
this.MegaPukeOption.visible = true;
this.WaterfallPukeOption.visible = true;
this.RainbowPukeOption.visible = true;
this.isWaterfallPukeEnabled = true;
this.isRainbowPukeEnabled = true;
if (BoozeUp(this.parent).waterfallPukeSetting){
this.WaterfallPukeOption.gotoAndStop("On");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "WaterfallPuke", "On"));
} else {
this.WaterfallPukeOption.gotoAndStop("Off");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "WaterfallPuke", "Off"));
};
if (BoozeUp(this.parent).rainbowPukeSetting){
this.RainbowPukeOption.gotoAndStop("On");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "RainbowPuke", "On"));
} else {
this.RainbowPukeOption.gotoAndStop("Off");
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "RainbowPuke", "Off"));
};
}
private function onPlayClicked(_arg1:MouseEvent):void{
this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "Play"));
}
private function onMuteClicked(_arg1:MouseEvent):void{
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "Mute"));
}
private function onToggleMegaPuke(_arg1:MouseEvent):void{
if (this.isMegaPukeEnabled){
if (this.MegaPukeOption.currentLabel == "On"){
this.MegaPukeOption.gotoAndStop("Off");
BoozeUp(this.parent).megaPukeSetting = false;
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "MegaPuke", "Off"));
} else {
this.MegaPukeOption.gotoAndStop("On");
BoozeUp(this.parent).megaPukeSetting = true;
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "MegaPuke", "On"));
};
};
}
private function onToggleWaterfallPuke(_arg1:MouseEvent):void{
if (this.isWaterfallPukeEnabled){
if (this.WaterfallPukeOption.currentLabel == "On"){
this.WaterfallPukeOption.gotoAndStop("Off");
BoozeUp(this.parent).waterfallPukeSetting = false;
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "WaterfallPuke", "Off"));
} else {
this.WaterfallPukeOption.gotoAndStop("On");
BoozeUp(this.parent).waterfallPukeSetting = true;
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "WaterfallPuke", "On"));
};
};
}
private function onToggleRainbowPuke(_arg1:MouseEvent):void{
if (this.isRainbowPukeEnabled){
if (this.RainbowPukeOption.currentLabel == "On"){
this.RainbowPukeOption.gotoAndStop("Off");
BoozeUp(this.parent).rainbowPukeSetting = false;
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "RainbowPuke", "Off"));
} else {
this.RainbowPukeOption.gotoAndStop("On");
BoozeUp(this.parent).rainbowPukeSetting = true;
this.dispatchEvent(new ScreenEvent(ScreenEvent.BUTTON_CLICKED, "RainbowPuke", "On"));
};
};
}
private function onMoreGamesClicked(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://armorgames.com");
navigateToURL(_local2);
}
private function onArmorGamesClicked(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://armorgames.com");
navigateToURL(_local2);
}
private function onTwitterClicked(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://twitter.com/armorgames");
navigateToURL(_local2);
}
private function onFacebookClicked(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://facebook.com/ArmorGames");
navigateToURL(_local2);
}
private function onMonsterAndMonsterClicked(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.monsterandmonster.com");
navigateToURL(_local2);
}
private function onKeyPressed(_arg1:KeyboardEvent):void{
this.codeEntered = (this.codeEntered + String.fromCharCode(_arg1.charCode));
if (this.codeEntered.length > CHEAT.length){
this.codeEntered = this.codeEntered.slice(1);
};
if (this.codeEntered.toLowerCase() == CHEAT){
BoozeUp(this.parent).isCheatActive = true;
this.activateCheat();
};
}
private function onAnimDone(_arg1:Event):void{
this.PlayButton.visible = true;
this.MoreGamesButton.visible = true;
}
}
}//package customclasses
Section 87
//ApiHolder (gmd.framework.ApiHolder)
package gmd.framework {
import flash.display.*;
public dynamic class ApiHolder extends MovieClip {
}
}//package gmd.framework
Section 88
//AppEvent (gmd.framework.AppEvent)
package gmd.framework {
import flash.events.*;
public class AppEvent extends Event {
public var percentLoaded:Number;
public static const LOAD_BEGIN:String = "Load begin";
public static const LOAD_PROGRESS:String = "Load progress";
public static const LOAD_COMPLETE:String = "Load complete";
public static const APP_READY:String = "App ready";
public static const GAME_READY:String = "Game ready";
public static const LEVEL_COMPLETE:String = "Level complete";
public static const GAME_FAIL:String = "Game fail";
public static const GAME_SUCCESS:String = "Game success";
public function AppEvent(_arg1:String, _arg2:Number=0){
super(_arg1);
this.percentLoaded = _arg2;
}
override public function clone():Event{
return (new AppEvent(this.type, this.percentLoaded));
}
override public function toString():String{
return (formatToString("AppEvent", "type", "percentLoaded", "bubbles", "cancelable", "eventPhase"));
}
}
}//package gmd.framework
Section 89
//Application (gmd.framework.Application)
package gmd.framework {
import flash.media.*;
import flash.events.*;
import flash.display.*;
import mochi.as3.*;
import flash.utils.*;
import mindjolt.*;
import flash.net.*;
import flash.system.*;
public class Application extends MovieClip {
private var isMute:Boolean;
protected var settings:SaveSettings;
private var currentMenuScreen:Screen;// = null
private var currentPopUp:Screen;// = null
public var nativeWidth:int;
public var nativeHeight:int;
public var scaleFactor:Number;
private var use3rdPartyApi:String;
protected var apiGameId:String;
private var apiHolder:MovieClip;
private var res:String;
protected var apiServicesReady:Boolean;
private var kongregate;
private var isKongregate:Boolean;
private var isKongregateReady:Boolean;
public static const API_MOCHI:String = "Mochi API";
public static const API_MINDJOLT:String = "MindJolt API";
public function Application(_arg1:int, _arg2:int, _arg3:Boolean=false, _arg4:String="", _arg5:String=""):void{
this.nativeWidth = _arg1;
this.nativeHeight = _arg2;
this.scaleFactor = 1;
this.use3rdPartyApi = _arg4;
this.apiGameId = _arg5;
this.res = ((String(_arg1) + "x") + String(_arg2));
this.isKongregate = _arg3;
this.isKongregateReady = false;
this.settings = new SaveSettings("Settings");
this.mute = this.settings.mute;
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.init();
}
private function onStageChanged(_arg1:Event):void{
var _local2:Number = (this.stage.stageWidth / this.nativeWidth);
var _local3:Number = (this.stage.stageHeight / this.nativeHeight);
this.scaleFactor = ((_local2 < _local3)) ? _local2 : _local3;
this.scaleX = this.scaleFactor;
this.scaleY = this.scaleFactor;
this.x = ((this.stage.stageWidth / 2) - ((this.nativeWidth * this.scaleFactor) / 2));
this.y = ((this.stage.stageHeight / 2) - ((this.nativeHeight * this.scaleFactor) / 2));
this.resize();
}
protected function resize():void{
trace("Derrived classes should override this function and handle the resizing of their content");
}
private function init():void{
var _local1:Object;
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:Loader;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
this.stage.quality = StageQuality.HIGH;
this.stage.showDefaultContextMenu = false;
if (this.use3rdPartyApi != ""){
this.apiHolder = new ApiHolder();
this.addChild(this.apiHolder);
switch (this.use3rdPartyApi){
case API_MOCHI:
this.apiServicesReady = true;
MochiServices.connect(this.apiGameId, this.apiHolder, onMochiConnectError);
_local1 = {id:this.apiGameId, res:this.res, clip:this.apiHolder, ad_finished:onMochiAdFinished, ad_failed:onMochiAdFailed, ad_skipped:onMochiAdFailed, ad_progress:onMochiAdProgress};
MochiAd.showPreGameAd(_local1);
break;
case API_MINDJOLT:
this.apiServicesReady = false;
MindJoltAPI.service.connect(this.apiGameId, this.apiHolder, onMindJoltConnect);
MindJoltAPI.ad.showPreGameAd({clip:this.apiHolder, ad_finished:onMindJoltAdFinished});
break;
};
} else {
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
};
if (this.isKongregate){
_local2 = LoaderInfo(this.root.loaderInfo).parameters;
_local3 = (_local2.kongregate) ? _local2.kongregate.api_path : "http://www.kongregate.com/flash/API_AS3_Local.swf";
Security.allowDomain(_local3);
_local4 = new URLRequest(_local3);
_local5 = new Loader();
_local5.contentLoaderInfo.addEventListener(Event.COMPLETE, onKongregateAPI);
_local5.load(_local4);
this.addChild(_local5);
};
if (this.settings.firstRun){
this.onFirstRun();
};
this.dispatchEvent(new AppEvent(AppEvent.LOAD_BEGIN));
}
private function onMochiAdProgress(_arg1:Number):void{
this.dispatchEvent(new AppEvent(AppEvent.LOAD_PROGRESS, _arg1));
}
private function onMochiAdFinished():void{
this.dispatchEvent(new AppEvent(AppEvent.LOAD_COMPLETE));
}
private function onMochiAdFailed():void{
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onMochiConnectError(_arg1:String):void{
this.apiServicesReady = false;
}
private function onMindJoltConnect(_arg1:Boolean):void{
if (_arg1){
trace("MindJolt connected");
} else {
trace("MindJolt connection failed");
};
this.apiServicesReady = _arg1;
}
private function onMindJoltAdFinished():void{
this.dispatchEvent(new AppEvent(AppEvent.LOAD_COMPLETE));
}
private function onKongregateAPI(_arg1:Event):void{
this.kongregate = _arg1.target.content;
this.kongregate.services.connect();
this.isKongregateReady = true;
}
private function onEnterFrame(_arg1:Event):void{
var _local2:Number = 0;
if (this.stage.loaderInfo.bytesTotal > 0){
_local2 = ((this.stage.loaderInfo.bytesLoaded / this.stage.loaderInfo.bytesTotal) * 100);
this.dispatchEvent(new AppEvent(AppEvent.LOAD_PROGRESS, _local2));
if (this.loaderInfo.bytesLoaded >= this.loaderInfo.bytesTotal){
this.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
this.dispatchEvent(new AppEvent(AppEvent.LOAD_COMPLETE));
};
} else {
this.dispatchEvent(new AppEvent(AppEvent.LOAD_PROGRESS, 0));
};
}
public function set mute(_arg1:Boolean):void{
var _local2:SoundTransform;
var _local3:SoundTransform;
if (_arg1){
_local2 = new SoundTransform();
_local2.volume = 0;
SoundMixer.soundTransform = _local2;
} else {
_local3 = new SoundTransform();
_local3.volume = 1;
SoundMixer.soundTransform = _local3;
};
this.isMute = _arg1;
this.settings.mute = this.isMute;
}
public function get mute():Boolean{
return (this.isMute);
}
public function gotoScreen(_arg1:String):void{
this.unloadMenu();
var _local2:Class = (getDefinitionByName(_arg1) as Class);
this.currentMenuScreen = (new (_local2) as Screen);
this.currentMenuScreen.addEventListener(ScreenEvent.BUTTON_CLICKED, onButtonClicked);
this.currentMenuScreen.addEventListener(ScreenEvent.BUTTON_OVER, onButtonOver);
this.currentMenuScreen.addEventListener(ScreenEvent.SCREEN_OUT, onScreenOut);
this.currentMenuScreen.addEventListener(ScreenEvent.SCREEN_REVEAL, onScreenReveal);
this.addChild(this.currentMenuScreen);
}
public function get screen():Screen{
return (this.currentMenuScreen);
}
public function get popUp():Screen{
return (this.currentPopUp);
}
public function showPopUp(_arg1:String):void{
this.clearPopUps();
var _local2:Class = (getDefinitionByName(_arg1) as Class);
this.currentPopUp = (new (_local2) as Screen);
this.currentPopUp.addEventListener(ScreenEvent.BUTTON_CLICKED, onButtonClicked);
this.currentPopUp.addEventListener(ScreenEvent.BUTTON_OVER, onButtonOver);
this.currentPopUp.addEventListener(ScreenEvent.SCREEN_OUT, onScreenOut);
this.currentPopUp.addEventListener(ScreenEvent.SCREEN_REVEAL, onScreenReveal);
this.addChild(this.currentPopUp);
}
public function apiServiceSubmitScore(_arg1:String, _arg2:Number):void{
switch (this.use3rdPartyApi){
case API_MOCHI:
trace("Default Mochi leaderboards not supported yet!");
break;
case API_MINDJOLT:
MindJoltAPI.service.submitScore(_arg2, null, jumpToTitle);
this.setChildIndex(this.apiHolder, (this.numChildren - 1));
break;
};
}
public function apiServicesStartPlay():void{
if ((((this.use3rdPartyApi == API_MOCHI)) && (this.apiServicesReady))){
MochiEvents.startPlay();
};
}
public function apiServicesEndPlay():void{
if ((((this.use3rdPartyApi == API_MOCHI)) && (this.apiServicesReady))){
MochiEvents.endPlay();
};
}
public function apiServicesCustomEvent(_arg1:String, _arg2):void{
if ((((this.use3rdPartyApi == API_MOCHI)) && (this.apiServicesReady))){
MochiEvents.trackEvent(_arg1, _arg2);
};
}
public function kongregateServicesUpdateStatistic(_arg1:String, _arg2:int):void{
if (this.isKongregateReady){
this.kongregate.stats.submit(_arg1, _arg2);
} else {
trace("Kongregate services not available");
};
}
public function jumpToTitle():void{
trace("Derrived classes should override this function and perform necessary actions to get to the title screen");
}
protected function onFirstRun():void{
}
private function onButtonClicked(_arg1:ScreenEvent):void{
this.dispatchEvent(new ScreenEvent(_arg1.type, _arg1.name, _arg1.param));
}
private function onButtonOver(_arg1:ScreenEvent):void{
this.dispatchEvent(new ScreenEvent(_arg1.type, _arg1.name, _arg1.param));
}
private function onScreenOut(_arg1:ScreenEvent):void{
this.dispatchEvent(new ScreenEvent(_arg1.type, _arg1.name, _arg1.param));
}
private function onScreenReveal(_arg1:ScreenEvent):void{
this.dispatchEvent(new ScreenEvent(_arg1.type, _arg1.name, _arg1.param));
}
public function unloadMenu():void{
this.clearPopUps();
if (this.currentMenuScreen){
this.currentMenuScreen.removeEventListener(ScreenEvent.BUTTON_CLICKED, onButtonClicked);
this.currentMenuScreen.removeEventListener(ScreenEvent.SCREEN_OUT, onScreenOut);
this.currentMenuScreen.removeEventListener(ScreenEvent.SCREEN_REVEAL, onScreenReveal);
this.removeChild(this.currentMenuScreen);
this.currentMenuScreen = null;
};
}
public function clearPopUps():void{
if (this.currentPopUp){
this.currentPopUp.removeEventListener(ScreenEvent.BUTTON_CLICKED, onButtonClicked);
this.currentPopUp.removeEventListener(ScreenEvent.SCREEN_OUT, onScreenOut);
this.currentPopUp.removeEventListener(ScreenEvent.SCREEN_REVEAL, onScreenReveal);
this.removeChild(this.currentPopUp);
this.currentPopUp = null;
};
}
}
}//package gmd.framework
Section 90
//GameTemplate (gmd.framework.GameTemplate)
package gmd.framework {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class GameTemplate extends MovieClip {
private var frameTime:int;// = 33
protected var isRunning:Boolean;// = false
private var timeStamp:int;// = 0
private var accumulatedTime:int;// = 0
private var gameTimer:int;// = 0
public function GameTemplate(){
this.timeStamp = getTimer();
this.addEventListener(Event.ENTER_FRAME, update, false, 0, true);
}
protected function gameOver():void{
}
public function cleanUp():void{
this.removeEventListener(Event.ENTER_FRAME, update);
}
public function getResult():String{
trace("Game modules should override this function to return a result to the app");
return ("");
}
public function set frameDelta(_arg1:int):void{
this.frameTime = _arg1;
}
public function set fps(_arg1:int):void{
this.frameTime = int((1000 / _arg1));
}
public function pause(_arg1:Boolean):void{
if (_arg1){
this.isRunning = false;
} else {
this.isRunning = true;
this.focusRect = false;
this.stage.focus = this;
};
}
private function update(_arg1:Event):void{
var _local2:int = getTimer();
var _local3:int = (_local2 - this.timeStamp);
this.timeStamp = _local2;
if (this.isRunning){
accumulatedTime = (accumulatedTime + _local3);
while (accumulatedTime > this.frameTime) {
this.gameLoop();
this.accumulatedTime = (this.accumulatedTime - this.frameTime);
this.gameTimer = (this.gameTimer + this.frameTime);
};
};
}
protected function gameLoop():void{
trace("Derived classes should override the gameLoop function in GameTemplate.");
}
public function setGameTime(_arg1:int):void{
this.gameTimer = _arg1;
}
public function getGameTime():int{
return (this.gameTimer);
}
public function getGameTimeStr():String{
var _local3:String;
var _local4:String;
var _local1:int = (this.gameTimer / 60000);
var _local2:int = ((this.gameTimer - (_local1 * 60000)) / 1000);
if (_local1 < 10){
_local3 = ("0" + String(_local1));
} else {
_local3 = String(_local1);
};
if (_local2 < 10){
_local4 = ("0" + String(_local2));
} else {
_local4 = String(_local2);
};
return (((_local3 + ":") + _local4));
}
}
}//package gmd.framework
Section 91
//ILoadingProgress (gmd.framework.ILoadingProgress)
package gmd.framework {
public interface ILoadingProgress {
function set percentLoaded(_arg1:Number):void;
}
}//package gmd.framework
Section 92
//SaveSettings (gmd.framework.SaveSettings)
package gmd.framework {
import flash.net.*;
public class SaveSettings {
private var settingsName:String;
private var settingMute:Boolean;
private var settingFirstRun:Boolean;
private var customSettings:Array;
public function SaveSettings(_arg1:String){
this.settingsName = _arg1;
var _local2:SharedObject = SharedObject.getLocal(this.settingsName);
if (_local2.data.settingMute != undefined){
this.settingMute = _local2.data.settingMute;
this.settingFirstRun = false;
} else {
this.mute = false;
this.settingFirstRun = true;
};
if (_local2.data.customSettings != undefined){
this.customSettings = _local2.data.customSettings;
} else {
this.customSettings = new Array();
};
}
public function get mute():Boolean{
return (this.settingMute);
}
public function set mute(_arg1:Boolean):void{
this.settingMute = _arg1;
var _local2:SharedObject = SharedObject.getLocal(this.settingsName);
_local2.data.settingMute = this.settingMute;
_local2.flush();
}
public function get firstRun():Boolean{
return (this.settingFirstRun);
}
public function getValue(_arg1:String):String{
return (this.customSettings[_arg1]);
}
public function setValue(_arg1:String, _arg2:String):void{
this.customSettings[_arg1] = _arg2;
var _local3:SharedObject = SharedObject.getLocal(this.settingsName);
_local3.data.customSettings = this.customSettings;
_local3.flush();
}
public function storeArray(_arg1:String, _arg2:Array):void{
this.customSettings[_arg1] = _arg2;
var _local3:SharedObject = SharedObject.getLocal(this.settingsName);
_local3.data.customSettings = this.customSettings;
_local3.flush();
}
public function retrieveArray(_arg1:String):Array{
return (this.customSettings[_arg1]);
}
}
}//package gmd.framework
Section 93
//Screen (gmd.framework.Screen)
package gmd.framework {
import flash.display.*;
public class Screen extends MovieClip {
}
}//package gmd.framework
Section 94
//ScreenEvent (gmd.framework.ScreenEvent)
package gmd.framework {
import flash.events.*;
public class ScreenEvent extends Event {
public var name:String;
public var param:String;
public static const BUTTON_READY:String = "Button ready";
public static const BUTTON_CLICKED:String = "Button clicked";
public static const BUTTON_OVER:String = "Button over";
public static const SCREEN_OUT:String = "Screen out";
public static const SCREEN_REVEAL:String = "Screen reveal";
public function ScreenEvent(_arg1:String, _arg2:String="", _arg3:String=""){
super(_arg1);
this.name = _arg2;
this.param = _arg3;
}
override public function clone():Event{
return (new ScreenEvent(this.type, this.name, this.param));
}
override public function toString():String{
return (formatToString("ScreenEvent", "type", "name", "param", "bubbles", "cancelable", "eventPhase"));
}
}
}//package gmd.framework
Section 95
//AnimEvent (gmd.utils.AnimEvent)
package gmd.utils {
import flash.events.*;
public class AnimEvent extends Event {
public var loopId:int;
public static const LOOP_COMPLETE:String = "Loop complete";
public function AnimEvent(_arg1:String, _arg2:Number=0){
super(_arg1);
this.loopId = _arg2;
}
override public function clone():Event{
return (new AnimEvent(this.type, this.loopId));
}
override public function toString():String{
return (formatToString("AppEvent", "type", "loopId", "bubbles", "cancelable", "eventPhase"));
}
}
}//package gmd.utils
Section 96
//AnimSprite (gmd.utils.AnimSprite)
package gmd.utils {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class AnimSprite extends EventDispatcher {
public var bitmapData:BitmapData;
public var rect:Rectangle;
public var cellWidth:int;
public var cellHeight:int;
private var pageWidth:int;
private var pageHeight:int;
private var gridLineWidth:int;
private var currFrame:int;
protected var currLoopId:int;
private var currAnimStep:int;
private var currLoop:Array;
private var loopList:Array;
public function AnimSprite(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int=0){
this.init(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
private function init(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int=0):void{
this.bitmapData = _arg1;
this.cellWidth = _arg2;
this.cellHeight = _arg3;
this.pageWidth = _arg4;
this.pageHeight = _arg5;
this.gridLineWidth = _arg6;
this.rect = new Rectangle(0, 0, this.cellWidth, this.cellHeight);
this.loopList = new Array();
this.reset();
}
public function get frame():int{
return (this.currFrame);
}
public function set frame(_arg1:int):void{
this.currFrame = _arg1;
this.setRect();
this.currAnimStep = 0;
this.currLoop = null;
this.currLoopId = -1;
}
public function get loop():int{
return (this.currLoopId);
}
public function reset():void{
this.currFrame = 0;
this.setRect();
this.currAnimStep = 0;
this.currLoop = null;
this.currLoopId = -1;
}
public function addLoop(_arg1:int, _arg2:Array, _arg3:Boolean=false):void{
if (_arg3){
_arg2.push(-1);
};
this.loopList[_arg1] = _arg2;
}
public function play(_arg1:int):void{
this.currLoop = this.loopList[_arg1];
this.currLoopId = _arg1;
this.currAnimStep = 0;
this.currFrame = this.currLoop[this.currAnimStep];
this.setRect();
}
public function stop():void{
this.currLoop = null;
this.currLoopId = -1;
}
public function update():void{
if (this.currLoop){
if (++this.currAnimStep >= this.currLoop.length){
this.currAnimStep = (this.currLoop.length - 1);
this.currFrame = this.currLoop[this.currAnimStep];
this.setRect();
this.currLoop = null;
this.dispatchEvent(new AnimEvent(AnimEvent.LOOP_COMPLETE, this.currLoopId));
return;
};
if (this.currLoop[this.currAnimStep] < 0){
this.currAnimStep = 0;
};
this.currFrame = this.currLoop[this.currAnimStep];
this.setRect();
};
}
private function setRect():void{
var _local1:int = (this.currFrame % this.pageWidth);
var _local2:int = Math.floor((this.currFrame / this.pageWidth));
this.rect.x = ((_local1 * this.cellWidth) + ((_local1 + 1) * this.gridLineWidth));
this.rect.y = ((_local2 * this.cellHeight) + ((_local2 + 1) * this.gridLineWidth));
}
}
}//package gmd.utils
Section 97
//MindJoltAPI (mindjolt.MindJoltAPI)
package mindjolt {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class MindJoltAPI {
public static var service:Object = {connect:load_service};
public static var ad:Object = {showPreGameAd:showPreGameAd};
private static var gameKey:String;
private static var clip:MovieClip;
private static var callback:Function;
private static var options:Object;
private static var version:String = "1.0.4";
public static function showPreGameAd(_arg1:Object=null):void{
if (clip == null){
trace("[MindJoltAPI] You must call MindJoltAPI.service.connect before MindJoltAPI.ad.showPreGameAd.");
};
if (_arg1 == null){
_arg1 = {};
};
if (service.showPreGameAd != undefined){
service.showPreGameAd(_arg1);
} else {
MindJoltAPI.options = _arg1;
if (_arg1["ad_started"] == null){
_arg1["clip"].stop();
};
};
}
private static function load_service_complete(_arg1:Event):void{
if (((!((_arg1.currentTarget.content == null))) && (!((_arg1.currentTarget.content.service == null))))){
service = _arg1.currentTarget.content.service;
trace("[MindJoltAPI] service successfully loaded");
service.connect(gameKey, clip, callback);
if (options != null){
service.showPreGameAd(options);
};
service.getLogger().info((("MindJoltAPI loader version [" + version) + "]"));
} else {
trace("[MindJoltAPI] failed to load");
};
}
private static function load_service(_arg1:String, _arg2:MovieClip, _arg3:Function=null):void{
var _local4:Object;
var _local5:Loader;
MindJoltAPI.gameKey = _arg1;
MindJoltAPI.clip = _arg2;
MindJoltAPI.callback = _arg3;
if (service.submitScore == null){
Security.allowDomain("static.mindjolt.com");
_local4 = LoaderInfo(_arg2.root.loaderInfo).parameters;
_local5 = new Loader();
_local5.contentLoaderInfo.addEventListener(Event.COMPLETE, load_service_complete);
_local5.load(new URLRequest(((_local4.mjPath) || ("http://static.mindjolt.com/api/as3/api_local_as3.swf"))));
_arg2.addChild(_local5);
};
}
}
}//package mindjolt
Section 98
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var mc = _arg1;
var f:Function = 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);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function showPreGameAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, 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{
}, progress_override:function (_arg1:Object):Number{
return (NaN);
}, bar_offset:0};
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;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
if (options.skip){
ad_timeout = 0;
};
delete options.ad_timeout;
var fadeout_time:Number = 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);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = (10 + options.bar_offset);
bar.y = (h - 20);
};
var bar_w:Number = ((w - bar.x) - 10);
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(bar_w, 0);
backing.lineTo(bar_w, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(bar_w, 0);
inside.lineTo(bar_w, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(bar_w, 0);
outline.lineTo(bar_w, 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 = (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;
var progress:Number = Math.min(1, options.progress_override(clip));
var f:Function = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (!isNaN(progress)){
complete = (progress == 1);
} else {
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
};
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 = 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);
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local12:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _local1:Object = this.parent.parent.root;
var _local2:Object = this.parent._mochiad_ctr;
var _local3:Number = (getTimer() - this.started);
var _local4:Boolean;
var _local5:Number = _local1.loaderInfo.bytesTotal;
var _local6:Number = _local1.loaderInfo.bytesLoaded;
var _local7:Number = Math.min(1, options.progress_override(_local1));
if (_local7 == 1){
complete = true;
};
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
var _local8:Number = ((100 * _local6) / _local5);
if (!isNaN(_local7)){
_local8 = (100 * _local7);
};
var _local9:Number = ((100 * _local3) / chk.ad_msec);
var _local10:Object = this._mochiad_bar._inside;
var _local11:Number = Math.min(100, Math.min(((_local8) || (0)), _local9));
_local11 = Math.max(this.last_pcnt, _local11);
this.last_pcnt = _local11;
_local10.scaleX = (_local11 * 0.01);
options.ad_progress(_local11);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local8});
if (_local8 >= 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local12 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local12 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local8 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (unloaded){
MochiAd.unload(_local1);
} else {
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
};
doOnEnterFrame(chk);
}
public static function showClickAwayAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, 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;
var ad_timeout:Number = 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();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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);
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
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 showInterLevelAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, 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;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = 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();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Number = (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 = 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 _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
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 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 _allowDomains(_arg1:String):String{
var _local2:String = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var clip:Object;
var mc:MovieClip;
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;
var DEFAULTS:Object = {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 (!(clip is DisplayObject)){
trace("Warning: Object passed as container clip not a descendant of the DisplayObject type");
return (null);
};
if (MovieClip(clip).stage == null){
trace("Warning: Container clip for ad is not attached to the stage");
return (null);
};
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."));
};
var depth:Number = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = 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;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
var lv:URLVariables = 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();
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
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.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
if (!options.skip){
loader.load(req);
};
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
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 _cleanup(_arg1:Object):void{
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);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local6:Array;
var _local3:Object = _arg2.getBounds(_arg2.root);
var _local4:Number = 0;
var _local5:Number = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.right - _local3.left);
_local5 = (_local3.top - _local3.bottom);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
var _local3:Object = {};
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 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 = _arg2.split(".");
var _local5:Number = 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 getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array = _arg2.split(".");
var _local4:Number = 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 runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array = _arg2.split(".");
var _local5:Number = 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 adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
}
}//package mochi.as3
Section 99
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_SHOW:String = "StoreShow";
public static const STORE_HIDE:String = "StoreHide";
public static const ITEM_OWNED:String = "ItemOwned";
public static const ITEM_NEW:String = "ItemNew";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static var _inventory:MochiInventory;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showStore(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
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 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);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function requestFunding(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFunding", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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);
}
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 100
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Fragment:Number;
private var Sibling:MochiDigits;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function get value():Number{
return (Number(this.toString()));
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
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 reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
}
}//package mochi.as3
Section 101
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_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 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);
};
}
}
}//package mochi.as3
Section 102
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_CENTER:String = "ALIGN_C";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const FORMAT_SHORT:String = "ShortForm";
public static const FORMAT_LONG:String = "LongForm";
private static var gameStart:Number;
private static var levelStart:Number;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
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 addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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 startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
}
}//package mochi.as3
Section 103
//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 _consumableProperties:Object;
private var _syncPending:Boolean;
private var _outstandingID:Number;
private var _syncID:Number;
private var _names:Array;
private var _storeSync:Object;
private static const CONSUMER_KEY:String = "MochiConsumables";
private static const KEY_SALT:String = " syncMaint";
public static const READY:String = "InvReady";
public static const WRITTEN:String = "InvWritten";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
public static const VALUE_ERROR:String = "InvValueError";
public static const NOT_READY:String = "InvNotReady";
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();
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
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));
};
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
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 putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
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 getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
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);
}
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 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++;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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);
}
}
}//package mochi.as3
Section 104
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _id:String;
private static var _container:Object;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _timer:Timer;
private static var _preserved:Object;
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
private static var _services:String = "services.swf";
private static var _mochiLC:String = "MochiLC.swf";
private static var _swfVersion:String;
private static var _listenChannelName:String = "__ms_";
private static var _sendChannel:LocalConnection;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
private static var _connected:Boolean = false;
public static var netup:Boolean = true;
public static var netupAttempted:Boolean = false;
public static var onError:Object;
public static var widget:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _queue:Array;
private static var _nextCallbackID:Number;
private static var _callbacks:Object;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get id():String{
return (_id);
}
public static function get clip():Object{
return (_container);
}
public static function get childClip():Object{
return (_clip);
}
public static function getVersion():String{
return ("3.9.1 as3");
}
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 isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
public static function get connected():Boolean{
return (_connected);
}
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++;
};
}
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 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 stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
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);
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
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 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);
}
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);
}
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);
}
private static function loadLCBridgeComplete(_arg1:Event):void{
var _local2:Loader = LoaderInfo(_arg1.target).loader;
_mochiLocalConnection = MovieClip(_local2.content);
listen();
}
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 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;
};
}
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...");
}
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());
};
};
}
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];
}
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 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);
};
};
};
};
}
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) {
};
};
};
};
}
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 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);
};
}
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);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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);
}
}
}//package mochi.as3
Section 105
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const LOGGED_OUT:String = "LoggedOut";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
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_CANCELED:String = "onCancel";
public static const ACTION_COMPLETE:String = "onComplete";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _user_info:Object = null;
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_showLoginWidget", {options:_arg1});
}
public static function hideLoginWidget():void{
MochiServices.send("social_hideLoginWidget");
}
public static function requestLogin(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestLogin", _arg1);
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("social_saveUserProperties", _arg1);
}
public static function getFriendsList(_arg1:Object=null):void{
MochiServices.send("social_getFriendsList", _arg1);
}
public static function postToStream(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_postToStream", _arg1);
}
public static function inviteFriends(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_inviteFriends", _arg1);
}
public static function requestFan(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFan", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function get loggedIn():Boolean{
return (!((_user_info == 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);
}
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 106
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var _loader:URLLoader;
public var key:String;// = null
public var data;// = null
public var error:Event;// = null
public var operation:String;// = null
public var callback:Function;// = 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 deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
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 errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
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 function getEvent():void{
request("get", serialize(null));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
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 107
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 108
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 109
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 110
//Bk1 (Bk1)
package {
import flash.display.*;
public dynamic class Bk1 extends BitmapData {
public function Bk1(_arg1:int=320, _arg2:int=236){
super(_arg1, _arg2);
}
}
}//package
Section 111
//Bk2 (Bk2)
package {
import flash.display.*;
public dynamic class Bk2 extends BitmapData {
public function Bk2(_arg1:int=320, _arg2:int=236){
super(_arg1, _arg2);
}
}
}//package
Section 112
//Bk3 (Bk3)
package {
import flash.display.*;
public dynamic class Bk3 extends BitmapData {
public function Bk3(_arg1:int=320, _arg2:int=236){
super(_arg1, _arg2);
}
}
}//package
Section 113
//Bk4 (Bk4)
package {
import flash.display.*;
public dynamic class Bk4 extends BitmapData {
public function Bk4(_arg1:int=320, _arg2:int=236){
super(_arg1, _arg2);
}
}
}//package
Section 114
//Bk5 (Bk5)
package {
import flash.display.*;
public dynamic class Bk5 extends BitmapData {
public function Bk5(_arg1:int=320, _arg2:int=236){
super(_arg1, _arg2);
}
}
}//package
Section 115
//Bk6 (Bk6)
package {
import flash.display.*;
public dynamic class Bk6 extends BitmapData {
public function Bk6(_arg1:int=320, _arg2:int=236){
super(_arg1, _arg2);
}
}
}//package
Section 116
//Bk7 (Bk7)
package {
import flash.display.*;
public dynamic class Bk7 extends BitmapData {
public function Bk7(_arg1:int=320, _arg2:int=236){
super(_arg1, _arg2);
}
}
}//package
Section 117
//DangerLeft (DangerLeft)
package {
import flash.display.*;
public dynamic class DangerLeft extends BitmapData {
public function DangerLeft(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 118
//DangerLeftEnd (DangerLeftEnd)
package {
import flash.display.*;
public dynamic class DangerLeftEnd extends BitmapData {
public function DangerLeftEnd(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 119
//DangerRight (DangerRight)
package {
import flash.display.*;
public dynamic class DangerRight extends BitmapData {
public function DangerRight(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 120
//DangerRightEnd (DangerRightEnd)
package {
import flash.display.*;
public dynamic class DangerRightEnd extends BitmapData {
public function DangerRightEnd(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 121
//DangerSingle (DangerSingle)
package {
import flash.display.*;
public dynamic class DangerSingle extends BitmapData {
public function DangerSingle(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 122
//DangerTile (DangerTile)
package {
import flash.display.*;
public dynamic class DangerTile extends BitmapData {
public function DangerTile(_arg1:int=11, _arg2:int=11){
super(_arg1, _arg2);
}
}
}//package
Section 123
//DebugTile (DebugTile)
package {
import flash.display.*;
public dynamic class DebugTile extends BitmapData {
public function DebugTile(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 124
//DeleteTile (DeleteTile)
package {
import flash.display.*;
public dynamic class DeleteTile extends BitmapData {
public function DeleteTile(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 125
//EnterDoor (EnterDoor)
package {
import flash.display.*;
public dynamic class EnterDoor extends BitmapData {
public function EnterDoor(_arg1:int=11, _arg2:int=17){
super(_arg1, _arg2);
}
}
}//package
Section 126
//EnterDoorAnim (EnterDoorAnim)
package {
import flash.events.*;
import flash.display.*;
public dynamic class EnterDoorAnim extends MovieClip {
public function EnterDoorAnim(){
addFrameScript(0, frame1, 11, frame12, 18, frame19, 20, frame21);
}
function frame1(){
stop();
}
function frame12(){
this.dispatchEvent(new Event("Door open"));
}
function frame19(){
this.dispatchEvent(new Event("Door close"));
}
function frame21(){
stop();
this.dispatchEvent(new Event("EntryDone"));
}
}
}//package
Section 127
//Exit (Exit)
package {
import flash.events.*;
import flash.display.*;
import customclasses.*;
public dynamic class Exit extends MovieClip {
public function Exit(){
addFrameScript(9, frame10, 168, frame169, 197, frame198, 201, frame202, 203, frame204, 205, frame206, 207, frame208, 209, frame210, 211, frame212, 213, frame214, 215, frame216, 217, frame218, 240, frame241, 263, frame264, 282, frame283, 336, frame337, 345, frame346, 368, frame369, 386, frame387, 403, frame404);
}
function frame10(){
this.gotoAndPlay("IdleNoPuke");
}
function frame169(){
this.gotoAndPlay("Idle");
}
function frame198(){
this.dispatchEvent(new Event("Short sick"));
}
function frame202(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -16, 22));
}
function frame204(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -14, 22));
}
function frame206(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -16, 22));
}
function frame208(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -14, 22));
}
function frame210(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -16, 22));
}
function frame212(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -14, 22));
}
function frame214(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -16, 22));
}
function frame216(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -14, 22));
}
function frame218(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, -15, 22));
}
function frame241(){
this.dispatchEvent(new Event("Girl no"));
}
function frame264(){
this.dispatchEvent(new Event("Pop"));
}
function frame283(){
this.dispatchEvent(new Event("Girl close"));
}
function frame337(){
this.dispatchEvent(new Event("Door open"));
}
function frame346(){
this.dispatchEvent(new Event("Door close"));
}
function frame369(){
this.stop();
this.dispatchEvent(new Event("ExitDone"));
}
function frame387(){
this.dispatchEvent(new Event("Door close"));
}
function frame404(){
this.stop();
this.dispatchEvent(new Event("ExitDone"));
}
}
}//package
Section 128
//ExitDoor (ExitDoor)
package {
import flash.display.*;
public dynamic class ExitDoor extends BitmapData {
public function ExitDoor(_arg1:int=60, _arg2:int=17){
super(_arg1, _arg2);
}
}
}//package
Section 129
//ExitFinal (ExitFinal)
package {
import flash.events.*;
import flash.display.*;
import customclasses.*;
public dynamic class ExitFinal extends MovieClip {
public function ExitFinal(){
addFrameScript(9, frame10, 168, frame169, 197, frame198, 201, frame202, 203, frame204, 205, frame206, 207, frame208, 209, frame210, 211, frame212, 213, frame214, 215, frame216, 217, frame218, 0x0100, frame257);
}
function frame10(){
this.gotoAndPlay("IdleNoPuke");
}
function frame169(){
this.gotoAndPlay("Idle");
}
function frame198(){
this.dispatchEvent(new Event("Girl sick"));
}
function frame202(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 2, 22));
}
function frame204(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 0, 22));
}
function frame206(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 2, 22));
}
function frame208(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 0, 22));
}
function frame210(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 2, 22));
}
function frame212(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 0, 22));
}
function frame214(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 2, 22));
}
function frame216(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 0, 22));
}
function frame218(){
this.dispatchEvent(new PukeEvent(PukeEvent.SPAWN, 1, 22));
}
function frame257(){
this.stop();
this.dispatchEvent(new Event("ExitDone"));
}
}
}//package
Section 130
//ExitTile (ExitTile)
package {
import flash.display.*;
public dynamic class ExitTile extends BitmapData {
public function ExitTile(_arg1:int=11, _arg2:int=14){
super(_arg1, _arg2);
}
}
}//package
Section 131
//InvertSpikeTile (InvertSpikeTile)
package {
import flash.display.*;
public dynamic class InvertSpikeTile extends BitmapData {
public function InvertSpikeTile(_arg1:int=12, _arg2:int=14){
super(_arg1, _arg2);
}
}
}//package
Section 132
//NoButton (NoButton)
package {
import customclasses.*;
public dynamic class NoButton extends GenericButton {
public function NoButton(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 133
//PintTile (PintTile)
package {
import flash.display.*;
public dynamic class PintTile extends BitmapData {
public function PintTile(_arg1:int=11, _arg2:int=15){
super(_arg1, _arg2);
}
}
}//package
Section 134
//PlayerAsset (PlayerAsset)
package {
import flash.display.*;
public dynamic class PlayerAsset extends BitmapData {
public function PlayerAsset(_arg1:int=66, _arg2:int=48){
super(_arg1, _arg2);
}
}
}//package
Section 135
//PlayerShadow (PlayerShadow)
package {
import flash.display.*;
public dynamic class PlayerShadow extends BitmapData {
public function PlayerShadow(_arg1:int=7, _arg2:int=3){
super(_arg1, _arg2);
}
}
}//package
Section 136
//PopSpikeTile (PopSpikeTile)
package {
import flash.display.*;
public dynamic class PopSpikeTile extends BitmapData {
public function PopSpikeTile(_arg1:int=60, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 137
//QuitButton (QuitButton)
package {
import customclasses.*;
public dynamic class QuitButton extends GenericButton {
}
}//package
Section 138
//RetryButton (RetryButton)
package {
import customclasses.*;
public dynamic class RetryButton extends GenericButton {
public function RetryButton(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 139
//SFXBass1 (SFXBass1)
package {
import flash.media.*;
public dynamic class SFXBass1 extends Sound {
}
}//package
Section 140
//SFXBass2 (SFXBass2)
package {
import flash.media.*;
public dynamic class SFXBass2 extends Sound {
}
}//package
Section 141
//SFXBoingA (SFXBoingA)
package {
import flash.media.*;
public dynamic class SFXBoingA extends Sound {
}
}//package
Section 142
//SFXBoingB (SFXBoingB)
package {
import flash.media.*;
public dynamic class SFXBoingB extends Sound {
}
}//package
Section 143
//SFXBoingC (SFXBoingC)
package {
import flash.media.*;
public dynamic class SFXBoingC extends Sound {
}
}//package
Section 144
//SFXButtonSelect (SFXButtonSelect)
package {
import flash.media.*;
public dynamic class SFXButtonSelect extends Sound {
}
}//package
Section 145
//SFXCheat (SFXCheat)
package {
import flash.media.*;
public dynamic class SFXCheat extends Sound {
}
}//package
Section 146
//SFXCollect (SFXCollect)
package {
import flash.media.*;
public dynamic class SFXCollect extends Sound {
}
}//package
Section 147
//SFXDeath (SFXDeath)
package {
import flash.media.*;
public dynamic class SFXDeath extends Sound {
}
}//package
Section 148
//SFXDoorClose (SFXDoorClose)
package {
import flash.media.*;
public dynamic class SFXDoorClose extends Sound {
}
}//package
Section 149
//SFXDoorOpen (SFXDoorOpen)
package {
import flash.media.*;
public dynamic class SFXDoorOpen extends Sound {
}
}//package
Section 150
//SFXDrums (SFXDrums)
package {
import flash.media.*;
public dynamic class SFXDrums extends Sound {
}
}//package
Section 151
//SFXFinalSick (SFXFinalSick)
package {
import flash.media.*;
public dynamic class SFXFinalSick extends Sound {
}
}//package
Section 152
//SFXGirlNo (SFXGirlNo)
package {
import flash.media.*;
public dynamic class SFXGirlNo extends Sound {
}
}//package
Section 153
//SFXGirlSick (SFXGirlSick)
package {
import flash.media.*;
public dynamic class SFXGirlSick extends Sound {
}
}//package
Section 154
//SFXJumpA (SFXJumpA)
package {
import flash.media.*;
public dynamic class SFXJumpA extends Sound {
}
}//package
Section 155
//SFXJumpB (SFXJumpB)
package {
import flash.media.*;
public dynamic class SFXJumpB extends Sound {
}
}//package
Section 156
//SFXJumpC (SFXJumpC)
package {
import flash.media.*;
public dynamic class SFXJumpC extends Sound {
}
}//package
Section 157
//SFXKissEnd (SFXKissEnd)
package {
import flash.media.*;
public dynamic class SFXKissEnd extends Sound {
}
}//package
Section 158
//SFXKissStart (SFXKissStart)
package {
import flash.media.*;
public dynamic class SFXKissStart extends Sound {
}
}//package
Section 159
//SFXMelody (SFXMelody)
package {
import flash.media.*;
public dynamic class SFXMelody extends Sound {
}
}//package
Section 160
//SFXOver (SFXOver)
package {
import flash.media.*;
public dynamic class SFXOver extends Sound {
}
}//package
Section 161
//SFXPiano1 (SFXPiano1)
package {
import flash.media.*;
public dynamic class SFXPiano1 extends Sound {
}
}//package
Section 162
//SFXPiano2 (SFXPiano2)
package {
import flash.media.*;
public dynamic class SFXPiano2 extends Sound {
}
}//package
Section 163
//SFXPop (SFXPop)
package {
import flash.media.*;
public dynamic class SFXPop extends Sound {
}
}//package
Section 164
//SFXShortSick (SFXShortSick)
package {
import flash.media.*;
public dynamic class SFXShortSick extends Sound {
}
}//package
Section 165
//SFXSickA (SFXSickA)
package {
import flash.media.*;
public dynamic class SFXSickA extends Sound {
}
}//package
Section 166
//SFXSickB (SFXSickB)
package {
import flash.media.*;
public dynamic class SFXSickB extends Sound {
}
}//package
Section 167
//SFXSickC (SFXSickC)
package {
import flash.media.*;
public dynamic class SFXSickC extends Sound {
}
}//package
Section 168
//SFXSpikePopA (SFXSpikePopA)
package {
import flash.media.*;
public dynamic class SFXSpikePopA extends Sound {
}
}//package
Section 169
//SFXSpikePopB (SFXSpikePopB)
package {
import flash.media.*;
public dynamic class SFXSpikePopB extends Sound {
}
}//package
Section 170
//SFXSpikePopC (SFXSpikePopC)
package {
import flash.media.*;
public dynamic class SFXSpikePopC extends Sound {
}
}//package
Section 171
//SFXStartGame (SFXStartGame)
package {
import flash.media.*;
public dynamic class SFXStartGame extends Sound {
}
}//package
Section 172
//SFXStartLevel (SFXStartLevel)
package {
import flash.media.*;
public dynamic class SFXStartLevel extends Sound {
}
}//package
Section 173
//SFXTaDaa (SFXTaDaa)
package {
import flash.media.*;
public dynamic class SFXTaDaa extends Sound {
}
}//package
Section 174
//SFXTrumpet (SFXTrumpet)
package {
import flash.media.*;
public dynamic class SFXTrumpet extends Sound {
}
}//package
Section 175
//SpikeTile (SpikeTile)
package {
import flash.display.*;
public dynamic class SpikeTile extends BitmapData {
public function SpikeTile(_arg1:int=11, _arg2:int=11){
super(_arg1, _arg2);
}
}
}//package
Section 176
//SpringTile (SpringTile)
package {
import flash.display.*;
public dynamic class SpringTile extends BitmapData {
public function SpringTile(_arg1:int=60, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 177
//StandardLeftEnd (StandardLeftEnd)
package {
import flash.display.*;
public dynamic class StandardLeftEnd extends BitmapData {
public function StandardLeftEnd(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 178
//StandardRightEnd (StandardRightEnd)
package {
import flash.display.*;
public dynamic class StandardRightEnd extends BitmapData {
public function StandardRightEnd(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 179
//StandardTile (StandardTile)
package {
import flash.display.*;
public dynamic class StandardTile extends BitmapData {
public function StandardTile(_arg1:int=12, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 180
//StartTile (StartTile)
package {
import flash.display.*;
public dynamic class StartTile extends BitmapData {
public function StartTile(_arg1:int=11, _arg2:int=14){
super(_arg1, _arg2);
}
}
}//package
Section 181
//YesButton (YesButton)
package {
import customclasses.*;
public dynamic class YesButton extends GenericButton {
public function YesButton(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package