Section 1
//BalanceArm_5 (balance_fla.BalanceArm_5)
package balance_fla {
import flash.display.*;
public dynamic class BalanceArm_5 extends MovieClip {
public var balanceState:String;
public var righttray:MovieClip;
public var motionState:String;
public var lefttray:MovieClip;
public function BalanceArm_5(){
addFrameScript(0, frame1, 19, frame20, 39, frame40, 59, frame60, 79, frame80, 99, frame100, 119, frame120);
}
function frame80(){
motionState = "STILL";
stop();
}
function frame1(){
motionState = "STILL";
stop();
}
function frame100(){
motionState = "STILL";
stop();
}
function frame20(){
motionState = "STILL";
stop();
}
function frame40(){
motionState = "STILL";
stop();
}
function frame120(){
motionState = "STILL";
stop();
}
function frame60(){
motionState = "STILL";
stop();
}
}
}//package balance_fla
Section 2
//Grid_1 (balance_fla.Grid_1)
package balance_fla {
import flash.display.*;
public dynamic class Grid_1 extends MovieClip {
public var gridmotion:MovieClip;
}
}//package balance_fla
Section 3
//LeftTray_8 (balance_fla.LeftTray_8)
package balance_fla {
import flash.display.*;
public dynamic class LeftTray_8 extends MovieClip {
public var starburst1:MovieClip;
public var mysteryweight:MovieClip;
}
}//package balance_fla
Section 4
//MainTimeline (balance_fla.MainTimeline)
package balance_fla {
import flash.events.*;
import flash.display.*;
import gs.*;
import fl.motion.easing.*;
import be.boulevart.as3.security.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var balancearm:MovieClip;
public var submit:Submit;
public var positivepoints:MovieClip;
public var speakeron:SimpleButton;
public var roundsleft:TextField;
public var newgrounds:MovieClip;
public var mouseDownWeight:Boolean;
public var numGuessed:int;
public var musicLoop:Sound;
public var j:int;
public var k:int;
public var i:int;
public var clickaway:MovieClip;
public var rightTrayWeight:int;
public var mysteryWeight:int;
public var score:TextField;
public var continuebutton:SimpleButton;
public var playagain:SimpleButton;
public var instrsprite:InstrSprite;
public var leftTrayWeight:int;
public var fw:MovieClip;
public var instrbkg:InstrBkg;
public var xc:Array;
public var speakeroff:SimpleButton;
public var yc:Array;
public var doneWeights:Array;
public var randWeights:Array;
public var muteFlag:Boolean;
public var grid:MovieClip;
public var currentWeight:MovieClip;
public var musicLoopChan:SoundChannel;
public var negativepoints:MovieClip;
public var entername:TextField;
public var playbutton:SimpleButton;
public var balanceSound:Sound;
public var pickWeights:Array;
public var mc:MovieClip;
public var helpbutton:SimpleButton;
public var glowFilters:Array;
public var usedweightcount:TextField;
public var totalScore:int;
public var my_so:SharedObject;
public var hoverFilter:Array;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2);
}
public function onSubmitScore(_arg1:MouseEvent):void{
var encScore:String;
var variables:URLVariables;
var request:URLRequest;
var loader:URLLoader;
var e = _arg1;
TweenLite.to(submit, 0.5, {x:-77});
TweenLite.to(entername, 0.5, {x:-284});
my_so.data.myTextSaved = entername.text;
my_so.flush();
encScore = RC4.encrypt(("LAR1234-1-" + score.text), "theknees");
variables = new URLVariables((((("score=" + encScore) + "&") + "pname=") + entername.text));
request = new URLRequest();
request.url = "http://cazualgamez.com/balance/highscores/index.php";
request.method = URLRequestMethod.POST;
request.data = variables;
loader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
try {
loader.load(request);
} catch(error:Error) {
trace("Unable to load URL");
};
}
public function onMouseOutWeight(_arg1:MouseEvent):void{
var _local2:MovieClip;
_local2 = (_arg1.currentTarget as MovieClip);
if (_local2.weightsprite.filters.length == 1){
_local2.weightsprite.filters = null;
};
}
public function onMouseDownStage(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:Point;
var _local5:Point;
if (balancearm.balanceState == "BALANCED"){
return;
};
_local2 = -1;
mouseDownWeight = false;
_local3 = 0;
while (_local3 < pickWeights.length) {
if (pickWeights[_local3].hitTestPoint(_arg1.stageX, _arg1.stageY)){
if (pickWeights[_local3].parent.getChildIndex(pickWeights[_local3]) > _local2){
_local2 = pickWeights[_local3].parent.getChildIndex(pickWeights[_local3]);
currentWeight = pickWeights[_local3];
mouseDownWeight = true;
};
};
_local3++;
};
if (currentWeight){
if (((!((currentWeight.parent == stage))) && (mouseDownWeight))){
_local4 = new Point(currentWeight.x, currentWeight.y);
_local5 = currentWeight.parent.localToGlobal(_local4);
if (currentWeight.parent.name == "lefttray"){
leftTrayWeight = (leftTrayWeight - int(currentWeight.weight.text));
} else {
rightTrayWeight = (rightTrayWeight - int(currentWeight.weight.text));
};
currentWeight.parent.removeChild(currentWeight);
stage.addChild(currentWeight);
currentWeight.x = _local5.x;
currentWeight.y = _local5.y;
};
};
}
public function onSpeakerOff(_arg1:MouseEvent):void{
var _local2:int;
_local2 = speakeron.x;
speakeron.x = speakeroff.x;
speakeroff.x = _local2;
speakeron.visible = true;
speakeroff.visible = false;
muteFlag = false;
musicLoopChan = musicLoop.play(0, 999999);
}
public function onMouseUpStage(_arg1:MouseEvent):void{
var _local2:int;
var _local3:Point;
var _local4:Point;
var _local5:Array;
var _local6:Array;
var _local7:int;
var _local8:int;
var _local9:int;
if (balancearm.balanceState == "BALANCED"){
return;
};
if (mouseDownWeight){
if ((((currentWeight.x > 230)) && ((currentWeight.x < 350)))){
if (currentWeight.weightsprite.filters.length == 1){
_local2 = int(usedweightcount.text);
_local2++;
usedweightcount.text = String(_local2);
updateScore();
};
currentWeight.weightsprite.filters = glowFilters;
_local3 = new Point(currentWeight.x, currentWeight.y);
_local4 = balancearm.righttray.globalToLocal(_local3);
stage.removeChild(currentWeight);
balancearm.righttray.addChild(currentWeight);
currentWeight.x = _local4.x;
currentWeight.y = 80;
rightTrayWeight = (rightTrayWeight + int(currentWeight.weight.text));
if (balancearm.balanceState == "LEFT_DOWN"){
if (rightTrayWeight > leftTrayWeight){
balancearm.balanceState = "RIGHT_DOWN";
balancearm.gotoAndPlay("leftdowntorightdown");
} else {
if (rightTrayWeight == leftTrayWeight){
balancearm.balanceState = "BALANCED";
balancearm.gotoAndPlay("leftdowntobalance");
balancearm.righttray.setChildIndex(balancearm.righttray.starburst2, (balancearm.righttray.numChildren - 1));
balancearm.righttray.starburst2.gotoAndPlay(2);
balancearm.lefttray.setChildIndex(balancearm.lefttray.starburst1, (balancearm.lefttray.numChildren - 1));
balancearm.lefttray.starburst1.gotoAndPlay(2);
doneWeights[(mysteryWeight - 1)].alpha = 1;
doneWeights[(mysteryWeight - 1)].weight.textColor = 0xFFFF00;
numGuessed++;
handleScore();
};
};
} else {
if (balancearm.balanceState == "RIGHT_DOWN"){
if (leftTrayWeight > rightTrayWeight){
balancearm.balanceState = "LEFT_DOWN";
balancearm.gotoAndPlay("rightdowntoleftdown");
} else {
if (rightTrayWeight == leftTrayWeight){
balancearm.balanceState = "BALANCED";
balancearm.gotoAndPlay("rightdowntobalance");
balancearm.righttray.setChildIndex(balancearm.righttray.starburst2, (balancearm.righttray.numChildren - 1));
balancearm.righttray.starburst2.gotoAndPlay(2);
balancearm.lefttray.setChildIndex(balancearm.lefttray.starburst1, (balancearm.lefttray.numChildren - 1));
balancearm.lefttray.starburst1.gotoAndPlay(2);
doneWeights[(mysteryWeight - 1)].alpha = 1;
doneWeights[(mysteryWeight - 1)].weight.textColor = 0xFFFF00;
numGuessed++;
handleScore();
};
};
};
};
} else {
if ((((currentWeight.x < 150)) && ((currentWeight.x > 30)))){
if (currentWeight.weightsprite.filters.length == 1){
_local2 = int(usedweightcount.text);
_local2++;
usedweightcount.text = String(_local2);
updateScore();
};
currentWeight.weightsprite.filters = glowFilters;
_local3 = new Point(currentWeight.x, currentWeight.y);
_local4 = balancearm.lefttray.globalToLocal(_local3);
stage.removeChild(currentWeight);
balancearm.lefttray.addChild(currentWeight);
currentWeight.x = _local4.x;
currentWeight.y = 80;
leftTrayWeight = (leftTrayWeight + int(currentWeight.weight.text));
if (balancearm.balanceState == "LEFT_DOWN"){
if (rightTrayWeight > leftTrayWeight){
balancearm.balanceState = "RIGHT_DOWN";
balancearm.gotoAndPlay("leftdowntorightdown");
} else {
if (rightTrayWeight == leftTrayWeight){
balancearm.balanceState = "BALANCED";
balancearm.gotoAndPlay("leftdowntobalance");
balancearm.righttray.setChildIndex(balancearm.righttray.starburst2, (balancearm.righttray.numChildren - 1));
balancearm.righttray.starburst2.gotoAndPlay(2);
balancearm.lefttray.setChildIndex(balancearm.lefttray.starburst1, (balancearm.lefttray.numChildren - 1));
balancearm.lefttray.starburst1.gotoAndPlay(2);
doneWeights[(mysteryWeight - 1)].alpha = 1;
doneWeights[(mysteryWeight - 1)].weight.textColor = 0xFFFF00;
numGuessed++;
handleScore();
};
};
} else {
if (balancearm.balanceState == "RIGHT_DOWN"){
if (leftTrayWeight > rightTrayWeight){
balancearm.balanceState = "LEFT_DOWN";
balancearm.gotoAndPlay("rightdowntoleftdown");
} else {
if (rightTrayWeight == leftTrayWeight){
balancearm.balanceState = "BALANCED";
balancearm.gotoAndPlay("rightdowntobalance");
balancearm.righttray.setChildIndex(balancearm.righttray.starburst2, (balancearm.righttray.numChildren - 1));
balancearm.righttray.starburst2.gotoAndPlay(2);
balancearm.lefttray.setChildIndex(balancearm.lefttray.starburst1, (balancearm.lefttray.numChildren - 1));
balancearm.lefttray.starburst1.gotoAndPlay(2);
doneWeights[(mysteryWeight - 1)].alpha = 1;
doneWeights[(mysteryWeight - 1)].weight.textColor = 0xFFFF00;
numGuessed++;
handleScore();
};
};
};
};
} else {
_local5 = [(400 + (0 * 35)), (400 + (1 * 35)), (400 + (2 * 35)), (400 + (3 * 35)), (400 + (4 * 35))];
_local6 = [(56 + (0 * 45)), (56 + (1 * 45)), (56 + (2 * 45)), (56 + (3 * 45)), (56 + (4 * 45)), (56 + (5 * 45)), (56 + (6 * 45)), (56 + (7 * 45))];
_local7 = 0;
_local8 = 0;
while (_local8 < 8) {
_local9 = 0;
while (_local9 < 5) {
_local7++;
if (currentWeight.weight.text == String(_local7)){
currentWeight.x = (_local5[_local9] - 5);
currentWeight.y = _local6[_local8];
_local8 = 8;
break;
};
_local9++;
};
_local8++;
};
if (balancearm.balanceState == "LEFT_DOWN"){
if (rightTrayWeight > leftTrayWeight){
balancearm.balanceState = "RIGHT_DOWN";
balancearm.gotoAndPlay("leftdowntorightdown");
} else {
if (rightTrayWeight == leftTrayWeight){
balancearm.balanceState = "BALANCED";
balancearm.gotoAndPlay("leftdowntobalance");
balancearm.righttray.setChildIndex(balancearm.righttray.starburst2, (balancearm.righttray.numChildren - 1));
balancearm.righttray.starburst2.gotoAndPlay(2);
balancearm.lefttray.setChildIndex(balancearm.lefttray.starburst1, (balancearm.lefttray.numChildren - 1));
balancearm.lefttray.starburst1.gotoAndPlay(2);
doneWeights[(mysteryWeight - 1)].alpha = 1;
doneWeights[(mysteryWeight - 1)].weight.textColor = 0xFFFF00;
numGuessed++;
handleScore();
};
};
} else {
if (balancearm.balanceState == "RIGHT_DOWN"){
if (leftTrayWeight > rightTrayWeight){
balancearm.balanceState = "LEFT_DOWN";
balancearm.gotoAndPlay("rightdowntoleftdown");
} else {
if (rightTrayWeight == leftTrayWeight){
balancearm.balanceState = "BALANCED";
balancearm.gotoAndPlay("rightdowntobalance");
balancearm.righttray.setChildIndex(balancearm.righttray.starburst2, (balancearm.righttray.numChildren - 1));
balancearm.righttray.starburst2.gotoAndPlay(2);
balancearm.lefttray.setChildIndex(balancearm.lefttray.starburst1, (balancearm.lefttray.numChildren - 1));
balancearm.lefttray.starburst1.gotoAndPlay(2);
doneWeights[(mysteryWeight - 1)].alpha = 1;
doneWeights[(mysteryWeight - 1)].weight.textColor = 0xFFFF00;
numGuessed++;
handleScore();
};
};
};
};
};
};
};
mouseDownWeight = false;
}
public function onFinishTween():void{
newgrounds.gotoAndPlay(1);
newgrounds.visible = true;
}
function frame2(){
NewgroundsAPI.linkAPI(this);
NewgroundsAPI.connectMovie(3057);
newgrounds.visible = false;
playbutton.visible = false;
clickaway.visible = false;
instrsprite.visible = false;
instrbkg.visible = false;
pickWeights = new Array();
randWeights = new Array();
mouseDownWeight = false;
mysteryWeight = 0;
leftTrayWeight = 0;
rightTrayWeight = 0;
numGuessed = 0;
totalScore = 0;
musicLoop = new MusicLoopSound();
balanceSound = new BalanceSound();
muteFlag = false;
musicLoopChan = musicLoop.play(0, 999999);
my_so = SharedObject.getLocal("savedName", "/");
k = 0;
xc = [(400 + (0 * 35)), (400 + (1 * 35)), (400 + (2 * 35)), (400 + (3 * 35)), (400 + (4 * 35))];
yc = [(56 + (0 * 45)), (56 + (1 * 45)), (56 + (2 * 45)), (56 + (3 * 45)), (56 + (4 * 45)), (56 + (5 * 45)), (56 + (6 * 45)), (56 + (7 * 45))];
i = 0;
while (i < 8) {
j = 0;
while (j < 5) {
k++;
mc = (new Weight() as MovieClip);
mc.weight.text = String(k);
mc.x = (xc[j] - 5);
mc.y = yc[i];
mc.width = 25;
mc.height = 40;
mc.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverWeight);
mc.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutWeight);
if (k == 1){
glowFilters = [mc.weightsprite.filters[0], mc.weightsprite.filters[1], mc.weightsprite.filters[2]];
hoverFilter = [mc.weightsprite.filters[3]];
};
mc.weightsprite.filters = null;
pickWeights.push(mc);
stage.addChild(mc);
j++;
};
i++;
};
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUpStage);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveStage);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownStage);
submit.addEventListener(MouseEvent.CLICK, onSubmitScore);
continuebutton.addEventListener(MouseEvent.CLICK, onContinue);
playagain.addEventListener(MouseEvent.CLICK, onPlayAgain);
speakeron.addEventListener(MouseEvent.CLICK, onSpeakerOn);
speakeroff.addEventListener(MouseEvent.CLICK, onSpeakerOff);
helpbutton.addEventListener(MouseEvent.CLICK, onHelp);
playbutton.removeEventListener(MouseEvent.CLICK, onPlay);
playbutton.addEventListener(MouseEvent.CLICK, onPlay2);
doneWeights = new Array();
i = 0;
while (i < 20) {
fw = new FoundWeight();
fw.x = ((i * 18) + 15);
fw.y = 15;
fw.weight.text = String((i + 1));
fw.check.visible = false;
fw.alpha = 0.6;
stage.addChild(fw);
doneWeights.push(fw);
i++;
};
i = 0;
while (i < 20) {
fw = new FoundWeight();
fw.x = ((i * 18) + 15);
fw.y = 33;
fw.weight.text = String(((i + 20) + 1));
fw.check.visible = false;
fw.alpha = 0.6;
stage.addChild(fw);
doneWeights.push(fw);
i++;
};
mysteryWeight = (int((Math.random() * 40)) + 1);
randWeights.push(mysteryWeight);
leftTrayWeight = mysteryWeight;
balancearm.lefttray.mysteryweight.weight.text = String(mysteryWeight);
balancearm.balanceState = "LEFT_DOWN";
balancearm.gotoAndPlay("balancetoleftdown");
stop();
}
function frame1(){
MochiAd.showClickAwayAd({clip:clickaway, id:"dfa2241e2b3e2f4d"});
playbutton.addEventListener(MouseEvent.CLICK, onPlay);
stop();
}
public function onMouseMoveStage(_arg1:MouseEvent):void{
if (mouseDownWeight){
currentWeight.x = mouseX;
currentWeight.y = mouseY;
};
}
public function onPlay2(_arg1:MouseEvent):void{
var _local2:int;
if (!muteFlag){
musicLoopChan = musicLoop.play(0, 999999);
};
playbutton.visible = false;
clickaway.visible = false;
instrsprite.visible = false;
instrbkg.visible = false;
_local2 = 0;
while (_local2 < pickWeights.length) {
pickWeights[_local2].visible = true;
_local2++;
};
_local2 = 0;
while (_local2 < doneWeights.length) {
doneWeights[_local2].visible = true;
_local2++;
};
MochiAd.unload(clickaway);
}
public function onMouseOverWeight(_arg1:MouseEvent):void{
var _local2:MovieClip;
_local2 = (_arg1.currentTarget as MovieClip);
if (_local2.weightsprite.filters.length == 0){
_local2.weightsprite.filters = hoverFilter;
};
}
public function updateScore():void{
if (int(usedweightcount.text) <= 4){
return;
};
negativepoints.gotoAndPlay(2);
negativepoints.x = currentWeight.x;
negativepoints.y = currentWeight.y;
totalScore = ((numGuessed * 100) - ((int(usedweightcount.text) - 4) * 100));
score.text = String(totalScore);
if (totalScore > 0){
score.textColor = 39372;
} else {
score.textColor = 0xFF0000;
};
}
public function onSpeakerOn(_arg1:MouseEvent):void{
var _local2:int;
_local2 = speakeroff.x;
speakeroff.x = speakeron.x;
speakeron.x = _local2;
speakeron.visible = false;
speakeroff.visible = true;
muteFlag = true;
musicLoopChan.stop();
}
public function handleScore():void{
if (!muteFlag){
balanceSound.play();
};
positivepoints.gotoAndPlay(2);
positivepoints.x = 179;
positivepoints.y = 133;
if (int(usedweightcount.text) > 4){
totalScore = ((numGuessed * 100) - ((int(usedweightcount.text) - 4) * 100));
} else {
totalScore = (numGuessed * 100);
};
score.text = String(totalScore);
if (totalScore > 0){
score.textColor = 39372;
} else {
score.textColor = 0xFF0000;
};
if (numGuessed == 10){
if ((((my_so.data.myTextSaved == undefined)) || ((my_so.data.myTextSaved == "")))){
entername.text = "<Enter Name>";
} else {
entername.text = my_so.data.myTextSaved;
};
TweenLite.to(submit, 1.5, {x:273, ease:Elastic.easeOut, onComplete:onFinishTween});
TweenLite.to(entername, 1.5, {x:65, ease:Elastic.easeOut, onComplete:onFinishTween});
TweenLite.to(playagain, 1.5, {x:181, ease:Elastic.easeOut});
} else {
TweenLite.to(continuebutton, 1.5, {x:181, ease:Elastic.easeOut});
};
roundsleft.text = String((10 - numGuessed));
}
public function onPlayAgain(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
newgrounds.visible = false;
TweenLite.to(submit, 0.5, {x:-77});
TweenLite.to(entername, 0.5, {x:-284});
TweenLite.to(playagain, 0.5, {x:-69});
_local2 = 0;
while (_local2 < doneWeights.length) {
doneWeights[_local2].alpha = 0.6;
doneWeights[(mysteryWeight - 1)].weight.textColor = 0xFFFFFF;
_local2++;
};
score.text = "0";
usedweightcount.text = "0";
roundsleft.text = "10";
mysteryWeight = 0;
leftTrayWeight = 0;
rightTrayWeight = 0;
numGuessed = 0;
totalScore = 0;
randWeights = new Array();
_local3 = 0;
_local2 = 0;
while (_local2 < 8) {
_local4 = 0;
while (_local4 < 5) {
pickWeights[_local3].weightsprite.filters = null;
pickWeights[_local3].x = (xc[_local4] - 5);
pickWeights[_local3].y = yc[_local2];
if (pickWeights[_local3].parent != stage){
pickWeights[_local3].parent.removeChild(pickWeights[_local3]);
stage.addChild(pickWeights[_local3]);
};
_local3++;
_local4++;
};
_local2++;
};
mysteryWeight = (int((Math.random() * 40)) + 1);
randWeights.push(mysteryWeight);
leftTrayWeight = mysteryWeight;
balancearm.lefttray.mysteryweight.weight.text = String(mysteryWeight);
balancearm.balanceState = "LEFT_DOWN";
balancearm.gotoAndPlay("balancetoleftdown");
}
public function onContinue(_arg1:MouseEvent):void{
var _local2:Boolean;
var _local3:int;
doneWeights[(mysteryWeight - 1)].weight.textColor = 0xFFFFFF;
TweenLite.to(continuebutton, 0.5, {x:-69});
leftTrayWeight = (leftTrayWeight - mysteryWeight);
while (true) {
mysteryWeight = (int((Math.random() * 40)) + 1);
_local2 = true;
_local3 = 0;
while (_local3 < randWeights.length) {
if (mysteryWeight == randWeights[_local3]){
_local2 = false;
break;
};
_local3++;
};
if (_local2){
break;
};
};
randWeights.push(mysteryWeight);
leftTrayWeight = (leftTrayWeight + mysteryWeight);
balancearm.lefttray.mysteryweight.weight.text = String(mysteryWeight);
if (leftTrayWeight > rightTrayWeight){
balancearm.balanceState = "LEFT_DOWN";
balancearm.gotoAndPlay("balancetoleftdown");
} else {
balancearm.balanceState = "RIGHT_DOWN";
balancearm.gotoAndPlay("balancetorightdown");
};
}
public function onHelp(_arg1:MouseEvent):void{
var _local2:int;
if (!muteFlag){
musicLoopChan.stop();
};
playbutton.visible = true;
clickaway.visible = true;
instrsprite.visible = true;
instrbkg.visible = true;
_local2 = 0;
while (_local2 < pickWeights.length) {
pickWeights[_local2].visible = false;
_local2++;
};
_local2 = 0;
while (_local2 < doneWeights.length) {
doneWeights[_local2].visible = false;
_local2++;
};
MochiAd.showClickAwayAd({clip:clickaway, id:"dfa2241e2b3e2f4d"});
}
public function onPlay(_arg1:MouseEvent):void{
gotoAndPlay(2);
}
public function completeHandler(_arg1:Event):void{
var url:String;
var request:URLRequest;
var event = _arg1;
trace("done submit");
url = "http://cazualgamez.com/balance/highscores/";
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
};
}
}
}//package balance_fla
Section 5
//MysteryWeight_9 (balance_fla.MysteryWeight_9)
package balance_fla {
import flash.display.*;
import flash.text.*;
public dynamic class MysteryWeight_9 extends MovieClip {
public var weight:TextField;
}
}//package balance_fla
Section 6
//NegativePoints_11 (balance_fla.NegativePoints_11)
package balance_fla {
import flash.display.*;
public dynamic class NegativePoints_11 extends MovieClip {
public function NegativePoints_11(){
addFrameScript(0, frame1, 59, frame60);
}
function frame1(){
stop();
}
function frame60(){
this.x = -100;
}
}
}//package balance_fla
Section 7
//NG_AD_OBJECT_19 (balance_fla.NG_AD_OBJECT_19)
package balance_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class NG_AD_OBJECT_19 extends MovieClip {
public var ng_ad:MovieClip;
public var NG_Button:SimpleButton;
public function NG_AD_OBJECT_19(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
public function startAd(_arg1){
var _local2:URLLoader;
_local2 = new URLLoader(new URLRequest(_arg1));
_local2.addEventListener(Event.COMPLETE, ad_Loaded);
}
function frame1(){
Security.allowDomain("70.87.128.99");
Security.allowInsecureDomain("70.87.128.99");
Security.allowDomain("ads.shizmoo.com");
Security.allowInsecureDomain("ads.shizmoo.com");
Security.allowDomain("www.cpmstar.com");
Security.allowInsecureDomain("www.cpmstar.com");
Security.allowDomain("server.cpmstar.com");
Security.allowInsecureDomain("server.cpmstar.com");
if (NewgroundsAPI.getAdURL()){
startAd(NewgroundsAPI.getAdURL());
};
NewgroundsAPI.addEventListener(NewgroundsAPI.ADS_APPROVED, startAd);
NG_Button.addEventListener(MouseEvent.CLICK, loadNGSite);
stop();
}
public function ad_Loaded(_arg1:Event){
var _local2:*;
var _local3:Loader;
_local2 = String(_arg1.target.data);
_local3 = new Loader();
_local3.load(new URLRequest(_local2));
ng_ad.addChild(_local3);
}
}
}//package balance_fla
Section 8
//NG_TANK_21 (balance_fla.NG_TANK_21)
package balance_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NG_TANK_21 extends MovieClip {
public var NG_Logo:SimpleButton;
public function NG_TANK_21(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
function frame1(){
NG_Logo.addEventListener(MouseEvent.CLICK, loadNGSite);
}
}
}//package balance_fla
Section 9
//PositivePoints_12 (balance_fla.PositivePoints_12)
package balance_fla {
import flash.display.*;
public dynamic class PositivePoints_12 extends MovieClip {
public function PositivePoints_12(){
addFrameScript(0, frame1, 59, frame60);
}
function frame1(){
stop();
}
function frame60(){
this.x = -100;
}
}
}//package balance_fla
Section 10
//RightTray_6 (balance_fla.RightTray_6)
package balance_fla {
import flash.display.*;
public dynamic class RightTray_6 extends MovieClip {
public var starburst2:MovieClip;
}
}//package balance_fla
Section 11
//StarBurst_7 (balance_fla.StarBurst_7)
package balance_fla {
import flash.display.*;
public dynamic class StarBurst_7 extends MovieClip {
public function StarBurst_7(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
this.visible = false;
stop();
}
function frame2(){
this.visible = true;
}
}
}//package balance_fla
Section 12
//RC4 (be.boulevart.as3.security.RC4)
package be.boulevart.as3.security {
public class RC4 {
protected static var mykey:Array = new Array(0xFF);
protected static var sbox:Array = new Array(0xFF);
protected static function charsToHex(_arg1:Array):String{
var _local2:String;
var _local3:Array;
var _local4:Number;
_local2 = new String("");
_local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
_local4 = 0;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
public static function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
_local3 = strToChars(_arg1);
_local4 = strToChars(_arg2);
_local5 = calculate(_local3, _local4);
return (charsToHex(_local5));
}
protected static function hexToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
public static function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
_local3 = hexToChars(_arg1);
_local4 = strToChars(_arg2);
_local5 = calculate(_local3, _local4);
return (charsToStr(_local5));
}
protected static function strToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
protected static function calculate(_arg1:Array, _arg2:Array):Array{
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
initialize(_arg2);
_local3 = 0;
_local4 = 0;
_local5 = new Array();
_local9 = 0;
while (_local9 < _arg1.length) {
_local3 = ((_local3 + 1) % 0x0100);
_local4 = ((_local4 + sbox[_local3]) % 0x0100);
_local7 = sbox[_local3];
sbox[_local3] = sbox[_local4];
sbox[_local4] = _local7;
_local10 = ((sbox[_local3] + sbox[_local4]) % 0x0100);
_local6 = sbox[_local10];
_local8 = (_arg1[_local9] ^ _local6);
_local5.push(_local8);
_local9++;
};
return (_local5);
}
protected static function initialize(_arg1:Array):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = 0;
_local4 = _arg1.length;
_local5 = 0;
while (_local5 <= 0xFF) {
mykey[_local5] = _arg1[(_local5 % _local4)];
sbox[_local5] = _local5;
_local5++;
};
_local5 = 0;
while (_local5 <= 0xFF) {
_local2 = (((_local2 + sbox[_local5]) + mykey[_local5]) % 0x0100);
_local3 = sbox[_local5];
sbox[_local5] = sbox[_local2];
sbox[_local2] = _local3;
_local5++;
};
}
protected static function charsToStr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = new String("");
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
}
}//package be.boulevart.as3.security
Section 13
//Elastic (fl.motion.easing.Elastic)
package fl.motion.easing {
public class Elastic {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) + _arg3) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) * 0.5) + _arg3) + _arg2));
}
}
}//package fl.motion.easing
Section 14
//TweenLite (gs.TweenLite)
package gs {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import flash.geom.*;
public class TweenLite {
public var delay:Number;
protected var _initted:Boolean;
protected var _subTweens:Array;
public var startTime:int;
public var target:Object;
public var duration:Number;
protected var _hst:Boolean;
protected var _active:Boolean;
public var vars:Object;
public var tweens:Array;
public var initTime:int;
private static var _timer:Timer = new Timer(2000);
private static var _classInitted:Boolean;
public static var defaultEase:Function = TweenLite.easeOut;
public static var version:Number = 6.35;
private static var _sprite:Sprite = new Sprite();
protected static var _all:Dictionary = new Dictionary();
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
protected static var _curTime:uint;
private static var _listening:Boolean;
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
if (_arg1 == null){
return;
};
if (((((!((_arg3.overwrite == false))) && (!((_arg1 == null))))) || ((_all[_arg1] == undefined)))){
delete _all[_arg1];
_all[_arg1] = new Dictionary();
};
_all[_arg1][this] = this;
this.vars = _arg3;
this.duration = ((_arg2) || (0.001));
this.delay = ((_arg3.delay) || (0));
_active = (((_arg2 == 0)) && ((this.delay == 0)));
this.target = _arg1;
if (!(this.vars.ease is Function)){
this.vars.ease = defaultEase;
};
if (this.vars.easeParams != null){
this.vars.proxiedEase = this.vars.ease;
this.vars.ease = easeProxy;
};
if (!isNaN(Number(this.vars.autoAlpha))){
this.vars.alpha = Number(this.vars.autoAlpha);
this.vars.visible = (this.vars.alpha > 0);
};
this.tweens = [];
_subTweens = [];
_hst = (_initted = false);
if (!_classInitted){
_curTime = getTimer();
_sprite.addEventListener(Event.ENTER_FRAME, executeAll);
_classInitted = true;
};
this.initTime = _curTime;
if ((((((this.vars.runBackwards == true)) && (!((this.vars.renderOnStart == true))))) || (_active))){
initTweenVals();
this.startTime = _curTime;
if (_active){
render((this.startTime + 1));
} else {
render(this.startTime);
};
if (((!((this.vars.visible == undefined))) && ((this.vars.runBackwards == true)))){
this.target.visible = this.vars.visible;
};
};
if (((!(_listening)) && (!(_active)))){
_timer.addEventListener("timer", killGarbage);
_timer.start();
_listening = true;
};
}
protected function addSubTween(_arg1:Function, _arg2:Object, _arg3:Object, _arg4:Object=null):void{
var _local5:Object;
var _local6:String;
_local5 = {proxy:_arg1, target:_arg2, info:_arg4};
_subTweens.push(_local5);
for (_local6 in _arg3) {
if (typeof(_arg3[_local6]) == "number"){
this.tweens.push({o:_arg2, p:_local6, s:_arg2[_local6], c:(_arg3[_local6] - _arg2[_local6]), sub:_local5});
} else {
this.tweens.push({o:_arg2, p:_local6, s:_arg2[_local6], c:Number(_arg3[_local6]), sub:_local5});
};
};
_hst = true;
}
public function initTweenVals(_arg1:Boolean=false, _arg2:String=""):void{
var _local3:Boolean;
var _local4:String;
var _local5:int;
var _local6:Array;
var _local7:ColorTransform;
var _local8:ColorTransform;
var _local9:Object;
_local3 = (this.target is DisplayObject);
if ((this.target is Array)){
_local6 = ((this.vars.endArray) || ([]));
_local5 = 0;
while (_local5 < _local6.length) {
if (((!((this.target[_local5] == _local6[_local5]))) && (!((this.target[_local5] == undefined))))){
this.tweens.push({o:this.target, p:_local5.toString(), s:this.target[_local5], c:(_local6[_local5] - this.target[_local5])});
};
_local5++;
};
} else {
for (_local4 in this.vars) {
if ((((((((((((((((((((((((((((((((((((((((_local4 == "ease")) || ((_local4 == "delay")))) || ((_local4 == "overwrite")))) || ((_local4 == "onComplete")))) || ((_local4 == "onCompleteParams")))) || ((_local4 == "onCompleteScope")))) || ((_local4 == "runBackwards")))) || ((_local4 == "visible")))) || ((_local4 == "parsed_visible")))) || ((_local4 == "onUpdate")))) || ((_local4 == "onUpdateParams")))) || ((_local4 == "onUpdateScope")))) || ((_local4 == "autoAlpha")))) || ((_local4 == "onStart")))) || ((_local4 == "onStartParams")))) || ((_local4 == "onStartScope")))) || ((_local4 == "renderOnStart")))) || ((_local4 == "proxiedEase")))) || ((_local4 == "easeParams")))) || (((_arg1) && (!((_arg2.indexOf(((" " + _local4) + " ")) == -1))))))){
} else {
if ((((_local4 == "tint")) && (_local3))){
_local7 = this.target.transform.colorTransform;
_local8 = new ColorTransform();
if (this.vars.alpha != undefined){
_local8.alphaMultiplier = this.vars.alpha;
delete this.vars.alpha;
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
if (this.tweens[_local5].p == "alpha"){
this.tweens.splice(_local5, 1);
break;
};
_local5--;
};
} else {
_local8.alphaMultiplier = this.target.alpha;
};
if (((((!((this.vars[_local4] == null))) && (!((this.vars[_local4] == ""))))) || ((this.vars[_local4] == 0)))){
_local8.color = this.vars[_local4];
};
addSubTween(tintProxy, {progress:0}, {progress:1}, {target:this.target, color:_local7, endColor:_local8});
} else {
if ((((_local4 == "frame")) && (_local3))){
addSubTween(frameProxy, {frame:this.target.currentFrame}, {frame:this.vars[_local4]}, {target:this.target});
} else {
if ((((_local4 == "volume")) && (((_local3) || ((this.target is SoundChannel)))))){
addSubTween(volumeProxy, this.target.soundTransform, {volume:this.vars[_local4]}, {target:this.target});
} else {
if (typeof(this.vars[_local4]) == "number"){
this.tweens.push({o:this.target, p:_local4, s:this.target[_local4], c:(this.vars[_local4] - this.target[_local4])});
} else {
this.tweens.push({o:this.target, p:_local4, s:this.target[_local4], c:Number(this.vars[_local4])});
};
};
};
};
};
};
};
if (this.vars.runBackwards == true){
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local9 = this.tweens[_local5];
this.tweens[_local5].s = (_local9.s + _local9.c);
_local9.c = (_local9.c * -1);
_local5--;
};
};
if (this.vars.visible == true){
this.target.visible = true;
};
_initted = true;
}
public function get active():Boolean{
if (_active){
return (true);
};
if (((_curTime - this.initTime) / 1000) > this.delay){
_active = true;
this.startTime = (this.initTime + (this.delay * 1000));
if (!_initted){
initTweenVals();
} else {
if (this.vars.visible != undefined){
this.target.visible = true;
};
};
if (this.vars.onStart != null){
this.vars.onStart.apply(this.vars.onStartScope, this.vars.onStartParams);
};
if (this.duration == 0.001){
this.startTime = (this.startTime - 1);
};
return (true);
//unresolved jump
};
return (false);
}
public function render(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
var _local4:Object;
var _local5:int;
_local2 = ((_arg1 - this.startTime) / 1000);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = 1;
} else {
_local3 = this.vars.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.o[_local4.p] = (_local4.s + (_local3 * _local4.c));
_local5--;
};
if (_hst){
_local5 = (_subTweens.length - 1);
while (_local5 > -1) {
_subTweens[_local5].proxy(_subTweens[_local5]);
_local5--;
};
};
if (this.vars.onUpdate != null){
this.vars.onUpdate.apply(this.vars.onUpdateScope, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public function complete(_arg1:Boolean=false):void{
if (!_arg1){
if (!_initted){
initTweenVals();
};
this.startTime = (_curTime - (this.duration * 1000));
render(_curTime);
return;
};
if (this.vars.visible != undefined){
if (((!((this.vars.autoAlpha == undefined))) && ((this.target.alpha == 0)))){
this.target.visible = false;
} else {
if (this.vars.runBackwards != true){
this.target.visible = this.vars.visible;
};
};
};
removeTween(this);
if (this.vars.onComplete != null){
this.vars.onComplete.apply(this.vars.onCompleteScope, this.vars.onCompleteParams);
};
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function frameProxy(_arg1:Object):void{
_arg1.info.target.gotoAndStop(Math.round(_arg1.target.frame));
}
public static function removeTween(_arg1:TweenLite=null):void{
if (((!((_arg1 == null))) && (!((_all[_arg1.target] == undefined))))){
delete _all[_arg1.target][_arg1];
};
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Object;
var _local4:*;
if (((!((_arg1 == null))) && (!((_all[_arg1] == undefined))))){
if (_arg2){
_local3 = _all[_arg1];
for (_local4 in _local3) {
_local3[_local4].complete(false);
};
};
delete _all[_arg1];
};
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4=null):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, onCompleteScope:_arg4, overwrite:false}));
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function executeAll(_arg1:Event=null):void{
var _local2:uint;
var _local3:Dictionary;
var _local4:Object;
var _local5:Object;
_local2 = (_curTime = getTimer());
if (_listening){
_local3 = _all;
for each (_local4 in _local3) {
for (_local5 in _local4) {
if (((!((_local4[_local5] == undefined))) && (_local4[_local5].active))){
_local4[_local5].render(_local2);
};
};
};
};
}
public static function volumeProxy(_arg1:Object):void{
_arg1.info.target.soundTransform = _arg1.target;
}
public static function killGarbage(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:Boolean;
var _local4:Object;
var _local5:Object;
var _local6:Object;
_local2 = 0;
for (_local4 in _all) {
_local3 = false;
for (_local5 in _all[_local4]) {
_local3 = true;
break;
};
if (!_local3){
delete _all[_local4];
} else {
_local2++;
};
};
if (_local2 == 0){
_timer.removeEventListener("timer", killGarbage);
_timer.stop();
_listening = false;
};
}
public static function tintProxy(_arg1:Object):void{
var _local2:Number;
var _local3:Number;
var _local4:Object;
var _local5:Object;
_local2 = _arg1.target.progress;
_local3 = (1 - _local2);
_local4 = _arg1.info.color;
_local5 = _arg1.info.endColor;
_arg1.info.target.transform.colorTransform = new ColorTransform(((_local4.redMultiplier * _local3) + (_local5.redMultiplier * _local2)), ((_local4.greenMultiplier * _local3) + (_local5.greenMultiplier * _local2)), ((_local4.blueMultiplier * _local3) + (_local5.blueMultiplier * _local2)), ((_local4.alphaMultiplier * _local3) + (_local5.alphaMultiplier * _local2)), ((_local4.redOffset * _local3) + (_local5.redOffset * _local2)), ((_local4.greenOffset * _local3) + (_local5.greenOffset * _local2)), ((_local4.blueOffset * _local3) + (_local5.blueOffset * _local2)), ((_local4.alphaOffset * _local3) + (_local5.alphaOffset * _local2)));
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 15
//Balance (Balance)
package {
import flash.display.*;
public dynamic class Balance extends Sprite {
}
}//package
Section 16
//BalanceSound (BalanceSound)
package {
import flash.media.*;
public dynamic class BalanceSound extends Sound {
}
}//package
Section 17
//Check (Check)
package {
import flash.display.*;
public dynamic class Check extends Sprite {
}
}//package
Section 18
//FoundWeight (FoundWeight)
package {
import flash.display.*;
import flash.text.*;
public dynamic class FoundWeight extends MovieClip {
public var check:Check;
public var weight:TextField;
}
}//package
Section 19
//InstrBkg (InstrBkg)
package {
import flash.display.*;
public dynamic class InstrBkg extends Sprite {
}
}//package
Section 20
//InstrSprite (InstrSprite)
package {
import flash.display.*;
public dynamic class InstrSprite extends Sprite {
}
}//package
Section 21
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.6");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 22
//MusicLoopSound (MusicLoopSound)
package {
import flash.media.*;
public dynamic class MusicLoopSound extends Sound {
}
}//package
Section 23
//NewgroundsAPI (NewgroundsAPI)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public class NewgroundsAPI {
public static const ADS_APPROVED:Number = 3;
public static const bridge:Sprite = new Sprite();
private static const STAT_NEW_VERSION:Number = 4;
private static const STAT_AUTHOR_SITE:Number = 2;
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway.php";
private static const NEWGROUNDS_URL:String = "http://www.newgrounds.com";
private static const STAT_CUSTOM_STATS:Number = 50;
private static const STAT_MOVIE_VIEWS:Number = 1;
private static const STAT_NEWGROUNDS:Number = 3;
public static const NEW_VERSION:Number = 2;
public static const DENY_HOST:Number = 1;
private static var tracker_id:Number;
private static var movie_options:Object = new Object();
private static var connected:Boolean;
private static var custom_events:Object = new Object();
private static var host:String;
private static var linked:Boolean;
private static var events:Object = new Object();
private static var debug:Boolean;
private static var version:String;
private static var custom_links:Object = new Object();
public static function getNewVersionURL(){
return (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + STAT_NEW_VERSION));
}
private static function ReadGatewayData(_arg1:Object){
var _local2:*;
var _local3:String;
var _local4:*;
var _local5:URLLoader;
for (_local2 in _arg1) {
_arg1[_local2] = unescape(_arg1[_local2]);
movie_options[_local2] = _arg1[_local2];
};
if (_arg1["settings_loaded"]){
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage((("Movie Identified as '" + movie_options["movie_name"]) + "'"));
if (movie_options["message"]){
SendMessage(movie_options["message"]);
};
if (movie_options["ad_url"]){
SendMessage("Your movie has been approved to run Flash Ads");
if (events[ADS_APPROVED]){
var _local6 = events;
_local6[ADS_APPROVED](movie_options["ad_url"]);
} else {
onAdsApproved(movie_options["ad_url"]);
};
};
if (((movie_options["movie_version"]) && (!((String(movie_options["movie_version"]) == String(version)))))){
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
if (events[NEW_VERSION]){
_local6 = events;
_local6[NEW_VERSION]({version:movie_options["movie_version"], real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onNewVersionAvailable(movie_options["movie_version"], getMovieURL(), getNewVersionURL());
};
};
if (movie_options["deny_host"]){
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
if (events[DENY_HOST]){
_local6 = events;
_local6[DENY_HOST]({host:host, real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onDenyHost(host, getMovieURL(), getNewVersionURL());
};
};
if (movie_options["request_portal_url"]){
_local3 = bridge.root.loaderInfo.url;
_local4 = ((((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_local3));
_local5 = new URLLoader(new URLRequest(_local4));
};
if (events[69]){
_local6 = events;
_local6[69]();
};
} else {
if (!movie_options["settings_loaded"]){
SendError("Could not establish connection to the API gateway.");
};
};
}
public static function setMovieVersion(_arg1){
if (!_arg1){
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = String(_arg1);
};
}
public static function loadCustomLink(_arg1:String){
if (!_arg1){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else {
if (!custom_links[_arg1]){
SendError(("Attempted to open undefined custom link: " + _arg1));
} else {
SendLink(custom_links[_arg1]);
};
};
}
public static function addCustomLink(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(((("Created custom link " + _arg1) + ": ") + _arg2));
};
};
}
public static function getMovieURL(){
if (movie_options["movie_url"]){
return (movie_options["movie_url"]);
};
return ("Newgrounds.com");
}
public static function debugMode(){
debug = true;
}
public static function getAdURL(){
return (movie_options["ad_url"]);
}
private static function SendStat(_arg1:Number, _arg2:Boolean, _arg3=null){
var target_url:*;
var XML_Loaded:Function;
var x:*;
var request:URLRequest;
var gateway_loader:URLLoader;
var stat_id = _arg1;
var open_in_browser = _arg2;
var extra = _arg3;
if (!tracker_id){
SendError("You must call NewgroundsAPI.connectMovie() with a valid movie id before using API features!");
} else {
XML_Loaded = function (_arg1:Event){
var _local2:XML;
var _local3:Object;
var _local4:XMLList;
var _local5:XML;
var _local6:*;
var _local7:*;
XML.ignoreWhitespace = true;
_local2 = XML(_arg1.target.data);
_local3 = new Object();
_local4 = _local2.children();
for each (_local5 in _local4) {
_local6 = _local5.localName();
_local7 = _local5.attribute("value");
if (_local7 == Number(_local7)){
_local7 = Number(_local7);
};
_local3[_local6] = _local7;
};
ReadGatewayData(_local3);
};
target_url = (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id) + addSeed());
if (extra){
for (x in extra) {
target_url = (target_url + ((("&" + escape(x)) + "=") + escape(extra[x])));
};
};
if (debug){
target_url = (target_url + "&debug=1");
};
if (open_in_browser){
request = new URLRequest((target_url + addSeed()));
navigateToURL(request, "_blank");
} else {
gateway_loader = new URLLoader(new URLRequest((target_url + addSeed())));
gateway_loader.addEventListener(Event.COMPLETE, XML_Loaded);
};
};
}
public static function onAdsApproved(_arg1:String){
}
public static function loadMySite(_arg1:Event=null){
SendLink(STAT_AUTHOR_SITE);
}
private static function SendMessage(_arg1:String){
trace(("[NEWGROUNDS API] :: " + _arg1));
}
public static function linkAPI(_arg1){
_arg1.addChild(bridge);
linked = true;
}
public static function loadNewgrounds(_arg1:Event=null, _arg2:String=null){
var _local3:URLRequest;
var _local4:*;
if (!tracker_id){
_local3 = new URLRequest(((NEWGROUNDS_URL + "/") + _arg2));
navigateToURL(_local3, "_blank");
} else {
_local4 = null;
if (_arg2){
_local4 = new Object();
_local4.page = _arg2;
};
SendLink(STAT_NEWGROUNDS, _local4);
};
}
private static function SendLink(_arg1, _arg2=null){
SendStat(_arg1, true, _arg2);
}
public static function logCustomEvent(_arg1:String){
if (!_arg1){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else {
if (!custom_events[_arg1]){
SendError(("Attempted to log undefined custom event: " + _arg1));
} else {
SendEvent(custom_events[_arg1]);
};
};
}
private static function SendError(_arg1:String){
trace(("[NEWGROUNDS API ERROR] :: " + _arg1));
}
public static function addCustomEvent(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(("Created custom event: " + _arg2));
};
};
}
private static function addSeed(){
return (("&seed=" + Math.random()));
}
public static function addEventListener(_arg1:Number, _arg2:Function){
events[_arg1] = _arg2;
}
private static function SendEvent(_arg1){
SendStat(_arg1, false);
}
public static function onNewVersionAvailable(_arg1:String, _arg2:String, _arg3:String){
var sw:*;
var sh:*;
var tw:*;
var th:*;
var mg:*;
var _root:*;
var overlay:MovieClip;
var overlay_x:*;
var overlay_y:*;
var close_x:*;
var blankarea:TextField;
var header:TextField;
var header_format:TextFormat;
var msgtext:TextField;
var msgtext_format:TextFormat;
var msgtext_link:TextFormat;
var version = _arg1;
var movie_url = _arg2;
var redirect_url = _arg3;
sw = bridge.stage.stageWidth;
sh = bridge.stage.stageHeight;
tw = 350;
th = 160;
mg = 20;
_root = bridge.root;
overlay = new MovieClip();
overlay.graphics.beginFill(0, 0.6);
overlay.graphics.lineStyle(0, 0);
overlay.graphics.drawRect(0, 0, sw, sh);
overlay.graphics.endFill();
overlay_x = Math.round(((sw - tw) / 2));
overlay_y = Math.round(((sh - th) / 2));
overlay.graphics.beginFill(102);
overlay.graphics.lineStyle(10, 0);
overlay.graphics.drawRect((overlay_x - mg), (overlay_y - mg), (tw + mg), (th + mg));
overlay.graphics.endFill();
overlay.close = function (_arg1:Event){
_root.removeChild(overlay);
};
close_x = new MovieClip();
close_x.graphics.beginFill(0, 0.1);
close_x.graphics.lineStyle(3, 22015);
close_x.graphics.drawRect(0, 0, 16, 16);
close_x.graphics.endFill();
close_x.graphics.moveTo(4, 4);
close_x.graphics.lineTo(13, 13);
close_x.graphics.moveTo(13, 4);
close_x.graphics.lineTo(4, 13);
close_x.x = ((overlay_x + tw) - 26);
close_x.y = (overlay_y - 10);
close_x.addEventListener(MouseEvent.CLICK, overlay.close);
blankarea = new TextField();
blankarea.x = (overlay_x - mg);
blankarea.y = (overlay_y - mg);
blankarea.width = (tw + mg);
blankarea.height = (th + mg);
blankarea.selectable = false;
header = new TextField();
header.width = tw;
header.x = overlay_x;
header.y = overlay_y;
header.height = 100;
header.selectable = false;
header_format = new TextFormat();
header_format.font = "Arial Black";
header_format.color = 0xFFFFFF;
header_format.size = 20;
header.defaultTextFormat = header_format;
header.text = "New Version Available!";
msgtext = new TextField();
msgtext.x = overlay_x;
msgtext.y = (overlay_y + 70);
msgtext.width = tw;
msgtext.height = 60;
msgtext.selectable = false;
msgtext_format = new TextFormat();
msgtext_format.font = "Arial";
msgtext_format.color = 0xFFFFFF;
msgtext_format.size = 12;
msgtext_format.bold = true;
msgtext_link = new TextFormat();
msgtext_link.font = "Arial";
msgtext_link.color = 0xFFFF00;
msgtext_link.size = 12;
msgtext_link.bold = true;
msgtext_link.url = redirect_url;
msgtext_link.target = "_blank";
if (version){
version = ("Version " + version);
} else {
version = "A new version";
};
msgtext.defaultTextFormat = msgtext_format;
msgtext.appendText((version + " is now available"));
if (movie_url){
msgtext.appendText(" at:\n");
msgtext.defaultTextFormat = msgtext_link;
msgtext.appendText(movie_url);
} else {
msgtext.appendText("!");
};
_root.addChild(overlay);
overlay.addChild(blankarea);
overlay.addChild(header);
overlay.addChild(msgtext);
overlay.addChild(close_x);
}
public static function onDenyHost(_arg1:String, _arg2:String, _arg3:String){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:MovieClip;
var _local10:TextField;
var _local11:TextField;
var _local12:TextFormat;
var _local13:TextField;
var _local14:TextFormat;
var _local15:TextFormat;
_local4 = bridge.stage.stageWidth;
_local5 = bridge.stage.stageHeight;
_local6 = 350;
_local7 = 160;
_local8 = bridge.root;
_local9 = new MovieClip();
_local9.graphics.beginFill(0x660000);
_local9.graphics.lineStyle(20, 0);
_local9.graphics.drawRect(0, 0, _local4, _local5);
_local9.graphics.endFill();
_local10 = new TextField();
_local10.x = 0;
_local10.y = 0;
_local10.width = _local4;
_local10.height = _local5;
_local10.selectable = false;
_local11 = new TextField();
_local11.x = Math.round(((_local4 - _local6) / 2));
_local11.y = Math.round(((_local5 - _local7) / 2.5));
_local11.width = _local6;
_local11.height = 100;
_local11.selectable = false;
_local12 = new TextFormat();
_local12.font = "Arial Black";
_local12.color = 0xFF0000;
_local12.size = 38;
_local11.defaultTextFormat = _local12;
_local11.text = "ERROR!";
_local13 = new TextField();
_local13.x = Math.round(((_local4 - _local6) / 2));
_local13.y = (Math.round(((_local5 - _local7) / 2.5)) + 80);
_local13.width = _local6;
_local13.height = 80;
_local13.selectable = false;
_local14 = new TextFormat();
_local14.font = "Arial";
_local14.color = 0xFFFFFF;
_local14.size = 12;
_local14.bold = true;
_local15 = new TextFormat();
_local15.font = "Arial";
_local15.color = 0xFFFF00;
_local15.size = 12;
_local15.bold = true;
_local15.url = _arg3;
_local15.target = "_blank";
_local13.defaultTextFormat = _local14;
_local13.appendText((("This movie has not been approved for use on " + _arg1) + "\n"));
_local13.appendText("For an approved copy, please visit:\n");
_local13.defaultTextFormat = _local15;
_local13.appendText(_arg2);
_local8.addChild(_local9);
_local9.addChild(_local10);
_local9.addChild(_local11);
_local9.addChild(_local13);
}
public static function connectMovie(_arg1:Number){
var _local2:String;
var _local3:*;
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else {
if (!linked){
SendError("Attempted to call MewgroundsAPI.connectMovie() without first calling NewgroundsAPI.linkAPI(this)");
} else {
if (!tracker_id){
SendMessage("Connecting to API gateway...");
tracker_id = _arg1;
_local2 = bridge.root.loaderInfo.url;
host = _local2.split("/")[2].toLowerCase();
if (host.length < 1){
host = "localhost";
};
_local3 = new Object();
SendEvent(STAT_MOVIE_VIEWS);
};
};
};
}
public static function isInstalled(){
return (true);
}
}
}//package
Section 24
//Submit (Submit)
package {
import flash.display.*;
public dynamic class Submit extends SimpleButton {
}
}//package
Section 25
//Weight (Weight)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Weight extends MovieClip {
public var weightsprite:WeightSprite;
public var weight:TextField;
}
}//package
Section 26
//WeightSprite (WeightSprite)
package {
import flash.display.*;
public dynamic class WeightSprite extends Sprite {
}
}//package