Section 1
//GameConnector (com.doof.client.gameconnector.GameConnector)
package com.doof.client.gameconnector {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
import com.doof.client.gameshell.*;
public class GameConnector extends MovieClip {
private var _parentRef:DisplayObject;
private var _splashFinishedMethod:Function;
private var _restartGameMethod:Function;
public var _gameObject:Object;
private var _gameID:String;
public var _userProfileObject:Object;
private var _gameShell;
public function GameConnector(_arg1:DisplayObject, _arg2:String, _arg3:Function, _arg4:Function){
trace("GameConnector V8 constructor called");
allowDomains();
_parentRef = _arg1;
_gameID = _arg2;
_splashFinishedMethod = _arg3;
_restartGameMethod = _arg4;
loadGameShell();
}
private function getPassedParameter(_arg1:String):String{
var _local2:Object;
var _local3:String;
_local2 = LoaderInfo(_parentRef.root.loaderInfo).parameters;
_local3 = String(_local2[_arg1]);
return (_local3);
}
public function init():void{
trace("GameConnector init();");
_gameShell.init(_parentRef, _gameID, _splashFinishedMethod, _restartGameMethod);
}
private function loadGameShell():void{
var _local1:Loader;
var _local2:URLRequest;
var _local3:String;
_local1 = new Loader();
_local3 = getPassedParameter("environment");
if (((!((_local3 == "null"))) && (!((_local3 == "undefined"))))){
_local2 = new URLRequest((("http://cdn.doof.com/static/gameClient/shell/GameShell" + _local3) + ".swf"));
} else {
_local2 = new URLRequest("http://cdn.doof.com/static/gameClient/shell/GameShell.swf");
};
_local1.contentLoaderInfo.addEventListener(Event.COMPLETE, shellLoadCompleteHandler);
_local1.load(_local2);
}
public function gameStarted(_arg1:int):void{
trace((("GameConnector gameStarted(" + _arg1) + ");"));
_gameShell.gameStarted(_arg1);
}
public function gameStat(_arg1:String, _arg2:String):void{
trace((((("GameConnector gameStat(" + _arg1) + ", ") + _arg2) + ");"));
_gameShell.gameStat(_arg1, _arg2);
}
private function allowDomains():void{
Security.allowDomain("*");
Security.allowInsecureDomain("*");
}
private function shellLoadCompleteHandler(_arg1:Event):void{
_gameShell = MovieClip(_arg1.currentTarget.content);
if (_gameShell != null){
_gameShell.setGameConnector(this);
_gameShell.setGameURL(_parentRef.root.loaderInfo.url);
_gameShell.init(_parentRef, _gameID, _splashFinishedMethod, _restartGameMethod);
} else {
trace("Game shell not loaded, please make sure both swf files are using network sandbox mode.");
};
}
public function gameEnded(_arg1:int):void{
trace((("GameConnector gameEnded(" + _arg1) + ");"));
_gameShell.gameEnded(_arg1);
}
}
}//package com.doof.client.gameconnector
Section 2
//BagsSubControl (com.whirled.game.BagsSubControl)
package com.whirled.game {
import com.whirled.*;
public class BagsSubControl extends AbstractSubControl {
public function BagsSubControl(parent:AbstractControl){
super(parent);
}
protected function getFrom(bagName:String, count:int, msgOrPropName:String, playerId:int, consume:Boolean, callback:Function):void{
callHostCode("getFromCollection_v2", bagName, count, msgOrPropName, playerId, consume, callback);
}
public function pick(bagName:String, count:int, msgOrPropName:String, playerId:int=0):void{
getFrom(bagName, count, msgOrPropName, playerId, false, null);
}
public function addTo(bagName:String, values:Array):void{
populate(bagName, values, false);
}
public function merge(srcBag:String, intoBag:String):void{
callHostCode("mergeCollection_v1", srcBag, intoBag);
}
protected function populate(bagName:String, values:Array, clearExisting:Boolean):void{
callHostCode("populateCollection_v1", bagName, values, clearExisting);
}
public function deal(bagName:String, count:int, msgOrPropName:String, callback:Function=null, playerId:int=0):void{
getFrom(bagName, count, msgOrPropName, playerId, true, callback);
}
public function create(bagName:String, values:Array):void{
populate(bagName, values, true);
}
}
}//package com.whirled.game
Section 3
//CoinsAwardedEvent (com.whirled.game.CoinsAwardedEvent)
package com.whirled.game {
import flash.events.*;
public class CoinsAwardedEvent extends Event {
protected var _amount:int;
protected var _percentile:int;
public static const COINS_AWARDED:String = "CoinsAwarded";
public function CoinsAwardedEvent(amount:int, percentile:int){
super(COINS_AWARDED);
_amount = amount;
_percentile = percentile;
}
public function get percentile():int{
return (_percentile);
}
public function get amount():int{
return (_amount);
}
override public function toString():String{
return ((((((("CoinsAwardedEvent [type=" + type) + ", amount=") + _amount) + ", percentile=") + _percentile) + "]"));
}
override public function clone():Event{
return (new CoinsAwardedEvent(_amount, _percentile));
}
}
}//package com.whirled.game
Section 4
//ElementChangedEvent (com.whirled.game.ElementChangedEvent)
package com.whirled.game {
import flash.events.*;
public class ElementChangedEvent extends PropertyChangedEvent {
protected var _key:int;
public static const ELEMENT_CHANGED:String = "ElemChanged";
public function ElementChangedEvent(type:String, propName:String, newValue:Object, oldValue:Object, key:int){
super(type, propName, newValue, oldValue);
_key = key;
}
public function get index():int{
return (_key);
}
override public function toString():String{
return ((((((("[ElementChangedEvent name=" + _name) + ", value=") + _newValue) + ", key=") + _key) + "]"));
}
override public function clone():Event{
return (new ElementChangedEvent(type, _name, _newValue, _oldValue, _key));
}
public function get key():int{
return (_key);
}
}
}//package com.whirled.game
Section 5
//GameControl (com.whirled.game.GameControl)
package com.whirled.game {
import flash.events.*;
import flash.display.*;
import com.whirled.*;
public class GameControl extends AbstractControl {
protected var _servicesCtrl:ServicesSubControl;
protected var _netCtrl:NetSubControl;
protected var _connected:Boolean;
protected var _playerCtrl:PlayerSubControl;
protected var _gameCtrl:GameSubControl;
protected var _localCtrl:LocalSubControl;
public function GameControl(disp:DisplayObject, autoReady:Boolean=true){
super(disp, {autoReady_v1:autoReady});
disp.root.addEventListener(MouseEvent.CLICK, handleRootClick);
}
public function get player():PlayerSubControl{
return (_playerCtrl);
}
override protected function setUserProps(o:Object):void{
super.setUserProps(o);
o["connectionClosed_v1"] = connectionClosed_v1;
}
public function get services():ServicesSubControl{
return (_servicesCtrl);
}
public function get local():LocalSubControl{
return (_localCtrl);
}
private function connectionClosed_v1():void{
_connected = false;
}
public function get game():GameSubControl{
return (_gameCtrl);
}
override protected function createSubControls():Array{
return ([(_localCtrl = new LocalSubControl(this)), (_netCtrl = new NetSubControl(this)), (_playerCtrl = new PlayerSubControl(this)), (_gameCtrl = new GameSubControl(this)), (_servicesCtrl = new ServicesSubControl(this))]);
}
override protected function gotHostProps(o:Object):void{
super.gotHostProps(o);
_connected = !((o.gameData == null));
}
public function get net():NetSubControl{
return (_netCtrl);
}
protected function handleRootClick(evt:MouseEvent):void{
var evt = evt;
if (!isConnected()){
return;
};
if ((((evt.target.stage == null)) || (!((evt.target.stage.focus == null))))){
return;
};
//unresolved jump
var _slot1 = err;
callHostCode("focusContainer_v1");
}
override public function isConnected():Boolean{
return (_connected);
}
}
}//package com.whirled.game
Section 6
//GameSubControl (com.whirled.game.GameSubControl)
package com.whirled.game {
import com.whirled.*;
public class GameSubControl extends AbstractSubControl {
protected var _seatingCtrl:SeatingSubControl;
protected var _gameConfig:Object;
public static const WINNERS_TAKE_ALL:int = 1;
public static const TO_EACH_THEIR_OWN:int = 2;
public static const CASCADING_PAYOUT:int = 0;
public function GameSubControl(parent:GameControl){
_gameConfig = {};
super(parent);
}
public function endGameWithWinners(winnerIds:Array, loserIds:Array, payoutType:int):void{
callHostCode("endGameWithWinners_v1", winnerIds, loserIds, payoutType);
}
public function playerReady():void{
callHostCode("playerReady_v1");
}
public function isInPlay():Boolean{
return (Boolean(callHostCode("isInPlay_v1")));
}
public function getOccupantIds():Array{
return ((callHostCode("getOccupants_v1") as Array));
}
private function turnDidChange_v1():void{
dispatch(new StateChangedEvent(StateChangedEvent.TURN_CHANGED));
}
public function getTurnHolderId():int{
return (int(callHostCode("getTurnHolder_v1")));
}
private function occupantChanged_v1(occupantId:int, player:Boolean, enter:Boolean):void{
dispatch(new OccupantChangedEvent((enter) ? OccupantChangedEvent.OCCUPANT_ENTERED : OccupantChangedEvent.OCCUPANT_LEFT, occupantId, player));
}
public function endRound(nextRoundDelay:int=0):void{
callHostCode("endRound_v1", nextRoundDelay);
}
public function getLevelPacks():Array{
return ((callHostCode("getLevelPacks_v1") as Array));
}
public function getControllerId():int{
return (int(callHostCode("getControllerId_v1")));
}
public function startNextTurn(nextPlayerId:int=0):void{
callHostCode("startNextTurn_v1", nextPlayerId);
}
public function isMyTurn():Boolean{
return (Boolean(callHostCode("isMyTurn_v1")));
}
public function endGameWithScores(playerIds:Array, scores:Array, payoutType:int):void{
callHostCode("endGameWithScores_v1", playerIds, scores, payoutType);
}
public function getRound():int{
return (int(callHostCode("getRound_v1")));
}
public function getMyId():int{
return (int(callHostCode("getMyId_v1")));
}
public function getOccupantName(playerId:int):String{
return (String(callHostCode("getOccupantName_v1", playerId)));
}
public function systemMessage(msg:String):void{
callHostCode("sendChat_v1", msg);
}
override protected function setUserProps(o:Object):void{
super.setUserProps(o);
o["controlDidChange_v1"] = controlDidChange_v1;
o["turnDidChange_v1"] = turnDidChange_v1;
o["gameStateChanged_v1"] = gameStateChanged_v1;
o["roundStateChanged_v1"] = roundStateChanged_v1;
o["occupantChanged_v1"] = occupantChanged_v1;
o["userChat_v1"] = userChat_v1;
}
public function restartGameIn(seconds:int):void{
callHostCode("restartGameIn_v1", seconds);
}
private function gameStateChanged_v1(started:Boolean):void{
dispatch(new StateChangedEvent((started) ? StateChangedEvent.GAME_STARTED : StateChangedEvent.GAME_ENDED));
}
private function controlDidChange_v1():void{
dispatch(new StateChangedEvent(StateChangedEvent.CONTROL_CHANGED));
}
private function roundStateChanged_v1(started:Boolean):void{
dispatch(new StateChangedEvent((started) ? StateChangedEvent.ROUND_STARTED : StateChangedEvent.ROUND_ENDED));
}
public function amInControl():Boolean{
return ((getControllerId() == getMyId()));
}
public function getItemPacks():Array{
return ((callHostCode("getItemPacks_v1") as Array));
}
private function userChat_v1(speaker:int, message:String):void{
dispatch(new UserChatEvent(speaker, message));
}
public function getConfig():Object{
return (_gameConfig);
}
override protected function createSubControls():Array{
return ([(_seatingCtrl = new SeatingSubControl(_parent, this))]);
}
override protected function gotHostProps(o:Object):void{
super.gotHostProps(o);
_gameConfig = o.gameConfig;
}
public function get seating():SeatingSubControl{
return (_seatingCtrl);
}
public function endGameWithScore(score:int):void{
endGameWithScores([getMyId()], [score], TO_EACH_THEIR_OWN);
}
}
}//package com.whirled.game
Section 7
//LocalSubControl (com.whirled.game.LocalSubControl)
package com.whirled.game {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.whirled.*;
public class LocalSubControl extends AbstractSubControl {
public function LocalSubControl(parent:GameControl){
super(parent);
}
public function setOccupantsLabel(label:String):void{
callHostCode("setOccupantsLabel_v1", label);
}
public function setShowButtons(rematch:Boolean=true, backButtons:Boolean=true):void{
callHostCode("setShowButtons_v1", rematch, backButtons);
}
override protected function setUserProps(o:Object):void{
super.setUserProps(o);
o["dispatchEvent_v1"] = dispatch;
o["sizeChanged_v1"] = sizeChanged_v1;
}
public function setPlayerScores(scores:Array, sortValues:Array=null):void{
callHostCode("setPlayerScores_v1", scores, sortValues);
}
public function feedback(msg:String):void{
callHostCode("localChat_v1", msg);
}
private function sizeChanged_v1(size:Point):void{
dispatch(new SizeChangedEvent(size));
}
override public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void{
super.removeEventListener(type, listener, useCapture);
switch (type){
case KeyboardEvent.KEY_UP:
case KeyboardEvent.KEY_DOWN:
if (!hasEventListener(type)){
callHostCode("alterKeyEvents_v1", type, false);
};
break;
};
}
override public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void{
super.addEventListener(type, listener, useCapture, priority, useWeakReference);
switch (type){
case KeyboardEvent.KEY_UP:
case KeyboardEvent.KEY_DOWN:
if (hasEventListener(type)){
callHostCode("alterKeyEvents_v1", type, true);
};
break;
};
}
public function clearScores(clearValue:Object=null, sortValuesToo:Boolean=false):void{
callHostCode("clearScores_v1", clearValue, sortValuesToo);
}
public function backToWhirled(showLobby:Boolean=false):void{
callHostCode("backToWhirled_v1", showLobby);
}
public function getHeadShot(occupantId:int):DisplayObject{
return ((callHostCode("getHeadShot_v2", occupantId) as DisplayObject));
}
public function setMappedScores(scores:Object):void{
callHostCode("setMappedScores_v1", scores);
}
public function getSize():Point{
return ((callHostCode("getSize_v1") as Point));
}
public function filter(text:String):String{
return ((callHostCode("filter_v1", text) as String));
}
}
}//package com.whirled.game
Section 8
//MessageReceivedEvent (com.whirled.game.MessageReceivedEvent)
package com.whirled.game {
import flash.events.*;
public class MessageReceivedEvent extends Event {
protected var _value:Object;
protected var _name:String;
public static const MESSAGE_RECEIVED:String = "MsgReceived";
public function MessageReceivedEvent(messageName:String, value:Object){
super(MESSAGE_RECEIVED);
_name = messageName;
_value = value;
}
public function get value():Object{
return (_value);
}
public function get name():String{
return (_name);
}
override public function toString():String{
return ((((("[MessageReceivedEvent name=" + _name) + ", value=") + _value) + "]"));
}
override public function clone():Event{
return (new MessageReceivedEvent(_name, _value));
}
}
}//package com.whirled.game
Section 9
//NetSubControl (com.whirled.game.NetSubControl)
package com.whirled.game {
import com.whirled.*;
public class NetSubControl extends AbstractSubControl {
protected var _gameData:Object;
public function NetSubControl(parent:GameControl){
super(parent);
}
public function set(propName:String, value:Object, immediate:Boolean=false):void{
callHostCode("setProperty_v2", propName, value, null, false, immediate);
}
override protected function setUserProps(o:Object):void{
super.setUserProps(o);
o["propertyWasSet_v2"] = propertyWasSet_v2;
o["messageReceived_v1"] = messageReceived_v1;
}
public function testAndSet(propName:String, newValue:Object, testValue:Object):void{
callHostCode("testAndSetProperty_v1", propName, newValue, testValue);
}
public function setIn(propName:String, key:int, value:Object, immediate:Boolean=false):void{
callHostCode("setProperty_v2", propName, value, key, false, immediate);
}
private function propertyWasSet_v2(name:String, newValue:Object, oldValue:Object, key:Object):void{
if (key == null){
dispatch(new PropertyChangedEvent(PropertyChangedEvent.PROPERTY_CHANGED, name, newValue, oldValue));
} else {
dispatch(new ElementChangedEvent(ElementChangedEvent.ELEMENT_CHANGED, name, newValue, oldValue, int(key)));
};
}
private function messageReceived_v1(name:String, value:Object):void{
dispatch(new MessageReceivedEvent(name, value));
}
public function setAt(propName:String, index:int, value:Object, immediate:Boolean=false):void{
callHostCode("setProperty_v2", propName, value, index, true, immediate);
}
public function get(propName:String):Object{
checkIsConnected();
return (_gameData[propName]);
}
override protected function gotHostProps(o:Object):void{
super.gotHostProps(o);
_gameData = o.gameData;
}
public function getPropertyNames(prefix:String=""):Array{
var s:String;
var props:Array = [];
for (s in _gameData) {
if (s.lastIndexOf(prefix, 0) == 0){
props.push(s);
};
};
return (props);
}
public function sendMessage(messageName:String, value:Object, playerId:int=0):void{
callHostCode("sendMessage_v2", messageName, value, playerId);
}
}
}//package com.whirled.game
Section 10
//OccupantChangedEvent (com.whirled.game.OccupantChangedEvent)
package com.whirled.game {
import flash.events.*;
public class OccupantChangedEvent extends Event {
protected var _player:Boolean;
protected var _occupantId:int;
public static const OCCUPANT_LEFT:String = "OccupantLeft";
public static const OCCUPANT_ENTERED:String = "OccupantEntered";
public function OccupantChangedEvent(type:String, occupantId:int, player:Boolean){
super(type);
_occupantId = occupantId;
_player = player;
}
public function get player():Boolean{
return (_player);
}
public function get occupantId():int{
return (_occupantId);
}
override public function toString():String{
return ((((((("[OccupantChangedEvent type=" + type) + ", occupantId=") + _occupantId) + ", player=") + _player) + "]"));
}
override public function clone():Event{
return (new OccupantChangedEvent(type, _occupantId, _player));
}
}
}//package com.whirled.game
Section 11
//PlayerSubControl (com.whirled.game.PlayerSubControl)
package com.whirled.game {
import com.whirled.*;
public class PlayerSubControl extends AbstractSubControl {
public function PlayerSubControl(parent:GameControl){
super(parent);
}
public function getPlayerItemPacks():Array{
return ((callHostCode("getPlayerItemPacks_v1") as Array));
}
public function setUserCookie(cookie:Object):Boolean{
return (Boolean(callHostCode("setUserCookie_v1", cookie)));
}
public function holdsTrophy(ident:String):Boolean{
return ((callHostCode("holdsTrophy_v1", ident) as Boolean));
}
public function getUserCookie(occupantId:int, callback:Function):void{
callHostCode("getUserCookie_v2", occupantId, callback);
}
override protected function setUserProps(o:Object):void{
super.setUserProps(o);
o["flowAwarded_v1"] = flowAwarded_v1;
}
private function flowAwarded_v1(amount:int, percentile:int):void{
dispatch(new CoinsAwardedEvent(amount, percentile));
}
public function awardPrize(ident:String):void{
callHostCode("awardPrize_v1", ident);
}
public function awardTrophy(ident:String):Boolean{
return ((callHostCode("awardTrophy_v1", ident) as Boolean));
}
}
}//package com.whirled.game
Section 12
//PropertyChangedEvent (com.whirled.game.PropertyChangedEvent)
package com.whirled.game {
import flash.events.*;
public class PropertyChangedEvent extends Event {
protected var _newValue:Object;
protected var _oldValue:Object;
protected var _name:String;
public static const PROPERTY_CHANGED:String = "PropChanged";
public function PropertyChangedEvent(type:String, propName:String, newValue:Object, oldValue:Object){
super(type);
_name = propName;
_newValue = newValue;
_oldValue = oldValue;
}
public function get newValue():Object{
return (_newValue);
}
public function get oldValue():Object{
return (_oldValue);
}
public function get name():String{
return (_name);
}
override public function toString():String{
return ((((("[PropertyChangedEvent name=" + _name) + ", value=") + _newValue) + "]"));
}
override public function clone():Event{
return (new PropertyChangedEvent(type, _name, _newValue, _oldValue));
}
}
}//package com.whirled.game
Section 13
//SeatingSubControl (com.whirled.game.SeatingSubControl)
package com.whirled.game {
import com.whirled.*;
public class SeatingSubControl extends AbstractSubControl {
protected var _game:GameSubControl;
public function SeatingSubControl(parent:AbstractControl, game:GameSubControl){
super(parent);
_game = game;
}
public function getPlayerPosition(playerId:int):int{
return (int(callHostCode("getPlayerPosition_v1", playerId)));
}
public function getPlayerIds():Array{
return ((callHostCode("getPlayers_v1") as Array));
}
public function getPlayerNames():Array{
return (getPlayerIds().map(function (playerId:int, o2, o3):String{
return (_game.getOccupantName(playerId));
}));
}
public function getMyPosition():int{
return (int(callHostCode("getMyPosition_v1")));
}
}
}//package com.whirled.game
Section 14
//ServicesSubControl (com.whirled.game.ServicesSubControl)
package com.whirled.game {
import com.whirled.*;
public class ServicesSubControl extends AbstractSubControl {
protected var _bagsCtrl:BagsSubControl;
public function ServicesSubControl(parent:GameControl){
super(parent);
}
public function getDictionaryLetterSet(locale:String, dictionary:String, count:int, callback:Function):void{
callHostCode("getDictionaryLetterSet_v2", locale, dictionary, count, callback);
}
public function stopTicker(tickerName:String):void{
startTicker(tickerName, 0);
}
public function checkDictionaryWord(locale:String, dictionary:String, word:String, callback:Function):void{
callHostCode("checkDictionaryWord_v2", locale, dictionary, word, callback);
}
override protected function createSubControls():Array{
return ([(_bagsCtrl = new BagsSubControl(_parent))]);
}
public function get bags():BagsSubControl{
return (_bagsCtrl);
}
public function startTicker(tickerName:String, msOfDelay:int):void{
callHostCode("setTicker_v1", tickerName, msOfDelay);
}
}
}//package com.whirled.game
Section 15
//SizeChangedEvent (com.whirled.game.SizeChangedEvent)
package com.whirled.game {
import flash.events.*;
import flash.geom.*;
public class SizeChangedEvent extends Event {
protected var _size:Point;
public static const SIZE_CHANGED:String = "SizeChanged";
public function SizeChangedEvent(size:Point){
super(SIZE_CHANGED);
_size = size;
}
public function get size():Point{
return (_size);
}
override public function toString():String{
return ((("[SizeChangedEvent size=" + _size) + "]"));
}
override public function clone():Event{
return (new SizeChangedEvent(_size.clone()));
}
}
}//package com.whirled.game
Section 16
//StateChangedEvent (com.whirled.game.StateChangedEvent)
package com.whirled.game {
import flash.events.*;
public class StateChangedEvent extends Event {
public static const CONTROL_CHANGED:String = "ControlChanged";
public static const ROUND_ENDED:String = "RoundEnded";
public static const GAME_ENDED:String = "GameEnded";
public static const ROUND_STARTED:String = "RoundStarted";
public static const GAME_STARTED:String = "GameStarted";
public static const TURN_CHANGED:String = "TurnChanged";
public function StateChangedEvent(type:String){
super(type);
}
override public function toString():String{
return ((("[StateChangedEvent type=" + type) + "]"));
}
override public function clone():Event{
return (new StateChangedEvent(type));
}
}
}//package com.whirled.game
Section 17
//UserChatEvent (com.whirled.game.UserChatEvent)
package com.whirled.game {
import flash.events.*;
public class UserChatEvent extends Event {
protected var _speaker:int;
protected var _message:String;
public static const USER_CHAT:String = "UserChat";
public function UserChatEvent(speaker:int, message:String){
super(USER_CHAT);
_speaker = speaker;
_message = message;
}
public function get message():String{
return (_message);
}
override public function toString():String{
return ((((("[UserChatEvent speaker=" + _speaker) + ", message=") + _message) + "]"));
}
override public function clone():Event{
return (new UserChatEvent(_speaker, _message));
}
public function get speaker():int{
return (_speaker);
}
}
}//package com.whirled.game
Section 18
//AbstractControl (com.whirled.AbstractControl)
package com.whirled {
import flash.events.*;
import flash.display.*;
import flash.errors.*;
public class AbstractControl extends EventDispatcher {
protected var _funcs:Object;
protected var _subControls:Array;
public function AbstractControl(disp:DisplayObject, initialUserProps:Object=null){
super();
_subControls = createSubControls();
if ((this is AbstractSubControl)){
return;
};
disp.root.loaderInfo.addEventListener(Event.UNLOAD, handleUnload);
var userProps:Object = ((initialUserProps)!=null) ? initialUserProps : new Object();
setUserProps(userProps);
var event:ConnectEvent = new ConnectEvent();
event.props.userProps = userProps;
disp.root.loaderInfo.sharedEvents.dispatchEvent(event);
if (Boolean(event.props.alreadyConnected)){
throw (new Error("You've already set up a Control instance. There should only be one."));
};
var hostProps:Object = event.props.hostProps;
if (hostProps != null){
gotHostProps(hostProps);
};
}
override public function dispatchEvent(event:Event):Boolean{
throw (new IllegalOperationError());
}
protected function createSubControls():Array{
return (null);
}
protected function callHostCode(name:String, ... _args){
var func:Function;
var name = name;
var args = _args;
if (_funcs != null){
func = (_funcs[name] as Function);
if (func != null){
return (func.apply(null, args));
};
//unresolved jump
var _slot1 = err;
trace(_slot1.getStackTrace());
throw (new Error(("Unable to call host code: " + _slot1.message)));
} else {
checkIsConnected();
};
return (undefined);
}
protected function setUserProps(o:Object):void{
var ctrl:AbstractSubControl;
for each (ctrl in _subControls) {
ctrl.setUserPropsFriend(o);
};
}
protected function handleUnload(event:Event):void{
dispatch(event);
}
function callHostCodeFriend(name:String, args:Array){
args.unshift(name);
return (callHostCode.apply(this, args));
}
override public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void{
super.removeEventListener(type, listener, useCapture);
}
override public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void{
super.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
public function doBatch(fn:Function):void{
var fn = fn;
callHostCode("startTransaction");
try {
try {
fn();
} finally {
};
} finally {
callHostCode("commitTransaction");
};
}
protected function checkIsConnected():void{
if (!isConnected()){
throw (new IllegalOperationError(("The control is not connected to the host framework, please check isConnected(). " + "If false, your SWF is being viewed standalone and should adjust.")));
};
}
protected function dispatch(event:Event):void{
var event = event;
super.dispatchEvent(event);
//unresolved jump
var _slot1 = err;
trace("Error dispatching event to user code.");
trace(_slot1.getStackTrace());
}
protected function gotHostProps(o:Object):void{
var ctrl:AbstractSubControl;
_funcs = o;
for each (ctrl in _subControls) {
ctrl.gotHostPropsFriend(o);
};
}
public function isConnected():Boolean{
return (!((_funcs == null)));
}
}
}//package com.whirled
import flash.events.*;
class ConnectEvent extends Event {
public var props:Object;
private function ConnectEvent(propsObj:Object=null){
super("controlConnect", true, false);
props = ((propsObj) || ({}));
}
override public function clone():Event{
return (new ConnectEvent(props));
}
}
Section 19
//AbstractSubControl (com.whirled.AbstractSubControl)
package com.whirled {
import flash.events.*;
public class AbstractSubControl extends AbstractControl {
protected var _parent:AbstractControl;
public function AbstractSubControl(parent:AbstractControl){
_parent = parent;
_parent.addEventListener(Event.UNLOAD, handleUnload);
super(null);
}
function setUserPropsFriend(o:Object):void{
setUserProps(o);
}
override protected function callHostCode(name:String, ... _args){
return (_parent.callHostCodeFriend(name, _args));
}
override public function isConnected():Boolean{
return (_parent.isConnected());
}
function gotHostPropsFriend(o:Object):void{
gotHostProps(o);
}
override public function doBatch(fn:Function):void{
return (_parent.doBatch(fn));
}
}
}//package com.whirled
Section 20
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public function MochiScores(){
super();
}
public static function showLeaderboard(options:Object=null):void{
var options = options;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(callbackObj:Object, callbackMethod:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
public static function requestList(callbackObj:Object, callbackMethod:Object=null):void{
MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
public static function scoresArrayToObjects(scores:Object):Object{
var i:Number;
var j:Number;
var o:Object;
var row_obj:Object;
var item:String;
var param:String;
var so:Object = {};
for (item in scores) {
if (typeof(scores[item]) == "object"){
if (((!((scores[item].cols == null))) && (!((scores[item].rows == null))))){
so[item] = [];
o = scores[item];
j = 0;
while (j < o.rows.length) {
row_obj = {};
i = 0;
while (i < o.cols.length) {
row_obj[o.cols[i]] = o.rows[j][i];
i++;
};
so[item].push(row_obj);
j++;
};
} else {
so[item] = {};
for (param in scores[item]) {
so[item][param] = scores[item][param];
};
};
} else {
so[item] = scores[item];
};
};
return (so);
}
public static function submit(score:Number, name:String, callbackObj:Object=null, callbackMethod:Object=null):void{
MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
public static function onClose(args:Object=null):void{
if (args != null){
if (args.error != null){
if (args.error == true){
if (onErrorHandler != null){
if (args.errorCode == null){
args.errorCode = "IOError";
};
onErrorHandler(args.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(boardID:String):void{
MochiScores.boardID = boardID;
MochiServices.send("scores_setBoardID", {boardID:boardID});
}
}
}//package mochi
Section 21
//MochiServices (mochi.MochiServices)
package mochi {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public function MochiServices(){
super();
}
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(methodName:String, args:Object=null, callbackObject:Object=null, callbackMethod:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(args, callbackObject, callbackMethod);
flush(true);
return;
};
_clip._queue.push({methodName:methodName, args:args, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(error:Boolean):void{
var request:Object;
var callback:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
request = _clip._queue.shift();
callback = null;
if (request != null){
if (request.callbackID != null){
callback = _clip._callbacks[request.callbackID];
};
delete _clip._callbacks[request.callbackID];
if (((error) && (!((callback == null))))){
handleError(request.args, callback.callbackObject, callback.callbackMethod);
};
};
};
};
};
}
private static function clickMovie(url:String, cb:Function):MovieClip{
var b:int;
var loader:Loader;
var avm1_bytecode: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 header:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var footer:Array = [0, 64, 0, 0, 0];
var mc:MovieClip = new MovieClip();
var lc:LocalConnection = new LocalConnection();
var lc_name:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime()));
lc = new LocalConnection();
mc.lc = lc;
mc.click = cb;
lc.client = mc;
lc.connect(lc_name);
var ba:ByteArray = new ByteArray();
var cpool:ByteArray = new ByteArray();
cpool.endian = Endian.LITTLE_ENDIAN;
cpool.writeShort(1);
cpool.writeUTFBytes(((url + " ") + lc_name));
cpool.writeByte(0);
var actionLength:uint = ((avm1_bytecode.length + cpool.length) + 4);
var fileLength:uint = (actionLength + 35);
ba.endian = Endian.LITTLE_ENDIAN;
ba.writeUTFBytes("FWS");
ba.writeByte(8);
ba.writeUnsignedInt(fileLength);
for each (b in header) {
ba.writeByte(b);
};
ba.writeUnsignedInt(actionLength);
ba.writeByte(136);
ba.writeShort(cpool.length);
ba.writeBytes(cpool);
for each (b in avm1_bytecode) {
ba.writeByte(b);
};
for each (b in footer) {
ba.writeByte(b);
};
loader = new Loader();
loader.loadBytes(ba);
mc.addChild(loader);
return (mc);
}
private static function init(id:String, clip:Object):void{
_id = id;
if (clip != null){
_container = clip;
loadCommunicator(id, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(url:String, burl:String, btn:DisplayObjectContainer, onClick:Function=null):void{
var netup:Boolean;
var s:String;
var x:String;
var req:URLRequest;
var loader:Loader;
var err:Function;
var complete:Function;
var setURL:Function;
var url = url;
var burl = burl;
var btn = btn;
var onClick = onClick;
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);
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://x.mochiads.com/linkping.swf");
loader = new Loader();
err = function (ev:Object):void{
netup = false;
ev.target.removeEventListener(ev.type, arguments.callee);
};
complete = function (ev:Object):void{
netup = true;
ev.target.removeEventListener(ev.type, arguments.callee);
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
setURL = function ():void{
var u:String;
if (netup){
u = (url + s);
} else {
u = burl;
};
var avm1Click:DisplayObject = clickMovie(u, onClick);
btn.addChild(avm1Click);
avm1Click.scaleX = (0.01 * btn.width);
avm1Click.scaleY = (0.01 * btn.height);
};
setTimeout(setURL, 1500);
}
public static function getVersion():String{
return ("1.35");
}
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);
_listenChannel.close();
_rcvChannel.close();
//unresolved jump
var _slot1 = error;
};
if (_timer != null){
_timer.stop();
//unresolved jump
var _slot1 = error;
};
}
public static function allowDomains(server:String):String{
var hostname:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (server.indexOf("http://") != -1){
hostname = server.split("/")[2].split(":")[0];
Security.allowDomain(hostname);
Security.allowInsecureDomain(hostname);
};
return (hostname);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(container:Object=null, doAdd:Boolean=true):void{
if (container != null){
if ((container is Sprite)){
_container = container;
};
};
if (doAdd){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(event:StatusEvent):void{
switch (event.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (pkg:Object):void{
var methodName:String;
var pkg = pkg;
var cb:String = pkg.callbackID;
var cblst:Object = this.client._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){
method.apply(obj, pkg.args);
//unresolved jump
var _slot1 = error;
trace(((("Error invoking callback method '" + methodName) + "': ") + pkg.toString()));
} else {
if (obj != null){
obj(pkg.args);
//unresolved jump
var _slot1 = error;
trace(("Error invoking method on object: " + pkg.toString()));
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (args:Object):void{
MochiServices.comChannelName = args.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
private static function handleError(args:Object, callbackObject:Object, callbackMethod:Object):void{
var args = args;
var callbackObject = callbackObject;
var callbackMethod = callbackMethod;
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)))){
var _local5 = callbackObject;
_local5[callbackMethod](args);
//unresolved jump
var _slot1 = error;
} else {
if (callbackMethod != null){
callbackMethod.apply(args);
//unresolved jump
var _slot1 = error;
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(val:String):void{
if (val != null){
if (val.length > 3){
_sendChannelName = (val + "_fromgame");
_rcvChannelName = val;
initComChannels();
};
};
}
private static function loadCommunicator(id:String, clip:Object):MovieClip{
var id = id;
var clip = clip;
var clipname:String = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
var f:Function = function (ev:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
var req:URLRequest = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(e:Event):void{
var e = e;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
//unresolved jump
var _slot1 = errorObject;
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
public static function connect(id:String, clip:Object, onError:Object=null):void{
var id = id;
var clip = clip;
var onError = onError;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (errorCode:String):void{
trace(errorCode);
};
};
};
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number, doAdd:Boolean=true):MovieClip{
var parent = parent;
var name = name;
var depth = depth;
var doAdd = doAdd;
var mc:MovieClip = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
parent[name] = mc;
//unresolved jump
var _slot1 = e;
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
mc["_name"] = name;
return (mc);
}
public static function connectWait(e:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 22
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.0.0.0";
public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
super(bitmapData, pixelSnapping, smoothing);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
}
}//package mx.core
Section 23
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
var bitmapData = bitmapData;
var pixelSnapping = pixelSnapping;
var smoothing = smoothing;
super(bitmapData, pixelSnapping, smoothing);
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 24
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 25
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(void:Point):Point;
function get name():String;
function set width(flash.display:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(flash.display:String):void;
function set scaleX(flash.display:Number):void;
function set scaleY(flash.display:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(flash.display:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(void:Point):Point;
function get height():Number;
function set blendMode(flash.display:String):void;
function get parent():DisplayObjectContainer;
function getBounds(String:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(flash.display:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(flash.display:Number):void;
function set accessibilityProperties(flash.display:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(flash.display:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(flash.display:Number):void;
function set mask(flash.display:DisplayObject):void;
function getRect(String:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(flash.display:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean;
function set opaqueBackground(flash.display:Object):void;
function set visible(flash.display:Boolean):void;
function get mask():DisplayObject;
function set x(flash.display:Number):void;
function set y(flash.display:Number):void;
function get transform():Transform;
function set filters(flash.display:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(flash.display:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 26
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 27
//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 28
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
public function SoundAsset(){
super();
}
}
}//package mx.core
Section 29
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var s:String;
var indices:Array;
var o:DisplayObject = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
return (result);
}
public static function createUniqueName(object:Object):String{
if (!object){
return (null);
};
var name:String = getQualifiedClassName(object);
var index:int = name.indexOf("::");
if (index != -1){
name = name.substr((index + 2));
};
var charCode:int = name.charCodeAt((name.length - 1));
if ((((charCode >= 48)) && ((charCode <= 57)))){
name = (name + "_");
};
return ((name + counter++));
}
}
}//package mx.utils
Section 30
//AddOption (AddOption)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
public class AddOption extends Sprite {
private const BAR_CORNER_SIZE:Number = 20;
private const BAR_WIDTH:Number = 360;
private const BAR_HEIGHT:Number = 24;
private const BORDER_SIZE:Number = 1.5;
private var sound_volume_class:Class;
private var _channel:SoundChannel;
private var _sound:Sound;
private var option_text_image:Bitmap;
private var options_class:Class;
private var music_volume_class:Class;
private var _mtx:Matrix;
private var option_text_bitmap:BitmapData;
private var option_position:int;
private var _transform:SoundTransform;
public function AddOption(){
_mtx = new Matrix();
music_volume_class = AddOption_music_volume_class;
sound_volume_class = AddOption_sound_volume_class;
options_class = AddOption_options_class;
super();
}
public function onEnterFrame(event:Event):void{
var _local2:int;
var _local3:int;
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_OPTIONS:
mouseEnabled = (option_position > -1);
visible = true;
if (this.alpha < 1){
this.alpha = (this.alpha + Bomboozle.FADE_SPEED);
};
graphics.clear();
_local2 = ((Bomboozle.STAGE_WIDTH - option_text_bitmap.width) / 2);
_local3 = ((Bomboozle.STAGE_HEIGHT * 0.25) + (this.option_position * (option_text_image.height * 1.3)));
if (option_position == -1){
_local3 = (_local3 - option_text_bitmap.height);
};
_mtx = new Matrix();
_mtx.translate(_local2, _local3);
graphics.beginBitmapFill(option_text_bitmap, _mtx, false, false);
graphics.drawRect(_local2, _local3, option_text_image.width, option_text_image.height);
if (option_position > -1){
_local2 = ((Bomboozle.STAGE_WIDTH - BAR_WIDTH) / 2);
_local3 = (_local3 + (option_text_bitmap.height * 0.575));
graphics.beginFill(8110176);
graphics.drawRoundRect((_local2 - (BORDER_SIZE * 2)), (_local3 - (BORDER_SIZE * 2)), (BAR_WIDTH + (BORDER_SIZE * 4)), (BAR_HEIGHT + (BORDER_SIZE * 4)), BAR_CORNER_SIZE, BAR_CORNER_SIZE);
graphics.beginFill(((option_position == 0)) ? 15147288 : 1065628);
graphics.drawRoundRect(_local2, _local3, (BAR_WIDTH * ((option_position == 0)) ? Bomboozle.music_volume : Bomboozle.sound_volume), BAR_HEIGHT, (BAR_CORNER_SIZE * 0.75), (BAR_CORNER_SIZE * 0.75));
graphics.beginFill(0xFFFFFF, 0.7);
graphics.drawRoundRect((_local2 + (BORDER_SIZE * 3)), (_local3 + 2), (BAR_WIDTH - (BORDER_SIZE * 6)), (BAR_HEIGHT / 5), (BAR_CORNER_SIZE * 0.2), (BAR_CORNER_SIZE * 0.2));
};
break;
default:
mouseEnabled = false;
if (this.alpha > 0){
this.alpha = (this.alpha - Bomboozle.FADE_SPEED);
};
break;
};
}
public function optionClicked(event:MouseEvent):void{
var bar_value:Number;
var bar_x = ((Bomboozle.STAGE_WIDTH - BAR_WIDTH) >> 1);
if ((((mouseX >= bar_x)) && ((mouseX <= (bar_x + BAR_WIDTH))))){
bar_value = ((mouseX - bar_x) / BAR_WIDTH);
trace(("bar_value = " + bar_value));
switch (option_position){
case 0:
if (ProgressBar._sound != null){
if (bar_value < 0.05){
Bomboozle.music_volume = 0;
ProgressBar._transform.volume = Bomboozle.music_volume;
ProgressBar._channel.stop();
} else {
if (Bomboozle.music_volume == 0){
ProgressBar._channel = ProgressBar._sound.play(0, int.MAX_VALUE);
};
Bomboozle.music_volume = bar_value;
ProgressBar._transform.volume = Bomboozle.music_volume;
ProgressBar._channel.soundTransform = ProgressBar._transform;
};
};
break;
case 1:
if (bar_value < 0.05){
bar_value = 0;
};
Bomboozle.sound_volume = bar_value;
PlaySample.playSound(PlaySample.SOUND_BOMB_AWARDED, 0);
break;
};
};
}
public function init($i:int):void{
option_position = $i;
switch ($i){
case -1:
option_text_image = new options_class();
break;
case 0:
option_text_image = new music_volume_class();
break;
case 1:
option_text_image = new sound_volume_class();
break;
};
option_text_bitmap = new BitmapData(option_text_image.width, option_text_image.height, true, 0xFFFFFF);
option_text_bitmap.draw(option_text_image, new Matrix());
addEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(MouseEvent.MOUSE_DOWN, optionClicked);
this.alpha = 0;
}
}
}//package
Section 31
//AddOption_music_volume_class (AddOption_music_volume_class)
package {
import mx.core.*;
public class AddOption_music_volume_class extends BitmapAsset {
}
}//package
Section 32
//AddOption_options_class (AddOption_options_class)
package {
import mx.core.*;
public class AddOption_options_class extends BitmapAsset {
}
}//package
Section 33
//AddOption_sound_volume_class (AddOption_sound_volume_class)
package {
import mx.core.*;
public class AddOption_sound_volume_class extends BitmapAsset {
}
}//package
Section 34
//BackButton (BackButton)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class BackButton extends Sprite {
private var backIconClass:Class;
private var icon_back:Bitmap;
public function BackButton(){
backIconClass = BackButton_backIconClass;
super();
}
public function init():void{
icon_back = new backIconClass();
alpha = 0;
addChild(icon_back);
addEventListener(MouseEvent.MOUSE_OVER, mouseOverIcon);
addEventListener(MouseEvent.MOUSE_OUT, mouseOffIcon);
addEventListener(MouseEvent.MOUSE_DOWN, iconClicked);
addEventListener(Event.ENTER_FRAME, step);
}
private function mouseOverIcon(event:MouseEvent):void{
if (this.alpha >= 1){
PlaySample.playSound(PlaySample.SOUND_OVER_ICON, 1);
};
}
private function mouseOffIcon(event:MouseEvent):void{
var color:ColorTransform = this.transform.colorTransform;
color.blueMultiplier = (color.redMultiplier = (color.greenMultiplier = 1));
this.transform.colorTransform = color;
}
public function step(event:Event):void{
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_SELECT_GAME:
case Bomboozle.GAME_STATE_OPTIONS:
case Bomboozle.GAME_STATE_CREDITS:
case Bomboozle.GAME_STATE_CHOOSE_LEADERBOARD:
this.x = ((Bomboozle.STAGE_WIDTH - this.width) / 2);
this.y = (Bomboozle.STAGE_HEIGHT * 0.85);
if (this.alpha < 1){
this.alpha = (this.alpha + (Bomboozle.FADE_SPEED / 4));
};
break;
default:
if (this.alpha > 0){
this.alpha = (this.alpha - Bomboozle.FADE_SPEED);
};
break;
};
this.mouseEnabled = (this.alpha >= 1);
this.visible = (this.alpha > 0);
}
private function iconClicked(event:MouseEvent):void{
trace("iconClicked");
if (this.alpha < 1){
return;
};
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_OPTIONS:
case Bomboozle.GAME_STATE_CREDITS:
case Bomboozle.GAME_STATE_SELECT_GAME:
case Bomboozle.GAME_STATE_CHOOSE_LEADERBOARD:
PlaySample.playSound(PlaySample.SOUND_SELECT, 0);
this.scaleX = 1;
this.scaleY = 1;
Bomboozle.resetTitle();
break;
};
}
}
}//package
Section 35
//BackButton_backIconClass (BackButton_backIconClass)
package {
import mx.core.*;
public class BackButton_backIconClass extends BitmapAsset {
}
}//package
Section 36
//Background (Background)
package {
import flash.events.*;
import flash.display.*;
public class Background extends Sprite {
private var sea_class:Class;
private var hills_class:Class;
private var cloud_image:Bitmap;
private var grass_image:Bitmap;
private var cloud_small_image:Bitmap;
private var bg_image:Bitmap;
private var sea_image2:Bitmap;
private var sea_image:Bitmap;
private var cloud_class:Class;
private var grass_class:Class;
private var hills_image:Bitmap;
private var cloud_small_class:Class;
private var boat_class:Class;
private var bg_class:Class;
public static var hill_bounce_angle:Number;
public static var boat_image:Bitmap;
public function Background(){
bg_class = Background_bg_class;
grass_class = Background_grass_class;
sea_class = Background_sea_class;
hills_class = Background_hills_class;
cloud_class = Background_cloud_class;
cloud_small_class = Background_cloud_small_class;
boat_class = Background_boat_class;
super();
}
public function step(event:Event):void{
switch (Bomboozle.game_state){
default:
cloud_image.x--;
cloud_image.height = ((1 + (Math.sin(Logo.scenery_bounce_angle) / 16)) * cloud_image.bitmapData.height);
cloud_image.y = ((Bomboozle.STAGE_HEIGHT * 0.15) - (cloud_image.height / 2));
if (cloud_image.x < -(cloud_image.width)){
cloud_image.x = Bomboozle.STAGE_WIDTH;
};
cloud_small_image.x = (cloud_small_image.x - 0.5);
cloud_small_image.height = ((1 + (Math.sin(Logo.scenery_bounce_angle) / 32)) * cloud_small_image.bitmapData.height);
cloud_small_image.y = ((Bomboozle.STAGE_HEIGHT * 0.4) - (cloud_small_image.height / 2));
if (cloud_small_image.x < -(cloud_small_image.width)){
cloud_small_image.x = Bomboozle.STAGE_WIDTH;
};
hill_bounce_angle = (hill_bounce_angle + 0.2);
hills_image.height = ((1 + (Math.sin(Logo.scenery_bounce_angle) / 16)) * hills_image.bitmapData.height);
hills_image.y = ((Bomboozle.STAGE_HEIGHT * 0.77) - hills_image.height);
sea_image.x = (sea_image.x + 1);
sea_image2.x = (sea_image2.x + 1);
sea_image.y = (sea_image2.y = ((Bomboozle.STAGE_HEIGHT * 0.65) + ((1 + (Math.sin(Logo.scenery_bounce_angle) / 6)) * 32)));
if (sea_image.x >= sea_image.width){
sea_image.x = -(sea_image.width);
};
if (sea_image2.x >= sea_image2.width){
sea_image2.x = -(sea_image2.width);
};
if ((((((Blocks.groups_made >= (Bomboozle.NEW_COLOUR_CHAIN_THRESHOLD * 0.7))) || ((boat_image.x > 0)))) && ((boat_image.x < Bomboozle.STAGE_WIDTH)))){
boat_image.x++;
boat_image.y = ((Bomboozle.STAGE_HEIGHT * 0.56) - ((1 + (Math.sin(Logo.scenery_bounce_angle) / 6)) * 32));
};
visible = true;
break;
case Bomboozle.GAME_STATE_PAUSED:
break;
};
}
public function init():void{
hill_bounce_angle = 0;
bg_image = new bg_class();
boat_image = new boat_class();
cloud_image = new cloud_class();
cloud_small_image = new cloud_small_class();
sea_image = new sea_class();
sea_image2 = new sea_class();
hills_image = new hills_class();
grass_image = new grass_class();
addChild(bg_image);
cloud_image.x = Bomboozle.STAGE_WIDTH;
addChild(cloud_image);
cloud_small_image.x = Bomboozle.STAGE_WIDTH;
addChild(cloud_small_image);
addChild(hills_image);
addChild(boat_image);
boat_image.x = -300;
sea_image2.x = -(sea_image.width);
addChild(sea_image);
addChild(sea_image2);
grass_image.y = (Bomboozle.STAGE_HEIGHT - grass_image.height);
addChild(grass_image);
addEventListener(Event.ENTER_FRAME, step);
visible = false;
}
}
}//package
Section 37
//Background_bg_class (Background_bg_class)
package {
import mx.core.*;
public class Background_bg_class extends BitmapAsset {
}
}//package
Section 38
//Background_boat_class (Background_boat_class)
package {
import mx.core.*;
public class Background_boat_class extends BitmapAsset {
}
}//package
Section 39
//Background_cloud_class (Background_cloud_class)
package {
import mx.core.*;
public class Background_cloud_class extends BitmapAsset {
}
}//package
Section 40
//Background_cloud_small_class (Background_cloud_small_class)
package {
import mx.core.*;
public class Background_cloud_small_class extends BitmapAsset {
}
}//package
Section 41
//Background_grass_class (Background_grass_class)
package {
import mx.core.*;
public class Background_grass_class extends BitmapAsset {
}
}//package
Section 42
//Background_hills_class (Background_hills_class)
package {
import mx.core.*;
public class Background_hills_class extends BitmapAsset {
}
}//package
Section 43
//Background_sea_class (Background_sea_class)
package {
import mx.core.*;
public class Background_sea_class extends BitmapAsset {
}
}//package
Section 44
//BitmapText (BitmapText)
package {
import flash.display.*;
import flash.geom.*;
public class BitmapText extends Sprite {
private var time_numbers_class:Class;
private var bonus_numbers_class:Class;
private var time_bubble_class:Class;
private var score_numbers_class:Class;
public static const TIME_FONT:int = 2;
public static const BONUS_FONT:int = 1;
public static const SCORE_FONT:int = 0;
public static var score_numbers_image:Bitmap;
public static var bonus_numbers_image:Bitmap;
public static var time_bubble_bitmap:BitmapData;
public static var score_numbers_bitmap:BitmapData;
public static var font_width:int;
public static var font_height:int;
public static var time_bubble_image:Bitmap;
public static var bonus_numbers_bitmap:BitmapData;
public static var _mtx:Matrix = new Matrix();
public static var time_numbers_image:Bitmap;
public static var time_numbers_bitmap:BitmapData;
public function BitmapText(){
score_numbers_class = BitmapText_score_numbers_class;
bonus_numbers_class = BitmapText_bonus_numbers_class;
time_numbers_class = BitmapText_time_numbers_class;
time_bubble_class = BitmapText_time_bubble_class;
super();
}
public function init():void{
mouseEnabled = false;
score_numbers_image = new score_numbers_class();
bonus_numbers_image = new bonus_numbers_class();
time_numbers_image = new time_numbers_class();
time_bubble_image = new time_bubble_class();
font_width = score_numbers_image.width;
font_height = (score_numbers_image.height / 10);
score_numbers_bitmap = new BitmapData(score_numbers_image.width, score_numbers_image.height, false);
score_numbers_bitmap.draw(score_numbers_image, new Matrix());
bonus_numbers_bitmap = new BitmapData(bonus_numbers_image.width, bonus_numbers_image.height, false);
bonus_numbers_bitmap.draw(bonus_numbers_image, new Matrix());
time_numbers_bitmap = new BitmapData(time_numbers_image.width, time_numbers_image.height, false);
time_numbers_bitmap.draw(time_numbers_image, new Matrix());
time_bubble_bitmap = new BitmapData(time_bubble_image.width, time_bubble_image.height, true, 0xFFFFFF);
time_bubble_bitmap.draw(time_bubble_image, new Matrix());
}
public static function drawNumber(_graphics:Graphics, _number:int, _x:int, _y:int, _alignment:String, _number_font:int):void{
var digit_value:*;
if (_number_font == TIME_FONT){
_mtx = new Matrix();
_mtx.translate((_x - 47), (_y - 30));
_graphics.beginBitmapFill(time_bubble_bitmap, _mtx, false, false);
_graphics.drawRect((_x - 47), (_y - 30), time_bubble_bitmap.width, time_bubble_bitmap.height);
};
var num:int;
var digits:int = _number.toString().length;
var a:int = digits;
if (_alignment == "centred"){
_x = (_x + ((digits * font_width) / 2));
} else {
if (_alignment == "left"){
_x = (_x + (digits * font_width));
};
};
do {
num = (num * 10);
num = (num + (_number % 10));
_number = (_number / 10);
--a;
} while (a > 0);
a = digits;
do {
digit_value = (num % 10);
_mtx = new Matrix();
_mtx.translate((_x - (a * font_width)), (_y - (digit_value * font_height)));
_graphics.beginBitmapFill(((_number_font == SCORE_FONT)) ? score_numbers_bitmap : ((_number_font == BONUS_FONT)) ? bonus_numbers_bitmap : time_numbers_bitmap, _mtx, false, false);
_graphics.drawRect((_x - (a * font_width)), _y, font_width, font_height);
num = (num / 10);
--a;
} while (a > 0);
_graphics.endFill();
}
}
}//package
Section 45
//BitmapText_bonus_numbers_class (BitmapText_bonus_numbers_class)
package {
import mx.core.*;
public class BitmapText_bonus_numbers_class extends BitmapAsset {
}
}//package
Section 46
//BitmapText_score_numbers_class (BitmapText_score_numbers_class)
package {
import mx.core.*;
public class BitmapText_score_numbers_class extends BitmapAsset {
}
}//package
Section 47
//BitmapText_time_bubble_class (BitmapText_time_bubble_class)
package {
import mx.core.*;
public class BitmapText_time_bubble_class extends BitmapAsset {
}
}//package
Section 48
//BitmapText_time_numbers_class (BitmapText_time_numbers_class)
package {
import mx.core.*;
public class BitmapText_time_numbers_class extends BitmapAsset {
}
}//package
Section 49
//Blocks (Blocks)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.external.*;
import flash.filters.*;
public dynamic class Blocks extends Sprite {
public const TROPHY_25_BLOB:int = 4;
public const PARTICLE_SIZE:int = 20;
public const PARTICLE_SPEED:int = 20;
public const TROPHY_5_SKULLS:int = 12;
public const TROPHY_100_BLOBS:int = 9;
public const TROPHY_30_BLOB:int = 5;
public const TROPHY_100_CHAINS:int = 7;
public const MAX_PARTICLES:int = 128;
public const TROPHY_500_BLOBS:int = 10;
public const TROPHY_5_BOMBS:int = 16;
public const TROPHY_5_BLOB:int = 0;
public const TROPHY_10_PURPLES:int = 14;
public const TROPHY_200_CHAINS:int = 8;
public const TROPHY_10_SKULLS:int = 13;
public const TROPHY_50_CHAINS:int = 6;
public const TROPHY_10_BLOB:int = 1;
public const TROPHY_15_BLOB:int = 2;
public const TROPHY_3_BOMBS:int = 15;
public const PARTICLE_SHRINK:Number = 0.5;
public const TROPHY_1000_BLOBS:int = 11;
public const TROPHY_20_BLOB:int = 3;
public var particle_y:Array;
private var blob_red_image:Bitmap;
private var blob_wildcard_image_class:Class;
private var blob_blue_bitmap:BitmapData;
private var blob_blue_image:Bitmap;
public var particle_size:Array;
public var particle_vx:Array;
public var particle_vy:Array;
private var blob_yellow_image:Bitmap;
private var blob_yellow_image_class:Class;
private var marker_skull_bitmap:BitmapData;
private var blob_yellow_bitmap:BitmapData;
private var blob_red_image_class:Class;
private var blob_green_image_class:Class;
private var blob_green_bitmap:BitmapData;
private var blob_skull_image:Bitmap;
private var blob_bomb_image:Bitmap;
private var blob_purple_image_class:Class;
private var marker_skull_image:Bitmap;
private var blob_purple_image:Bitmap;
private var blob_green_image:Bitmap;
private var blob_red_bitmap:BitmapData;
private var blob_skull_image_class:Class;
private var blob_blue_image_class:Class;
private var blob_wildcard_bitmap:BitmapData;
private var blob_wildcard_image:Bitmap;
private var marker_bomb_image:Bitmap;
public var particle_colour:Array;
private var hint_arrow_image_class:Class;
private var board_bitmap:BitmapData;
private var blob_skull_bitmap:BitmapData;
private var board_image_class:Class;
private var board_image:Bitmap;
private var blob_bomb_bitmap:BitmapData;
public var particle_index:int;
private var marker_bomb_image_class:Class;
private var blobs_surprised_image_class:Class;
private var marker_skull_image_class:Class;
private var marker_bomb_bitmap:BitmapData;
private var blob_purple_bitmap:BitmapData;
private var blob_bomb_image_class:Class;
public var _mtx:Matrix;
private var blobs_surprised_image:Bitmap;
private var blobs_surprised_bitmap:BitmapData;
public var particle_x:Array;
public static const BLOB_BOMB:int = 7;
public static const BLOB_SKULL:int = 5;
public static const BOARD_X:int = 40;
public static const COLOR_ARRAY:Array = [15415321, 16567302, 3715912, 112577, 7951521, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF];
public static const BLOB_WILDCARD:int = 6;
public static const BOARD_COLUMNS:int = 7;
public static const BLOB_SIZE:int = 40;
public static const BOARD_START_XO:int = -640;
public static const trophy_strings:Array = ["5 Blob Chain", "10 Blob Chain", "15 Blob Chain", "20 Blob Chain", "25 Blob Chain", "30 Blob Chain", "50 Chains", "100 Chains", "200 Chains", "100 Blobs", "500 Blobs", "1000 Blobs", "5 Skull Chain", "10 Skull Chain", "10 Purple Chain", "3 Bombs", "5 Bombs"];
public static const BOARD_CELLS:int = 77;
public static const BLOB_GRAVITY:Number = 1;
public static const FALL_DELAY:int = 10;
public static const PATH_CHECK_X:Array = [-1, -2, 0, 0, 1, 2, 0, 0, -1, -1, 0, -1, 1, 1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];
public static const PATH_CHECK_Y:Array = [0, 0, -1, -2, 0, 0, 1, 2, 0, 1, -1, -1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1];
public static const BOARD_ROWS:int = 12;
public static const BOARD_HEIGHT:int = 440;
public static const BOARD_WIDTH:int = 280;
public static const BOMB_THRESHOLD:int = 6;
public static var blobs_in_line:int;
public static var cursor_active:Boolean = false;
public static var line_colour_index:int;
public static var BOARD_Y:int;
public static var hint_bounce_angle:Number = 0;
public static var blob_explosion_x:Array = new Array(BOARD_CELLS);
public static var blob_explosion_y:Array = new Array(BOARD_CELLS);
public static var mouse_column:int;
public static var mouse_row:int;
public static var marker_bounce_angle:Number = 0;
public static var grid:Array = new Array();
public static var cursor_column:int;
public static var cursor_row:int;
public static var ticks:int = 0;
public static var hint_timer:int;
public static var groups_left:int;
public static var total_blobs_destroyed:int;
public static var bombs_detonated:int;
public static var waiting_for_blobs_to_settle:Boolean;
public static var groups_made:int;
public static var found_hint_group:Boolean;
public static var blob_gravity:Array = new Array();
public static var trophy_awarded:Array = new Array(trophy_strings.length);
public static var bomb_explosion:Array = new Array();
public static var prev_mouse_blob_x:int;
public static var prev_mouse_blob_y:int;
public static var fall_delay:int;
public static var hint_y:int;
public static var longest_chain:int = 0;
public static var hint_x:int;
public static var maskSprite:Sprite = new Sprite();
public static var blob_counter_x:Number;
public static var blob_counter_y:Number;
public static var blobs_exploding:Boolean;
public static var hint_arrow_bitmap:BitmapData;
public static var blob_explosions:int = 0;
public static var blobs_still_falling:Boolean;
public static var hint_arrow_image:Bitmap;
public static var blob_lit:Array = new Array();
public static var board_xo:int;
public static var blob_yo:Array = new Array();
public static var blob_explosion_timer:int;
public function Blocks(stageRef:Stage){
particle_x = new Array(MAX_PARTICLES);
particle_y = new Array(MAX_PARTICLES);
particle_vx = new Array(MAX_PARTICLES);
particle_vy = new Array(MAX_PARTICLES);
particle_colour = new Array(MAX_PARTICLES);
particle_size = new Array(MAX_PARTICLES);
marker_skull_image_class = Blocks_marker_skull_image_class;
marker_bomb_image_class = Blocks_marker_bomb_image_class;
hint_arrow_image_class = Blocks_hint_arrow_image_class;
board_image_class = Blocks_board_image_class;
blob_red_image_class = Blocks_blob_red_image_class;
blob_yellow_image_class = Blocks_blob_yellow_image_class;
blob_green_image_class = Blocks_blob_green_image_class;
blob_blue_image_class = Blocks_blob_blue_image_class;
blob_purple_image_class = Blocks_blob_purple_image_class;
blob_wildcard_image_class = Blocks_blob_wildcard_image_class;
blob_bomb_image_class = Blocks_blob_bomb_image_class;
blob_skull_image_class = Blocks_blob_skull_image_class;
blobs_surprised_image_class = Blocks_blobs_surprised_image_class;
_mtx = new Matrix();
super();
board_image = new board_image_class();
marker_skull_image = new marker_skull_image_class();
marker_bomb_image = new marker_bomb_image_class();
hint_arrow_image = new hint_arrow_image_class();
blob_red_image = new blob_red_image_class();
blob_yellow_image = new blob_yellow_image_class();
blob_green_image = new blob_green_image_class();
blob_blue_image = new blob_blue_image_class();
blob_purple_image = new blob_purple_image_class();
blob_wildcard_image = new blob_wildcard_image_class();
blob_bomb_image = new blob_bomb_image_class();
blob_skull_image = new blob_skull_image_class();
blobs_surprised_image = new blobs_surprised_image_class();
BOARD_Y = ((Bomboozle.STAGE_HEIGHT - BOARD_HEIGHT) >> 1);
init();
}
public function drawBlob(_last_tile:Boolean, _highlighted:Boolean, _colour_index:int, _x:Number, _y:Number):void{
_mtx = new Matrix();
if (((_highlighted) && (blobs_exploding))){
_mtx.translate((_x - (_colour_index * BLOB_SIZE)), _y);
graphics.beginBitmapFill(blobs_surprised_bitmap, _mtx, false, false);
} else {
_mtx.translate(_x, _y);
switch (_colour_index){
case BLOB_WILDCARD:
graphics.beginBitmapFill(blob_wildcard_bitmap, _mtx, false, false);
break;
case BLOB_BOMB:
graphics.beginBitmapFill(blob_bomb_bitmap, _mtx, false, false);
break;
case 0:
graphics.beginBitmapFill(blob_red_bitmap, _mtx, false, false);
break;
case 1:
graphics.beginBitmapFill(blob_yellow_bitmap, _mtx, false, false);
break;
case 2:
graphics.beginBitmapFill(blob_green_bitmap, _mtx, false, false);
break;
case 3:
graphics.beginBitmapFill(blob_blue_bitmap, _mtx, false, false);
break;
case 4:
graphics.beginBitmapFill(blob_purple_bitmap, _mtx, false, false);
break;
case 5:
graphics.beginBitmapFill(blob_skull_bitmap, _mtx, false, false);
break;
};
};
graphics.drawRect(_x, Math.max(_y, BOARD_Y), BLOB_SIZE, (BLOB_SIZE - ((_y < BOARD_Y)) ? (BOARD_Y - _y) : 0));
graphics.endFill();
if (((((!(blobs_exploding)) && (_highlighted))) && (((ticks % 8) < 4)))){
graphics.beginFill(0xFFFFFF, 0.7);
graphics.drawRect(_x, _y, BLOB_SIZE, BLOB_SIZE);
};
}
public function drawBoard(event:Event):void{
var _local4:Number;
var _local5:Number;
var _local6:int;
var x:int;
var i:int;
var y:int;
var blob_y:Number;
var marker_x:int;
var marker_y:Number;
var new_hint_x:Number;
var new_hint_y:Number;
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
case Bomboozle.GAME_STATE_PAUSED:
case Bomboozle.GAME_STATE_OVER:
_local4 = (board_xo + BOARD_X);
graphics.clear();
_local5 = ((_local4 + ((BOARD_COLUMNS * BLOB_SIZE) >> 1)) - (board_image.width >> 1));
_local6 = ((Bomboozle.STAGE_HEIGHT - board_image.height) >> 1);
_mtx = new Matrix();
_mtx.translate(_local5, _local6);
graphics.beginBitmapFill(board_bitmap, _mtx, false, false);
graphics.drawRect(_local5, _local6, board_image.width, board_image.height);
graphics.endFill();
if ((((Bomboozle.game_state == Bomboozle.GAME_STATE_PAUSED)) && ((Bomboozle.game_type == Bomboozle.GAME_TYPE_TIMED)))){
} else {
x = 0;
while (x < BOARD_COLUMNS) {
y = (BOARD_ROWS - 1);
while (y >= 0) {
if (grid[x][y] != -1){
blob_y = ((BOARD_Y + ((y - 1) * BLOB_SIZE)) + blob_yo[x][y]);
if (blob_yo[x][y] >= BLOB_SIZE){
blob_y = (blob_y - (blob_yo[x][y] % BLOB_SIZE));
};
drawBlob((((x == cursor_column)) && ((y == cursor_row))), (blob_lit[x][y] > 0), grid[x][y], (_local4 + (x * BLOB_SIZE)), blob_y);
};
y--;
};
x++;
};
graphics.endFill();
i = 0;
while (i < MAX_PARTICLES) {
if (particle_size[i] > 0){
graphics.beginFill(particle_colour[i], 1);
graphics.drawCircle((particle_x[i] - (particle_size[i] / 2)), (particle_y[i] - (particle_size[i] / 2)), (particle_size[i] / 2));
};
i++;
};
x = 0;
while (x < BOARD_COLUMNS) {
y = 1;
while (y < BOARD_ROWS) {
if (bomb_explosion[x][y] != -1){
Explosion.drawExplosion(graphics, bomb_explosion[x][y], ((BOARD_X + (x * BLOB_SIZE)) + (BLOB_SIZE * 0.5)), ((BOARD_Y + ((y - 1) * BLOB_SIZE)) + (BLOB_SIZE * 0.5)));
if ((ticks % 3) == 0){
var _local13 = bomb_explosion[x];
var _local14 = y;
var _local15 = (_local13[_local14] + 1);
_local13[_local14] = _local15;
if (_local15 >= Explosion.ANIM_FRAMES){
bomb_explosion[x][y] = -1;
};
};
};
y++;
};
x++;
};
};
if (cursor_active){
if ((((((((Bomboozle.game_type == Bomboozle.GAME_TYPE_SKULL)) || (Bomboozle.FROSMO_VERSION))) && ((blobs_in_line == 3)))) || ((blobs_in_line >= BOMB_THRESHOLD)))){
marker_bounce_angle = (marker_bounce_angle + 1);
marker_x = (((BOARD_X + (mouse_column * BLOB_SIZE)) + (BLOB_SIZE * 0.5)) - (marker_bomb_image.width / 2));
marker_y = ((BOARD_Y - marker_bomb_image.height) + ((Math.sin(marker_bounce_angle) / 16) * 32));
_mtx = new Matrix();
_mtx.translate(marker_x, marker_y);
graphics.beginBitmapFill(((blobs_in_line == 3)) ? marker_skull_bitmap : marker_bomb_bitmap, _mtx, false, false);
graphics.drawRect(marker_x, marker_y, marker_bomb_image.width, marker_bomb_image.height);
graphics.endFill();
};
};
if (((((!(cursor_active)) && ((Bomboozle.game_state == Bomboozle.GAME_STATE_GAME)))) && (!(waiting_for_blobs_to_settle)))){
if (++hint_timer > 150){
hint_timer = (-(Math.random()) * 50);
};
if (hint_timer > 100){
hint_bounce_angle = (hint_bounce_angle + 0.5);
new_hint_x = (hint_x - ((Math.sin(hint_bounce_angle) / 16) * 64));
new_hint_y = (hint_y - ((Math.sin(hint_bounce_angle) / 16) * 64));
_mtx = new Matrix();
_mtx.translate(new_hint_x, new_hint_y);
graphics.beginBitmapFill(hint_arrow_bitmap, _mtx, false, false);
graphics.drawRect(new_hint_x, new_hint_y, hint_arrow_image.width, hint_arrow_image.height);
graphics.endFill();
};
};
if (Bomboozle.game_type == Bomboozle.GAME_TYPE_TIMED){
BitmapText.drawNumber(graphics, Bomboozle.game_time, 570, 260, "centred", BitmapText.TIME_FONT);
};
break;
default:
break;
};
}
public function addParticles(_x:int, _y:int, _line_colour_index:int):void{
var i:int;
while (i < 8) {
particle_x[particle_index] = _x;
particle_y[particle_index] = _y;
particle_colour[particle_index] = COLOR_ARRAY[_line_colour_index];
particle_size[particle_index] = PARTICLE_SIZE;
particle_vx[particle_index] = (-((PARTICLE_SPEED / 2)) + (Math.random() * PARTICLE_SPEED));
particle_vy[particle_index] = (-((PARTICLE_SPEED / 2)) + (Math.random() * PARTICLE_SPEED));
if (++particle_index >= MAX_PARTICLES){
particle_index = 0;
};
i++;
};
}
public function init():void{
line_colour_index = -1;
blobs_in_line = 0;
board_xo = BOARD_START_XO;
board_bitmap = new BitmapData(board_image.width, board_image.height, true, 0xFFFFFF);
board_bitmap.draw(board_image, new Matrix());
marker_bomb_bitmap = new BitmapData(marker_bomb_image.width, marker_bomb_image.height, true, 0xFFFFFF);
marker_bomb_bitmap.draw(marker_bomb_image, new Matrix());
marker_skull_bitmap = new BitmapData(marker_skull_image.width, marker_skull_image.height, true, 0xFFFFFF);
marker_skull_bitmap.draw(marker_skull_image, new Matrix());
hint_arrow_bitmap = new BitmapData(hint_arrow_image.width, hint_arrow_image.height, true, 0xFFFFFF);
hint_arrow_bitmap.draw(hint_arrow_image, new Matrix());
blob_red_bitmap = new BitmapData(BLOB_SIZE, BLOB_SIZE);
blob_red_bitmap.draw(blob_red_image, new Matrix());
blob_yellow_bitmap = new BitmapData(BLOB_SIZE, BLOB_SIZE);
blob_yellow_bitmap.draw(blob_yellow_image, new Matrix());
blob_green_bitmap = new BitmapData(BLOB_SIZE, BLOB_SIZE);
blob_green_bitmap.draw(blob_green_image, new Matrix());
blob_blue_bitmap = new BitmapData(BLOB_SIZE, BLOB_SIZE);
blob_blue_bitmap.draw(blob_blue_image, new Matrix());
blob_purple_bitmap = new BitmapData(BLOB_SIZE, BLOB_SIZE);
blob_purple_bitmap.draw(blob_purple_image, new Matrix());
blob_wildcard_bitmap = new BitmapData(BLOB_SIZE, BLOB_SIZE);
blob_wildcard_bitmap.draw(blob_wildcard_image, new Matrix());
blob_bomb_bitmap = new BitmapData(BLOB_SIZE, BLOB_SIZE);
blob_bomb_bitmap.draw(blob_bomb_image, new Matrix());
blob_skull_bitmap = new BitmapData(BLOB_SIZE, BLOB_SIZE);
blob_skull_bitmap.draw(blob_skull_image, new Matrix());
blobs_surprised_bitmap = new BitmapData(blobs_surprised_image.width, BLOB_SIZE);
blobs_surprised_bitmap.draw(blobs_surprised_image, new Matrix());
blobs_still_falling = false;
waiting_for_blobs_to_settle = false;
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
addEventListener(MouseEvent.MOUSE_UP, mouseUp);
addEventListener(Event.ENTER_FRAME, step);
addEventListener(Event.ENTER_FRAME, drawBoard);
addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
maskSprite.graphics.beginFill(0xFFFFFF);
maskSprite.graphics.drawRect(0, 0, Bomboozle.STAGE_WIDTH, Bomboozle.STAGE_HEIGHT);
this.addChild(maskSprite);
this.mask = maskSprite;
}
public function addTileToChain(_column:int, _row:int):void{
if ((((blobs_in_line > 0)) && (((Math.abs((cursor_column - _column)) + Math.abs((cursor_row - _row))) > 1)))){
cancelLine();
} else {
if (((((((((blobIsOnBoard(_column, _row)) && ((((blobs_in_line > 0)) || (tileIsWithinGroup(_column, _row, grid[_column][_row])))))) && ((((((grid[_column][_row] == line_colour_index)) || ((line_colour_index < 0)))) || ((grid[_column][_row] == BLOB_WILDCARD)))))) && ((blob_lit[_column][_row] < 1)))) && (!((grid[_column][_row] == -1))))){
if ((((line_colour_index < 0)) && (!((grid[_column][_row] == BLOB_WILDCARD))))){
line_colour_index = grid[_column][_row];
};
if ((((blobs_in_line < 1)) || (((Math.abs((cursor_column - _column)) + Math.abs((cursor_row - _row))) < 2)))){
if (!cursor_active){
cursor_active = true;
Path.clear_path = true;
Path.prev_mouseX = mouseX;
Path.prev_mouseY = mouseY;
blob_explosions = 0;
PlaySample.playSound(PlaySample.SOUND_ACTIVATE, 0);
} else {
PlaySample.playSound(PlaySample.SOUND_ADD_BLOB, 0);
};
prev_mouse_blob_x = mouseX;
prev_mouse_blob_y = mouseY;
blob_lit[_column][_row] = 1;
cursor_column = _column;
cursor_row = _row;
blobs_in_line++;
blob_explosion_x[blob_explosions] = _column;
blob_explosion_y[blob_explosions] = _row;
blob_explosions++;
};
} else {
cancelLine();
};
};
}
public function mouseMove(event:MouseEvent):void{
hint_timer = 0;
}
public function finishLine():void{
if (cursor_active){
if (blobs_in_line > 2){
Path.clear_path = true;
addBlob(getColumn(mouseX), 0, (((blobs_in_line == 3)) && ((((Bomboozle.game_type == Bomboozle.GAME_TYPE_SKULL)) || (Bomboozle.FROSMO_VERSION)))), (blobs_in_line >= BOMB_THRESHOLD));
blobs_exploding = true;
cursor_active = false;
if (blobs_in_line > 9){
CharacterAnim.next_pose = CharacterAnim.POSE_ECSTATIC;
} else {
if (blobs_in_line > 5){
CharacterAnim.next_pose = CharacterAnim.POSE_VERY_HAPPY;
} else {
if ((((blobs_in_line == 3)) && ((Math.random() < 0.5)))){
CharacterAnim.next_pose = CharacterAnim.POSE_BORED;
};
};
};
if (blobs_in_line > longest_chain){
longest_chain = blobs_in_line;
};
} else {
cancelLine();
};
};
hint_timer = 0;
}
public function mouseUp(event:MouseEvent):void{
if (((cursor_active) && ((blobs_in_line > 1)))){
finishLine();
};
}
public function particleTick():void{
var i:int;
while (i < MAX_PARTICLES) {
if (particle_size[i] > 0){
particle_size[i] = (particle_size[i] - PARTICLE_SHRINK);
particle_x[i] = (particle_x[i] + particle_vx[i]);
particle_y[i] = (particle_y[i] + particle_vy[i]);
particle_vx[i] = (particle_vx[i] * 0.93);
particle_vy[i] = (particle_vy[i] * 0.93);
};
i++;
};
}
public function getColumn(_x:int):int{
var column:int = ((_x - BOARD_X) / BLOB_SIZE);
column = Math.min(column, (BOARD_COLUMNS - 1));
column = Math.max(column, 0);
return (column);
}
private function endGame():void{
cancelLine();
Bomboozle.game_state = Bomboozle.GAME_STATE_OVER;
if (Bomboozle.XPO_VERSION){
Bomboozle.conn.send("XPOGamesToolkit", "setScore", (Bomboozle.score - Bomboozle.score_modifier));
Bomboozle.conn.send("XPOGamesToolkit", "rewindAt", 1);
} else {
if (Bomboozle.FROSMO_VERSION){
EsnServices.submitScore(("" + (Bomboozle.score - Bomboozle.score_modifier)), null, null);
} else {
if (Bomboozle.MINDJOLT_VERSION){
Bomboozle.MindJoltAPI.service.submitScore((Bomboozle.score - Bomboozle.score_modifier), Bomboozle.GAME_MODE_STRINGS[Bomboozle.game_type]);
} else {
if (Bomboozle.KONGREGATE_VERSION){
Bomboozle.kongregate.scores.submit((Bomboozle.score - Bomboozle.score_modifier), Bomboozle.GAME_MODE_STRINGS[Bomboozle.game_type]);
Bomboozle.kongregate.stats.submit("Chains", Blocks.groups_made);
Bomboozle.kongregate.stats.submit("Longest chain", Blocks.longest_chain);
} else {
if (Bomboozle.HALLPASS_VERSION){
} else {
if (Bomboozle.WHIRLED_VERSION){
if (Bomboozle.game_type == Bomboozle.GAME_TYPE_TIMED){
Bomboozle.score = (Bomboozle.score * 3);
};
Bomboozle._control.game.endGameWithScore(Bomboozle.score);
Bomboozle._control.game.playerReady();
} else {
if (Bomboozle.DOOF_VERSION){
Logo.connector.gameStat((Bomboozle.GAME_MODE_STRINGS[Bomboozle.game_type] + " mode score"), (Bomboozle.score - Bomboozle.score_modifier).toString());
Logo.connector.gameEnded((Bomboozle.score - Bomboozle.score_modifier));
} else {
if (Bomboozle.GAME_GARAGE_VERSION){
} else {
if (Bomboozle.SHOCKWAVE_VERSION){
};
};
};
};
};
};
};
};
};
}
public function cancelLine():void{
var y:int;
PlaySample.playSound(PlaySample.SOUND_DEACTIVATE, 0);
var x:int;
while (x < BOARD_COLUMNS) {
y = 0;
while (y < BOARD_ROWS) {
blob_lit[x][y] = 0;
y++;
};
x++;
};
blobs_in_line = 0;
line_colour_index = -1;
cursor_active = false;
Path.clear_path = true;
}
public function mouseIsOnBoard():Boolean{
if ((((((((mouseX < BOARD_X)) || ((mouseX >= (BOARD_X + BOARD_WIDTH))))) || ((mouseY < BOARD_Y)))) || ((mouseY >= (BOARD_Y + BOARD_HEIGHT))))){
return (false);
};
return (true);
}
public function getRow(_y:int):int{
var row:int = (((_y - BOARD_Y) / BLOB_SIZE) + 1);
row = Math.min(row, (BOARD_ROWS - 1));
row = Math.max(row, 0);
return ((((_y - BOARD_Y) / BLOB_SIZE) + 1));
}
private function checkForGameOver():void{
var y:int;
groups_left = 0;
var x:int;
while (x < BOARD_COLUMNS) {
y = 1;
while (y < BOARD_ROWS) {
if ((((grid[x][y] == BLOB_BOMB)) || (tileIsWithinGroup(x, y, grid[x][y])))){
hint_x = ((BOARD_X + (x * BLOB_SIZE)) - hint_arrow_image.width);
hint_y = ((BOARD_Y + ((y - 1) * BLOB_SIZE)) - hint_arrow_image.height);
if (++groups_left > 4){
y = 99;
x = y;
};
};
y++;
};
x++;
};
if (groups_left == 0){
endGame();
};
}
public function step(event:Event):void{
var x:int;
var y:int;
var exp_x:int;
var exp_y:int;
ticks++;
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_OVER:
break;
case Bomboozle.GAME_STATE_GAME:
if (!found_hint_group){
checkForGameOver();
found_hint_group = true;
};
particleTick();
if (blobs_exploding){
if (--blob_explosion_timer < 0){
blob_explosion_timer = 2;
PlaySample.playSound(PlaySample.SOUND_BLOB_EXPLOSION, 0);
x = blob_explosion_x[(blob_explosions - 1)];
y = blob_explosion_y[(blob_explosions - 1)];
exp_x = ((BOARD_X + (x * BLOB_SIZE)) + (BLOB_SIZE * 0.5));
exp_y = ((BOARD_Y + ((y - 1) * BLOB_SIZE)) + (BLOB_SIZE * 0.5));
Path.placeFlash(exp_x, exp_y);
addParticles(exp_x, exp_y, line_colour_index);
grid[x][y] = -1;
if (--blob_explosions <= 0){
blobs_exploding = false;
setBlobsToFall(false, exp_x, exp_y);
};
};
};
if (Bomboozle.game_type == Bomboozle.GAME_TYPE_TIMED){
if (!LargeText.go_image.visible){
if (((((ticks % 10) == 0)) && ((--Bomboozle.game_time == 0)))){
endGame();
};
};
};
if (board_xo < 0){
board_xo = (board_xo - (board_xo / 6));
if (board_xo > -0.1){
board_xo = 0;
};
};
mouse_column = ((mouseX - BOARD_X) / BLOB_SIZE);
mouse_row = (((mouseY - BOARD_Y) / BLOB_SIZE) + 1);
if (fall_delay > 0){
fall_delay--;
} else {
if (cursor_active){
blob_counter_x = (blob_counter_x + ((mouseX - blob_counter_x) / 4));
blob_counter_y = (blob_counter_y + ((mouseY - blob_counter_y) / 4));
if (!mouseIsOnBoard()){
cancelLine();
} else {
if (((!((mouse_column == cursor_column))) || (!((mouse_row == cursor_row))))){
addTileToChain(mouse_column, mouse_row);
};
};
};
if (waiting_for_blobs_to_settle){
blobs_still_falling = false;
x = 0;
while (x < BOARD_COLUMNS) {
y = (BOARD_ROWS - 1);
while (y >= 0) {
if (grid[x][y] != -1){
if (blob_gravity[x][y] != 0){
blobs_still_falling = true;
if (blob_gravity[x][y] < BLOB_SIZE){
blob_gravity[x][y] = (blob_gravity[x][y] + BLOB_GRAVITY);
};
blob_yo[x][y] = (blob_yo[x][y] + blob_gravity[x][y]);
if (blob_yo[x][y] >= BLOB_SIZE){
grid[x][(y + 1)] = grid[x][y];
grid[x][y] = -1;
blob_gravity[x][(y + 1)] = blob_gravity[x][y];
blob_yo[x][y] = 0;
blob_yo[x][(y + 1)] = 0;
if ((((y == (BOARD_ROWS - 2))) || ((((grid[x][(y + 2)] > -1)) && ((blob_gravity[x][(y + 2)] == 0)))))){
blob_gravity[x][y] = 0;
blob_gravity[x][(y + 1)] = 0;
};
if (y == 0){
addBlob(x, y, false, false);
};
};
};
};
y--;
};
x++;
};
if (!blobs_still_falling){
waiting_for_blobs_to_settle = false;
blobs_in_line = 0;
line_colour_index = -1;
checkForGameOver();
};
};
};
break;
default:
graphics.clear();
break;
};
}
public function detonateBomb(_bomb_x:int, _bomb_y:int):void{
var width:int;
var x:int;
bombs_detonated++;
bomb_explosion[_bomb_x][_bomb_y] = 0;
var y = -2;
while (y <= 2) {
width = (2 - ((y)<0) ? -(y) : y);
x = -(width);
while (x <= width) {
if (((((((!((x == _bomb_x))) || (!((y == _bomb_y))))) && (blobIsOnBoard((x + _bomb_x), (y + _bomb_y))))) && ((blob_lit[(x + _bomb_x)][(y + _bomb_y)] == 0)))){
blob_lit[(x + _bomb_x)][(y + _bomb_y)] = 1;
if (grid[(x + _bomb_x)][(y + _bomb_y)] == BLOB_BOMB){
detonateBomb((x + _bomb_x), (y + _bomb_y));
};
};
x++;
};
y++;
};
}
public function setBlobsToFall(_add_particle_explosions:Boolean, _bonus_x:int, _bonus_y:int):void{
var y:int;
var y2:int;
var i:int;
var blobs_destroyed:int;
var x:int;
while (x < BOARD_COLUMNS) {
y = 0;
while (y < BOARD_ROWS) {
if (blob_lit[x][y] > 0){
blobs_destroyed++;
if (_add_particle_explosions){
addParticles(((BOARD_X + (x * BLOB_SIZE)) + (BLOB_SIZE * 0.5)), ((BOARD_Y + ((y - 1) * BLOB_SIZE)) + (BLOB_SIZE * 0.5)), grid[x][y]);
};
blob_lit[x][y] = 0;
grid[x][y] = -1;
y2 = y;
while (y2 >= 0) {
blob_gravity[x][y2] = 1E-13;
y2--;
};
};
y++;
};
x++;
};
if (blobs_in_line > 2){
Bomboozle.bonus = ((blobs_in_line * blobs_in_line) * 50);
} else {
Bomboozle.bonus = ((blobs_destroyed * blobs_destroyed) * 10);
};
Bomboozle.score = (Bomboozle.score + Bomboozle.bonus);
if ((Bomboozle.score - Bomboozle.score_modifier) > Bomboozle.hiscore[Bomboozle.game_type]){
Bomboozle.hiscore[Bomboozle.game_type] = (Bomboozle.score - Bomboozle.score_modifier);
};
waiting_for_blobs_to_settle = true;
blobs_still_falling = true;
fall_delay = FALL_DELAY;
cursor_active = false;
groups_made++;
total_blobs_destroyed = (total_blobs_destroyed + blobs_destroyed);
BonusText.init(Bomboozle.bonus, _bonus_x, _bonus_y);
if (Bomboozle.OURWORLD_VERSION){
ExternalInterface.call("fpBroadcastScore", (Bomboozle.score - Bomboozle.score_modifier));
ExternalInterface.call("fpBroadcastLevel", Math.round((total_blobs_destroyed / 100)));
};
if (Bomboozle.WHIRLED_VERSION){
i = 0;
while (i < trophy_awarded.length) {
if (!trophy_awarded[i]){
switch (i){
case TROPHY_5_BLOB:
case TROPHY_10_BLOB:
case TROPHY_15_BLOB:
case TROPHY_20_BLOB:
case TROPHY_25_BLOB:
case TROPHY_30_BLOB:
if (longest_chain >= ((i + 1) * 5)){
trophy_awarded[i] = true;
};
break;
case TROPHY_100_BLOBS:
case TROPHY_500_BLOBS:
case TROPHY_1000_BLOBS:
if (total_blobs_destroyed >= ((i == TROPHY_100_BLOBS)) ? 100 : ((i == TROPHY_500_BLOBS)) ? 500 : 1000){
trophy_awarded[i] = true;
};
break;
case TROPHY_50_CHAINS:
case TROPHY_100_CHAINS:
case TROPHY_200_CHAINS:
if (groups_made >= ((i == TROPHY_50_CHAINS)) ? 50 : ((i == TROPHY_100_CHAINS)) ? 100 : 200){
trophy_awarded[i] = true;
};
break;
case TROPHY_5_SKULLS:
case TROPHY_10_SKULLS:
if ((((line_colour_index == BLOB_SKULL)) && ((blobs_in_line >= ((i == TROPHY_5_SKULLS)) ? 5 : 10)))){
trophy_awarded[i] = true;
};
break;
case TROPHY_10_PURPLES:
if ((((line_colour_index == 4)) && ((blobs_in_line >= 10)))){
trophy_awarded[i] = true;
};
break;
case TROPHY_3_BOMBS:
case TROPHY_5_BOMBS:
if (bombs_detonated >= ((i == TROPHY_3_BOMBS)) ? 3 : 5){
trophy_awarded[i] = true;
};
break;
};
if (trophy_awarded[i]){
Bomboozle._control.player.awardTrophy(trophy_strings[i]);
};
};
i++;
};
};
}
public function mouseDown(event:MouseEvent):void{
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
if ((((((fall_delay <= 0)) && (!(blobs_still_falling)))) && (!(blobs_exploding)))){
if (cursor_active){
finishLine();
} else {
if (mouseIsOnBoard()){
blob_counter_x = mouseX;
blob_counter_y = mouseY;
switch (grid[getColumn(mouseX)][getRow(mouseY)]){
case BLOB_BOMB:
PlaySample.playSound(PlaySample.SOUND_BOMB_EXPLOSION, 0);
bombs_detonated = -1;
detonateBomb(getColumn(mouseX), getRow(mouseY));
trace(("bombs_detonated = " + bombs_detonated));
setBlobsToFall(true, mouseX, mouseY);
break;
default:
addTileToChain(getColumn(mouseX), getRow(mouseY));
break;
};
};
};
};
break;
};
}
public static function tileIsWithinGroup(tileX:int, tileY:int, tileColour:int):Boolean{
var pathCheckIndex:int;
var tilesInPath:int;
var i:int;
var pathX:int;
var pathY:int;
var neighbourColour:int;
var colours_to_check = 1;
switch (grid[tileX][tileY]){
case BLOB_WILDCARD:
colours_to_check = 6;
break;
case -1:
return (false);
};
var colour:int;
while (colour <= colours_to_check) {
if (colours_to_check > 1){
tileColour = colour;
};
pathCheckIndex = 0;
while (pathCheckIndex <= 22) {
tilesInPath = 1;
i = 0;
while (i < 2) {
pathX = (tileX + PATH_CHECK_X[(pathCheckIndex + i)]);
pathY = (tileY + PATH_CHECK_Y[(pathCheckIndex + i)]);
if (((blobIsOnBoard(pathX, pathY)) && ((blob_lit[pathX][pathY] < 1)))){
neighbourColour = grid[pathX][pathY];
if ((((neighbourColour == tileColour)) || ((neighbourColour == BLOB_WILDCARD)))){
++tilesInPath;
if (tilesInPath > 2){
return (true);
};
} else {
i = 99;
};
};
i++;
};
pathCheckIndex = (pathCheckIndex + 2);
};
colour++;
};
return (false);
}
public static function blobIsOnBoard(_column:int, _row:int):Boolean{
if ((((((((_column < 0)) || ((_column >= BOARD_COLUMNS)))) || ((_row < 1)))) || ((_row >= BOARD_ROWS)))){
return (false);
};
return (true);
}
public static function addBlob(_column:int, _row:int, _force_skull:Boolean, _force_bomb:Boolean):void{
var tile_type = -1;
if (_force_skull){
tile_type = BLOB_SKULL;
PlaySample.playSound(PlaySample.SOUND_SKULL_DROP, 0);
} else {
if (_force_bomb){
tile_type = BLOB_BOMB;
PlaySample.playSound(PlaySample.SOUND_BOMB_AWARDED, 0);
};
};
if (tile_type == -1){
if ((((((Bomboozle.game_type == Bomboozle.GAME_TYPE_INFINITE)) && ((groups_made > 100)))) && ((Math.random() < (groups_made / 5000))))){
tile_type = BLOB_SKULL;
} else {
if (Math.random() < 0.02){
tile_type = BLOB_WILDCARD;
} else {
if (groups_made >= Bomboozle.NEW_COLOUR_CHAIN_THRESHOLD){
Bomboozle.tile_limit = 4;
} else {
Bomboozle.tile_limit = 3;
};
tile_type = Math.round((Math.random() * Bomboozle.tile_limit));
};
};
};
grid[_column][_row] = tile_type;
}
}
}//package
Section 50
//Blocks_blob_blue_image_class (Blocks_blob_blue_image_class)
package {
import mx.core.*;
public class Blocks_blob_blue_image_class extends BitmapAsset {
}
}//package
Section 51
//Blocks_blob_bomb_image_class (Blocks_blob_bomb_image_class)
package {
import mx.core.*;
public class Blocks_blob_bomb_image_class extends BitmapAsset {
}
}//package
Section 52
//Blocks_blob_green_image_class (Blocks_blob_green_image_class)
package {
import mx.core.*;
public class Blocks_blob_green_image_class extends BitmapAsset {
}
}//package
Section 53
//Blocks_blob_purple_image_class (Blocks_blob_purple_image_class)
package {
import mx.core.*;
public class Blocks_blob_purple_image_class extends BitmapAsset {
}
}//package
Section 54
//Blocks_blob_red_image_class (Blocks_blob_red_image_class)
package {
import mx.core.*;
public class Blocks_blob_red_image_class extends BitmapAsset {
}
}//package
Section 55
//Blocks_blob_skull_image_class (Blocks_blob_skull_image_class)
package {
import mx.core.*;
public class Blocks_blob_skull_image_class extends BitmapAsset {
}
}//package
Section 56
//Blocks_blob_wildcard_image_class (Blocks_blob_wildcard_image_class)
package {
import mx.core.*;
public class Blocks_blob_wildcard_image_class extends BitmapAsset {
}
}//package
Section 57
//Blocks_blob_yellow_image_class (Blocks_blob_yellow_image_class)
package {
import mx.core.*;
public class Blocks_blob_yellow_image_class extends BitmapAsset {
}
}//package
Section 58
//Blocks_blobs_surprised_image_class (Blocks_blobs_surprised_image_class)
package {
import mx.core.*;
public class Blocks_blobs_surprised_image_class extends BitmapAsset {
}
}//package
Section 59
//Blocks_board_image_class (Blocks_board_image_class)
package {
import mx.core.*;
public class Blocks_board_image_class extends BitmapAsset {
}
}//package
Section 60
//Blocks_hint_arrow_image_class (Blocks_hint_arrow_image_class)
package {
import mx.core.*;
public class Blocks_hint_arrow_image_class extends BitmapAsset {
}
}//package
Section 61
//Blocks_marker_bomb_image_class (Blocks_marker_bomb_image_class)
package {
import mx.core.*;
public class Blocks_marker_bomb_image_class extends BitmapAsset {
}
}//package
Section 62
//Blocks_marker_skull_image_class (Blocks_marker_skull_image_class)
package {
import mx.core.*;
public class Blocks_marker_skull_image_class extends BitmapAsset {
}
}//package
Section 63
//Bomboozle (Bomboozle)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import com.whirled.game.*;
import mochi.*;
public dynamic class Bomboozle extends MovieClip {
public static const GAME_STATE_NULL:int = -3;
public static const GAME_STATE_SUBMIT_SCORE:int = 9;
public static const USE_EXTERNAL_AUDIO:Boolean = false;
public static const GAME_STATE_TITLE:int = 1;
public static const GAME_STATE_CREDITS:int = 7;
public static const GAME_MODE_STRINGS:Array = ["Infinite", "Timed", "Skull"];
public static const GAME_STATE_OPTIONS:int = 4;
public static const SKULL_CHAIN_THRESHOLD:int = 100;
public static const GAME_STATE_OVER:int = 5;
public static const GAME_TYPE_TIMED:int = 1;
public static const GAME_STATE_TUTORIAL:int = 11;
public static const GAME_TYPE_SKULL:int = 2;
public static const SCREEN_BORDER:int = 16;
public static const ICON_GRAVITY:int = 2;
public static const GAME_STATE_GAME:int = 3;
public static const GAME_STATE_CHOOSE_LEADERBOARD:int = 10;
public static const NEW_COLOUR_CHAIN_THRESHOLD:int = 30;
public static const GAME_STATE_SELECT_GAME:int = 2;
public static const TUTORIAL_PAGES:int = 5;
public static const GAME_STATE_SHOW_MOCHIAD:int = -2;
public static const game_ID:String = "526e0978452effb3";
public static const FADE_SPEED:Number = 0.1;
public static const GAME_STATE_DEV_LOGO:int = -1;
public static const GAME_STATE_SCOREBOARD:int = 6;
public static const GAME_STATE_PAUSED:int = 8;
public static const GAME_TYPE_INFINITE:int = 0;
public static const leaderboard_IDs:Array = ["c100960b3cc2a2f1", "2887fb4675b7bb15", "fac77ac486436640"];
public static var game_time:int;
public static var SHOCKWAVE_VERSION:Boolean = false;
public static var STAGE_WIDTH:int = 640;
public static var game_state:int;
public static var DOOF_VERSION:Boolean = false;
public static var _control:GameControl;
public static var bonus:int;
public static var MOCHIADS_VERSION:Boolean = false;
public static var _highscore_timed:Object;
public static var conn:LocalConnection = new LocalConnection();
public static var hiscore:Array = [0, 0, 0];
public static var SHOW_IPHONE_AD:Boolean = false;
public static var OURWORLD_VERSION:Boolean = false;
public static var HALLPASS_VERSION:Boolean = false;
public static var sound_volume:Number = 0.2;
public static var urls_allowed:Array;
public static var _highscore_skull:Object;
public static var KONGREGATE_VERSION:Boolean = false;
public static var MINDJOLT_VERSION:Boolean = false;
public static var game_type:int;
public static var WHIRLED_VERSION:Boolean = false;
public static var music_volume:Number = 0.1;
public static var tutorial_has_been_viewed:Boolean = false;
public static var MindJoltAPI:Object;
public static var GAME_GARAGE_VERSION:Boolean = false;
public static var score:int;
public static var game_url:String;
public static var STAGE_HEIGHT:int = 520;
public static var game_domain:String;
public static var LOCAL_VERSION:Boolean = false;
public static var ANDKON_VERSION:Boolean = true;
public static var XPO_VERSION:Boolean = false;
public static var maskSprite:Sprite = new Sprite();
public static var stage_ref:Stage;
public static var MOCHIADS_HISCORES:Boolean = false;
public static var clipGateway:MovieClip;
public static var FROSMO_VERSION:Boolean = false;
public static var kongregate;
public static var SANOMA_VERSION:Boolean = false;
public static var tutorial_page:int = 0;
public static var _highscore_infinite:Object;
public static var FREEBINGOHUNTER_VERSION:Boolean = false;
public static var score_modifier:int;
public static var tile_limit:int;
public static var ldr:Loader = new Loader();
public function Bomboozle():void{
var gameParams:Object;
var urlLoader:Loader;
var paramObj:Object;
var api_url:String;
var request:URLRequest;
var loader:Loader;
var _pause_button:PauseButton;
var _tutorial:Tutorial;
var _menuIcon:MenuIcon;
var _Option:AddOption;
super();
stage.quality = StageQuality.HIGH;
game_state = GAME_STATE_DEV_LOGO;
if (DOOF_VERSION){
};
if (FREEBINGOHUNTER_VERSION){
game_state = GAME_STATE_TITLE;
};
if (XPO_VERSION){
ldr.load(new URLRequest("http://www.xpogames.com/toolkit/xpoToolkit.swf"));
ldr.contentLoaderInfo.addEventListener(Event.INIT, XPOloaded);
conn.addEventListener(StatusEvent.STATUS, XPOonStatus);
conn.addEventListener(SecurityErrorEvent.SECURITY_ERROR, XPOonReceivedError);
conn.allowDomain("*");
_slot1.conn.send("XPOGamesToolkit", "setScore", _slot1.score);
_slot1.conn.send("XPOGamesToolkit", "rewindAt", 1);
_slot1.conn.send("XPOGamesToolkit", "gameEnd");
};
if (GAME_GARAGE_VERSION){
tracking();
};
if (WHIRLED_VERSION){
trace("WHIRLED_VERSION");
_control = new GameControl(this);
if (_control.isConnected()){
_control.game.amInControl();
};
};
if (FREEBINGOHUNTER_VERSION){
siteIsOK("freebingohunter.com");
};
if (KONGREGATE_VERSION){
MOCHIADS_VERSION = true;
siteIsOK("chat.kongregate.com");
};
if (OURWORLD_VERSION){
if (!siteIsOK("ourworld.com")){
siteIsOK("flowplay.com");
};
};
if (MINDJOLT_VERSION){
var loadFinished:Function = function (e:Event):void{
MindJoltAPI = e.currentTarget.content;
MindJoltAPI.service.connect();
trace("[MindJoltAPI] service manually loaded");
};
gameParams = LoaderInfo(root.loaderInfo).parameters;
urlLoader = new Loader();
urlLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFinished);
urlLoader.load(new URLRequest(((gameParams.mjPath) || ("http://static.mindjolt.com/api/as3/scoreapi_as3_local.swf"))));
this.addChild(urlLoader);
};
if (KONGREGATE_VERSION){
paramObj = LoaderInfo(root.loaderInfo).parameters;
api_url = ((paramObj.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
trace(("API path: " + api_url));
request = new URLRequest(api_url);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.load(request);
this.addChild(loader);
};
if (SHOCKWAVE_VERSION){
siteIsOK("shockwave.com");
};
if (MOCHIADS_VERSION){
MochiServices.connect(game_ID, root);
};
if (FROSMO_VERSION){
clipGateway = new MovieClip();
addChild(clipGateway);
EsnServices.connect("H5NTBIHMIN", clipGateway, EsnServices.error_handler, EsnServices.ready_handler);
};
var _progressBar:ProgressBar = new ProgressBar();
addChild(_progressBar);
var i:int;
var _soundPlayer:PlaySample = new PlaySample();
var _bg:Background = new Background();
addChild(_bg);
_bg.init();
var _blocks:Blocks = new Blocks(stage);
addChild(_blocks);
var _explosion:Explosion = new Explosion();
addChild(_explosion);
_explosion.init();
var _character_anim:CharacterAnim = new CharacterAnim();
addChild(_character_anim);
var _winged_box:WingedBox = new WingedBox();
addChild(_winged_box);
_winged_box.init();
var _panel:Panel = new Panel();
addChild(_panel);
_panel.init();
var _back_button:BackButton = new BackButton();
addChild(_back_button);
_back_button.init();
if (!FROSMO_VERSION){
_pause_button = new PauseButton();
addChild(_pause_button);
_pause_button.init();
};
i = 0;
while (i < 5) {
_tutorial = new Tutorial();
addChild(_tutorial);
_tutorial.init(i);
i = (i + 1);
};
i = 0;
while (i < (((((((MOCHIADS_HISCORES) || (SHOCKWAVE_VERSION))) || (MINDJOLT_VERSION))) || (ANDKON_VERSION))) ? 4 : 3) {
_menuIcon = new MenuIcon();
addChild(_menuIcon);
_menuIcon.init(i, (((((((MOCHIADS_HISCORES) || (SHOCKWAVE_VERSION))) || (MINDJOLT_VERSION))) || (ANDKON_VERSION))) ? 4 : 3, 0);
i = (i + 1);
};
if (!FROSMO_VERSION){
i = 0;
while (i < 3) {
_menuIcon = new MenuIcon();
addChild(_menuIcon);
_menuIcon.init((i + 4), 3, 4);
i = (i + 1);
};
};
i = 0;
while (i < 1) {
_menuIcon = new MenuIcon();
addChild(_menuIcon);
_menuIcon.init((i + 7), 1, 7);
i = (i + 1);
};
i = 0;
while (i < 2) {
_menuIcon = new MenuIcon();
addChild(_menuIcon);
_menuIcon.init((i + 9), 2, 9);
i = (i + 1);
};
i = 0;
while (i < 2) {
_menuIcon = new MenuIcon();
addChild(_menuIcon);
_menuIcon.init((i + 11), 2, 11);
i = (i + 1);
};
i = 0;
while (i < 3) {
_menuIcon = new MenuIcon();
addChild(_menuIcon);
_menuIcon.init((i + 13), 3, 13);
i = (i + 1);
};
i = -1;
while (i < 2) {
_Option = new AddOption();
addChild(_Option);
_Option.init(i);
i = (i + 1);
};
var _logo:Logo = new Logo();
addChild(_logo);
var _sparkle:Sparkle = new Sparkle();
addChild(_sparkle);
var _bitmap_text:BitmapText = new BitmapText();
addChild(_bitmap_text);
_bitmap_text.init();
var _text_anim:LargeText = new LargeText();
addChild(_text_anim);
var _path:Path = new Path();
addChild(_path);
_path.init();
var _bonus_text:BonusText = new BonusText();
addChild(_bonus_text);
stage_ref = stage;
if (MOCHIADS_VERSION){
showMochiAd();
};
addEventListener(MouseEvent.MOUSE_DOWN, Path.mouseDown);
addEventListener(MouseEvent.MOUSE_OUT, Path.mouseOut);
addEventListener(MouseEvent.MOUSE_OVER, Path.mouseOver);
maskSprite.graphics.beginFill(0xFFFFFF);
maskSprite.graphics.drawRect(0, 0, _slot1.STAGE_WIDTH, _slot1.STAGE_HEIGHT);
this.addChild(maskSprite);
this.mask = maskSprite;
}
final private function XPOonStatus(theEvent:Event):void{
trace(("XPO status = " + theEvent));
}
final private function XPOonReceivedError(sEvent:Event):void{
trace(("XPO error = " + sEvent));
}
final private function errorHandler():void{
trace("Couldn't connect!");
}
private function create_hs_obj(arg_gameId:String):Object{
return (-1);
}
public function tracking():void{
var scriptRequest:URLRequest = new URLRequest("http://www.gamegarage.co.uk/scripts/tracking.php");
scriptRequest.method = URLRequestMethod.POST;
var scriptVars:URLVariables = new URLVariables();
scriptVars.game_id = LoaderInfo(this.root.loaderInfo).parameters["game_id"];
scriptVars.user_id = LoaderInfo(this.root.loaderInfo).parameters["user_id"];
scriptRequest.data = scriptVars;
var loader:URLLoader = new URLLoader(scriptRequest);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(scriptRequest);
}
public function showMochiAd():void{
game_state = GAME_STATE_SHOW_MOCHIAD;
MochiAd.showPreGameAd({clip:root, id:game_ID, res:"640x520", background:3771466, color:16764432, outline:16764432, no_bg:true, no_progress_bar:false, ad_failed:_slot1.resetTitle, ad_skipped:_slot1.resetTitle, ad_finished:_slot1.resetTitle});
//unresolved jump
var _slot1 = errObject;
trace(("Error: " + _slot1.message));
}
final private function readyHandler():void{
trace("Connected!");
}
final private function XPOloaded(evt:Event):void{
addChild(ldr);
}
public function siteIsOK(_allowed_domain:String):Boolean{
game_url = stage.loaderInfo.url;
trace(("game_url = " + game_url));
var urlStart:int = (game_url.indexOf("://") + 3);
var urlEnd:int = game_url.indexOf("/", urlStart);
var domain:String = game_url.substring(urlStart, urlEnd);
var LastDot:int = (domain.lastIndexOf(".") - 1);
var domEnd:int = (domain.lastIndexOf(".", LastDot) + 1);
game_domain = domain.substring(domEnd, domain.length);
trace(("domain = " + domain));
if (game_domain != _allowed_domain){
if (((((((OURWORLD_VERSION) || (WHIRLED_VERSION))) || (SHOCKWAVE_VERSION))) || (FREEBINGOHUNTER_VERSION))){
root.x = 10000;
root.y = 10000;
root.alpha = 0;
} else {
MOCHIADS_VERSION = true;
MOCHIADS_HISCORES = true;
};
KONGREGATE_VERSION = false;
WHIRLED_VERSION = false;
OURWORLD_VERSION = false;
MINDJOLT_VERSION = false;
return (false);
//unresolved jump
};
return (true);
}
final private function onKeyRelease(event:KeyboardEvent):void{
}
public function loadComplete(event:Event):void{
if (KONGREGATE_VERSION){
kongregate = event.target.content;
kongregate.services.connect();
trace(("\n" + kongregate.services));
trace(("\n" + kongregate.user));
trace(("\n" + kongregate.scores));
trace(("\n" + kongregate.stats));
};
}
public static function updateHighscores(highscoresXML){
}
public static function resetTitle():void{
if (game_state != GAME_STATE_TITLE){
game_state = GAME_STATE_TITLE;
Logo.initTitleLogo();
PlaySample.playSound(PlaySample.SOUND_SELECT, 0);
};
}
public static function startGame():void{
var scoreXML:XML;
var y:int;
tutorial_has_been_viewed = true;
game_state = GAME_STATE_GAME;
Blocks.total_blobs_destroyed = 0;
LargeText.init();
tile_limit = 3;
game_time = (FROSMO_VERSION) ? 500 : 999;
score_modifier = (-777 - (Math.random() * 10000));
score = score_modifier;
if (DOOF_VERSION){
Logo.connector.gameStarted(0);
};
if (WHIRLED_VERSION){
_control.game.playerReady();
};
if (_slot1.SANOMA_VERSION){
scoreXML = new XML((("<highscore score=\"" + score) + "\"><display/><data/></highscore>"));
PelikoneGameAPI.submitHighscore(3, "7bcf9e6e157f93f6b6210ef7130bb76c", "6969", scoreXML, function (developerId, gameKey, highscoresXML){
updateHighscores(highscoresXML);
});
};
Blocks.bombs_detonated = 0;
Blocks.groups_made = 0;
Panel.panel_score_yo = (Panel.panel_hiscore_yo = (Panel.panel_chains_yo = -600));
Blocks.board_xo = Blocks.BOARD_START_XO;
BonusText.bonus_text_y = -100;
Background.boat_image.x = -300;
CharacterAnim.next_pose = CharacterAnim.POSE_HAPPY;
var x:int;
while (x < Blocks.BOARD_COLUMNS) {
Blocks.bomb_explosion[x] = new Array();
Blocks.grid[x] = new Array();
Blocks.blob_gravity[x] = new Array();
Blocks.blob_yo[x] = new Array();
Blocks.blob_lit[x] = new Array();
y = 0;
while (y < Blocks.BOARD_ROWS) {
Blocks.bomb_explosion[x][y] = -1;
Blocks.addBlob(x, y, false, false);
Blocks.blob_gravity[x][y] = 0;
Blocks.blob_yo[x][y] = 0;
Blocks.blob_lit[x][y] = 0;
y = (y + 1);
};
x = (x + 1);
};
Blocks.found_hint_group = false;
PlaySample.playSound(PlaySample.SOUND_START_GAME, 0);
}
public static function doofReset():void{
trace("splashFinished got called");
game_state = GAME_STATE_TITLE;
}
public static function sanomaCallBack(_devId:int, _gameKey:String, _highscoresXML:XML):void{
}
public static function submitShockwaveScore(_game_type:int, _score:int):void{
trace("submitShockwaveScore()");
switch (_game_type){
case GAME_TYPE_INFINITE:
_highscore_infinite.openHub("submit", _score);
break;
case GAME_TYPE_TIMED:
_highscore_timed.openHub("submit", _score);
break;
case GAME_TYPE_SKULL:
_highscore_skull.openHub("submit", _score);
break;
};
}
}
}//package
Section 64
//BonusText (BonusText)
package {
import flash.events.*;
import flash.display.*;
public class BonusText extends Sprite {
public static var bonus_value:int;
public static var bonus_text_x:Number;
public static var bonus_text_y:Number;
public static var bonus_text_gravity:Number;
public function BonusText(){
super();
mouseEnabled = false;
addEventListener(Event.ENTER_FRAME, step);
}
public function step(event:Event):void{
var text_width:int;
var box_x:Number;
graphics.clear();
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
if (Blocks.cursor_active){
WingedBox.drawBox(graphics, (Blocks.blob_counter_x + Blocks.BLOB_SIZE), Blocks.blob_counter_y, (BitmapText.font_width * 2.5), -1);
BitmapText.drawNumber(graphics, Blocks.blobs_in_line, (Blocks.blob_counter_x + Blocks.BLOB_SIZE), (Blocks.blob_counter_y + (BitmapText.font_height * 0.6)), "centred", BitmapText.BONUS_FONT);
};
if (bonus_text_y > -40){
graphics.beginFill(0xFFFFFF);
text_width = (bonus_value.toString().length * BitmapText.font_width);
box_x = (bonus_text_x + (1 + (Math.sin(Logo.scenery_bounce_angle) * 32)));
WingedBox.drawBox(graphics, box_x, bonus_text_y, (text_width * 1.5), 0);
BitmapText.drawNumber(graphics, bonus_value, box_x, (bonus_text_y + (BitmapText.font_height * 0.6)), "centred", BitmapText.BONUS_FONT);
bonus_text_y = (bonus_text_y - ((bonus_text_y + 100) / 48));
};
break;
default:
break;
};
}
public static function init(_new_bonus:int, _x:Number, _y:Number):void{
bonus_text_gravity = 12;
bonus_value = _new_bonus;
bonus_text_x = _x;
bonus_text_y = _y;
}
}
}//package
Section 65
//CharacterAnim (CharacterAnim)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class CharacterAnim extends Sprite {
private var bloke_unhappy_class:Class;
private var bloke_ecstatic_class:Class;
private var bloke_very_happy_class:Class;
private var bloke_happy_class:Class;
private var bloke_bored_class:Class;
public static const ECSTATIC_FRAMES:Array = [0, 1, 2, 3, 4, 5];
public static const BORED_IMAGE_FRAMES:int = 4;
public static const BORED_FRAMES:Array = [0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 2];
public static const POSE_ECSTATIC:int = 4;
public static const HAPPY_FRAMES:Array = [0, 1, 2, 3, 2, 4, 2, 3, 2, 4, 5, 5, 4, 4];
public static const HAPPY_IMAGE_FRAMES:int = 6;
public static const POSE_HAPPY:int = 2;
public static const POSE_BORED:int = 1;
public static const UNHAPPY_FRAMES:Array = [0, 1, 2, 3, 4, 5, 1, 2, 3, 4];
public static const VERY_HAPPY_IMAGE_FRAMES:int = 5;
public static const POSE_UNHAPPY:int = 0;
public static const POSE_VERY_HAPPY:int = 3;
public static const UNHAPPY_IMAGE_FRAMES:int = 6;
public static const VERY_HAPPY_FRAMES:Array = [0, 1, 0, 2, 0, 3, 4, 0];
public static const ECSTATIC_IMAGE_FRAMES:int = 6;
public static var container:Sprite;
public static var animation:Bitmap;
public static var ANIM_FRAMES_ARRAY:Array;
public static var ANIM_FRAMES:int;
public static var current_pose:int;
public static var previous_pose:int = -1;
public static var next_pose:int = -1;
public static var FRAME_HEIGHT:int;
public static var FRAME_WIDTH:int;
public static var anim_frame:int;
public function CharacterAnim(){
bloke_unhappy_class = CharacterAnim_bloke_unhappy_class;
bloke_bored_class = CharacterAnim_bloke_bored_class;
bloke_happy_class = CharacterAnim_bloke_happy_class;
bloke_very_happy_class = CharacterAnim_bloke_very_happy_class;
bloke_ecstatic_class = CharacterAnim_bloke_ecstatic_class;
super();
startNewAnim(POSE_HAPPY);
}
public function step(event:Event):void{
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
case Bomboozle.GAME_STATE_PAUSED:
case Bomboozle.GAME_STATE_OVER:
container.visible = true;
if (alpha < 1){
alpha = (alpha + Bomboozle.FADE_SPEED);
};
container.y = ((Bomboozle.STAGE_HEIGHT - animation.height) - 10);
if (((!((Bomboozle.game_state == Bomboozle.GAME_STATE_PAUSED))) && (((Blocks.ticks % 9) == 0)))){
container.scrollRect = new Rectangle((FRAME_WIDTH * ANIM_FRAMES_ARRAY[anim_frame]), 0, FRAME_WIDTH, animation.height);
if (++anim_frame >= ANIM_FRAMES_ARRAY.length){
if (next_pose == -1){
if (Blocks.groups_left < 4){
next_pose = POSE_UNHAPPY;
} else {
next_pose = ((Math.random() < 0.5)) ? POSE_BORED : POSE_HAPPY;
};
};
startNewAnim(next_pose);
};
};
break;
default:
if (alpha > 0){
alpha = (alpha - Bomboozle.FADE_SPEED);
};
break;
};
}
public function startNewAnim(_new_pose:int):void{
if (container != null){
removeChild(container);
};
previous_pose = current_pose;
current_pose = _new_pose;
anim_frame = 0;
container = new Sprite();
switch (_new_pose){
case POSE_BORED:
animation = new bloke_bored_class();
ANIM_FRAMES = BORED_IMAGE_FRAMES;
ANIM_FRAMES_ARRAY = BORED_FRAMES;
break;
case POSE_UNHAPPY:
animation = new bloke_unhappy_class();
ANIM_FRAMES = UNHAPPY_IMAGE_FRAMES;
ANIM_FRAMES_ARRAY = UNHAPPY_FRAMES;
break;
case POSE_HAPPY:
animation = new bloke_happy_class();
ANIM_FRAMES = HAPPY_IMAGE_FRAMES;
ANIM_FRAMES_ARRAY = HAPPY_FRAMES;
break;
case POSE_VERY_HAPPY:
animation = new bloke_very_happy_class();
ANIM_FRAMES = VERY_HAPPY_IMAGE_FRAMES;
ANIM_FRAMES_ARRAY = VERY_HAPPY_FRAMES;
break;
case POSE_ECSTATIC:
animation = new bloke_ecstatic_class();
ANIM_FRAMES = ECSTATIC_IMAGE_FRAMES;
ANIM_FRAMES_ARRAY = ECSTATIC_FRAMES;
break;
};
FRAME_WIDTH = (animation.width / ANIM_FRAMES);
FRAME_HEIGHT = animation.height;
container.addChild(animation);
animation.height = ((1 + (Math.sin(-(Logo.scenery_bounce_angle)) / 32)) * animation.bitmapData.height);
container.x = (490 - (FRAME_WIDTH >> 1));
container.y = ((520 - animation.height) - 10);
container.scrollRect = new Rectangle(0, 0, FRAME_WIDTH, animation.height);
container.mouseEnabled = false;
addChild(container);
addEventListener(Event.ENTER_FRAME, step);
next_pose = -1;
if ((((Bomboozle.game_state == Bomboozle.GAME_STATE_GAME)) || ((Bomboozle.game_state == Bomboozle.GAME_STATE_OVER)))){
container.visible = true;
} else {
container.visible = false;
};
}
}
}//package
Section 66
//CharacterAnim_bloke_bored_class (CharacterAnim_bloke_bored_class)
package {
import mx.core.*;
public class CharacterAnim_bloke_bored_class extends BitmapAsset {
}
}//package
Section 67
//CharacterAnim_bloke_ecstatic_class (CharacterAnim_bloke_ecstatic_class)
package {
import mx.core.*;
public class CharacterAnim_bloke_ecstatic_class extends BitmapAsset {
}
}//package
Section 68
//CharacterAnim_bloke_happy_class (CharacterAnim_bloke_happy_class)
package {
import mx.core.*;
public class CharacterAnim_bloke_happy_class extends BitmapAsset {
}
}//package
Section 69
//CharacterAnim_bloke_unhappy_class (CharacterAnim_bloke_unhappy_class)
package {
import mx.core.*;
public class CharacterAnim_bloke_unhappy_class extends BitmapAsset {
}
}//package
Section 70
//CharacterAnim_bloke_very_happy_class (CharacterAnim_bloke_very_happy_class)
package {
import mx.core.*;
public class CharacterAnim_bloke_very_happy_class extends BitmapAsset {
}
}//package
Section 71
//EsnMath (EsnMath)
package {
public class EsnMath {
public static var seed:Number = 0;
public function EsnMath(){
super();
}
public static function random(max:Number=-1):Number{
if (max == -1){
seed = ((seed * 16807) % 2147483647);
return ((seed / 2147483647));
};
return (int((max * EsnMath.random())));
}
}
}//package
Section 72
//EsnServices (EsnServices)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class EsnServices {
private static var _container:Object;
private static var _session_id:String = "0";
private static var _receive_ch_name:String;
private static var _public_lc:Object;
private static var _connected:Boolean = false;
public static var error_handler:Object;
private static var _game_parameters:String;
private static var _version = "1.02";
private static var _public_channel_name:String = "_esn_public_channel";
private static var _game_client_id:String;
private static var _ready:Boolean = false;
private static var _loader_listener:Object;
private static var _exit_url:String = "#";
private static var _clip:MovieClip;
private static var _loader:Loader;
public static var ready_handler:Object;
private static var _gateway_url:String = "http://frosmo.com/frosmo_api/secure_gateway.swf";
private static var _send_ch:Object;
private static var _timer:Timer;
private static var _send_ch_name:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
private static var _debug_level = 0;
private static var _receive_ch:Object;
private static var _rng_seed:String;
public function EsnServices(){
super();
}
public static function send(methodName:String, args:Object, callbackObject:Object=null, callbackMethod:Object=null):void{
var call:* = {methodName:methodName, args:args, callbackID:_clip._nextcallbackID};
debug(((("sending " + methodName) + " id:") + call.callbackID));
if (_connected){
_send_ch.send(_send_ch_name, "onReceive", call);
} else {
if ((((_clip == null)) || (!(_connecting)))){
error_handler.apply(null, ["NotConnected"]);
flush(true);
return;
};
_clip._queue.push(call);
};
_clip._callbacks[_clip._nextcallbackID] = {methodName:methodName, args:args, callbackObject:callbackObject, callbackMethod:callbackMethod};
_clip._nextcallbackID++;
}
public static function get game_client_id():String{
return (_game_client_id);
}
private static function flush(error:Boolean):void{
var request:Object;
var callback:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
request = _clip._queue.shift();
callback = null;
if (request != null){
if (request.callbackID != null){
callback = _clip._callbacks[request.callbackID];
};
delete _clip._callbacks[request.callbackID];
};
};
};
};
}
private static function init(id:String, clip:MovieClip):void{
var domain:String = _gateway_url.split("/")[2].split(":")[0];
_game_client_id = id;
var parameters:Object = clip.root.loaderInfo.parameters;
if (parameters){
if (parameters["session_id"]){
_session_id = parameters["session_id"];
};
if (parameters["esn_url"]){
_gateway_url = parameters["esn_url"];
};
};
if (_session_id == null){
_session_id = "0";
};
if (clip != null){
_container = clip;
load_gateway(_container);
start_listening_public_channel();
};
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, EsnServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function get ready():Boolean{
return (_ready);
}
private static function init_private_connection(channel_name:String):void{
var channel_name = channel_name;
_send_ch_name = (channel_name + "_fromgame");
_receive_ch_name = channel_name;
if (!_connected){
debug(("Handshake done. Moving to private channel " + _receive_ch_name));
_connecting = false;
_connected = true;
_public_lc.close();
_send_ch.addEventListener(StatusEvent.STATUS, EsnServices.onStatus);
_receive_ch.addEventListener(StatusEvent.STATUS, EsnServices.onStatus);
_clip.onReceive = EsnServices.handle_received_message;
_clip.onError = function ():void{
error_handler.apply(null, ["NotConnected"]);
};
_receive_ch.connect(_receive_ch_name);
while (_clip._queue.length > 0) {
_send_ch.send(_send_ch_name, "onReceive", _clip._queue.shift());
};
};
}
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 = (_ready = false));
flush(true);
_public_lc.close();
_receive_ch.close();
//unresolved jump
var _slot1 = error;
if (_timer != null){
_timer.stop();
//unresolved jump
var _slot1 = error;
};
};
}
private static function respond_to_handshake(args:Object):void{
trace("Received handshake");
init_private_connection(args.private_channel_name);
send("connect_to_session", [_session_id, _game_client_id]);
}
private static function onStatus(event:StatusEvent):void{
switch (event.level){
case "error":
debug("ERROR, try to reconnect");
_connected = false;
_public_lc.connect(_public_channel_name);
break;
};
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, EsnServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function allowDomains(server:String):String{
var hostname:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (server.indexOf("http://") != -1){
hostname = server.split("/")[2].split(":")[0];
Security.allowDomain(hostname);
Security.allowInsecureDomain(hostname);
};
return (hostname);
}
public static function setContainer(container:Object=null, doAdd:Boolean=true):void{
if (container != null){
if ((container is Sprite)){
_container = container;
};
};
if (doAdd){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get rngSeed():String{
return (_rng_seed);
}
public static function debug(text:String){
if (_debug_level > 0){
trace(((EsnServices._version + "SVC> ") + text));
};
}
public static function get version():String{
return (_version);
}
public static function get clip():Object{
return (_container);
}
public static function submitScore(score:String, callbackObj:Object, callbackMethod:Object):void{
var args:* = [EsnServices.session_id, EsnServices.game_client_id, score];
EsnServices.send("set_score", args, callbackObj, callbackMethod);
}
private static function handle_received_message(call:Object){
var method:*;
var call = call;
debug(((("Received response id: " + call.callbackID) + "/") + (_clip._nextcallbackID - 1)));
var id:String = call.callbackID;
var callback:Object = _clip._callbacks[id];
var error = !((call.errorID == null));
if (error){
EsnServices.error_handler.apply(null, [call.description]);
} else {
switch (callback.methodName){
case "set_score":
handle_response_set_score(call.args);
break;
case "connect_to_session":
handle_response_connect_to_session(call.args);
break;
};
};
if (!callback){
return;
};
method = callback.callbackMethod;
var obj:* = callback.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
method = obj[method];
};
if (((!((method == null))) && (!(error)))){
method.apply(obj, call.args);
//unresolved jump
var _slot1 = error;
trace(((("Error invoking callback method '" + method) + "': ") + _slot1.toString()));
} else {
if (((!((obj == null))) && (!(error)))){
obj(call.args);
//unresolved jump
var _slot1 = error;
trace(("Error invoking method on object: " + _slot1.toString()));
};
};
delete _clip._callbacks[id];
}
public static function bringToTop(e:Event):void{
var e = e;
if (EsnServices.clip != null){
if (EsnServices.childClip != null){
if (EsnServices.clip.numChildren > 1){
EsnServices.clip.setChildIndex(EsnServices.childClip, (EsnServices.clip.numChildren - 1));
};
//unresolved jump
var _slot1 = errorObject;
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, EsnServices.bringToTop);
};
};
}
private static function start_listening_public_channel(){
_public_lc = get_local_connection();
_public_lc.client = _clip;
_public_lc.client.handshake = respond_to_handshake;
_public_lc.connect(_public_channel_name);
//unresolved jump
var _slot1 = error;
error_handler.apply(null, ["Gateway already connected."]);
EsnServices.disconnect();
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number, doAdd:Boolean=true):MovieClip{
var parent = parent;
var name = name;
var depth = depth;
var doAdd = doAdd;
var mc:MovieClip = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
parent[name] = mc;
//unresolved jump
var _slot1 = e;
throw (new Error("Clip instance should be dynamic"));
mc["_name"] = name;
return (mc);
}
public static function get exitUrl():String{
return (_exit_url);
}
private static function load_gateway(clip:Object):MovieClip{
var clip = clip;
var clipname:String = ("_esn_" + _game_client_id);
if (_clip != null){
return (_clip);
};
allowDomains(_gateway_url);
_clip = createEmptyMovieClip(clip, clipname, 20000, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
var f:Function = function (ev:Object):void{
_clip._esnservices_failed = true;
EsnServices.disconnect();
error_handler.apply(null, ["NotConnected"]);
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
var req:URLRequest = new URLRequest(_gateway_url);
_loader.load(req);
_clip.addChild(_loader);
_clip._esnservices_gateway = _loader;
_send_ch = get_local_connection();
_clip._queue = [];
_receive_ch = get_local_connection();
_receive_ch.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
trace("Loading gateway...");
return (_clip);
}
public static function get session_id():String{
return (_session_id);
}
public static function dump(obj:Object):String{
var name:String;
var ret:String = "";
for (name in obj) {
ret = (ret + (((name + ": ") + obj[name]) + " "));
};
return (ret);
}
private static function handle_response_set_score(args){
trace("score submitted");
}
public static function connect(game_client_id:String, clip:MovieClip, error_handler:Object, ready_handler:Object):void{
var game_client_id = game_client_id;
var clip = clip;
var error_handler = error_handler;
var ready_handler = ready_handler;
if (error_handler != null){
EsnServices.error_handler = error_handler;
} else {
if (EsnServices.error_handler == null){
EsnServices.error_handler = function (errorCode:String):void{
trace(("ERROR :: " + errorCode));
};
};
};
if (ready_handler != null){
EsnServices.ready_handler = ready_handler;
};
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
_connecting = true;
init(game_client_id, clip);
};
} else {
trace("Error, EsnServices requires a Sprite, Movieclip or instance of the stage.");
};
}
private static function get_local_connection():LocalConnection{
var lc:* = new LocalConnection();
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
return (lc);
}
public static function get gameParameters():String{
return (_game_parameters);
}
private static function handle_response_connect_to_session(args){
trace("Received parameters from Esn Server");
_game_parameters = args[0];
_exit_url = args[1];
_rng_seed = args[2];
EsnMath.seed = args[2];
_ready = true;
if (EsnServices.ready_handler){
EsnServices.ready_handler.apply(null, []);
};
}
public static function connectWait(e:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._esnservices_failed = true;
trace("Gateway couldn't be loaded.");
EsnServices.disconnect();
error_handler.apply(null, ["Gateway couldn't be loaded."]);
};
_timer.stop();
};
}
}
}//package
Section 73
//Explosion (Explosion)
package {
import flash.display.*;
import flash.geom.*;
public class Explosion extends Sprite {
private var bomb_explosion_class:Class;
public static const ANIM_FRAMES:int = 6;
public static var explosion_bitmap:BitmapData;
public static var _mtx:Matrix = new Matrix();
public static var explosion_image:Bitmap;
public static var frame_width:int;
public static var frame_height:int;
public function Explosion(){
bomb_explosion_class = Explosion_bomb_explosion_class;
super();
}
public function init():void{
mouseEnabled = false;
explosion_image = new bomb_explosion_class();
frame_width = explosion_image.width;
frame_height = (explosion_image.height / ANIM_FRAMES);
explosion_bitmap = new BitmapData(explosion_image.width, explosion_image.height, true, 0xFFFFFF);
explosion_bitmap.draw(explosion_image, new Matrix());
}
public static function drawExplosion(_graphics:Graphics, _frame:int, _x:int, _y:int):void{
_x = (_x - (frame_width / 2));
_y = (_y - (frame_height / 2));
_mtx = new Matrix();
_mtx.translate(_x, (_y - (_frame * frame_height)));
_graphics.beginBitmapFill(explosion_bitmap, _mtx, false, false);
_graphics.drawRect(_x, _y, frame_width, frame_height);
_graphics.endFill();
}
}
}//package
Section 74
//Explosion_bomb_explosion_class (Explosion_bomb_explosion_class)
package {
import mx.core.*;
public class Explosion_bomb_explosion_class extends BitmapAsset {
}
}//package
Section 75
//LargeText (LargeText)
package {
import flash.events.*;
import flash.display.*;
public class LargeText extends Sprite {
private var text_ready_class:Class;
private var credits_class:Class;
private var text_gameover_class:Class;
private var text_go_class:Class;
private var leaderboard_class:Class;
private var text_paused_class:Class;
private var choose_game_class:Class;
private var text_time_up_class:Class;
public static var container:Sprite;
public static var go_image:Bitmap;
public static var paused_image:Bitmap;
public static var go_image_gravity:Number;
public static var leaderboard_image:Bitmap;
public static var game_over_image:Bitmap;
public static var ready_sound_played:Boolean;
public static var time_up_image:Bitmap;
public static var go_image_bounces:int;
public static var credits_image:Bitmap;
public static var go_image_yo:Number;
public static var choose_game_image:Bitmap;
public static var ready_image:Bitmap;
public function LargeText(){
text_ready_class = LargeText_text_ready_class;
text_go_class = LargeText_text_go_class;
text_gameover_class = LargeText_text_gameover_class;
text_time_up_class = LargeText_text_time_up_class;
choose_game_class = LargeText_choose_game_class;
text_paused_class = LargeText_text_paused_class;
credits_class = LargeText_credits_class;
leaderboard_class = LargeText_leaderboard_class;
super();
ready_image = new text_ready_class();
go_image = new text_go_class();
game_over_image = new text_gameover_class();
time_up_image = new text_time_up_class();
choose_game_image = new choose_game_class();
paused_image = new text_paused_class();
credits_image = new credits_class();
leaderboard_image = new leaderboard_class();
addChild(ready_image);
addChild(go_image);
addChild(game_over_image);
addChild(time_up_image);
addChild(choose_game_image);
addChild(paused_image);
addChild(credits_image);
addChild(leaderboard_image);
ready_image.visible = false;
go_image.visible = false;
game_over_image.visible = false;
time_up_image.visible = false;
paused_image.visible = false;
credits_image.visible = false;
leaderboard_image.visible = false;
choose_game_image.alpha = 0;
mouseEnabled = false;
addEventListener(Event.ENTER_FRAME, step);
}
public function step(event:Event):void{
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_TITLE:
case Bomboozle.GAME_STATE_PAUSED:
ready_image.visible = false;
go_image.visible = false;
game_over_image.visible = false;
break;
case Bomboozle.GAME_STATE_CREDITS:
credits_image.x = ((Bomboozle.STAGE_WIDTH - credits_image.width) / 2);
credits_image.y = (Bomboozle.STAGE_HEIGHT * 0.09);
break;
};
leaderboard_image.visible = (Bomboozle.game_state == Bomboozle.GAME_STATE_CHOOSE_LEADERBOARD);
leaderboard_image.x = ((Bomboozle.STAGE_WIDTH - leaderboard_image.width) / 2);
leaderboard_image.y = (Bomboozle.STAGE_HEIGHT * 0.2);
credits_image.visible = (Bomboozle.game_state == Bomboozle.GAME_STATE_CREDITS);
if (Bomboozle.game_state == Bomboozle.GAME_STATE_PAUSED){
paused_image.width = ((1 + (Math.sin(Logo.scenery_bounce_angle) / 16)) * paused_image.bitmapData.width);
paused_image.height = ((1 + (Math.sin(Logo.scenery_bounce_angle) / 16)) * paused_image.bitmapData.height);
paused_image.x = ((Bomboozle.STAGE_WIDTH - paused_image.width) / 2);
paused_image.y = ((Bomboozle.STAGE_HEIGHT / 4) - (paused_image.height / 2));
};
paused_image.visible = (Bomboozle.game_state == Bomboozle.GAME_STATE_PAUSED);
if (Bomboozle.game_state == Bomboozle.GAME_STATE_SELECT_GAME){
if (choose_game_image.alpha < 1){
choose_game_image.alpha = (choose_game_image.alpha + Bomboozle.FADE_SPEED);
};
choose_game_image.x = ((Bomboozle.STAGE_WIDTH - choose_game_image.width) / 2);
choose_game_image.y = (Bomboozle.STAGE_HEIGHT * 0.2);
} else {
if (choose_game_image.alpha > 0){
choose_game_image.alpha = (choose_game_image.alpha - Bomboozle.FADE_SPEED);
};
};
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
if (ready_image.visible){
if (ready_image.scaleX < 1){
ready_image.scaleX = (ready_image.scaleX + ((1.1 - ready_image.scaleX) / 8));
if (((!(ready_sound_played)) && ((ready_image.scaleX >= 0.5)))){
ready_sound_played = true;
PlaySample.playSound(PlaySample.SOUND_READY, 0);
};
};
if (ready_image.scaleY > 1){
ready_image.scaleY = (ready_image.scaleY - ((ready_image.scaleY - 1) / 4));
};
if (go_image_bounces > 0){
if ((ready_image.alpha = (ready_image.alpha - Bomboozle.FADE_SPEED)) < 0){
ready_image.visible = false;
};
};
ready_image.x = ((Bomboozle.STAGE_WIDTH - ready_image.width) >> 1);
ready_image.y = ((Bomboozle.STAGE_HEIGHT - ready_image.height) >> 1);
};
if (go_image.visible){
if (go_image_bounces < 6){
go_image_yo = (go_image_yo + (go_image_gravity = (go_image_gravity + 0.5)));
if (go_image_yo >= 0){
go_image_gravity = (-(go_image_gravity) / 3);
go_image_yo = 0;
if (++go_image_bounces == 1){
PlaySample.playSound(PlaySample.SOUND_GO, 0);
};
};
} else {
if ((go_image.alpha = (go_image.alpha - Bomboozle.FADE_SPEED)) < 0){
go_image.visible = false;
};
};
go_image.x = ((Bomboozle.STAGE_WIDTH - go_image.width) >> 1);
go_image.y = (((Bomboozle.STAGE_HEIGHT - go_image.height) >> 1) + go_image_yo);
};
if (game_over_image.alpha > 0){
game_over_image.alpha = (game_over_image.alpha - Bomboozle.FADE_SPEED);
};
break;
case Bomboozle.GAME_STATE_OVER:
if ((((Bomboozle.game_type == Bomboozle.GAME_TYPE_TIMED)) && ((Bomboozle.game_time <= 0)))){
time_up_image.visible = (time_up_image.alpha > 0);
time_up_image.x = ((Bomboozle.STAGE_WIDTH - time_up_image.width) / 2);
time_up_image.y = (Bomboozle.STAGE_HEIGHT * 0.25);
if (time_up_image.alpha < 1){
time_up_image.alpha = (time_up_image.alpha + Bomboozle.FADE_SPEED);
};
} else {
game_over_image.visible = (game_over_image.alpha > 0);
game_over_image.x = ((Bomboozle.STAGE_WIDTH - game_over_image.width) / 2);
game_over_image.y = (Bomboozle.STAGE_HEIGHT * 0.13);
if (game_over_image.alpha < 1){
game_over_image.alpha = (game_over_image.alpha + Bomboozle.FADE_SPEED);
};
};
break;
default:
if (game_over_image.alpha > 0){
game_over_image.alpha = (game_over_image.alpha - Bomboozle.FADE_SPEED);
};
if (time_up_image.alpha > 0){
time_up_image.alpha = (time_up_image.alpha - Bomboozle.FADE_SPEED);
};
break;
};
}
public static function init():void{
ready_sound_played = false;
ready_image.scaleX = 0;
ready_image.scaleY = 10;
ready_image.alpha = 1;
ready_image.visible = true;
go_image.scaleX = 1;
go_image.scaleY = 1;
go_image.alpha = 1;
go_image.visible = true;
go_image_gravity = 1;
go_image.y = -400;
go_image_yo = -400;
go_image_bounces = 0;
}
}
}//package
Section 76
//LargeText_choose_game_class (LargeText_choose_game_class)
package {
import mx.core.*;
public class LargeText_choose_game_class extends BitmapAsset {
}
}//package
Section 77
//LargeText_credits_class (LargeText_credits_class)
package {
import mx.core.*;
public class LargeText_credits_class extends BitmapAsset {
}
}//package
Section 78
//LargeText_leaderboard_class (LargeText_leaderboard_class)
package {
import mx.core.*;
public class LargeText_leaderboard_class extends BitmapAsset {
}
}//package
Section 79
//LargeText_text_gameover_class (LargeText_text_gameover_class)
package {
import mx.core.*;
public class LargeText_text_gameover_class extends BitmapAsset {
}
}//package
Section 80
//LargeText_text_go_class (LargeText_text_go_class)
package {
import mx.core.*;
public class LargeText_text_go_class extends BitmapAsset {
}
}//package
Section 81
//LargeText_text_paused_class (LargeText_text_paused_class)
package {
import mx.core.*;
public class LargeText_text_paused_class extends BitmapAsset {
}
}//package
Section 82
//LargeText_text_ready_class (LargeText_text_ready_class)
package {
import mx.core.*;
public class LargeText_text_ready_class extends BitmapAsset {
}
}//package
Section 83
//LargeText_text_time_up_class (LargeText_text_time_up_class)
package {
import mx.core.*;
public class LargeText_text_time_up_class extends BitmapAsset {
}
}//package
Section 84
//Logo (Logo)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.geom.*;
import com.doof.client.gameconnector.*;
public class Logo extends Sprite {
private const logo_image_class:Class;
private const LOADER_BAR_LEFT:int;
private const LOADER_BAR_TOP:int;
private const LOADER_BAR_HEIGHT:int = 16;
private const LOADER_BAR_WIDTH:int;
private const class_dev_logo:Class;
private const ADVERT_TIMER_MAX:int = 300;
private var class_mindjolt_logo:Class;
private var class_andkon_logo:Class;
private var dev_logo_bitmap:Bitmap;
private var advert_timer:int;// = 300
private var sponsor_logo_bitmap:Bitmap;
private var advert_bitmap:Bitmap;
private var class_advert:Class;
private var sponsor_logo_timer:int;// = 80
public static var finished_scaling:Boolean;
public static var scenery_bounce_angle:Number = 0;
public static var connector:GameConnector;
public static var advert_sprite:Sprite = new Sprite();
public static var logo_stretching:Boolean = true;
public static var flash_fade_value:Number = 1;
public static var wobble_angle:Number = 0;
public static var logo:Bitmap;
public static var portal_logo:Bitmap;
public static var dev_logo_sprite:Sprite = new Sprite();
public static var sponsor_logo_sprite:Sprite = new Sprite();
public function Logo(){
class_advert = Logo_class_advert;
LOADER_BAR_WIDTH = (Bomboozle.STAGE_WIDTH - (LOADER_BAR_HEIGHT << 1));
LOADER_BAR_LEFT = ((Bomboozle.STAGE_WIDTH >> 1) - (LOADER_BAR_WIDTH >> 1));
LOADER_BAR_TOP = (Bomboozle.STAGE_HEIGHT - (LOADER_BAR_HEIGHT << 1));
class_mindjolt_logo = Logo_class_mindjolt_logo;
class_andkon_logo = Logo_class_andkon_logo;
class_dev_logo = Logo_class_dev_logo;
logo_image_class = Logo_logo_image_class;
super();
logo = new logo_image_class();
logo.alpha = 0;
mouseEnabled = false;
addChild(logo);
if (Bomboozle.SHOW_IPHONE_AD){
advert_bitmap = Bitmap(new class_advert());
advert_sprite.addChild(advert_bitmap);
advert_sprite.buttonMode = true;
advert_sprite.addEventListener(MouseEvent.MOUSE_DOWN, advertClicked);
advert_sprite.scaleX = 0;
advert_sprite.scaleY = 0;
addChild(advert_sprite);
advert_sprite.alpha = 1;
};
if (!Bomboozle.FREEBINGOHUNTER_VERSION){
if (((Bomboozle.MINDJOLT_VERSION) || (Bomboozle.ANDKON_VERSION))){
if (Bomboozle.MINDJOLT_VERSION){
sponsor_logo_bitmap = Bitmap(new class_mindjolt_logo());
sponsor_logo_sprite.addEventListener(MouseEvent.MOUSE_DOWN, mindjoltLogoClicked);
} else {
if (Bomboozle.ANDKON_VERSION){
sponsor_logo_bitmap = Bitmap(new class_andkon_logo());
sponsor_logo_sprite.addEventListener(MouseEvent.MOUSE_DOWN, andkonLogoClicked);
};
};
sponsor_logo_sprite.addChild(sponsor_logo_bitmap);
sponsor_logo_sprite.buttonMode = true;
sponsor_logo_sprite.x = (320 - (sponsor_logo_bitmap.width >> 1));
sponsor_logo_sprite.y = (260 - (sponsor_logo_bitmap.height >> 1));
addChild(sponsor_logo_sprite);
};
dev_logo_bitmap = Bitmap(new class_dev_logo());
dev_logo_sprite.addChild(dev_logo_bitmap);
dev_logo_sprite.buttonMode = false;
dev_logo_sprite.addEventListener(MouseEvent.MOUSE_DOWN, devLogoClicked);
dev_logo_sprite.x = ((640 - 8) - dev_logo_bitmap.width);
dev_logo_sprite.y = ((520 - 8) - dev_logo_bitmap.height);
addChild(dev_logo_sprite);
dev_logo_sprite.alpha = 0;
};
if (((Bomboozle.MOCHIADS_VERSION) || (Bomboozle.SHOW_IPHONE_AD))){
Bomboozle.game_state = Bomboozle.GAME_STATE_SHOW_MOCHIAD;
} else {
initTitleLogo();
};
addEventListener(Event.ENTER_FRAME, step);
}
public function step(event:Event):void{
var _local2:ColorTransform;
if (((Bomboozle.DOOF_VERSION) || (Bomboozle.SHOCKWAVE_VERSION))){
if ((((Bomboozle.game_state == Bomboozle.GAME_STATE_GAME)) || ((Bomboozle.game_state == Bomboozle.GAME_STATE_PAUSED)))){
if (portal_logo.alpha > 0){
portal_logo.alpha = (portal_logo.alpha - Bomboozle.FADE_SPEED);
};
} else {
if (portal_logo.alpha < 1){
portal_logo.alpha = (portal_logo.alpha + Bomboozle.FADE_SPEED);
};
};
portal_logo.visible = (portal_logo.alpha > 0);
};
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_SHOW_MOCHIAD:
case Bomboozle.GAME_STATE_DEV_LOGO:
if (--sponsor_logo_timer < 0){
flash_fade_value = (flash_fade_value - 0.05);
if (sponsor_logo_sprite.alpha > 0){
sponsor_logo_sprite.alpha = (sponsor_logo_sprite.alpha - 0.05);
if ((sponsor_logo_sprite.alpha = (sponsor_logo_sprite.alpha - 0.05)) <= 0){
removeChild(sponsor_logo_sprite);
if (!Bomboozle.SHOW_IPHONE_AD){
Bomboozle.resetTitle();
};
};
};
if (advert_sprite.scaleX < 1){
advert_sprite.scaleX = (advert_sprite.scaleX + ((1 - advert_sprite.scaleX) * 0.2));
advert_sprite.scaleY = (advert_sprite.scaleY + ((1 - advert_sprite.scaleY) * 0.2));
advert_sprite.x = ((Bomboozle.STAGE_WIDTH >> 1) - (advert_sprite.width * 0.5));
advert_sprite.y = ((Bomboozle.STAGE_HEIGHT >> 1) - (advert_sprite.height * 0.5));
};
};
if (Bomboozle.SHOW_IPHONE_AD){
graphics.clear();
graphics.beginFill(3771466, 1);
graphics.drawRect(LOADER_BAR_LEFT, LOADER_BAR_TOP, LOADER_BAR_WIDTH, LOADER_BAR_HEIGHT);
graphics.beginFill(16764432, 1);
graphics.drawRect(LOADER_BAR_LEFT, LOADER_BAR_TOP, LOADER_BAR_WIDTH, 1);
graphics.drawRect(LOADER_BAR_LEFT, (LOADER_BAR_TOP + LOADER_BAR_HEIGHT), LOADER_BAR_WIDTH, 1);
graphics.drawRect(LOADER_BAR_LEFT, LOADER_BAR_TOP, 1, LOADER_BAR_HEIGHT);
graphics.drawRect((LOADER_BAR_LEFT + LOADER_BAR_WIDTH), LOADER_BAR_TOP, 1, LOADER_BAR_HEIGHT);
graphics.drawRect((LOADER_BAR_LEFT + 1), (LOADER_BAR_TOP + 1), ((LOADER_BAR_WIDTH * ((ADVERT_TIMER_MAX - advert_timer) / ADVERT_TIMER_MAX)) - 2), (LOADER_BAR_HEIGHT - 1));
if (--advert_timer == 0){
dev_logo_sprite.buttonMode = true;
graphics.clear();
removeChild(advert_sprite);
Bomboozle.resetTitle();
};
};
break;
case Bomboozle.GAME_STATE_TITLE:
if (dev_logo_sprite.alpha < 1){
dev_logo_sprite.alpha = (dev_logo_sprite.alpha + 0.05);
};
dev_logo_sprite.buttonMode = true;
logo.x = ((Bomboozle.STAGE_WIDTH - logo.width) / 2);
logo.y = ((Bomboozle.STAGE_HEIGHT / 4) - (logo.height / 2));
if (logo.alpha < 1){
logo.alpha = (logo.alpha + Bomboozle.FADE_SPEED);
};
if (((!(finished_scaling)) && ((logo.scaleX < 1)))){
logo.scaleX = (logo.scaleX + ((1.01 - logo.scaleX) / 8));
logo.scaleX = Math.min(logo.scaleX, 1);
finished_scaling = (logo.scaleX >= 1);
if (finished_scaling){
wobble_angle = 0;
logo.scaleX = 0;
};
};
if (logo.scaleX < 0){
logo.x = ((Bomboozle.STAGE_WIDTH / 2) + (logo.width / 2));
} else {
if (!finished_scaling){
logo.x = ((Bomboozle.STAGE_WIDTH / 2) - (logo.width / 2));
} else {
wobble_angle = (wobble_angle + 0.1);
logo.width = ((1 + (Math.sin(wobble_angle) / 16)) * logo.bitmapData.width);
logo.height = ((1 + (Math.sin(wobble_angle) / 16)) * logo.bitmapData.height);
};
};
_local2 = logo.transform.colorTransform;
_local2.redMultiplier = (_local2.greenMultiplier = (_local2.blueMultiplier = logo.scaleX));
logo.transform.colorTransform = _local2;
break;
default:
if (logo.alpha > 0){
logo.alpha = (logo.alpha - Bomboozle.FADE_SPEED);
};
if (dev_logo_sprite.alpha > 0){
dev_logo_sprite.alpha = (dev_logo_sprite.alpha - Bomboozle.FADE_SPEED);
};
dev_logo_sprite.buttonMode = false;
break;
};
scenery_bounce_angle = (scenery_bounce_angle + 0.1);
logo.visible = (logo.alpha > 0);
}
public static function advertClicked(event:MouseEvent):void{
PlaySample.playSound(PlaySample.SOUND_SELECT, 0);
navigateToURL(new URLRequest("http://www.megadev.co.uk/bomboozle_iphone.php"), "_blank");
}
public static function mindjoltLogoClicked(event:MouseEvent):void{
navigateToURL(new URLRequest("http://www.mindjolt.com"), "_blank");
}
public static function devLogoClicked(event:MouseEvent):void{
if (dev_logo_sprite.alpha >= 1){
PlaySample.playSound(PlaySample.SOUND_SELECT, 0);
navigateToURL(new URLRequest("http://www.megadev.co.uk"), "_blank");
};
}
public static function andkonLogoClicked(event:MouseEvent):void{
navigateToURL(new URLRequest("http://www.andkon.com"), "_blank");
}
public static function initTitleLogo():void{
logo.visible = true;
logo.alpha = 1;
logo.scaleX = -1;
wobble_angle = 0;
finished_scaling = false;
}
}
}//package
Section 85
//Logo_class_advert (Logo_class_advert)
package {
import mx.core.*;
public class Logo_class_advert extends BitmapAsset {
}
}//package
Section 86
//Logo_class_andkon_logo (Logo_class_andkon_logo)
package {
import mx.core.*;
public class Logo_class_andkon_logo extends BitmapAsset {
}
}//package
Section 87
//Logo_class_dev_logo (Logo_class_dev_logo)
package {
import mx.core.*;
public class Logo_class_dev_logo extends BitmapAsset {
}
}//package
Section 88
//Logo_class_mindjolt_logo (Logo_class_mindjolt_logo)
package {
import mx.core.*;
public class Logo_class_mindjolt_logo extends BitmapAsset {
}
}//package
Section 89
//Logo_logo_image_class (Logo_logo_image_class)
package {
import mx.core.*;
public class Logo_logo_image_class extends BitmapAsset {
}
}//package
Section 90
//MD5 (MD5)
package {
class MD5 {
public static var hexcase = 0;
public static var chrsz = 8;
public static var b64pad = "=";
function MD5(){
super();
}
private static function md5_gg(a, b, c, d, x, s, t){
return (md5_cmn(((b & d) | (c & ~(d))), a, b, x, s, t));
}
private static function md5_cmn(q, a, b, x, s, t){
return (safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
private static function binl2str(bin){
var str:* = "";
var mask:* = ((1 << chrsz) - 1);
var i:* = 0;
while (i < (bin.length * 32)) {
str = (str + String.fromCharCode(((bin[(i >> 5)] >>> (i % 32)) & mask)));
i = (i + chrsz);
};
return (str);
}
private static function core_hmac_md5(key, data){
var bkey:* = str2binl(key);
if (bkey.length > 16){
bkey = core_md5(bkey, (key.length * chrsz));
};
var ipad:* = Array(16);
var opad:* = Array(16);
var i:* = 0;
while (i < 16) {
ipad[i] = (bkey[i] ^ 909522486);
opad[i] = (bkey[i] ^ 1549556828);
i++;
};
var hash:* = core_md5(ipad.concat(str2binl(data)), (0x0200 + (data.length * chrsz)));
return (core_md5(opad.concat(hash), (0x0200 + 128)));
}
private static function md5_ii(a, b, c, d, x, s, t){
return (md5_cmn((c ^ (b | ~(d))), a, b, x, s, t));
}
public static function hex_hmac_md5(key, data){
return (binl2hex(core_hmac_md5(key, data)));
}
public static function md5_vm_test(){
return ((hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"));
}
public static function hex_md5(s){
return (binl2hex(core_md5(str2binl(s), (s.length * chrsz))));
}
private static function bit_rol(num, cnt){
return (((num << cnt) | (num >>> (32 - cnt))));
}
private static function core_md5(x, len){
var olda:*;
var oldb:*;
var oldc:*;
var oldd:*;
x[(len >> 5)] = (x[(len >> 5)] | (128 << (len % 32)));
x[((((len + 64) >>> 9) << 4) + 14)] = len;
var a:* = 1732584193;
var b:* = -271733879;
var c:* = -1732584194;
var d:* = 271733878;
var i:* = 0;
while (i < x.length) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = md5_ff(a, b, c, d, x[(i + 0)], 7, -680876936);
d = md5_ff(d, a, b, c, x[(i + 1)], 12, -389564586);
c = md5_ff(c, d, a, b, x[(i + 2)], 17, 606105819);
b = md5_ff(b, c, d, a, x[(i + 3)], 22, -1044525330);
a = md5_ff(a, b, c, d, x[(i + 4)], 7, -176418897);
d = md5_ff(d, a, b, c, x[(i + 5)], 12, 1200080426);
c = md5_ff(c, d, a, b, x[(i + 6)], 17, -1473231341);
b = md5_ff(b, c, d, a, x[(i + 7)], 22, -45705983);
a = md5_ff(a, b, c, d, x[(i + 8)], 7, 1770035416);
d = md5_ff(d, a, b, c, x[(i + 9)], 12, -1958414417);
c = md5_ff(c, d, a, b, x[(i + 10)], 17, -42063);
b = md5_ff(b, c, d, a, x[(i + 11)], 22, -1990404162);
a = md5_ff(a, b, c, d, x[(i + 12)], 7, 1804603682);
d = md5_ff(d, a, b, c, x[(i + 13)], 12, -40341101);
c = md5_ff(c, d, a, b, x[(i + 14)], 17, -1502002290);
b = md5_ff(b, c, d, a, x[(i + 15)], 22, 1236535329);
a = md5_gg(a, b, c, d, x[(i + 1)], 5, -165796510);
d = md5_gg(d, a, b, c, x[(i + 6)], 9, -1069501632);
c = md5_gg(c, d, a, b, x[(i + 11)], 14, 643717713);
b = md5_gg(b, c, d, a, x[(i + 0)], 20, -373897302);
a = md5_gg(a, b, c, d, x[(i + 5)], 5, -701558691);
d = md5_gg(d, a, b, c, x[(i + 10)], 9, 38016083);
c = md5_gg(c, d, a, b, x[(i + 15)], 14, -660478335);
b = md5_gg(b, c, d, a, x[(i + 4)], 20, -405537848);
a = md5_gg(a, b, c, d, x[(i + 9)], 5, 568446438);
d = md5_gg(d, a, b, c, x[(i + 14)], 9, -1019803690);
c = md5_gg(c, d, a, b, x[(i + 3)], 14, -187363961);
b = md5_gg(b, c, d, a, x[(i + 8)], 20, 1163531501);
a = md5_gg(a, b, c, d, x[(i + 13)], 5, -1444681467);
d = md5_gg(d, a, b, c, x[(i + 2)], 9, -51403784);
c = md5_gg(c, d, a, b, x[(i + 7)], 14, 1735328473);
b = md5_gg(b, c, d, a, x[(i + 12)], 20, -1926607734);
a = md5_hh(a, b, c, d, x[(i + 5)], 4, -378558);
d = md5_hh(d, a, b, c, x[(i + 8)], 11, -2022574463);
c = md5_hh(c, d, a, b, x[(i + 11)], 16, 1839030562);
b = md5_hh(b, c, d, a, x[(i + 14)], 23, -35309556);
a = md5_hh(a, b, c, d, x[(i + 1)], 4, -1530992060);
d = md5_hh(d, a, b, c, x[(i + 4)], 11, 1272893353);
c = md5_hh(c, d, a, b, x[(i + 7)], 16, -155497632);
b = md5_hh(b, c, d, a, x[(i + 10)], 23, -1094730640);
a = md5_hh(a, b, c, d, x[(i + 13)], 4, 681279174);
d = md5_hh(d, a, b, c, x[(i + 0)], 11, -358537222);
c = md5_hh(c, d, a, b, x[(i + 3)], 16, -722521979);
b = md5_hh(b, c, d, a, x[(i + 6)], 23, 76029189);
a = md5_hh(a, b, c, d, x[(i + 9)], 4, -640364487);
d = md5_hh(d, a, b, c, x[(i + 12)], 11, -421815835);
c = md5_hh(c, d, a, b, x[(i + 15)], 16, 530742520);
b = md5_hh(b, c, d, a, x[(i + 2)], 23, -995338651);
a = md5_ii(a, b, c, d, x[(i + 0)], 6, -198630844);
d = md5_ii(d, a, b, c, x[(i + 7)], 10, 1126891415);
c = md5_ii(c, d, a, b, x[(i + 14)], 15, -1416354905);
b = md5_ii(b, c, d, a, x[(i + 5)], 21, -57434055);
a = md5_ii(a, b, c, d, x[(i + 12)], 6, 1700485571);
d = md5_ii(d, a, b, c, x[(i + 3)], 10, -1894986606);
c = md5_ii(c, d, a, b, x[(i + 10)], 15, -1051523);
b = md5_ii(b, c, d, a, x[(i + 1)], 21, -2054922799);
a = md5_ii(a, b, c, d, x[(i + 8)], 6, 1873313359);
d = md5_ii(d, a, b, c, x[(i + 15)], 10, -30611744);
c = md5_ii(c, d, a, b, x[(i + 6)], 15, -1560198380);
b = md5_ii(b, c, d, a, x[(i + 13)], 21, 1309151649);
a = md5_ii(a, b, c, d, x[(i + 4)], 6, -145523070);
d = md5_ii(d, a, b, c, x[(i + 11)], 10, -1120210379);
c = md5_ii(c, d, a, b, x[(i + 2)], 15, 718787259);
b = md5_ii(b, c, d, a, x[(i + 9)], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
i = (i + 16);
};
return (new Array(a, b, c, d));
}
public static function b64_md5(s){
return (binl2b64(core_md5(str2binl(s), (s.length * chrsz))));
}
private static function md5_ff(a, b, c, d, x, s, t){
return (md5_cmn(((b & c) | (~(b) & d)), a, b, x, s, t));
}
public static function b64_hmac_md5(key, data){
return (binl2b64(core_hmac_md5(key, data)));
}
public static function calculate(s){
return (hex_md5(s));
}
private static function md5_hh(a, b, c, d, x, s, t){
return (md5_cmn(((b ^ c) ^ d), a, b, x, s, t));
}
private static function str2binl(str){
var bin:* = new Array();
var mask:* = ((1 << chrsz) - 1);
var i:* = 0;
while (i < (str.length * chrsz)) {
bin[(i >> 5)] = (bin[(i >> 5)] | ((str.charCodeAt((i / chrsz)) & mask) << (i % 32)));
i = (i + chrsz);
};
return (bin);
}
private static function binl2hex(binarray){
var hex_tab:* = (hexcase) ? "0123456789ABCDEF" : "0123456789abcdef";
var str:* = "";
var i:* = 0;
while (i < (binarray.length * 4)) {
str = (str + (hex_tab.charAt(((binarray[(i >> 2)] >> (((i % 4) * 8) + 4)) & 15)) + hex_tab.charAt(((binarray[(i >> 2)] >> ((i % 4) * 8)) & 15))));
i++;
};
return (str);
}
public static function str_md5(s){
return (binl2str(core_md5(str2binl(s), (s.length * chrsz))));
}
public static function str_hmac_md5(key, data){
return (binl2str(core_hmac_md5(key, data)));
}
private static function safe_add(x, y){
var lsw:* = ((x & 0xFFFF) + (y & 0xFFFF));
var msw:* = (((x >> 16) + (y >> 16)) + (lsw >> 16));
return (((msw << 16) | (lsw & 0xFFFF)));
}
private static function binl2b64(binarray){
var triplet:*;
var j:*;
var tab:* = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str:* = "";
var i:* = 0;
while (i < (binarray.length * 4)) {
triplet = (((((binarray[(i >> 2)] >> (8 * (i % 4))) & 0xFF) << 16) | (((binarray[((i + 1) >> 2)] >> (8 * ((i + 1) % 4))) & 0xFF) << 8)) | ((binarray[((i + 2) >> 2)] >> (8 * ((i + 2) % 4))) & 0xFF));
j = 0;
while (j < 4) {
if (((i * 8) + (j * 6)) > (binarray.length * 32)){
str = (str + b64pad);
} else {
str = (str + tab.charAt(((triplet >> (6 * (3 - j))) & 63)));
};
j++;
};
i = (i + 3);
};
return (str);
}
}
}//package
Section 91
//MenuIcon (MenuIcon)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.geom.*;
import mochi.*;
public dynamic class MenuIcon extends Sprite {
private var icon_yoffset:int;
private var icon_gravity:int;
private var icon_hardcore_class:Class;
private var icon_game_state:int;
private var icon_infinite_class:Class;
private var icon_image:Bitmap;
private var icon_more_games_class:Class;
private var icons_in_menu:int;
private var icon_menu_class:Class;
private var first_icon_in_menu:int;
private var icon_wobble_angle:Number;
private var icon_bounces:int;
private var icon_andkon_arcade_class:Class;
private var icon_timed_class:Class;
private var icon_next_class:Class;
private var icon_option_class:Class;
private var icon_play_class:Class;
private var icon_skip_class:Class;
private var icon_squash:Number;
private var icon_credits_class:Class;
private var icon_number:int;
private var icon_scores_class:Class;
private var icon_continue_class:Class;
public static const ICON_BOUNCE_LIMIT:int = 3;
public static var total_icon_bounces:int;
public static var mouse_over_icon:int = -1;
public function MenuIcon(){
icon_play_class = MenuIcon_icon_play_class;
icon_option_class = MenuIcon_icon_option_class;
icon_credits_class = MenuIcon_icon_credits_class;
icon_scores_class = MenuIcon_icon_scores_class;
icon_more_games_class = MenuIcon_icon_more_games_class;
icon_andkon_arcade_class = MenuIcon_icon_andkon_arcade_class;
icon_infinite_class = MenuIcon_icon_infinite_class;
icon_timed_class = MenuIcon_icon_timed_class;
icon_hardcore_class = MenuIcon_icon_hardcore_class;
icon_continue_class = MenuIcon_icon_continue_class;
icon_menu_class = MenuIcon_icon_menu_class;
icon_skip_class = MenuIcon_icon_skip_class;
icon_next_class = MenuIcon_icon_next_class;
super();
}
public function init($icon_value:int, $num_menu_items:int, $first_icon:int):void{
switch ($icon_value){
case 0:
icon_image = new icon_play_class();
break;
case 1:
icon_image = new icon_option_class();
break;
case 2:
icon_image = new icon_credits_class();
break;
case 3:
if (Bomboozle.MINDJOLT_VERSION){
icon_image = new icon_more_games_class();
} else {
if (Bomboozle.ANDKON_VERSION){
icon_image = new icon_andkon_arcade_class();
} else {
icon_image = new icon_scores_class();
};
};
break;
case 4:
icon_image = new icon_infinite_class();
break;
case 5:
icon_image = new icon_timed_class();
break;
case 6:
icon_image = new icon_hardcore_class();
break;
case 7:
icon_image = new icon_continue_class();
break;
case 8:
icon_image = new icon_menu_class();
break;
case 9:
icon_image = new icon_continue_class();
break;
case 10:
icon_image = new icon_menu_class();
break;
case 11:
icon_image = new icon_skip_class();
break;
case 12:
icon_image = new icon_next_class();
break;
case 13:
icon_image = new icon_infinite_class();
break;
case 14:
icon_image = new icon_timed_class();
break;
case 15:
icon_image = new icon_hardcore_class();
break;
};
if ($icon_value < 4){
icon_game_state = Bomboozle.GAME_STATE_TITLE;
} else {
if ($icon_value < 7){
icon_game_state = Bomboozle.GAME_STATE_SELECT_GAME;
} else {
if ($icon_value < 9){
icon_game_state = Bomboozle.GAME_STATE_OVER;
} else {
if ($icon_value < 11){
icon_game_state = Bomboozle.GAME_STATE_PAUSED;
} else {
if ($icon_value < 13){
icon_game_state = Bomboozle.GAME_STATE_TUTORIAL;
} else {
if ($icon_value < 16){
icon_game_state = Bomboozle.GAME_STATE_CHOOSE_LEADERBOARD;
};
};
};
};
};
};
first_icon_in_menu = $first_icon;
icon_number = $icon_value;
icons_in_menu = $num_menu_items;
icon_squash = 1;
icon_wobble_angle = 0;
addChild(icon_image);
resetIcon();
addEventListener(MouseEvent.MOUSE_OVER, mouseOverIcon);
addEventListener(MouseEvent.MOUSE_OUT, mouseOffIcon);
addEventListener(MouseEvent.MOUSE_DOWN, iconClicked);
addEventListener(Event.ENTER_FRAME, step);
}
private function mouseOffIcon(event:MouseEvent):void{
var color:ColorTransform = this.transform.colorTransform;
color.blueMultiplier = (color.redMultiplier = (color.greenMultiplier = 1));
this.transform.colorTransform = color;
}
private function mouseOverIcon(event:MouseEvent):void{
if ((((this.icon_gravity == 0)) && ((this.icon_bounces >= ICON_BOUNCE_LIMIT)))){
PlaySample.playSound(PlaySample.SOUND_OVER_ICON, 0);
};
}
public function step(event:Event):void{
this.visible = ((((this.y + this.height) >= 0)) && ((this.y < Bomboozle.STAGE_HEIGHT)));
if (this.icon_game_state == Bomboozle.game_state){
this.icon_wobble_angle = (this.icon_wobble_angle + 0.1);
mouse_over_icon = -1;
if (this.icon_bounces < ICON_BOUNCE_LIMIT){
if (this.icon_squash == 1){
this.icon_yoffset = (this.icon_yoffset + this.icon_gravity);
this.icon_gravity = (this.icon_gravity + Bomboozle.ICON_GRAVITY);
};
if (this.icon_yoffset >= 0){
if (this.icon_bounces < 1){
this.icon_squash = (this.icon_squash - ((this.icon_squash - (0.45 + (this.icon_bounces * 0.2))) / 2));
this.icon_yoffset = 0;
if (this.icon_squash <= 0.5){
this.icon_bounces++;
total_icon_bounces++;
this.icon_squash = 1;
this.icon_gravity = (-(this.icon_gravity) / 3);
};
} else {
this.icon_gravity = (-(this.icon_gravity) / 3);
this.icon_bounces++;
total_icon_bounces++;
};
};
this.scaleY = this.icon_squash;
} else {
this.icon_gravity = 0;
};
} else {
if ((((((this.icon_bounces >= ICON_BOUNCE_LIMIT)) || (!((this.icon_gravity == 0))))) && ((this.y > 0)))){
this.icon_yoffset = (this.icon_yoffset + (this.icon_gravity = (this.icon_gravity + Bomboozle.ICON_GRAVITY)));
};
};
var spacing:int = (Bomboozle.STAGE_WIDTH / this.icons_in_menu);
var menu_x:int = ((Bomboozle.STAGE_WIDTH >> 1) - ((spacing * (this.icons_in_menu - 1)) >> 1));
this.x = ((menu_x + ((this.icon_number - this.first_icon_in_menu) * spacing)) - (this.width / 2));
switch (this.icon_game_state){
case Bomboozle.GAME_STATE_OVER:
this.y = (Bomboozle.STAGE_HEIGHT * 0.8);
break;
case Bomboozle.GAME_STATE_TUTORIAL:
this.y = (Bomboozle.STAGE_HEIGHT * 0.75);
break;
default:
this.y = (Bomboozle.STAGE_HEIGHT * 0.65);
break;
};
this.y = ((this.y - (this.height / 2)) + this.icon_yoffset);
if (this.y > Bomboozle.STAGE_HEIGHT){
resetIcon();
};
}
private function iconClicked(event:MouseEvent):void{
var _score_xml:XML;
if ((((((((this.icon_game_state == Bomboozle.game_state)) && ((this.icon_gravity == 0)))) && ((this.icon_yoffset == 0)))) && ((total_icon_bounces >= (this.icons_in_menu * ICON_BOUNCE_LIMIT))))){
PlaySample.playSound(PlaySample.SOUND_SELECT, 0);
switch (this.icon_number){
case 0:
if (Bomboozle.FROSMO_VERSION){
Bomboozle.game_type = Bomboozle.GAME_TYPE_TIMED;
if (Bomboozle.tutorial_has_been_viewed){
Bomboozle.startGame();
} else {
Bomboozle.game_state = Bomboozle.GAME_STATE_TUTORIAL;
};
} else {
Bomboozle.game_state = Bomboozle.GAME_STATE_SELECT_GAME;
};
break;
case 1:
Bomboozle.game_state = Bomboozle.GAME_STATE_OPTIONS;
break;
case 2:
Bomboozle.game_state = Bomboozle.GAME_STATE_CREDITS;
break;
case 3:
if (Bomboozle.MINDJOLT_VERSION){
Logo.mindjoltLogoClicked(event);
} else {
if (Bomboozle.ANDKON_VERSION){
navigateToURL(new URLRequest("http://www.andkon.com"), "_blank");
} else {
Bomboozle.game_state = Bomboozle.GAME_STATE_CHOOSE_LEADERBOARD;
};
};
break;
case 4:
case 5:
case 6:
Bomboozle.game_type = (this.icon_number - 4);
if (Bomboozle.tutorial_has_been_viewed){
Bomboozle.startGame();
} else {
Bomboozle.game_state = Bomboozle.GAME_STATE_TUTORIAL;
};
break;
case 7:
if (Bomboozle.MOCHIADS_HISCORES){
Bomboozle.game_state = Bomboozle.GAME_STATE_SUBMIT_SCORE;
MochiScores.showLeaderboard({boardID:Bomboozle.leaderboard_IDs[Bomboozle.game_type], score:(Bomboozle.score - Bomboozle.score_modifier), showTableRank:true, previewScores:true, numScores:20, onError:Bomboozle.resetTitle, onClose:Bomboozle.resetTitle, preloaderDisplay:false});
} else {
if (Bomboozle.XPO_VERSION){
Bomboozle.conn.send("XPOGamesToolkit", "gameEnd");
};
if (Bomboozle.WHIRLED_VERSION){
Bomboozle._control.game.playerReady();
};
if (Bomboozle.FROSMO_VERSION){
navigateToURL(new URLRequest(EsnServices.exitUrl));
};
if (Bomboozle.SANOMA_VERSION){
_score_xml = new XML("<highscore score=\"88888\"><display>88888</display><data></data></highscore>");
PelikoneGameAPI.submitHighscore(3, "7bcf9e6e157f93f6b6210ef7130bb76c", "12345678", _score_xml, sanomaCallBack);
};
Bomboozle.resetTitle();
};
break;
case 8:
break;
case 9:
Bomboozle.game_state = Bomboozle.GAME_STATE_GAME;
Bomboozle.tutorial_has_been_viewed = true;
Bomboozle.tutorial_page = Bomboozle.TUTORIAL_PAGES;
break;
case 10:
Bomboozle.resetTitle();
break;
case 11:
Bomboozle.startGame();
break;
case 12:
if (++Bomboozle.tutorial_page >= Bomboozle.TUTORIAL_PAGES){
Bomboozle.startGame();
};
break;
case 13:
case 14:
case 15:
if (Bomboozle.SHOCKWAVE_VERSION){
switch ((this.icon_number - 13)){
case Bomboozle.GAME_TYPE_INFINITE:
Bomboozle._highscore_infinite.openHub("view", 0);
break;
case Bomboozle.GAME_TYPE_TIMED:
Bomboozle._highscore_timed.openHub("view", 0);
break;
case Bomboozle.GAME_TYPE_SKULL:
Bomboozle._highscore_skull.openHub("view", 0);
break;
};
} else {
if (Bomboozle.MOCHIADS_HISCORES){
Bomboozle.game_state = Bomboozle.GAME_STATE_SCOREBOARD;
MochiScores.showLeaderboard({boardID:Bomboozle.leaderboard_IDs[(this.icon_number - 13)], showTableRank:true, previewScores:true, numScores:20, onError:Bomboozle.resetTitle, onClose:Bomboozle.resetTitle, preloaderDisplay:false});
};
};
break;
};
};
}
public function resetIcon():void{
this.visible = false;
this.icon_gravity = 0;
this.icon_yoffset = (this.y = (-(Bomboozle.STAGE_HEIGHT) - (Math.random() * 200)));
this.icon_bounces = 0;
this.alpha = 1;
this.icon_squash = 1;
total_icon_bounces = 0;
}
public static function sanomaCallBack():void{
}
}
}//package
Section 92
//MenuIcon_icon_andkon_arcade_class (MenuIcon_icon_andkon_arcade_class)
package {
import mx.core.*;
public class MenuIcon_icon_andkon_arcade_class extends BitmapAsset {
}
}//package
Section 93
//MenuIcon_icon_continue_class (MenuIcon_icon_continue_class)
package {
import mx.core.*;
public class MenuIcon_icon_continue_class extends BitmapAsset {
}
}//package
Section 94
//MenuIcon_icon_credits_class (MenuIcon_icon_credits_class)
package {
import mx.core.*;
public class MenuIcon_icon_credits_class extends BitmapAsset {
}
}//package
Section 95
//MenuIcon_icon_hardcore_class (MenuIcon_icon_hardcore_class)
package {
import mx.core.*;
public class MenuIcon_icon_hardcore_class extends BitmapAsset {
}
}//package
Section 96
//MenuIcon_icon_infinite_class (MenuIcon_icon_infinite_class)
package {
import mx.core.*;
public class MenuIcon_icon_infinite_class extends BitmapAsset {
}
}//package
Section 97
//MenuIcon_icon_menu_class (MenuIcon_icon_menu_class)
package {
import mx.core.*;
public class MenuIcon_icon_menu_class extends BitmapAsset {
}
}//package
Section 98
//MenuIcon_icon_more_games_class (MenuIcon_icon_more_games_class)
package {
import mx.core.*;
public class MenuIcon_icon_more_games_class extends BitmapAsset {
}
}//package
Section 99
//MenuIcon_icon_next_class (MenuIcon_icon_next_class)
package {
import mx.core.*;
public class MenuIcon_icon_next_class extends BitmapAsset {
}
}//package
Section 100
//MenuIcon_icon_option_class (MenuIcon_icon_option_class)
package {
import mx.core.*;
public class MenuIcon_icon_option_class extends BitmapAsset {
}
}//package
Section 101
//MenuIcon_icon_play_class (MenuIcon_icon_play_class)
package {
import mx.core.*;
public class MenuIcon_icon_play_class extends BitmapAsset {
}
}//package
Section 102
//MenuIcon_icon_scores_class (MenuIcon_icon_scores_class)
package {
import mx.core.*;
public class MenuIcon_icon_scores_class extends BitmapAsset {
}
}//package
Section 103
//MenuIcon_icon_skip_class (MenuIcon_icon_skip_class)
package {
import mx.core.*;
public class MenuIcon_icon_skip_class extends BitmapAsset {
}
}//package
Section 104
//MenuIcon_icon_timed_class (MenuIcon_icon_timed_class)
package {
import mx.core.*;
public class MenuIcon_icon_timed_class extends BitmapAsset {
}
}//package
Section 105
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public function MochiAd(){
super();
}
public static function getVersion():String{
return ("2.6");
}
public static function showClickAwayAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (width:Number, height: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 (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
var sendHostProgress:Boolean;
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
finished = true;
chk.started = getTimer();
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (this.root == null){
finished = true;
};
if (finished){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(server:String):String{
var hostname:String = server.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(hostname);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(hostname);
return (hostname);
}
public static function unload(clip:Object):Boolean{
if (((clip.clip) && (clip.clip._mochiad))){
clip = clip.clip;
};
if (clip.origFrameRate != undefined){
clip.stage.frameRate = clip.origFrameRate;
};
if (!clip._mochiad){
return (false);
};
if (clip._mochiad._containerLCName != undefined){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
};
if (clip._mochiad.onUnload){
clip._mochiad.onUnload();
};
delete clip._mochiad_loaded;
delete clip._mochiad;
return (true);
}
public static function showInterLevelAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height: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 p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 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 (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = (msec - 250);
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (finished){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(options:Object, defaults:Object):Object{
var k:String;
var pairs:Array;
var i:Number;
var kv:Array;
var optcopy:Object = {};
for (k in defaults) {
optcopy[k] = defaults[k];
};
if (options){
for (k in options) {
optcopy[k] = options[k];
};
};
if (optcopy.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."));
};
options = optcopy.clip.loaderInfo.parameters.mochiad_options;
if (options){
pairs = options.split("&");
i = 0;
while (i < pairs.length) {
kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
};
};
if (optcopy.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (optcopy);
}
public static function _cleanup(mc:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = mc;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
lc.client = null;
lc.close();
//unresolved jump
var _slot1 = e;
};
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 load(options:Object):MovieClip{
var clip:Object;
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 = options;
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 (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
//unresolved jump
var _slot1 = e;
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;
var mc:MovieClip = 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;
};
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();
loader = new Loader();
g = function (ev:Object):void{
ev.target.removeEventListener(ev.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(base:Object, methodName:String, argsArray:Array):Object{
var nameArray:Array = methodName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
if (typeof(base[nameArray[i]]) == "function"){
return (base[nameArray[i]].apply(base, argsArray));
};
return (undefined);
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number):MovieClip{
var mc:MovieClip = new MovieClip();
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
parent[name] = mc;
mc["_name"] = name;
return (mc);
}
public static function _getRes(options:Object, clip:Object):Array{
var xy:Array;
var b:Object = clip.getBounds(clip.root);
var w:Number = 0;
var h:Number = 0;
if (typeof(options.res) != "undefined"){
xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = (b.xMax - b.xMin);
h = (b.yMax - b.yMin);
};
if ((((w == 0)) || ((h == 0)))){
w = clip.stage.stageWidth;
h = clip.stage.stageHeight;
};
return ([w, h]);
}
public static function adShowing(mc:Object):void{
mc.origFrameRate = mc.stage.frameRate;
mc.stage.frameRate = 30;
}
public static function getValue(base:Object, objectName:String):Object{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
return (base[nameArray[i]]);
}
public static function rpc(clip:Object, callbackID:Number, arg:Object):void{
var _local4:Object;
var _local5:Object;
switch (arg.id){
case "setValue":
MochiAd.setValue(clip, arg.objectName, arg.value);
break;
case "getValue":
_local4 = MochiAd.getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + arg.id));
};
}
public static function setValue(base:Object, objectName:String, value:Object):void{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return;
};
base = base[nameArray[i]];
i++;
};
base[nameArray[i]] = value;
}
public static function showPreGameAd(options: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 = options;
var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height: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 (percent:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
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);
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;
bar.y = (h - 20);
};
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((w - 20), 0);
backing.lineTo((w - 20), 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((w - 20), 0);
inside.lineTo((w - 20), 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((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var f:Function = function (ev:Event):void{
ev.target.removeEventListener(ev.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s:String):Object{
trace(("[MOCHIAD rpcTestFn] " + s));
return (s);
};
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (lc_name:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _clip:Object = this.parent.parent.root;
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
var clip_total:Number = _clip.loaderInfo.bytesTotal;
var clip_loaded:Number = _clip.loaderInfo.bytesLoaded;
if (complete){
clip_loaded = Math.max(1, clip_loaded);
clip_total = clip_loaded;
};
var clip_pcnt:Number = ((100 * clip_loaded) / clip_total);
var ad_pcnt:Number = ((100 * elapsed) / chk.ad_msec);
var _inside:Object = this._mochiad_bar._inside;
var pcnt:Number = Math.min(100, Math.min(((clip_pcnt) || (0)), ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside.scaleX = (pcnt * 0.01);
options.ad_progress(pcnt);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:clip_pcnt});
if (clip_pcnt == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((elapsed > chk.ad_timeout)) && ((clip_pcnt == 100)))){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (((complete) && (finished))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(options);
}
public static function showTimedAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(options);
}
public static function doOnEnterFrame(mc:MovieClip):void{
var mc = mc;
var f:Function = function (ev:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
ev.target.removeEventListener(ev.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 106
//Panel (Panel)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class Panel extends Sprite {
private var panel_chains_image:Bitmap;
private var panel_chains_class:Class;
private var panel_hiscore_class:Class;
private var panel_score_class:Class;
private var panel_score_image:Bitmap;
private var panel_hiscore_image:Bitmap;
private var panel_x:int;
private var panel_y:int;
public static var panel_chains_bitmap:BitmapData;
public static var panel_chains_yo:Number;
public static var _mtx:Matrix = new Matrix();
public static var panel_score_bitmap:BitmapData;
public static var panel_hiscore_bitmap:BitmapData;
public static var panel_score_yo:Number;
public static var panel_hiscore_yo:Number;
public function Panel(){
panel_score_class = Panel_panel_score_class;
panel_hiscore_class = Panel_panel_hiscore_class;
panel_chains_class = Panel_panel_chains_class;
super();
}
public function init():void{
panel_score_image = new panel_score_class();
panel_hiscore_image = new panel_hiscore_class();
panel_chains_image = new panel_chains_class();
panel_score_bitmap = new BitmapData(panel_score_image.width, panel_score_image.height, true, 0xFFFFFF);
panel_score_bitmap.draw(panel_score_image, new Matrix());
panel_hiscore_bitmap = new BitmapData(panel_hiscore_image.width, panel_hiscore_image.height, true, 0xFFFFFF);
panel_hiscore_bitmap.draw(panel_hiscore_image, new Matrix());
panel_chains_bitmap = new BitmapData(panel_chains_image.width, panel_chains_image.height, true, 0xFFFFFF);
panel_chains_bitmap.draw(panel_chains_image, new Matrix());
addEventListener(Event.ENTER_FRAME, step);
}
public function step(event:Event):void{
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
case Bomboozle.GAME_STATE_PAUSED:
case Bomboozle.GAME_STATE_OVER:
visible = true;
graphics.clear();
panel_x = 369;
panel_y = (29 + panel_score_yo);
_mtx = new Matrix();
_mtx.translate(panel_x, panel_y);
graphics.beginBitmapFill(panel_score_bitmap, _mtx, false, false);
graphics.drawRect(panel_x, panel_y, panel_score_image.width, panel_score_image.height);
BitmapText.drawNumber(graphics, (Bomboozle.score - Bomboozle.score_modifier), (panel_x + (panel_score_image.width * 0.9)), (panel_y + (panel_score_image.height / 2)), "right", BitmapText.SCORE_FONT);
panel_x = 420;
panel_y = (93 + panel_hiscore_yo);
_mtx = new Matrix();
_mtx.translate(panel_x, panel_y);
graphics.beginBitmapFill(panel_hiscore_bitmap, _mtx, false, false);
graphics.drawRect(panel_x, panel_y, panel_hiscore_image.width, panel_hiscore_image.height);
BitmapText.drawNumber(graphics, Bomboozle.hiscore[Bomboozle.game_type], (panel_x + (panel_hiscore_image.width * 0.9)), (panel_y + (panel_hiscore_image.height / 2)), "right", BitmapText.SCORE_FONT);
panel_x = 472;
panel_y = (156 + panel_chains_yo);
_mtx = new Matrix();
_mtx.translate(panel_x, panel_y);
graphics.beginBitmapFill(panel_chains_bitmap, _mtx, false, false);
graphics.drawRect(panel_x, panel_y, panel_chains_image.width, panel_chains_image.height);
BitmapText.drawNumber(graphics, Blocks.groups_made, (panel_x + (panel_chains_image.width * 0.9)), (panel_y + (panel_chains_image.height / 2)), "right", BitmapText.SCORE_FONT);
if (panel_chains_yo < 0){
panel_chains_yo = (panel_chains_yo + Math.abs(((panel_chains_yo - 1) / 2)));
} else {
if (panel_hiscore_yo < 0){
panel_hiscore_yo = (panel_hiscore_yo + Math.abs(((panel_hiscore_yo - 1) / 2)));
} else {
if (panel_score_yo < 0){
panel_score_yo = (panel_score_yo + Math.abs(((panel_score_yo - 1) / 2)));
};
};
};
break;
default:
visible = false;
break;
};
}
}
}//package
Section 107
//Panel_panel_chains_class (Panel_panel_chains_class)
package {
import mx.core.*;
public class Panel_panel_chains_class extends BitmapAsset {
}
}//package
Section 108
//Panel_panel_hiscore_class (Panel_panel_hiscore_class)
package {
import mx.core.*;
public class Panel_panel_hiscore_class extends BitmapAsset {
}
}//package
Section 109
//Panel_panel_score_class (Panel_panel_score_class)
package {
import mx.core.*;
public class Panel_panel_score_class extends BitmapAsset {
}
}//package
Section 110
//Path (Path)
package {
import flash.events.*;
import flash.display.*;
import flash.ui.*;
public class Path extends Sprite {
private var pencil_image_class:Class;
private var flash_image_class:Class;
public static var prev_mouseY:Number;
public static var path_start_x:Number;
public static var pencil_image:Bitmap;
public static var flash_y:int;
public static var flash_image:Bitmap;
public static var flash_x:int;
public static var clear_path:Boolean;
public static var path_start_y:Number;
public static var prev_mouseX:Number;
public function Path(){
pencil_image_class = Path_pencil_image_class;
flash_image_class = Path_flash_image_class;
super();
pencil_image = new pencil_image_class();
flash_image = new flash_image_class();
}
public function init():void{
mouseEnabled = false;
pencil_image.alpha = 1;
pencil_image.visible = false;
addChild(pencil_image);
addChild(flash_image);
flash_image.alpha = 0;
addEventListener(Event.ENTER_FRAME, step);
}
public function step(event:Event):void{
flash_x = mouseX;
flash_y = mouseY;
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
if (((((Blocks.cursor_active) && (((!((prev_mouseX == stage.mouseX))) || (!((prev_mouseY == stage.mouseY))))))) || (clear_path))){
graphics.lineStyle(7, 0xFFFFFF);
graphics.moveTo((path_start_x - (Blocks.BLOB_SIZE * 0.26)), (path_start_y - (Blocks.BLOB_SIZE * 0.24)));
graphics.lineTo((path_start_x + (Blocks.BLOB_SIZE / 4)), (path_start_y + (Blocks.BLOB_SIZE / 4)));
graphics.moveTo((path_start_x + (Blocks.BLOB_SIZE * 0.23)), (path_start_y - (Blocks.BLOB_SIZE * 0.27)));
graphics.lineTo((path_start_x - (Blocks.BLOB_SIZE * 0.22)), (path_start_y + (Blocks.BLOB_SIZE * 0.22)));
graphics.moveTo(prev_mouseX, prev_mouseY);
graphics.lineTo(mouseX, mouseY);
prev_mouseX = mouseX;
prev_mouseY = mouseY;
if (clear_path){
graphics.clear();
prev_mouseX = mouseX;
prev_mouseY = mouseY;
path_start_x = mouseX;
path_start_y = mouseY;
clear_path = false;
};
};
pencil_image.visible = true;
break;
case Bomboozle.GAME_STATE_SHOW_MOCHIAD:
case Bomboozle.GAME_STATE_SCOREBOARD:
case Bomboozle.GAME_STATE_SUBMIT_SCORE:
graphics.clear();
pencil_image.visible = false;
break;
default:
graphics.clear();
pencil_image.visible = true;
break;
};
if (flash_image.alpha > 0){
flash_image.alpha = (flash_image.alpha - (Bomboozle.FADE_SPEED / 2));
};
pencil_image.x = mouseX;
pencil_image.y = (mouseY - pencil_image.height);
}
public static function mouseOver(event:MouseEvent):void{
if (pencil_image.visible){
Mouse.hide();
};
}
public static function placeFlash(_x:int, _y:int):void{
flash_image.x = (_x - (flash_image.width >> 1));
flash_image.y = (_y - (flash_image.height >> 1));
flash_image.alpha = 1;
}
public static function mouseOut(event:MouseEvent):void{
Mouse.show();
}
public static function mouseDown(event:MouseEvent):void{
flash_image.x = (flash_x - (flash_image.width >> 1));
flash_image.y = (flash_y - (flash_image.height >> 1));
flash_image.alpha = 1;
}
}
}//package
Section 111
//Path_flash_image_class (Path_flash_image_class)
package {
import mx.core.*;
public class Path_flash_image_class extends BitmapAsset {
}
}//package
Section 112
//Path_pencil_image_class (Path_pencil_image_class)
package {
import mx.core.*;
public class Path_pencil_image_class extends BitmapAsset {
}
}//package
Section 113
//PauseButton (PauseButton)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class PauseButton extends Sprite {
private var icon_pause:Bitmap;
private var pauseIconClass:Class;
public function PauseButton(){
pauseIconClass = PauseButton_pauseIconClass;
super();
}
private function mouseOverIcon(event:MouseEvent):void{
if (this.alpha >= 1){
PlaySample.playSound(PlaySample.SOUND_OVER_ICON, 1);
};
}
public function init():void{
icon_pause = new pauseIconClass();
alpha = 0;
x = 369;
y = 200;
addChild(icon_pause);
addEventListener(MouseEvent.MOUSE_OVER, mouseOverIcon);
addEventListener(MouseEvent.MOUSE_OUT, mouseOffIcon);
addEventListener(MouseEvent.MOUSE_DOWN, iconClicked);
addEventListener(Event.ENTER_FRAME, step);
}
private function mouseOffIcon(event:MouseEvent):void{
var color:ColorTransform = this.transform.colorTransform;
color.blueMultiplier = (color.redMultiplier = (color.greenMultiplier = 1));
this.transform.colorTransform = color;
}
public function step(event:Event):void{
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
if (this.alpha < 1){
this.alpha = (this.alpha + Bomboozle.FADE_SPEED);
};
break;
default:
if (this.alpha > 0){
this.alpha = (this.alpha - Bomboozle.FADE_SPEED);
};
break;
};
this.mouseEnabled = (this.alpha >= 1);
this.visible = (this.alpha > 0);
}
private function iconClicked(event:MouseEvent):void{
trace("iconClicked");
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_GAME:
PlaySample.playSound(PlaySample.SOUND_SELECT, 0);
Bomboozle.game_state = Bomboozle.GAME_STATE_PAUSED;
break;
};
}
}
}//package
Section 114
//PauseButton_pauseIconClass (PauseButton_pauseIconClass)
package {
import mx.core.*;
public class PauseButton_pauseIconClass extends BitmapAsset {
}
}//package
Section 115
//PelikoneGameAPI (PelikoneGameAPI)
package {
import flash.display.*;
public dynamic class PelikoneGameAPI extends MovieClip {
private static var BASEURL:String = "http://pelikone.rd.swelcom.fi";
public function PelikoneGameAPI(){
super();
}
public static function submitHighscore(developerId:Number, developerSecret:String, gameKey:String, scoreXML:XML, onLoad:Function):void{
var responseXML:XML;
var developerId = developerId;
var developerSecret = developerSecret;
var gameKey = gameKey;
var scoreXML = scoreXML;
var onLoad = onLoad;
responseXML = new XML();
var url = (((("/gameapi/game/" + developerId.toString()) + "/") + gameKey) + "/highscore");
responseXML.onLoad = function (success:Boolean){
var data:* = null;
if (success){
data = responseXML;
};
if (onLoad != null){
onLoad(developerId, gameKey, data);
};
};
addRESTHeaders(scoreXML, developerId, developerSecret, url, "POST");
scoreXML.sendAndLoad((BASEURL + url), responseXML);
}
public static function getHighscores(developerId:Number, developerSecret:String, gameKey:String, onLoad:Function):void{
var responseXML:XML;
var developerId = developerId;
var developerSecret = developerSecret;
var gameKey = gameKey;
var onLoad = onLoad;
var sendXML:XML = new XML("<null/>");
responseXML = new XML();
var url = (((("/gameapi/game/" + developerId.toString()) + "/") + gameKey) + "/highscore");
responseXML.onLoad = function (success:Boolean){
var data:* = null;
if (success){
data = responseXML;
};
if (onLoad != null){
onLoad(developerId, gameKey, data);
};
};
addRESTHeaders(sendXML, developerId, developerSecret, url, "GET");
sendXML.sendAndLoad((BASEURL + url), responseXML);
}
private static function addRESTHeaders(xml:XML, developerId:Number, developerSecret:String, url:String, method:String):void{
var body:* = xml.toString();
var md5:* = MD5.hex_md5(body);
var ctype:* = "text/xml";
var now:* = new Date();
var date:* = now.toString();
var macsrc:* = ((((((((method + "\n") + md5) + "\n") + ctype) + "\n") + date) + "\n") + url);
var mac:* = MD5.b64_hmac_md5(developerSecret, macsrc);
xml.addRequestHeader("X-PKGA-Method", method);
xml.addRequestHeader("X-PKGA-Content-MD5", md5);
xml.addRequestHeader("X-PKGA-Content-Type", ctype);
xml.addRequestHeader("X-PKGA-Date", date);
xml.addRequestHeader("X-PKGA-Authorization", ((("PKGA " + developerId.toString()) + ":") + mac));
}
}
}//package
Section 116
//PlaySample (PlaySample)
package {
import flash.media.*;
public class PlaySample {
private var _sound_bomb_awarded_Class:Class;
private var _sound_ready_Class:Class;
private var _sound_go_Class:Class;
private var _sound_blob_explosion_Class:Class;
private var _sound_bomb_explosion_Class:Class;
private var _sound_activate_Class:Class;
private var _sound_add_blob_Class:Class;
private var _sound_select_Class:Class;
private var _sound_deactivate_Class:Class;
private var _sound_over_icon_Class:Class;
private var _sound_start_game_class:Class;
private var _sound_skull_drop_Class:Class;
public static const SOUND_SKULL_DROP:int = 11;
public static const SOUND_DEV_LOGO:int = 12;
public static const SOUND_START_GAME:int = 2;
public static const SOUND_BLOB_EXPLOSION:int = 3;
public static const SOUND_READY:int = 8;
public static const SOUND_OVER_ICON:int = 0;
public static const SOUND_GO:int = 9;
public static const SOUND_ACTIVATE:int = 4;
public static const SOUND_DEACTIVATE:int = 5;
public static const SOUND_SELECT:int = 1;
public static const SOUND_BOMB_AWARDED:int = 10;
public static const SOUND_ADD_BLOB:int = 7;
public static const SOUND_BOMB_EXPLOSION:int = 6;
public static var _sound_deactivate:Sound;
public static var _sound_blob_explosion:Sound;
public static var _sound_select:Sound;
public static var _sound_over_icon:Sound;
public static var _sound_skull_drop:Sound;
public static var _sound_ready:Sound;
public static var _sound_start_game:Sound;
public static var _sound_activate:Sound;
public static var _sound_bomb_explosion:Sound;
public static var _sound_add_blob:Sound;
public static var _channel:SoundChannel;
public static var _sound_dev_logo:Sound;
public static var _transform:SoundTransform;
public static var _sound_bomb_awarded:Sound;
public static var _sound_go:Sound;
public function PlaySample(){
_sound_over_icon_Class = PlaySample__sound_over_icon_Class;
_sound_select_Class = PlaySample__sound_select_Class;
_sound_start_game_class = PlaySample__sound_start_game_class;
_sound_blob_explosion_Class = PlaySample__sound_blob_explosion_Class;
_sound_activate_Class = PlaySample__sound_activate_Class;
_sound_deactivate_Class = PlaySample__sound_deactivate_Class;
_sound_bomb_explosion_Class = PlaySample__sound_bomb_explosion_Class;
_sound_add_blob_Class = PlaySample__sound_add_blob_Class;
_sound_ready_Class = PlaySample__sound_ready_Class;
_sound_go_Class = PlaySample__sound_go_Class;
_sound_bomb_awarded_Class = PlaySample__sound_bomb_awarded_Class;
_sound_skull_drop_Class = PlaySample__sound_skull_drop_Class;
super();
if (Bomboozle.USE_EXTERNAL_AUDIO){
} else {
_sound_over_icon = new _sound_over_icon_Class();
_sound_select = new _sound_select_Class();
_sound_start_game = new _sound_start_game_class();
_sound_blob_explosion = new _sound_blob_explosion_Class();
_sound_activate = new _sound_activate_Class();
_sound_deactivate = new _sound_deactivate_Class();
_sound_bomb_explosion = new _sound_bomb_explosion_Class();
_sound_add_blob = new _sound_add_blob_Class();
_sound_ready = new _sound_ready_Class();
_sound_go = new _sound_go_Class();
_sound_bomb_awarded = new _sound_bomb_awarded_Class();
_sound_skull_drop = new _sound_skull_drop_Class();
};
_transform = new SoundTransform();
}
public static function playSound(_sound_to_play:int, _pan:Number):void{
if (Bomboozle.sound_volume > 0){
_transform.volume = Bomboozle.sound_volume;
_transform.pan = _pan;
switch (_sound_to_play){
case SOUND_OVER_ICON:
_channel = _sound_over_icon.play(0, 0);
break;
case SOUND_SELECT:
_channel = _sound_select.play(0, 0);
break;
case SOUND_START_GAME:
_channel = _sound_start_game.play(0, 0);
break;
case SOUND_BLOB_EXPLOSION:
_channel = _sound_blob_explosion.play(0, 0);
break;
case SOUND_ACTIVATE:
_channel = _sound_activate.play(0, 0);
break;
case SOUND_DEACTIVATE:
_channel = _sound_deactivate.play(0, 0);
break;
case SOUND_BOMB_EXPLOSION:
_channel = _sound_bomb_explosion.play(0, 0);
break;
case SOUND_ADD_BLOB:
_channel = _sound_add_blob.play(0, 0);
break;
case SOUND_READY:
_channel = _sound_ready.play(0, 0);
break;
case SOUND_GO:
_channel = _sound_go.play(0, 0);
break;
case SOUND_BOMB_AWARDED:
_channel = _sound_bomb_awarded.play(0, 0);
break;
case SOUND_SKULL_DROP:
_channel = _sound_skull_drop.play(0, 0);
break;
case SOUND_DEV_LOGO:
_channel = _sound_dev_logo.play(0, 0);
break;
};
_channel.soundTransform = _transform;
};
}
}
}//package
Section 117
//PlaySample__sound_activate_Class (PlaySample__sound_activate_Class)
package {
import mx.core.*;
public class PlaySample__sound_activate_Class extends SoundAsset {
}
}//package
Section 118
//PlaySample__sound_add_blob_Class (PlaySample__sound_add_blob_Class)
package {
import mx.core.*;
public class PlaySample__sound_add_blob_Class extends SoundAsset {
}
}//package
Section 119
//PlaySample__sound_blob_explosion_Class (PlaySample__sound_blob_explosion_Class)
package {
import mx.core.*;
public class PlaySample__sound_blob_explosion_Class extends SoundAsset {
}
}//package
Section 120
//PlaySample__sound_bomb_awarded_Class (PlaySample__sound_bomb_awarded_Class)
package {
import mx.core.*;
public class PlaySample__sound_bomb_awarded_Class extends SoundAsset {
}
}//package
Section 121
//PlaySample__sound_bomb_explosion_Class (PlaySample__sound_bomb_explosion_Class)
package {
import mx.core.*;
public class PlaySample__sound_bomb_explosion_Class extends SoundAsset {
}
}//package
Section 122
//PlaySample__sound_deactivate_Class (PlaySample__sound_deactivate_Class)
package {
import mx.core.*;
public class PlaySample__sound_deactivate_Class extends SoundAsset {
}
}//package
Section 123
//PlaySample__sound_go_Class (PlaySample__sound_go_Class)
package {
import mx.core.*;
public class PlaySample__sound_go_Class extends SoundAsset {
}
}//package
Section 124
//PlaySample__sound_over_icon_Class (PlaySample__sound_over_icon_Class)
package {
import mx.core.*;
public class PlaySample__sound_over_icon_Class extends SoundAsset {
}
}//package
Section 125
//PlaySample__sound_ready_Class (PlaySample__sound_ready_Class)
package {
import mx.core.*;
public class PlaySample__sound_ready_Class extends SoundAsset {
}
}//package
Section 126
//PlaySample__sound_select_Class (PlaySample__sound_select_Class)
package {
import mx.core.*;
public class PlaySample__sound_select_Class extends SoundAsset {
}
}//package
Section 127
//PlaySample__sound_skull_drop_Class (PlaySample__sound_skull_drop_Class)
package {
import mx.core.*;
public class PlaySample__sound_skull_drop_Class extends SoundAsset {
}
}//package
Section 128
//PlaySample__sound_start_game_class (PlaySample__sound_start_game_class)
package {
import mx.core.*;
public class PlaySample__sound_start_game_class extends SoundAsset {
}
}//package
Section 129
//ProgressBar (ProgressBar)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.media.*;
public class ProgressBar extends Sprite {
public static var _sound:Sound;
public static var _channel:SoundChannel;
public static var theme_playing:Boolean;
public static var _transform:SoundTransform;
public static var finished_loading:Boolean;
public function ProgressBar(){
super();
theme_playing = false;
if (Bomboozle.WHIRLED_VERSION){
} else {
finished_loading = false;
if (((((((Bomboozle.MOCHIADS_VERSION) || (Bomboozle.WHIRLED_VERSION))) || (Bomboozle.MINDJOLT_VERSION))) || (Bomboozle.DOOF_VERSION))){
trace("init sound...");
} else {
if (((((((((((((((Bomboozle.KONGREGATE_VERSION) || (Bomboozle.OURWORLD_VERSION))) || (Bomboozle.LOCAL_VERSION))) || (Bomboozle.SHOCKWAVE_VERSION))) || (Bomboozle.USE_EXTERNAL_AUDIO))) || (Bomboozle.FROSMO_VERSION))) || (Bomboozle.FREEBINGOHUNTER_VERSION))) || (Bomboozle.ANDKON_VERSION))){
_sound = new Sound(new URLRequest("bomboozle.mp3"));
};
};
//unresolved jump
var _slot1 = errObject;
trace(("Error: " + _slot1.message));
};
addEventListener(Event.ENTER_FRAME, step);
}
public function step(event:Event):void{
var loaded:int;
var total:int;
var event = event;
if (!finished_loading){
trace("loading sound...");
loaded = _sound.bytesLoaded;
total = _sound.bytesTotal;
if (loaded >= total){
finished_loading = true;
};
} else {
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_SHOW_MOCHIAD:
case Bomboozle.GAME_STATE_DEV_LOGO:
break;
default:
if (!theme_playing){
trace("play the theme!");
_channel = _sound.play(0, int.MAX_VALUE);
_transform = new SoundTransform();
_transform.volume = Bomboozle.music_volume;
_channel.soundTransform = _transform;
theme_playing = true;
trace("...done");
};
break;
};
};
//unresolved jump
var _slot1 = errObject;
trace(("Error: " + _slot1.message));
}
}
}//package
Section 130
//Sparkle (Sparkle)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class Sparkle extends Sprite {
public var matrix:Matrix;
private var sparkle_image_class:Class;
public static var sparkle_scale:Number = 0;
public static var sparkle_rotation:Number = 0;
public static var sparkle_x:Number;
public static var sparkle_y:Number;
public static var sparkle_image:Bitmap;
public static var sparkle_rotation_dir:Number = 0;
public static var sparkle_bitmap:BitmapData;
public function Sparkle(){
matrix = new Matrix();
sparkle_image_class = Sparkle_sparkle_image_class;
super();
sparkle_image = new sparkle_image_class();
mouseEnabled = false;
init();
addEventListener(Event.ENTER_FRAME, step);
}
public function drawSparkle(_x:Number, _y:Number):void{
graphics.clear();
matrix = new Matrix();
matrix.translate(-((sparkle_bitmap.width / 2)), -((sparkle_bitmap.height / 2)));
matrix.rotate(sparkle_rotation);
matrix.scale(sparkle_scale, sparkle_scale);
matrix.translate(_x, _y);
_x = (_x - (sparkle_bitmap.width / 2));
_y = (_y - (sparkle_bitmap.height / 2));
graphics.beginBitmapFill(sparkle_bitmap, matrix, false, false);
graphics.drawRect(_x, _y, sparkle_bitmap.width, sparkle_bitmap.height);
graphics.endFill();
}
public function step(event:Event):void{
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_TITLE:
visible = true;
sparkle_rotation = (sparkle_rotation + sparkle_rotation_dir);
drawSparkle(sparkle_x, sparkle_y);
sparkle_scale = (sparkle_scale - 0.04);
if (sparkle_scale <= 0){
placeSparkle();
};
break;
default:
visible = false;
break;
};
}
public function placeSparkle():void{
sparkle_x = (Logo.logo.x + (Math.random() * Logo.logo.width));
sparkle_y = (Logo.logo.y + (Math.random() * Logo.logo.height));
sparkle_scale = 1;
sparkle_rotation_dir = ((Math.random() < 0.5)) ? -0.1 : 0.1;
}
public static function init():void{
sparkle_bitmap = new BitmapData(sparkle_image.width, sparkle_image.height, true, 0xFFFFFF);
sparkle_bitmap.draw(sparkle_image, new Matrix());
}
}
}//package
Section 131
//Sparkle_sparkle_image_class (Sparkle_sparkle_image_class)
package {
import mx.core.*;
public class Sparkle_sparkle_image_class extends BitmapAsset {
}
}//package
Section 132
//Tutorial (Tutorial)
package {
import flash.events.*;
import flash.display.*;
public class Tutorial extends Sprite {
private var tutorial_3_class:Class;
private var tutorial_0_class:Class;
private var tutorial_1_class:Class;
private var tutorial_2_class:Class;
private var page_id:int;
private var tutorial_4_class:Class;
private var tutorial_image:Bitmap;
public function Tutorial(){
tutorial_0_class = Tutorial_tutorial_0_class;
tutorial_1_class = Tutorial_tutorial_1_class;
tutorial_2_class = Tutorial_tutorial_2_class;
tutorial_3_class = Tutorial_tutorial_3_class;
tutorial_4_class = Tutorial_tutorial_4_class;
super();
}
public function step(event:Event):void{
if (this.visible){
switch (Bomboozle.game_state){
case Bomboozle.GAME_STATE_TUTORIAL:
if (Bomboozle.tutorial_page == this.page_id){
if (this.x > ((Bomboozle.STAGE_WIDTH / 2) - (this.width / 2))){
this.x = (this.x - ((this.x - ((Bomboozle.STAGE_WIDTH / 2) - (this.width / 2))) / 4));
};
} else {
if ((((this.page_id < Bomboozle.tutorial_page)) && ((this.x > -(this.width))))){
this.x = (this.x - ((this.x - (-(this.width) * 1.1)) / 4));
if (this.x < -(this.width)){
this.visible = false;
};
};
};
break;
case Bomboozle.GAME_STATE_GAME:
if (this.alpha > 0){
this.alpha = (this.alpha - Bomboozle.FADE_SPEED);
} else {
this.visible = false;
};
break;
default:
break;
};
};
}
public function init(_page:int):void{
switch (_page){
case 0:
this.tutorial_image = new tutorial_0_class();
break;
case 1:
this.tutorial_image = new tutorial_1_class();
break;
case 2:
this.tutorial_image = new tutorial_2_class();
break;
case 3:
this.tutorial_image = new tutorial_3_class();
break;
case 4:
this.tutorial_image = new tutorial_4_class();
break;
};
this.page_id = _page;
this.x = (Bomboozle.STAGE_WIDTH * 1.5);
this.y = ((Bomboozle.STAGE_HEIGHT * 0.35) - (this.tutorial_image.height / 2));
this.mouseEnabled = true;
addChild(this.tutorial_image);
addEventListener(Event.ENTER_FRAME, step);
}
}
}//package
Section 133
//Tutorial_tutorial_0_class (Tutorial_tutorial_0_class)
package {
import mx.core.*;
public class Tutorial_tutorial_0_class extends BitmapAsset {
}
}//package
Section 134
//Tutorial_tutorial_1_class (Tutorial_tutorial_1_class)
package {
import mx.core.*;
public class Tutorial_tutorial_1_class extends BitmapAsset {
}
}//package
Section 135
//Tutorial_tutorial_2_class (Tutorial_tutorial_2_class)
package {
import mx.core.*;
public class Tutorial_tutorial_2_class extends BitmapAsset {
}
}//package
Section 136
//Tutorial_tutorial_3_class (Tutorial_tutorial_3_class)
package {
import mx.core.*;
public class Tutorial_tutorial_3_class extends BitmapAsset {
}
}//package
Section 137
//Tutorial_tutorial_4_class (Tutorial_tutorial_4_class)
package {
import mx.core.*;
public class Tutorial_tutorial_4_class extends BitmapAsset {
}
}//package
Section 138
//WingedBox (WingedBox)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class WingedBox extends Sprite {
private var wing_small_image_class:Class;
private var bonus_border_right_image_class:Class;
private var bonus_border_left_image_class:Class;
public static const WING_FRAMES:int = 4;
public static var bonus_border_left_bitmapdata:BitmapData;
public static var WING_WIDTH:int = 0;
public static var wing_small_bitmapdata:BitmapData;
public static var bonus_border_right_bitmapdata:BitmapData;
public static var wing_small_image:Bitmap;
public static var WING_HEIGHT:int = 0;
public static var bonus_border_right_image:Bitmap;
public static var bonus_border_left_image:Bitmap;
public static var wing_frame:int = 0;
public static var _mtx:Matrix;
public function WingedBox(){
bonus_border_left_image_class = WingedBox_bonus_border_left_image_class;
bonus_border_right_image_class = WingedBox_bonus_border_right_image_class;
wing_small_image_class = WingedBox_wing_small_image_class;
super();
bonus_border_left_image = new bonus_border_left_image_class();
bonus_border_right_image = new bonus_border_right_image_class();
wing_small_image = new wing_small_image_class();
WING_WIDTH = (wing_small_image.width / WING_FRAMES);
WING_HEIGHT = (wing_small_image.height / 2);
mouseEnabled = false;
visible = false;
}
public function init():void{
bonus_border_left_bitmapdata = new BitmapData(bonus_border_left_image.width, bonus_border_left_image.height, true, 0xFFFFFF);
bonus_border_left_bitmapdata.draw(bonus_border_left_image, new Matrix());
bonus_border_right_bitmapdata = new BitmapData(bonus_border_right_image.width, bonus_border_right_image.height, true, 0xFFFFFF);
bonus_border_right_bitmapdata.draw(bonus_border_right_image, new Matrix());
wing_small_bitmapdata = new BitmapData(wing_small_image.width, wing_small_image.height, true, 0xFFFFFF);
wing_small_bitmapdata.draw(wing_small_image, new Matrix());
addEventListener(Event.ENTER_FRAME, step);
}
public function step(event:Event):void{
if (((((Blocks.ticks % 3) == 0)) && ((++wing_frame >= WING_FRAMES)))){
wing_frame = 0;
};
}
public static function drawBox(_graphics:Graphics, _box_x:Number, _box_y:Number, _box_width:Number, _wing_size:int):void{
var i:int;
var box_height:int = bonus_border_left_image.height;
_box_x = (_box_x - (_box_width / 2));
_graphics.beginFill(6238856);
_graphics.drawRect(_box_x, _box_y, _box_width, box_height);
_graphics.endFill();
_graphics.beginFill(46534);
_graphics.drawRect(_box_x, (_box_y + 3), _box_width, (box_height - 6));
_graphics.endFill();
_mtx = new Matrix();
_mtx.translate((_box_x - bonus_border_left_image.width), _box_y);
_graphics.beginBitmapFill(bonus_border_left_bitmapdata, _mtx, false, false);
_graphics.drawRect((_box_x - bonus_border_left_image.width), _box_y, bonus_border_left_image.width, box_height);
_graphics.endFill();
_mtx = new Matrix();
_mtx.translate((_box_x + _box_width), _box_y);
_graphics.beginBitmapFill(bonus_border_right_bitmapdata, _mtx, false, false);
_graphics.drawRect((_box_x + _box_width), _box_y, bonus_border_right_image.width, box_height);
_graphics.endFill();
_graphics.lineStyle();
if (_wing_size > -1){
_mtx = new Matrix();
i = 0;
while (i < 2) {
if (i > 0){
_mtx = new Matrix();
};
_mtx.translate(((_box_x + ((i == 0)) ? -(WING_WIDTH) : _box_width) - (wing_frame * WING_WIDTH)), (_box_y - (i * WING_HEIGHT)));
_graphics.beginBitmapFill(wing_small_bitmapdata, _mtx, false, false);
_graphics.drawRect((_box_x + ((i == 0)) ? -(WING_WIDTH) : _box_width), _box_y, WING_WIDTH, WING_HEIGHT);
i++;
};
};
_graphics.endFill();
}
}
}//package
Section 139
//WingedBox_bonus_border_left_image_class (WingedBox_bonus_border_left_image_class)
package {
import mx.core.*;
public class WingedBox_bonus_border_left_image_class extends BitmapAsset {
}
}//package
Section 140
//WingedBox_bonus_border_right_image_class (WingedBox_bonus_border_right_image_class)
package {
import mx.core.*;
public class WingedBox_bonus_border_right_image_class extends BitmapAsset {
}
}//package
Section 141
//WingedBox_wing_small_image_class (WingedBox_wing_small_image_class)
package {
import mx.core.*;
public class WingedBox_wing_small_image_class extends BitmapAsset {
}
}//package