Section 1
//ARC4 (com.hurlant.crypto.prng.ARC4)
package com.hurlant.crypto.prng {
import flash.utils.*;
import com.hurlant.util.*;
import com.hurlant.crypto.symmetric.*;
public class ARC4 implements IPRNG, IStreamCipher {
private const psize:uint = 0x0100;
private var S:ByteArray;
private var i:int;// = 0
private var j:int;// = 0
public function ARC4(_arg1:ByteArray=null){
i = 0;
j = 0;
super();
S = new ByteArray();
if (_arg1){
init(_arg1);
};
}
public function decrypt(_arg1:ByteArray):void{
encrypt(_arg1);
}
public function init(_arg1:ByteArray):void{
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = 0;
while (_local2 < 0x0100) {
S[_local2] = _local2;
_local2++;
};
_local3 = 0;
_local2 = 0;
while (_local2 < 0x0100) {
_local3 = (((_local3 + S[_local2]) + _arg1[(_local2 % _arg1.length)]) & 0xFF);
_local4 = S[_local2];
S[_local2] = S[_local3];
S[_local3] = _local4;
_local2++;
};
this.i = 0;
this.j = 0;
}
public function dispose():void{
var _local1:uint;
_local1 = 0;
if (S != null){
_local1 = 0;
while (_local1 < S.length) {
S[_local1] = (Math.random() * 0x0100);
_local1++;
};
S.length = 0;
S = null;
};
this.i = 0;
this.j = 0;
Memory.gc();
}
public function encrypt(_arg1:ByteArray):void{
var _local2:uint;
_local2 = 0;
while (_local2 < _arg1.length) {
var _temp1 = _local2;
_local2 = (_local2 + 1);
var _local3 = _temp1;
_arg1[_local3] = (_arg1[_local3] ^ next());
};
}
public function next():uint{
var _local1:int;
i = ((i + 1) & 0xFF);
j = ((j + S[i]) & 0xFF);
_local1 = S[i];
S[i] = S[j];
S[j] = _local1;
return (S[((_local1 + S[i]) & 0xFF)]);
}
public function getBlockSize():uint{
return (1);
}
public function getPoolSize():uint{
return (psize);
}
public function toString():String{
return ("rc4");
}
}
}//package com.hurlant.crypto.prng
Section 2
//IPRNG (com.hurlant.crypto.prng.IPRNG)
package com.hurlant.crypto.prng {
import flash.utils.*;
public interface IPRNG {
function init(_arg1:ByteArray):void;
function next():uint;
function dispose():void;
function getPoolSize():uint;
function toString():String;
}
}//package com.hurlant.crypto.prng
Section 3
//ICipher (com.hurlant.crypto.symmetric.ICipher)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public interface ICipher {
function encrypt(_arg1:ByteArray):void;
function dispose():void;
function getBlockSize():uint;
function toString():String;
function decrypt(_arg1:ByteArray):void;
}
}//package com.hurlant.crypto.symmetric
Section 4
//IStreamCipher (com.hurlant.crypto.symmetric.IStreamCipher)
package com.hurlant.crypto.symmetric {
public interface IStreamCipher extends ICipher {
}
}//package com.hurlant.crypto.symmetric
Section 5
//Hex (com.hurlant.util.Hex)
package com.hurlant.util {
import flash.utils.*;
public class Hex {
public static function fromString(_arg1:String, _arg2:Boolean=false):String{
var _local3:ByteArray;
_local3 = new ByteArray();
_local3.writeUTFBytes(_arg1);
return (fromArray(_local3, _arg2));
}
public static function toString(_arg1:String):String{
var _local2:ByteArray;
_local2 = toArray(_arg1);
return (_local2.readUTFBytes(_local2.length));
}
public static function toArray(_arg1:String):ByteArray{
var _local2:ByteArray;
var _local3:uint;
_arg1 = _arg1.replace(/\s|:/gm, "");
_local2 = new ByteArray();
if ((_arg1.length & (1 == 1))){
_arg1 = ("0" + _arg1);
};
_local3 = 0;
while (_local3 < _arg1.length) {
_local2[(_local3 / 2)] = parseInt(_arg1.substr(_local3, 2), 16);
_local3 = (_local3 + 2);
};
return (_local2);
}
public static function fromArray(_arg1:ByteArray, _arg2:Boolean=false):String{
var _local3:String;
var _local4:uint;
_local3 = "";
_local4 = 0;
while (_local4 < _arg1.length) {
_local3 = (_local3 + ("0" + _arg1[_local4].toString(16)).substr(-2, 2));
if (_arg2){
if (_local4 < (_arg1.length - 1)){
_local3 = (_local3 + ":");
};
};
_local4++;
};
return (_local3);
}
}
}//package com.hurlant.util
Section 6
//Memory (com.hurlant.util.Memory)
package com.hurlant.util {
import flash.net.*;
import flash.system.*;
public class Memory {
public static function gc():void{
try {
new LocalConnection().connect("foo");
new LocalConnection().connect("foo");
} catch(e) {
};
}
public static function get used():uint{
return (System.totalMemory);
}
}
}//package com.hurlant.util
Section 7
//Point3D (com.wefiends.loader.Point3D)
package com.wefiends.loader {
public class Point3D {
public var fl:Number;// = 250
private var cX:Number;// = 0
private var cY:Number;// = 0
private var vpX:Number;// = 0
private var vpY:Number;// = 0
private var cZ:Number;// = 0
public var x:Number;// = 0
public var y:Number;// = 0
public var z:Number;// = 0
public function Point3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
fl = 250;
vpX = 0;
vpY = 0;
cX = 0;
cY = 0;
cZ = 0;
x = 0;
y = 0;
z = 0;
super();
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function setVanishingPoint(_arg1:Number, _arg2:Number):void{
this.vpX = _arg1;
this.vpY = _arg2;
}
public function setCenter(_arg1:Number, _arg2:Number, _arg3:Number=0):void{
this.cX = _arg1;
this.cY = _arg2;
this.cZ = _arg3;
}
public function rotateX(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
_local4 = ((y * _local2) - (z * _local3));
_local5 = ((z * _local2) + (y * _local3));
y = _local4;
z = _local5;
}
public function rotateY(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
_local4 = ((x * _local2) - (z * _local3));
_local5 = ((z * _local2) + (x * _local3));
x = _local4;
z = _local5;
}
public function get screenY():Number{
var _local1:Number;
_local1 = (fl / ((fl + z) + cZ));
return ((vpY + ((cY + y) * _local1)));
}
public function rotateZ(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
_local4 = ((x * _local2) - (y * _local3));
_local5 = ((y * _local2) + (x * _local3));
x = _local4;
y = _local5;
}
public function get screenX():Number{
var _local1:Number;
_local1 = (fl / ((fl + z) + cZ));
return ((vpX + ((cX + x) * _local1)));
}
}
}//package com.wefiends.loader
Section 8
//PreloadBar (com.wefiends.loader.PreloadBar)
package com.wefiends.loader {
import flash.display.*;
public class PreloadBar {
private var color:uint;
private var yoffset:int;// = 90
private var pointA:Point3D;
private var pointB:Point3D;
private var pointC:Point3D;
public function PreloadBar(_arg1:uint){
yoffset = 90;
super();
this.color = _arg1;
}
public function draw(_arg1:Graphics, _arg2, _arg3:int, _arg4:Number):void{
var _local5:int;
_local5 = (Math.round(((_arg3 / 100) * 140)) - 70);
_arg1.lineStyle(0, 0xFFFFFF, (0.9 * _arg4));
_arg1.moveTo(((_arg2 / 2) - 70), (320 + yoffset));
_arg1.lineTo(((_arg2 / 2) + 70), (320 + yoffset));
_arg1.curveTo(((_arg2 / 2) + 75), (326 + yoffset), ((_arg2 / 2) + 70), (330 + yoffset));
_arg1.lineTo(((_arg2 / 2) - 70), (330 + yoffset));
_arg1.curveTo(((_arg2 / 2) - 75), (326 + yoffset), ((_arg2 / 2) - 70), (320 + yoffset));
_arg1.lineStyle();
_arg1.beginFill(0xFFFFFF, (0.8 * _arg4));
_arg1.moveTo(((_arg2 / 2) - 70), (320 + yoffset));
_arg1.lineTo(((_arg2 / 2) + _local5), (320 + yoffset));
_arg1.curveTo((((_arg2 / 2) + _local5) + 5), (326 + yoffset), ((_arg2 / 2) + _local5), (330 + yoffset));
_arg1.lineTo(((_arg2 / 2) - 70), (330 + yoffset));
_arg1.curveTo(((_arg2 / 2) - 75), (326 + yoffset), ((_arg2 / 2) - 70), (320 + yoffset));
_arg1.endFill();
}
}
}//package com.wefiends.loader
Section 9
//Preloader (com.wefiends.loader.Preloader)
package com.wefiends.loader {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import com.wefiends.sorterbob.*;
import flash.text.*;
import flash.ui.*;
public class Preloader extends MovieClip {
private var points:Array;
var letterAlpha:Number;// = 1
private var ptLoaded:int;// = 0
private var preloadDone:Boolean;// = false
private var myContextMenu:ContextMenu;
private var triangles:Array;
private var loadbar:PreloadBar;
private var linkFormat:TextFormat;
public var main:Main;
var ngad:NG_AD_OBJECT;
private var fl:Number;// = 250
private var vpX:Number;
private var linktoWeFiends:TextField;
private var vpY:Number;
private var adTimer:Timer;
public function Preloader(){
fl = 250;
vpX = (stage.stageWidth / 2);
vpY = ((stage.stageHeight / 2) - 170);
loadbar = new PreloadBar(0);
ptLoaded = 0;
linktoWeFiends = new TextField();
linkFormat = new TextFormat();
preloadDone = false;
adTimer = new Timer(1000, 10);
ngad = new NG_AD_OBJECT();
letterAlpha = 1;
super();
addFrameScript(2, frame3);
stop();
init();
}
private function urltoWeFiends(_arg1:MouseEvent){
NewgroundsAPI.loadMySite();
}
private function init():void{
var _local1:int;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:uint;
MochiBot.track(this, "9854b28d");
NewgroundsAPI.linkAPI(this);
NewgroundsAPI.connectMovie(742);
NewgroundsAPI.addCustomLink(1, "We Fiends Games");
NewgroundsAPI.addCustomLink(2, "We Fiends Scoreboard");
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
ngad.x = 300;
ngad.y = 265;
addChild(ngad);
myContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
this.contextMenu = myContextMenu;
linkFormat.size = 10;
linkFormat.font = "Verdana";
linkFormat.color = 0xFFFFFF;
linktoWeFiends.defaultTextFormat = linkFormat;
linktoWeFiends.text = "wefiends.com";
linktoWeFiends.width = 78;
linktoWeFiends.x = ((stage.stageWidth / 2) - 35);
linktoWeFiends.y = 425;
linktoWeFiends.selectable = false;
addChild(linktoWeFiends);
linktoWeFiends.addEventListener(MouseEvent.CLICK, urltoWeFiends);
points = new Array();
_local1 = 100;
_local2 = 0.4;
points[0] = new Point3D((-85 * _local2), (-120 * _local2), _local1);
points[1] = new Point3D((-65 * _local2), (-120 * _local2), _local1);
points[2] = new Point3D((-55 * _local2), (-60 * _local2), _local1);
points[3] = new Point3D((-45 * _local2), (-80 * _local2), _local1);
points[4] = new Point3D((-35 * _local2), (-60 * _local2), _local1);
points[5] = new Point3D((-25 * _local2), (-120 * _local2), _local1);
points[6] = new Point3D((-5 * _local2), (-120 * _local2), _local1);
points[7] = new Point3D((-15 * _local2), (-20 * _local2), _local1);
points[8] = new Point3D((-25 * _local2), (-20 * _local2), _local1);
points[9] = new Point3D((-45 * _local2), (-50 * _local2), _local1);
points[10] = new Point3D((-65 * _local2), (-20 * _local2), _local1);
points[11] = new Point3D((-75 * _local2), (-20 * _local2), _local1);
points[12] = new Point3D((5 * _local2), (-120 * _local2), _local1);
points[13] = new Point3D((75 * _local2), (-120 * _local2), _local1);
points[14] = new Point3D((75 * _local2), (-100 * _local2), _local1);
points[15] = new Point3D((25 * _local2), (-100 * _local2), _local1);
points[16] = new Point3D((25 * _local2), (-80 * _local2), _local1);
points[17] = new Point3D((65 * _local2), (-80 * _local2), _local1);
points[18] = new Point3D((65 * _local2), (-60 * _local2), _local1);
points[19] = new Point3D((25 * _local2), (-60 * _local2), _local1);
points[20] = new Point3D((25 * _local2), (-40 * _local2), _local1);
points[21] = new Point3D((75 * _local2), (-40 * _local2), _local1);
points[22] = new Point3D((75 * _local2), (-20 * _local2), _local1);
points[23] = new Point3D((5 * _local2), (-20 * _local2), _local1);
_local1 = 65;
points[24] = new Point3D((-215 * _local2), (20 * _local2), _local1);
points[25] = new Point3D((-145 * _local2), (20 * _local2), _local1);
points[26] = new Point3D((-145 * _local2), (40 * _local2), _local1);
points[27] = new Point3D((-195 * _local2), (40 * _local2), _local1);
points[28] = new Point3D((-195 * _local2), (50 * _local2), _local1);
points[29] = new Point3D((-155 * _local2), (50 * _local2), _local1);
points[30] = new Point3D((-155 * _local2), (70 * _local2), _local1);
points[31] = new Point3D((-195 * _local2), (70 * _local2), _local1);
points[32] = new Point3D((-195 * _local2), (120 * _local2), _local1);
points[33] = new Point3D((-215 * _local2), (120 * _local2), _local1);
_local1 = 85;
points[34] = new Point3D((-135 * _local2), (20 * _local2), _local1);
points[35] = new Point3D((-115 * _local2), (20 * _local2), _local1);
points[36] = new Point3D((-115 * _local2), (120 * _local2), _local1);
points[37] = new Point3D((-135 * _local2), (120 * _local2), _local1);
_local3 = -100;
_local4 = 140;
_local1 = 95;
points[38] = new Point3D(((5 + _local3) * _local2), ((-120 + _local4) * _local2), _local1);
points[39] = new Point3D(((75 + _local3) * _local2), ((-120 + _local4) * _local2), _local1);
points[40] = new Point3D(((75 + _local3) * _local2), ((-100 + _local4) * _local2), _local1);
points[41] = new Point3D(((25 + _local3) * _local2), ((-100 + _local4) * _local2), _local1);
points[42] = new Point3D(((25 + _local3) * _local2), ((-80 + _local4) * _local2), _local1);
points[43] = new Point3D(((65 + _local3) * _local2), ((-80 + _local4) * _local2), _local1);
points[44] = new Point3D(((65 + _local3) * _local2), ((-60 + _local4) * _local2), _local1);
points[45] = new Point3D(((25 + _local3) * _local2), ((-60 + _local4) * _local2), _local1);
points[46] = new Point3D(((25 + _local3) * _local2), ((-40 + _local4) * _local2), _local1);
points[47] = new Point3D(((75 + _local3) * _local2), ((-40 + _local4) * _local2), _local1);
points[48] = new Point3D(((75 + _local3) * _local2), ((-20 + _local4) * _local2), _local1);
points[49] = new Point3D(((5 + _local3) * _local2), ((-20 + _local4) * _local2), _local1);
_local3 = 0;
_local4 = 0;
_local1 = 95;
points[50] = new Point3D(((-15 + _local3) * _local2), ((20 + _local4) * _local2), _local1);
points[51] = new Point3D(((5 + _local3) * _local2), ((20 + _local4) * _local2), _local1);
points[52] = new Point3D(((45 + _local3) * _local2), ((80 + _local4) * _local2), _local1);
points[53] = new Point3D(((45 + _local3) * _local2), ((20 + _local4) * _local2), _local1);
points[54] = new Point3D(((65 + _local3) * _local2), ((20 + _local4) * _local2), _local1);
points[55] = new Point3D(((65 + _local3) * _local2), ((120 + _local4) * _local2), _local1);
points[56] = new Point3D(((45 + _local3) * _local2), ((120 + _local4) * _local2), _local1);
points[57] = new Point3D(((5 + _local3) * _local2), ((60 + _local4) * _local2), _local1);
points[58] = new Point3D(((5 + _local3) * _local2), ((120 + _local4) * _local2), _local1);
points[59] = new Point3D(((-15 + _local3) * _local2), ((120 + _local4) * _local2), _local1);
_local1 = 85;
points[60] = new Point3D((75 * _local2), (20 * _local2), _local1);
points[61] = new Point3D((125 * _local2), (20 * _local2), _local1);
points[62] = new Point3D((135 * _local2), (25 * _local2), _local1);
points[63] = new Point3D((140 * _local2), (30 * _local2), _local1);
points[64] = new Point3D((145 * _local2), (40 * _local2), _local1);
points[65] = new Point3D((145 * _local2), (70 * _local2), _local1);
points[66] = new Point3D((145 * _local2), (100 * _local2), _local1);
points[67] = new Point3D((140 * _local2), (110 * _local2), _local1);
points[68] = new Point3D((135 * _local2), (115 * _local2), _local1);
points[69] = new Point3D((125 * _local2), (120 * _local2), _local1);
points[70] = new Point3D((75 * _local2), (120 * _local2), _local1);
points[71] = new Point3D((95 * _local2), (40 * _local2), _local1);
points[72] = new Point3D((105 * _local2), (40 * _local2), _local1);
points[73] = new Point3D((115 * _local2), (45 * _local2), _local1);
points[74] = new Point3D((122 * _local2), (50 * _local2), _local1);
points[75] = new Point3D((125 * _local2), (70 * _local2), _local1);
points[76] = new Point3D((122 * _local2), (90 * _local2), _local1);
points[77] = new Point3D((115 * _local2), (95 * _local2), _local1);
points[78] = new Point3D((105 * _local2), (100 * _local2), _local1);
points[79] = new Point3D((95 * _local2), (100 * _local2), _local1);
_local1 = 65;
points[80] = new Point3D((155 * _local2), (40 * _local2), _local1);
points[81] = new Point3D((165 * _local2), (30 * _local2), _local1);
points[82] = new Point3D((175 * _local2), (25 * _local2), _local1);
points[83] = new Point3D((185 * _local2), (20 * _local2), _local1);
points[84] = new Point3D((225 * _local2), (20 * _local2), _local1);
points[85] = new Point3D((225 * _local2), (40 * _local2), _local1);
points[86] = new Point3D((185 * _local2), (40 * _local2), _local1);
points[87] = new Point3D((180 * _local2), (45 * _local2), _local1);
points[88] = new Point3D((180 * _local2), (55 * _local2), _local1);
points[89] = new Point3D((190 * _local2), (60 * _local2), _local1);
points[90] = new Point3D((205 * _local2), (65 * _local2), _local1);
points[91] = new Point3D((215 * _local2), (70 * _local2), _local1);
points[92] = new Point3D((225 * _local2), (80 * _local2), _local1);
points[93] = new Point3D((225 * _local2), (110 * _local2), _local1);
points[94] = new Point3D((220 * _local2), (115 * _local2), _local1);
points[95] = new Point3D((215 * _local2), (120 * _local2), _local1);
points[96] = new Point3D((195 * _local2), (120 * _local2), _local1);
points[97] = new Point3D((155 * _local2), (120 * _local2), _local1);
points[98] = new Point3D((155 * _local2), (100 * _local2), _local1);
points[99] = new Point3D((195 * _local2), (100 * _local2), _local1);
points[100] = new Point3D((205 * _local2), (95 * _local2), _local1);
points[101] = new Point3D((205 * _local2), (85 * _local2), _local1);
points[102] = new Point3D((190 * _local2), (80 * _local2), _local1);
points[103] = new Point3D((175 * _local2), (75 * _local2), _local1);
points[104] = new Point3D((165 * _local2), (70 * _local2), _local1);
points[105] = new Point3D((155 * _local2), (60 * _local2), _local1);
points[106] = new Point3D((155 * _local2), (50 * _local2), _local1);
_local3 = -240;
_local4 = -125;
_local1 = 150;
points[107] = new Point3D(((92 + _local3) * _local2), ((62 + _local4) * _local2), _local1);
points[108] = new Point3D(((101 + _local3) * _local2), ((89 + _local4) * _local2), _local1);
points[109] = new Point3D(((83 + _local3) * _local2), ((89 + _local4) * _local2), _local1);
points[110] = new Point3D(((70 + _local3) * _local2), ((79 + _local4) * _local2), _local1);
points[111] = new Point3D(((87 + _local3) * _local2), ((79 + _local4) * _local2), _local1);
points[112] = new Point3D(((97 + _local3) * _local2), ((79 + _local4) * _local2), _local1);
points[113] = new Point3D(((114 + _local3) * _local2), ((79 + _local4) * _local2), _local1);
points[114] = new Point3D(((92 + _local3) * _local2), ((95 + _local4) * _local2), _local1);
points[115] = new Point3D(((79 + _local3) * _local2), ((105 + _local4) * _local2), _local1);
points[116] = new Point3D(((106 + _local3) * _local2), ((105 + _local4) * _local2), _local1);
_local3 = 70;
_local4 = -125;
_local1 = 0;
points[117] = new Point3D(((92 + _local3) * _local2), ((62 + _local4) * _local2), _local1);
points[118] = new Point3D(((101 + _local3) * _local2), ((89 + _local4) * _local2), _local1);
points[119] = new Point3D(((83 + _local3) * _local2), ((89 + _local4) * _local2), _local1);
points[120] = new Point3D(((70 + _local3) * _local2), ((79 + _local4) * _local2), _local1);
points[121] = new Point3D(((87 + _local3) * _local2), ((79 + _local4) * _local2), _local1);
points[122] = new Point3D(((97 + _local3) * _local2), ((79 + _local4) * _local2), _local1);
points[123] = new Point3D(((114 + _local3) * _local2), ((79 + _local4) * _local2), _local1);
points[124] = new Point3D(((92 + _local3) * _local2), ((95 + _local4) * _local2), _local1);
points[125] = new Point3D(((79 + _local3) * _local2), ((105 + _local4) * _local2), _local1);
points[126] = new Point3D(((106 + _local3) * _local2), ((105 + _local4) * _local2), _local1);
_local5 = 0;
while (_local5 < points.length) {
points[_local5].setVanishingPoint(vpX, vpY);
points[_local5].setCenter(0, 0, 200);
_local5++;
};
triangles = new Array();
triangles[0] = new Triangle(points[0], points[1], points[11], 0xFFFFFF);
triangles[1] = new Triangle(points[1], points[2], points[11], 0xFFFFFF);
triangles[2] = new Triangle(points[2], points[10], points[11], 0xFFFFFF);
triangles[3] = new Triangle(points[3], points[4], points[2], 0xFFFFFF);
triangles[4] = new Triangle(points[2], points[9], points[10], 0xFFFFFF);
triangles[5] = new Triangle(points[2], points[4], points[9], 0xFFFFFF);
triangles[6] = new Triangle(points[4], points[8], points[9], 0xFFFFFF);
triangles[7] = new Triangle(points[5], points[7], points[4], 0xFFFFFF);
triangles[8] = new Triangle(points[5], points[6], points[7], 0xFFFFFF);
triangles[9] = new Triangle(points[4], points[7], points[8], 0xFFFFFF);
triangles[10] = new Triangle(points[12], points[15], points[23], 0xFFFFFF);
triangles[11] = new Triangle(points[12], points[14], points[15], 0xFFFFFF);
triangles[12] = new Triangle(points[12], points[13], points[14], 0xFFFFFF);
triangles[13] = new Triangle(points[15], points[20], points[23], 0xFFFFFF);
triangles[14] = new Triangle(points[16], points[17], points[19], 0xFFFFFF);
triangles[15] = new Triangle(points[17], points[18], points[19], 0xFFFFFF);
triangles[16] = new Triangle(points[20], points[21], points[23], 0xFFFFFF);
triangles[17] = new Triangle(points[21], points[22], points[23], 0xFFFFFF);
triangles[18] = new Triangle(points[24], points[32], points[33], 0xFFFFFF);
triangles[19] = new Triangle(points[24], points[27], points[32], 0xFFFFFF);
triangles[20] = new Triangle(points[24], points[25], points[26], 0xFFFFFF);
triangles[21] = new Triangle(points[24], points[26], points[27], 0xFFFFFF);
triangles[22] = new Triangle(points[28], points[29], points[31], 0xFFFFFF);
triangles[23] = new Triangle(points[29], points[30], points[31], 0xFFFFFF);
triangles[24] = new Triangle(points[34], points[35], points[37], 0xFFFFFF);
triangles[25] = new Triangle(points[35], points[36], points[37], 0xFFFFFF);
triangles[26] = new Triangle(points[38], points[41], points[49], 0xFFFFFF);
triangles[27] = new Triangle(points[38], points[40], points[41], 0xFFFFFF);
triangles[28] = new Triangle(points[38], points[39], points[40], 0xFFFFFF);
triangles[29] = new Triangle(points[41], points[46], points[49], 0xFFFFFF);
triangles[30] = new Triangle(points[42], points[43], points[45], 0xFFFFFF);
triangles[31] = new Triangle(points[43], points[44], points[45], 0xFFFFFF);
triangles[32] = new Triangle(points[46], points[47], points[49], 0xFFFFFF);
triangles[33] = new Triangle(points[47], points[48], points[49], 0xFFFFFF);
triangles[34] = new Triangle(points[50], points[58], points[59], 0xFFFFFF);
triangles[35] = new Triangle(points[50], points[51], points[58], 0xFFFFFF);
triangles[36] = new Triangle(points[51], points[52], points[56], 0xFFFFFF);
triangles[37] = new Triangle(points[51], points[56], points[57], 0xFFFFFF);
triangles[38] = new Triangle(points[53], points[54], points[56], 0xFFFFFF);
triangles[39] = new Triangle(points[54], points[55], points[56], 0xFFFFFF);
triangles[40] = new Triangle(points[60], points[71], points[70], 0xFFFFFF);
triangles[41] = new Triangle(points[60], points[72], points[71], 0xFFFFFF);
triangles[42] = new Triangle(points[60], points[61], points[72], 0xFFFFFF);
triangles[43] = new Triangle(points[71], points[79], points[70], 0xFFFFFF);
triangles[44] = new Triangle(points[79], points[69], points[70], 0xFFFFFF);
triangles[45] = new Triangle(points[61], points[73], points[72], 0xFFFFFF);
triangles[46] = new Triangle(points[61], points[62], points[73], 0xFFFFFF);
triangles[47] = new Triangle(points[62], points[74], points[73], 0xFFFFFF);
triangles[48] = new Triangle(points[62], points[63], points[74], 0xFFFFFF);
triangles[49] = new Triangle(points[63], points[64], points[74], 0xFFFFFF);
triangles[50] = new Triangle(points[64], points[75], points[74], 0xFFFFFF);
triangles[51] = new Triangle(points[64], points[65], points[75], 0xFFFFFF);
triangles[52] = new Triangle(points[75], points[65], points[66], 0xFFFFFF);
triangles[53] = new Triangle(points[75], points[66], points[76], 0xFFFFFF);
triangles[54] = new Triangle(points[76], points[66], points[67], 0xFFFFFF);
triangles[55] = new Triangle(points[76], points[67], points[77], 0xFFFFFF);
triangles[56] = new Triangle(points[77], points[67], points[68], 0xFFFFFF);
triangles[57] = new Triangle(points[77], points[68], points[69], 0xFFFFFF);
triangles[58] = new Triangle(points[78], points[77], points[69], 0xFFFFFF);
triangles[59] = new Triangle(points[79], points[78], points[69], 0xFFFFFF);
triangles[60] = new Triangle(points[80], points[87], points[81], 0xFFFFFF);
triangles[61] = new Triangle(points[81], points[86], points[87], 0xFFFFFF);
triangles[62] = new Triangle(points[81], points[82], points[86], 0xFFFFFF);
triangles[63] = new Triangle(points[82], points[83], points[86], 0xFFFFFF);
triangles[64] = new Triangle(points[83], points[84], points[86], 0xFFFFFF);
triangles[65] = new Triangle(points[86], points[84], points[85], 0xFFFFFF);
triangles[66] = new Triangle(points[80], points[87], points[106], 0xFFFFFF);
triangles[67] = new Triangle(points[106], points[87], points[88], 0xFFFFFF);
triangles[68] = new Triangle(points[106], points[88], points[105], 0xFFFFFF);
triangles[69] = new Triangle(points[105], points[88], points[104], 0xFFFFFF);
triangles[70] = new Triangle(points[104], points[88], points[103], 0xFFFFFF);
triangles[71] = new Triangle(points[88], points[89], points[103], 0xFFFFFF);
triangles[72] = new Triangle(points[89], points[102], points[103], 0xFFFFFF);
triangles[73] = new Triangle(points[89], points[90], points[102], 0xFFFFFF);
triangles[74] = new Triangle(points[90], points[101], points[102], 0xFFFFFF);
triangles[75] = new Triangle(points[90], points[91], points[101], 0xFFFFFF);
triangles[76] = new Triangle(points[91], points[92], points[101], 0xFFFFFF);
triangles[77] = new Triangle(points[92], points[93], points[101], 0xFFFFFF);
triangles[78] = new Triangle(points[101], points[93], points[100], 0xFFFFFF);
triangles[79] = new Triangle(points[100], points[93], points[94], 0xFFFFFF);
triangles[80] = new Triangle(points[100], points[94], points[95], 0xFFFFFF);
triangles[81] = new Triangle(points[99], points[100], points[95], 0xFFFFFF);
triangles[82] = new Triangle(points[98], points[99], points[96], 0xFFFFFF);
triangles[83] = new Triangle(points[98], points[96], points[97], 0xFFFFFF);
triangles[84] = new Triangle(points[99], points[95], points[96], 0xFFFFFF);
triangles[85] = new Triangle(points[107], points[108], points[109], 0xFFFFFF);
triangles[86] = new Triangle(points[110], points[111], points[109], 0xFFFFFF);
triangles[87] = new Triangle(points[112], points[113], points[108], 0xFFFFFF);
triangles[88] = new Triangle(points[109], points[108], points[114], 0xFFFFFF);
triangles[89] = new Triangle(points[109], points[114], points[115], 0xFFFFFF);
triangles[90] = new Triangle(points[114], points[108], points[116], 0xFFFFFF);
triangles[91] = new Triangle(points[117], points[118], points[119], 0xFFFFFF);
triangles[92] = new Triangle(points[120], points[121], points[119], 0xFFFFFF);
triangles[93] = new Triangle(points[122], points[123], points[118], 0xFFFFFF);
triangles[94] = new Triangle(points[119], points[118], points[124], 0xFFFFFF);
triangles[95] = new Triangle(points[119], points[124], points[125], 0xFFFFFF);
triangles[96] = new Triangle(points[124], points[118], points[126], 0xFFFFFF);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function initGame(){
removeChild(ngad);
linktoWeFiends.removeEventListener(MouseEvent.CLICK, urltoWeFiends);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
graphics.clear();
removeChild(linktoWeFiends);
play();
}
function frame3(){
stop();
main = new Main(stage);
addChild(main);
}
private function determinePercent(_arg1, _arg2){
ptLoaded = Math.round(((_arg1 / _arg2) * 50));
if (adTimer.running){
ptLoaded = (ptLoaded + int(((adTimer.currentCount / adTimer.repeatCount) * 50)));
};
}
private function onEnterFrame(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:uint;
var _local5:Point3D;
determinePercent(this.loaderInfo.bytesLoaded, this.loaderInfo.bytesTotal);
if (ptLoaded > 99){
preloadDone = true;
};
if (!adTimer.running){
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
adTimer.start();
};
};
_local2 = ((0 - vpY) * 0.0001);
_local3 = ((0 - vpX) * 0.0001);
_local4 = 0;
while (_local4 < points.length) {
_local5 = points[_local4];
_local5.rotateX(_local2);
_local5.rotateY(_local3);
_local4++;
};
graphics.clear();
graphics.beginFill(0);
graphics.drawRect(0, 0, 600, 450);
graphics.endFill();
_local4 = 0;
while (_local4 < triangles.length) {
triangles[_local4].draw(graphics, (0.9 * letterAlpha));
_local4++;
};
loadbar.draw(graphics, stage.stageWidth, ptLoaded, letterAlpha);
if (preloadDone){
if (letterAlpha > 0){
letterAlpha = (letterAlpha - 0.05);
} else {
graphics.clear();
initGame();
};
};
}
}
}//package com.wefiends.loader
Section 10
//Triangle (com.wefiends.loader.Triangle)
package com.wefiends.loader {
import flash.display.*;
public class Triangle {
private var color:uint;
private var pointA:Point3D;
private var pointB:Point3D;
private var pointC:Point3D;
public function Triangle(_arg1:Point3D, _arg2:Point3D, _arg3:Point3D, _arg4:uint){
pointA = _arg1;
pointB = _arg2;
pointC = _arg3;
this.color = _arg4;
}
public function draw(_arg1:Graphics, _arg2:Number):void{
_arg1.beginFill(color, _arg2);
_arg1.moveTo(pointA.screenX, pointA.screenY);
_arg1.lineTo(pointB.screenX, pointB.screenY);
_arg1.lineTo(pointC.screenX, pointC.screenY);
_arg1.lineTo(pointA.screenX, pointA.screenY);
_arg1.endFill();
}
}
}//package com.wefiends.loader
Section 11
//Arm (com.wefiends.sorterbob.Arm)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Arm extends MovieClip {
private var claw:Claw;
private var numSegments:uint;// = 10
private var segments:Array;
public function Arm():void{
numSegments = 10;
claw = new Claw(38, 10, 0xCCCCCC);
super();
init();
}
private function init():void{
var _local1:uint;
var _local2:Segment;
segments = new Array();
addChild(claw);
_local1 = 0;
while (_local1 < numSegments) {
_local2 = new Segment(40, 15, 0xCCCCCC);
addChild(_local2);
segments.push(_local2);
_local1++;
};
_local2.x = 300;
_local2.y = -10;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function position(_arg1, _arg2):void{
_arg1.x = _arg2.getPin().x;
_arg1.y = _arg2.getPin().y;
}
public function removeEnterFrame():void{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
graphics.clear();
}
private function reach(_arg1, _arg2:Number, _arg3:Number):Point{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local4 = (_arg2 - _arg1.x);
_local5 = (_arg3 - _arg1.y);
_local6 = Math.atan2(_local5, _local4);
_arg1.rotation = ((_local6 * 180) / Math.PI);
_local7 = (_arg1.getPin().x - _arg1.x);
_local8 = (_arg1.getPin().y - _arg1.y);
_local9 = (_arg2 - _local7);
_local10 = (_arg3 - _local8);
return (new Point(_local9, _local10));
}
public function get getclaw():Claw{
return (claw);
}
private function onEnterFrame(_arg1:Event):void{
var _local2:Point;
var _local3:uint;
var _local4:Segment;
var _local5:Segment;
var _local6:Segment;
_local2 = reach(claw, mouseX, mouseY);
_local3 = 0;
while (_local3 < numSegments) {
_local4 = segments[_local3];
_local2 = reach(_local4, _local2.x, _local2.y);
_local3++;
};
_local3 = (numSegments - 1);
while (_local3 > 0) {
_local5 = segments[_local3];
_local6 = segments[(_local3 - 1)];
position(_local6, _local5);
_local3--;
};
position(claw, _local6);
}
}
}//package com.wefiends.sorterbob
Section 12
//backpipeGenerator (com.wefiends.sorterbob.backpipeGenerator)
package com.wefiends.sorterbob {
import flash.display.*;
public class backpipeGenerator extends MovieClip {
var widgetVariety:int;
var mainstage:Stage;
public function backpipeGenerator(_arg1:Stage, _arg2:int){
this.mainstage = _arg1;
this.widgetVariety = _arg2;
init();
}
function init(){
var _local1:backPipe;
var _local2:backPipe;
var _local3:backPipe;
var _local4:backPipe;
var _local5:backPipe;
var _local6:backPipe;
if (widgetVariety > 0){
_local1 = new backPipe();
_local1.x = -76;
_local1.y = 45;
addChild(_local1);
};
if (widgetVariety > 1){
_local2 = new backPipe();
_local2.scaleX = -1;
_local2.x = 667;
_local2.y = 46;
addChild(_local2);
};
if (widgetVariety > 2){
_local3 = new backPipe();
_local3.y = 127;
_local3.x = -76;
addChild(_local3);
};
if (widgetVariety > 3){
_local4 = new backPipe();
_local4.scaleX = -1;
_local4.x = 667;
_local4.y = 128;
addChild(_local4);
};
if (widgetVariety > 4){
_local5 = new backPipe();
_local5.y = 209;
_local5.x = -76;
addChild(_local5);
};
if (widgetVariety > 5){
_local6 = new backPipe();
_local6.scaleX = -1;
_local6.x = 667;
_local6.y = 210;
addChild(_local6);
};
}
}
}//package com.wefiends.sorterbob
Section 13
//blueWidget (com.wefiends.sorterbob.blueWidget)
package com.wefiends.sorterbob {
import flash.display.*;
public class blueWidget extends Widget {
public function blueWidget(_arg1:Stage=null, _arg2:Claw=null, _arg3:Number=1){
super(_arg1, _arg2, _arg3);
}
override public function init():void{
this.alpha = 0;
super.init();
}
}
}//package com.wefiends.sorterbob
Section 14
//Claw (com.wefiends.sorterbob.Claw)
package com.wefiends.sorterbob {
import flash.geom.*;
public class Claw extends Segment {
public function Claw(_arg1:Number, _arg2:Number, _arg3:uint=0xFFFFFF){
super(_arg1, _arg2, _arg3);
}
override public function init():void{
graphics.lineStyle();
graphics.beginFill(color);
graphics.moveTo(15, -25);
graphics.lineTo(0, 0);
graphics.lineTo(15, 25);
graphics.lineTo(45, 25);
graphics.lineTo(45, 15);
graphics.lineTo(20, 15);
graphics.lineTo(12, 0);
graphics.lineTo(20, -15);
graphics.lineTo(45, -15);
graphics.lineTo(45, -25);
graphics.lineTo(15, -25);
graphics.endFill();
graphics.lineStyle(0);
graphics.drawCircle(segmentWidth, 0, 2);
}
public function changeColor(_arg1:uint=0x666666){
this.color = _arg1;
init();
}
public function getPin2():Point{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = ((rotation * Math.PI) * half180);
_local2 = (x + (Math.cos(_local1) * (segmentWidth - 17)));
_local3 = (y + (Math.sin(_local1) * (segmentWidth - 17)));
return (new Point(_local2, _local3));
}
}
}//package com.wefiends.sorterbob
Section 15
//Engine (com.wefiends.sorterbob.Engine)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import flash.ui.*;
public class Engine extends MovieClip {
protected var levelLen:int;
protected var musicchan:SoundChannel;
protected var widgetTester:Tester;
protected var cv2:ConveyorBelt;
protected var bg:sorterBackground;
protected var timer:Timer;
var pipeArray:Array;
protected var speed:Number;
protected var fscreen:failScreen;
protected var arm:Arm;
public var scoreKeep:scoreKeeper;
var widgetArray:Array;
protected var widgetVariety:int;
protected var backpipeGen:backpipeGenerator;
protected var cv:ConveyorBeltSlow;
protected var widgetTotal:int;
protected var sscreen:scoreScreen;
protected var percentThreshold:int;
protected var widgetPattern:Pattern;
protected var globalScore:int;
protected var musictrans:SoundTransform;
protected var pipeGen:pipeGenerator;
protected var beltchan:SoundChannel;
var mainstage:Stage;
protected var levelNumber:int;
protected var scoreArray:Array;
protected var widgetGenerator:Generator;
public function Engine(_arg1:Stage, _arg2:int, _arg3:int, _arg4:Timer, _arg5:int, _arg6:int, _arg7:Number, _arg8:int, _arg9:SoundChannel, _arg10:SoundTransform){
widgetArray = new Array();
pipeArray = new Array();
beltchan = new SoundChannel();
super();
this.mainstage = _arg1;
this.levelLen = _arg2;
this.widgetTotal = _arg3;
this.percentThreshold = _arg5;
this.timer = _arg4;
this.widgetVariety = _arg6;
this.speed = _arg7;
this.levelNumber = _arg8;
this.musictrans = _arg10;
this.musicchan = _arg9;
}
public function reallyStartScoring(_arg1:Event){
if ((((this.alpha > 0)) || ((musictrans.volume > 0.2)))){
this.alpha = (this.alpha - 0.015);
if (musictrans.volume > 0.2){
musictrans.volume = (musictrans.volume - 0.02);
musicchan.soundTransform = musictrans;
};
} else {
removeEventListener(Event.ENTER_FRAME, reallyStartScoring);
stopEngine();
sscreen = new scoreScreen(scoreArray, globalScore);
this.addChild(sscreen);
sscreen.addEventListener("scoredone", doneScoring);
};
}
protected function doneScoring(_arg1:Event){
_arg1.currentTarget.removeEventListener("scoredone", doneScoring);
removeChild(sscreen);
dispatchEvent(_arg1);
}
public function startScoring(_arg1:Array, _arg2:int){
this.scoreArray = _arg1;
this.globalScore = _arg2;
arm.removeEnterFrame();
addEventListener(Event.ENTER_FRAME, reallyStartScoring);
}
public function init(){
var onEnterFrame:Function;
onEnterFrame = function (_arg1:Event){
if (musictrans.volume < 0.85){
musictrans.volume = (musictrans.volume + 0.05);
musicchan.soundTransform = musictrans;
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
reallyInit();
};
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function doneFailing(_arg1:Event){
dispatchEvent(_arg1);
_arg1.currentTarget.removeEventListener("scoredone", doneScoring);
removeChild(fscreen);
}
public function reallyStartFail(_arg1:Event){
if ((((this.alpha > 0)) || ((musictrans.volume > 0.2)))){
this.alpha = (this.alpha - 0.015);
if (musictrans.volume > 0.2){
musictrans.volume = (musictrans.volume - 0.02);
musicchan.soundTransform = musictrans;
};
} else {
removeEventListener(Event.ENTER_FRAME, reallyStartFail);
stopEngine();
fscreen = new failScreen(globalScore, levelNumber);
this.addChild(fscreen);
fscreen.addEventListener("scoredone", doneFailing);
};
}
protected function stopEngine(){
var _local1:int;
Mouse.show();
_local1 = 0;
while (_local1 < widgetArray.length) {
widgetArray[_local1].removeEnterFrame();
_local1++;
};
this.removeChild(bg);
if (speed == 1){
this.removeChild(cv);
} else {
if (speed == 2){
this.removeChild(cv2);
};
};
beltchan.stop();
this.removeChild(arm);
this.removeChild(pipeGen);
this.removeChild(backpipeGen);
widgetTester.removeEnterFrame();
widgetGenerator.removeEnterFrame();
this.removeChild(widgetGenerator);
scoreKeep.removeEnterFrame();
this.removeChild(scoreKeep);
this.removeChild(widgetPattern);
this.alpha = 1;
}
protected function reallyInit(){
var _local1:SoundTransform;
var _local2:belt;
_local1 = new SoundTransform();
_local2 = new belt();
_local1.volume = 0.5;
beltchan = _local2.play(0, 100);
beltchan.soundTransform = _local1;
Mouse.hide();
bg = new sorterBackground();
bg.x = -4;
addChild(bg);
if (speed == 1){
cv = new ConveyorBeltSlow();
addChild(cv);
cv.x = 126;
cv.y = 127;
};
if (speed == 2){
cv2 = new ConveyorBelt();
addChild(cv2);
cv2.x = 126;
cv2.y = 127;
};
arm = new Arm();
pipeGen = new pipeGenerator(mainstage, pipeArray, arm.getclaw, widgetVariety);
backpipeGen = new backpipeGenerator(mainstage, widgetVariety);
widgetGenerator = new Generator(mainstage, widgetArray, arm.getclaw, widgetTotal, timer, widgetVariety, speed);
widgetTester = new Tester(mainstage, widgetArray, pipeArray, arm.getclaw, widgetVariety);
scoreKeep = new scoreKeeper(widgetTester, widgetGenerator, percentThreshold, levelLen, widgetTotal);
widgetPattern = new Pattern(widgetGenerator, levelNumber, scoreKeep);
widgetTester.setWidgetPattern(widgetPattern);
this.addChild(backpipeGen);
this.addChild(widgetGenerator);
this.addChild(arm);
this.addChild(scoreKeep);
this.addChild(pipeGen);
this.addChild(widgetPattern);
}
public function startFail(_arg1:int){
this.globalScore = _arg1;
arm.removeEnterFrame();
addEventListener(Event.ENTER_FRAME, reallyStartFail);
}
}
}//package com.wefiends.sorterbob
Section 16
//failScreen (com.wefiends.sorterbob.failScreen)
package com.wefiends.sorterbob {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
import flash.text.*;
import com.hurlant.util.*;
import com.hurlant.crypto.prng.*;
import flash.net.*;
public class failScreen extends MovieClip {
protected var totalScoreBackFormat:TextFormat;
var ngad2:NG_AD_OBJECT;
protected var totalScoreFormat:TextFormat;
protected var baseScore:TextField;
protected var key:String;// = "4C16FDBE4A754A1EAFF7681C68460EB328308D411D9B82344D31EBB6A84E5CB8"
protected var initScore:int;// = 0
protected var keydata:ByteArray;
var submitTextField:TextField;
protected var baseScoreFormat:TextFormat;
protected var run:int;// = 1
protected var retry:TextField;
protected var globalScore:int;
protected var totalScore:TextField;
protected var moregames:TextField;
protected var Name:TextInput;
protected var totalScoreBack:TextField;
protected var retryFormat:TextFormat;
protected var onLevel:int;
public function failScreen(_arg1:int, _arg2:int):void{
baseScore = new TextField();
baseScoreFormat = new TextFormat();
totalScore = new TextField();
totalScoreFormat = new TextFormat();
totalScoreBack = new TextField();
totalScoreBackFormat = new TextFormat();
retry = new TextField();
retryFormat = new TextFormat();
moregames = new TextField();
run = 1;
initScore = 0;
Name = new TextInput();
ngad2 = new NG_AD_OBJECT();
key = "4C16FDBE4A754A1EAFF7681C68460EB328308D411D9B82344D31EBB6A84E5CB8";
super();
this.globalScore = _arg1;
this.onLevel = (_arg2 + 1);
init();
}
protected function init(){
var _local1:*;
_local1 = new sorterBackground();
_local1.alpha = 0.2;
_local1.x = -4;
addChild(_local1);
ngad2.x = 428;
ngad2.y = 225;
addChild(ngad2);
baseScoreFormat.color = 0;
baseScoreFormat.size = 100;
baseScoreFormat.font = "Kabel LT Std Book";
baseScoreFormat.align = TextFormatAlign.CENTER;
baseScore.type = TextFieldType.DYNAMIC;
baseScore.selectable = false;
baseScore.defaultTextFormat = baseScoreFormat;
baseScore.x = 20;
baseScore.y = 115;
baseScore.alpha = 0;
baseScore.width = 250;
baseScore.embedFonts = true;
baseScore.text = "Fail";
addChild(baseScore);
totalScoreFormat.color = 0;
totalScoreFormat.size = 36;
totalScoreFormat.font = "Kabel LT Std Book";
totalScoreFormat.align = TextFormatAlign.CENTER;
totalScore.type = TextFieldType.DYNAMIC;
totalScore.selectable = false;
totalScore.defaultTextFormat = totalScoreFormat;
totalScore.x = 20;
totalScore.y = 50;
totalScore.alpha = 1;
totalScore.width = 250;
totalScore.embedFonts = true;
totalScore.text = globalScore.toString();
totalScoreBackFormat.color = 0;
totalScoreBackFormat.size = 22;
totalScoreBackFormat.font = "Kabel LT Std Book";
totalScoreBackFormat.align = TextFormatAlign.CENTER;
totalScoreBack.type = TextFieldType.DYNAMIC;
totalScoreBack.selectable = false;
totalScoreBack.defaultTextFormat = totalScoreBackFormat;
totalScoreBack.x = 20;
totalScoreBack.y = 30;
totalScoreBack.alpha = 0.2;
totalScoreBack.width = 250;
totalScoreBack.embedFonts = true;
totalScoreBack.text = "Total Score";
retryFormat.color = 0;
retryFormat.size = 30;
retryFormat.font = "Kabel LT Std Book";
retryFormat.align = TextFormatAlign.CENTER;
retry.type = TextFieldType.DYNAMIC;
retry.selectable = false;
retry.defaultTextFormat = retryFormat;
retry.x = 20;
retry.y = 230;
retry.alpha = 0;
retry.width = 250;
retry.height = 42;
retry.embedFonts = true;
retry.text = "Try Again";
moregames.type = TextFieldType.DYNAMIC;
moregames.selectable = false;
moregames.defaultTextFormat = retryFormat;
moregames.x = 20;
moregames.y = 285;
moregames.alpha = 0;
moregames.width = 250;
moregames.height = 42;
moregames.embedFonts = true;
moregames.text = "More Games";
addChild(baseScore);
addChild(totalScore);
addChild(totalScoreBack);
addChild(moregames);
addChild(retry);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
retry.addEventListener(MouseEvent.CLICK, onClick);
retry.addEventListener(MouseEvent.MOUSE_OVER, onOver);
retry.addEventListener(MouseEvent.MOUSE_OUT, onOut);
moregames.addEventListener(MouseEvent.MOUSE_OVER, onOver2);
moregames.addEventListener(MouseEvent.MOUSE_OUT, onOut2);
moregames.addEventListener(MouseEvent.CLICK, urltoMoreGames);
createNameInput();
}
protected function onOut2(_arg1:MouseEvent){
retryFormat.color = 0;
moregames.defaultTextFormat = retryFormat;
moregames.text = "More Games";
}
protected function onOver2(_arg1:MouseEvent){
retryFormat.color = 16724787;
moregames.defaultTextFormat = retryFormat;
moregames.text = "More Games";
}
protected function onOver(_arg1:MouseEvent){
retryFormat.color = 16724787;
retry.defaultTextFormat = retryFormat;
retry.text = "Try Again";
}
private function urltoMoreGames(_arg1:MouseEvent):void{
NewgroundsAPI.loadCustomLink("We Fiends Games");
}
protected function submitScore(_arg1:ComponentEvent){
var _local2:*;
var _local3:URLVariables;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:URLRequest;
Name.removeEventListener(ComponentEvent.ENTER, submitScore);
submitTextField.removeEventListener(MouseEvent.CLICK, submitScore2);
_local2 = getTimer();
_local2 = int((_local2 / 1000));
_local3 = new URLVariables();
keydata = Hex.toArray(Hex.fromString(key));
_local4 = new ARC4(keydata);
_local5 = ((((((((Name.text + ";") + globalScore.toString()) + ";") + loaderInfo.url) + ";") + onLevel) + ";") + _local2);
_local6 = Hex.toArray(Hex.fromString(_local5));
_local4.encrypt(_local6);
_local3.gamedata = Hex.fromArray(_local6);
_local7 = new URLRequest();
_local7.url = "http://www.wefiends.com/games/sorterbob/scoreboard/submit/";
_local7.method = "GET";
_local7.data = _local3;
navigateToURL(_local7, "_blank");
}
protected function createNameInput(){
var nameFormat:TextFormat;
var onOver3:Function;
var onOut3:Function;
onOver3 = function (_arg1:MouseEvent){
nameFormat.color = 16724787;
submitTextField.defaultTextFormat = nameFormat;
submitTextField.text = "Submit your score";
};
onOut3 = function (_arg1:MouseEvent){
nameFormat.color = 0;
submitTextField.defaultTextFormat = nameFormat;
submitTextField.text = "Submit your score";
};
nameFormat = new TextFormat();
nameFormat.color = 0;
nameFormat.size = 28;
nameFormat.font = "Kabel LT Std Book";
nameFormat.align = TextFormatAlign.CENTER;
Name.x = 45;
Name.y = 350;
Name.height = 28;
Name.width = 200;
Name.setStyle("embedFonts", true);
Name.setStyle("textFormat", nameFormat);
Name.maxChars = 25;
Name.text = "Your Name";
addChild(Name);
Name.addEventListener(ComponentEvent.ENTER, submitScore);
submitTextField = new TextField();
submitTextField.selectable = false;
submitTextField.embedFonts = true;
submitTextField.defaultTextFormat = nameFormat;
submitTextField.width = 250;
submitTextField.x = 20;
submitTextField.y = 385;
submitTextField.text = "Submit your score";
addChild(submitTextField);
submitTextField.addEventListener(MouseEvent.CLICK, submitScore2);
submitTextField.addEventListener(MouseEvent.MOUSE_OVER, onOver3);
submitTextField.addEventListener(MouseEvent.MOUSE_OUT, onOut3);
}
protected function onEnterFrame(_arg1:Event){
if (run == 1){
if (baseScore.alpha < 1){
baseScore.alpha = (baseScore.alpha + 0.05);
retry.alpha = (retry.alpha + 0.05);
moregames.alpha = (moregames.alpha + 0.05);
};
};
}
protected function submitScore2(_arg1:MouseEvent){
var _local2:*;
var _local3:URLVariables;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:URLRequest;
_arg1.currentTarget.removeEventListener(MouseEvent.CLICK, submitScore2);
Name.removeEventListener(ComponentEvent.ENTER, submitScore);
_local2 = getTimer();
_local2 = int((_local2 / 1000));
_local3 = new URLVariables();
keydata = Hex.toArray(Hex.fromString(key));
_local4 = new ARC4(keydata);
_local5 = ((((((((Name.text + ";") + globalScore.toString()) + ";") + loaderInfo.url) + ";") + onLevel) + ";") + _local2);
_local6 = Hex.toArray(Hex.fromString(_local5));
_local4.encrypt(_local6);
_local3.gamedata = Hex.fromArray(_local6);
_local7 = new URLRequest();
_local7.url = "http://www.wefiends.com/games/sorterbob/scoreboard/submit/";
_local7.method = "GET";
_local7.data = _local3;
navigateToURL(_local7, "_blank");
}
protected function onClick(_arg1:MouseEvent){
dispatchEvent(new Event("scoredone"));
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function onOut(_arg1:MouseEvent){
retryFormat.color = 0;
retry.defaultTextFormat = retryFormat;
retry.text = "Try Again";
}
}
}//package com.wefiends.sorterbob
Section 17
//Generator (com.wefiends.sorterbob.Generator)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Generator extends MovieClip {
var arrayLen:int;
var onWidget:int;// = 0
public var lastWidgetName:String;
var timer:Timer;
var claw:Claw;
var speed:int;
var widgetVariety:int;
var widgetArray:Array;
var widgetTotal:int;
var widgetTimeArray:Array;
var widgetIterator:int;// = 0
var mainstage:Stage;
public static var CREATED = "created";
public function Generator(_arg1:Stage, _arg2:Array, _arg3:Claw, _arg4:int, _arg5:Timer, _arg6:int, _arg7:Number){
onWidget = 0;
widgetTimeArray = new Array();
widgetIterator = 0;
super();
this.mainstage = _arg1;
this.widgetArray = _arg2;
this.claw = _arg3;
this.widgetTotal = _arg4;
this.timer = _arg5;
this.widgetVariety = _arg6;
this.speed = _arg7;
init();
}
function init(){
var _local1:int;
widgetIterator = 0;
_local1 = 0;
while (_local1 < widgetTotal) {
widgetTimeArray[_local1] = (Math.round((Math.random() * (timer.repeatCount - 60))) + 1);
_local1++;
};
widgetTimeArray.sort(Array.NUMERIC);
arrayLen = (widgetTimeArray.length - 1);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function dispatchCreateEvent():void{
dispatchEvent(new Event(Generator.CREATED));
}
public function removeEnterFrame():void{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
widgetIterator = 0;
widgetTimeArray = null;
}
private function onEnterFrame(_arg1:Event){
var _local2:int;
var _local3:redWidget;
var _local4:greenWidget;
var _local5:orangeWidget;
var _local6:blueWidget;
var _local7:yellowWidget;
var _local8:purpleWidget;
if (!(widgetIterator > arrayLen)){
if (widgetTimeArray[widgetIterator] < timer.currentCount){
widgetIterator++;
};
while (widgetTimeArray[widgetIterator] == timer.currentCount) {
_local2 = (Math.round((Math.random() * (widgetVariety - 1))) + 1);
if (_local2 == 1){
_local3 = new redWidget(mainstage, claw, speed);
addChild(_local3);
setChildIndex(_local3, 0);
widgetArray.push(_local3);
lastWidgetName = "red";
} else {
if (_local2 == 2){
_local4 = new greenWidget(mainstage, claw, speed);
addChild(_local4);
setChildIndex(_local4, 0);
widgetArray.push(_local4);
lastWidgetName = "green";
} else {
if (_local2 == 3){
_local5 = new orangeWidget(mainstage, claw, speed);
addChild(_local5);
setChildIndex(_local5, 0);
widgetArray.push(_local5);
lastWidgetName = "orange";
} else {
if (_local2 == 4){
_local6 = new blueWidget(mainstage, claw, speed);
addChild(_local6);
setChildIndex(_local6, 0);
widgetArray.push(_local6);
lastWidgetName = "blue";
} else {
if (_local2 == 5){
_local7 = new yellowWidget(mainstage, claw, speed);
addChild(_local7);
setChildIndex(_local7, 0);
widgetArray.push(_local7);
lastWidgetName = "yellow";
} else {
if (_local2 == 6){
_local8 = new purpleWidget(mainstage, claw, speed);
addChild(_local8);
setChildIndex(_local8, 0);
widgetArray.push(_local8);
lastWidgetName = "purple";
};
};
};
};
};
};
dispatchCreateEvent();
widgetIterator++;
};
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
}
}
}//package com.wefiends.sorterbob
Section 18
//greenWidget (com.wefiends.sorterbob.greenWidget)
package com.wefiends.sorterbob {
import flash.display.*;
public class greenWidget extends Widget {
public function greenWidget(_arg1:Stage=null, _arg2:Claw=null, _arg3:Number=1){
super(_arg1, _arg2, _arg3);
}
override public function init():void{
this.alpha = 0;
super.init();
}
}
}//package com.wefiends.sorterbob
Section 19
//Level (com.wefiends.sorterbob.Level)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
public class Level extends Sprite {
protected var engine:Engine;
protected var speed:Number;
protected var widgetTotal:int;
protected var widgetVariety:int;
var timeCounter:Number;// = 0
protected var widgetTimer:Timer;
protected var percentThreshold:int;
public var globalScore:int;
protected var musictrans:SoundTransform;
protected var mainstage:Stage;
protected var pscreen:percentageScreen;
public var levelNumber:int;
protected var levelLen:int;
protected var musicchan:SoundChannel;
protected var levelProb:Number;
public static var DONE:String = "leveldone";
public function Level(_arg1:Stage, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:Number, _arg8:int, _arg9:SoundChannel, _arg10:SoundTransform):void{
timeCounter = 0;
super();
this.mainstage = _arg1;
this.levelNumber = _arg2;
this.levelLen = _arg3;
this.levelProb = levelProb;
this.widgetTotal = _arg4;
this.percentThreshold = _arg5;
this.widgetVariety = _arg6;
this.globalScore = _arg8;
this.speed = _arg7;
this.musictrans = _arg10;
this.musicchan = _arg9;
init();
}
protected function updateTimer(_arg1:TimerEvent){
timeCounter = (timeCounter + 1);
if (timeCounter > 19){
engine.scoreKeep.second();
timeCounter = 0;
};
}
protected function startScoring(_arg1:TimerEvent){
var _local2:Array;
if (engine.scoreKeep.percentage >= percentThreshold){
_local2 = new Array();
_local2 = engine.scoreKeep.score();
globalScore = (globalScore + _local2[4]);
engine.startScoring(_local2, globalScore);
engine.addEventListener("scoredone", done);
levelNumber++;
} else {
engine.startFail(globalScore);
engine.addEventListener("scoredone", done);
};
}
protected function init(){
widgetTimer = new Timer(50, int(((levelLen * 1000) / 50)));
widgetTimer.addEventListener(TimerEvent.TIMER, updateTimer);
widgetTimer.addEventListener(TimerEvent.TIMER_COMPLETE, startScoring);
}
protected function levelStart(_arg1:Event){
removeChild(pscreen);
pscreen.removeEventListener("scoredone", levelStart);
widgetTimer.reset();
widgetTimer.start();
engine = new Engine(mainstage, levelLen, widgetTotal, widgetTimer, percentThreshold, widgetVariety, speed, levelNumber, musicchan, musictrans);
addChild(engine);
engine.init();
}
public function start(){
pscreen = new percentageScreen(levelNumber, percentThreshold, globalScore);
addChild(pscreen);
pscreen.addEventListener("scoredone", levelStart);
}
protected function done(_arg1:Event){
engine.removeEventListener("scoredone", done);
removeChild(engine);
dispatchEvent(new Event(DONE));
}
}
}//package com.wefiends.sorterbob
Section 20
//Main (com.wefiends.sorterbob.Main)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
public class Main extends MovieClip {
var menua:MenuAnimation;
protected var musicchan:SoundChannel;
var currentVolume:Number;// = 1
var version:TextField;
var myContextMenu:ContextMenu;
var intro:Intro;
var level:Level;
var Levels:Array;
public var globalScore:int;// = 0
var instruc:Instructions;
protected var musictrans:SoundTransform;
protected var mainstage:Stage;
var levelLen:int;// = 31
public var onLevel:int;// = 0
var instruc2:Instructions2;
public function Main(_arg1:Stage){
globalScore = 0;
onLevel = 0;
Levels = new Array();
levelLen = 31;
currentVolume = 1;
musicchan = new SoundChannel();
musictrans = new SoundTransform();
super();
this.mainstage = _arg1;
init();
}
function onSoundOff(_arg1:ContextMenuEvent){
var _local2:SoundTransform;
_local2 = new SoundTransform();
if (_arg1.currentTarget.caption == "Sound off"){
_local2.volume = 0;
SoundMixer.soundTransform = _local2;
_arg1.currentTarget.caption = "Sound on";
} else {
if (_arg1.currentTarget.caption == "Sound on"){
_local2.volume = currentVolume;
SoundMixer.soundTransform = _local2;
_arg1.currentTarget.caption = "Sound off";
};
};
}
function startInstructions2(_arg1:KeyboardEvent){
var onEnterFrame:Function;
var event = _arg1;
onEnterFrame = function (_arg1:Event){
if (instruc2.alpha < 1){
instruc2.alpha = (instruc2.alpha + 0.05);
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
mainstage.addEventListener(KeyboardEvent.KEY_DOWN, startGame);
};
};
mainstage.removeEventListener(KeyboardEvent.KEY_DOWN, startInstructions2);
removeChild(instruc);
instruc2 = new Instructions2();
instruc2.scaleY = 1.01;
instruc2.alpha = 0;
addChild(instruc2);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
function init(){
var _local1:ContextMenuItem;
var _local2:ContextMenuItem;
var _local3:ContextMenuItem;
var _local4:ContextMenuItem;
var _local5:ContextMenuItem;
var _local6:TextFormat;
graphics.clear();
myContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
_local1 = new ContextMenuItem("Sound off");
_local2 = new ContextMenuItem("Volume 100%");
_local2.separatorBefore = true;
_local3 = new ContextMenuItem("Volume 75%");
_local4 = new ContextMenuItem("Volume 50%");
_local5 = new ContextMenuItem("Volume 25%");
myContextMenu.customItems.push(_local1, _local2, _local3, _local4, _local5);
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onSoundOff);
_local2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, volumeSet);
_local3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, volumeSet);
_local4.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, volumeSet);
_local5.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, volumeSet);
this.contextMenu = myContextMenu;
if (checkVersion()){
intro = new Intro();
intro.introstuff.gotoAndPlay(2);
addChild(intro);
intro.introstuff.addEventListener("introdone", displayMenu);
} else {
_local6 = new TextFormat();
version = new TextField();
_local6.color = 0;
_local6.size = 17;
_local6.font = "Arial";
_local6.align = TextFormatAlign.CENTER;
version.selectable = false;
version.defaultTextFormat = _local6;
version.x = 0;
version.y = 75;
version.alpha = 1;
version.width = 600;
version.height = 300;
version.embedFonts = false;
version.htmlText = "<b>You are using an outdated version of Flash Player.</b>\n\nPlease consider updating.\nNewer versions include important bug and performance fixes.\n\n<b>More importantly, older versions have known severe security flaws.</b>\n\n\t\t\t\tYou may experience performance issues\n and unexpected behavior if you continue.\n\n<A HREF='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash'><u>Take me to the update page.</u></a>\n\t\t\t\t\n\n<font size='36'><a href='event:startGame'>Play anyways.</a></font>";
version.addEventListener(TextEvent.LINK, startGameAnyways);
addChild(version);
};
}
function startInstructions(_arg1:MouseEvent){
var onEnterFrame:Function;
var event = _arg1;
onEnterFrame = function (_arg1:Event){
if (instruc.alpha < 1){
instruc.alpha = (instruc.alpha + 0.05);
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
mainstage.addEventListener(KeyboardEvent.KEY_DOWN, startInstructions2);
};
};
menua.menu.begin.removeEventListener(MouseEvent.CLICK, startInstructions);
levelLen = menua.menu.levelLen;
removeChild(menua);
instruc = new Instructions();
instruc.scaleY = 1.01;
instruc.alpha = 0;
addChild(instruc);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
function startNextLevel():void{
var _local1:winScreen;
if (onLevel < 25){
level = new Level(mainstage, onLevel, Levels[onLevel][0], Levels[onLevel][1], Levels[onLevel][2], Levels[onLevel][3], Levels[onLevel][4], globalScore, musicchan, musictrans);
addChild(level);
level.start();
level.addEventListener(Level.DONE, levelDone);
} else {
_local1 = new winScreen(globalScore, onLevel);
addChild(_local1);
};
}
function levelDone(_arg1:Event){
globalScore = level.globalScore;
onLevel = level.levelNumber;
level.removeEventListener(Level.DONE, levelDone);
removeChild(level);
startNextLevel();
}
function startGameAnyways(_arg1:TextEvent){
removeChild(version);
menua = new MenuAnimation();
menua.gotoAndPlay(1);
menua.x = 130;
menua.y = 135;
addChild(menua);
menua.menu.begin.addEventListener(MouseEvent.CLICK, startInstructions);
}
function displayMenu(_arg1:Event){
var onEnterFrame:Function;
var event = _arg1;
onEnterFrame = function (_arg1:Event){
if (intro.alpha < 1){
intro.alpha = (intro.alpha - 0.05);
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeChild(intro);
menua = new MenuAnimation();
menua.gotoAndPlay(1);
menua.x = 130;
menua.y = 130;
addChild(menua);
menua.menu.begin.addEventListener(MouseEvent.CLICK, startInstructions);
};
};
intro.introstuff.removeEventListener("introdone", displayMenu);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
function startGame(_arg1:KeyboardEvent){
var onEnterFrame:Function;
var event = _arg1;
if (event.keyCode == Keyboard.SPACE){
onEnterFrame = function (_arg1:Event){
var _local2:Music;
if (instruc2.alpha > 0){
instruc2.alpha = (instruc2.alpha - 0.05);
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeChild(instruc2);
_local2 = new Music();
musictrans.volume = 0.85;
musicchan = _local2.play(0, 100);
musicchan.soundTransform = musictrans;
Levels = [[levelLen, 15, 65, 2, 1], [levelLen, 15, 50, 2, 2], [levelLen, 25, 70, 2, 1], [levelLen, 25, 60, 2, 2], [levelLen, 20, 60, 3, 1], [levelLen, 30, 55, 3, 2], [levelLen, 30, 70, 3, 1], [levelLen, 30, 50, 3, 2], [levelLen, 40, 45, 3, 1], [levelLen, 40, 60, 4, 1], [levelLen, 35, 50, 4, 2], [levelLen, 40, 70, 4, 2], [levelLen, 35, 60, 5, 1], [levelLen, 25, 75, 5, 1], [levelLen, 30, 55, 5, 2], [levelLen, 30, 60, 6, 1], [levelLen, 30, 50, 6, 2], [levelLen, 40, 55, 6, 1], [levelLen, 50, 65, 1, 1], [levelLen, 55, 65, 2, 1], [levelLen, 55, 65, 3, 1], [levelLen, 55, 65, 4, 1], [levelLen, 55, 65, 5, 1], [levelLen, 55, 65, 6, 1], [levelLen, 55, 50, 6, 2]];
level = new Level(mainstage, onLevel, Levels[onLevel][0], Levels[onLevel][1], Levels[onLevel][2], Levels[onLevel][3], Levels[onLevel][4], globalScore, musicchan, musictrans);
addChild(level);
level.contextMenu = myContextMenu;
level.start();
level.addEventListener(Level.DONE, levelDone);
};
};
mainstage.removeEventListener(KeyboardEvent.KEY_DOWN, startGame);
instruc2.removeEventListener(MouseEvent.CLICK, startGame);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
};
}
function checkVersion():Boolean{
var _local1:String;
var _local2:RegExp;
var _local3:Object;
_local1 = Capabilities.version;
_local2 = /^(\w*) (\d*),(\d*),(\d*),(\d*)$/;
_local3 = _local2.exec(_local1);
if (_local3 != null){
if ((((((((_local3[2] >= 9)) && ((_local3[3] >= 0)))) && ((_local3[4] >= 115)))) && ((_local3[5] >= 0)))){
return (true);
};
};
return (false);
}
function volumeSet(_arg1:ContextMenuEvent){
var _local2:SoundTransform;
_local2 = new SoundTransform();
if (_arg1.currentTarget.caption == "Volume 100%"){
currentVolume = 1;
_local2.volume = currentVolume;
SoundMixer.soundTransform = _local2;
} else {
if (_arg1.currentTarget.caption == "Volume 75%"){
currentVolume = 0.75;
_local2.volume = currentVolume;
SoundMixer.soundTransform = _local2;
} else {
if (_arg1.currentTarget.caption == "Volume 50%"){
currentVolume = 0.5;
_local2.volume = currentVolume;
SoundMixer.soundTransform = _local2;
} else {
if (_arg1.currentTarget.caption == "Volume 25%"){
currentVolume = 0.25;
_local2.volume = currentVolume;
SoundMixer.soundTransform = _local2;
};
};
};
};
}
}
}//package com.wefiends.sorterbob
Section 21
//Menu (com.wefiends.sorterbob.Menu)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
public class Menu extends MovieClip {
public var Hard:hard;
public var Normal:normal;
public var Impassible:impassible;
public var highscore:Highscore;
public var wefiends:WeFiends;
public var begin:Begin;
public var moregames:MoreGames;
public var levelLen:int;// = 30
public function Menu(){
levelLen = 30;
super();
init();
}
private function onImpassibleClick(_arg1:MouseEvent){
Normal.gotoAndStop(1);
Hard.gotoAndStop(1);
Impassible.gotoAndStop(2);
levelLen = 12;
}
private function urltoHighScore(_arg1:MouseEvent):void{
NewgroundsAPI.loadCustomLink("We Fiends Scoreboard");
}
protected function init(){
wefiends.addEventListener(MouseEvent.CLICK, urltoWeFiends);
highscore.addEventListener(MouseEvent.CLICK, urltoHighScore);
moregames.addEventListener(MouseEvent.CLICK, urltoMoreGames);
addEventListener(Event.REMOVED_FROM_STAGE, stopListeners);
Normal.gotoAndStop(2);
Hard.gotoAndStop(1);
Impassible.gotoAndStop(1);
Normal.addEventListener(MouseEvent.CLICK, onNormalClick);
Hard.addEventListener(MouseEvent.CLICK, onHardClick);
Impassible.addEventListener(MouseEvent.CLICK, onImpassibleClick);
}
private function urltoWeFiends(_arg1:MouseEvent):void{
NewgroundsAPI.loadMySite();
}
private function onHardClick(_arg1:MouseEvent){
Normal.gotoAndStop(1);
Hard.gotoAndStop(2);
Impassible.gotoAndStop(1);
levelLen = 20;
}
private function urltoMoreGames(_arg1:MouseEvent):void{
NewgroundsAPI.loadCustomLink("We Fiends Games");
}
private function stopListeners(_arg1:Event){
wefiends.removeEventListener(MouseEvent.CLICK, urltoWeFiends);
highscore.removeEventListener(MouseEvent.CLICK, urltoHighScore);
moregames.removeEventListener(MouseEvent.CLICK, urltoMoreGames);
}
private function onNormalClick(_arg1:MouseEvent){
Normal.gotoAndStop(2);
Hard.gotoAndStop(1);
Impassible.gotoAndStop(1);
levelLen = 30;
}
}
}//package com.wefiends.sorterbob
Section 22
//orangeWidget (com.wefiends.sorterbob.orangeWidget)
package com.wefiends.sorterbob {
import flash.display.*;
public class orangeWidget extends Widget {
public function orangeWidget(_arg1:Stage=null, _arg2:Claw=null, _arg3:Number=1){
super(_arg1, _arg2, _arg3);
}
override public function init():void{
this.alpha = 0;
super.init();
}
}
}//package com.wefiends.sorterbob
Section 23
//Pattern (com.wefiends.sorterbob.Pattern)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class Pattern extends MovieClip {
var scorekeeper:scoreKeeper;
var patterns:Array;
var readyForNextPattern;// = false
var widgetCount:int;// = 0
var widgetArray:Array;
var level:int;
var testingNumber:int;
var patternArray:Array;
var widgets:Array;
var patternSize:int;// = 2
var firstPattern:Boolean;// = true
var generator:Generator;
var frameCounter:int;// = 0
var currentPattern:Array;
protected var patternchan:SoundChannel;
public function Pattern(_arg1:Generator, _arg2:int, _arg3:scoreKeeper){
widgetCount = 0;
patternSize = 2;
readyForNextPattern = false;
patternArray = new Array();
patterns = new Array();
firstPattern = true;
frameCounter = 0;
widgets = new Array();
patternchan = new SoundChannel();
super();
this.widgetArray = widgetArray;
this.generator = _arg1;
this.level = _arg2;
this.scorekeeper = _arg3;
init();
}
function removeOldPattern(){
var _local1:SoundTransform;
var _local2:PatternComplete;
var _local3:int;
_local1 = new SoundTransform();
_local2 = new PatternComplete();
_local1.volume = 1;
patternchan = _local2.play(0, 1);
patternchan.soundTransform = _local1;
_local3 = 0;
while (_local3 < widgets.length) {
removeChild(widgets[_local3]);
_local3++;
};
scorekeeper.patternMatched();
widgets = new Array();
currentPattern = new Array();
drawPattern();
}
function init():void{
generator.addEventListener(Generator.CREATED, countWidgets);
setPatternSize();
this.alpha = 0;
}
function resetPattern():void{
var _local1:int;
testingNumber = 0;
_local1 = 0;
while (_local1 < widgets.length) {
widgets[_local1].alpha = 0.5;
_local1++;
};
}
function generatePattern():void{
patternArray = shuffleArray(patternArray);
patterns.push(patternArray.concat());
patternArray = new Array();
if (patterns.length > 1){
if (firstPattern){
drawPattern();
};
};
}
public function patternTest(_arg1:String):void{
if (firstPattern == false){
if (_arg1 == currentPattern[testingNumber]){
widgets[testingNumber].alpha = 1;
testingNumber++;
if (testingNumber >= currentPattern.length){
testingNumber = 0;
removeOldPattern();
};
} else {
resetPattern();
};
};
}
function countWidgets(_arg1:Event):void{
widgetCount++;
patternArray.push(generator.lastWidgetName);
if (widgetCount > patternSize){
widgetCount = 0;
generatePattern();
};
}
function drawPattern():void{
var _local1:int;
var _local2:*;
var _local3:int;
var _local4:String;
var _local5:redWidgetPattern;
var _local6:greenWidgetPattern;
var _local7:orangeWidgetPattern;
var _local8:blueWidgetPattern;
var _local9:yellowWidgetPattern;
var _local10:purpleWidgetPattern;
firstPattern = false;
currentPattern = patterns.pop();
_local1 = 0;
_local2 = 0.85;
_local3 = 0;
while (_local3 < currentPattern.length) {
_local4 = currentPattern[_local3];
if (_local4 == "red"){
_local5 = new redWidgetPattern();
_local5.x = _local1;
_local5.y = 0;
_local5.scaleX = _local2;
_local5.scaleY = _local2;
addChild(_local5);
widgets.push(_local5);
} else {
if (_local4 == "green"){
_local6 = new greenWidgetPattern();
_local6.x = _local1;
_local6.y = 0;
_local6.scaleX = _local2;
_local6.scaleY = _local2;
addChild(_local6);
widgets.push(_local6);
} else {
if (_local4 == "orange"){
_local7 = new orangeWidgetPattern();
_local7.x = _local1;
_local7.y = 0;
_local7.scaleX = _local2;
_local7.scaleY = _local2;
addChild(_local7);
widgets.push(_local7);
} else {
if (_local4 == "blue"){
_local8 = new blueWidgetPattern();
_local8.x = _local1;
_local8.y = 0;
_local8.scaleX = _local2;
_local8.scaleY = _local2;
addChild(_local8);
widgets.push(_local8);
} else {
if (_local4 == "yellow"){
_local9 = new yellowWidgetPattern();
_local9.x = _local1;
_local9.y = 0;
_local9.scaleX = _local2;
_local9.scaleY = _local2;
addChild(_local9);
widgets.push(_local9);
} else {
if (_local4 == "purple"){
_local10 = new purpleWidgetPattern();
_local10.x = _local1;
_local10.y = 0;
_local10.scaleX = _local2;
_local10.scaleY = _local2;
addChild(_local10);
widgets.push(_local10);
};
};
};
};
};
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
_local1 = (_local1 + 50);
_local3++;
};
this.x = ((300 - (this.width / 2)) + 18);
this.y = 32;
}
function onEnterFrame(_arg1:Event){
var _local2:int;
if (frameCounter < 20){
if (this.alpha < 1){
this.alpha = (this.alpha + 0.15);
} else {
frameCounter++;
};
} else {
if (widgets[0].alpha > 0.5){
_local2 = 0;
while (_local2 < widgets.length) {
widgets[_local2].alpha = (widgets[_local2].alpha - 0.15);
_local2++;
};
} else {
testingNumber = 0;
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
};
}
function shuffleArray(_arg1:Array):Array{
var _local2:int;
var _local3:*;
var _local4:int;
var _local5:int;
_local2 = _arg1.length;
_local4 = _local2;
while (_local4--) {
_local5 = Math.floor((Math.random() * _local2));
_local3 = _arg1[_local4];
_arg1[_local4] = _arg1[_local5];
_arg1[_local5] = _local3;
};
return (_arg1);
}
function setPatternSize():void{
if (level > 4){
patternSize = 3;
} else {
if (level > 9){
patternSize = 4;
} else {
if (level > 14){
patternSize = 4;
} else {
if (level > 20){
patternSize = 5;
};
};
};
};
}
}
}//package com.wefiends.sorterbob
Section 24
//percentageScreen (com.wefiends.sorterbob.percentageScreen)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class percentageScreen extends MovieClip {
protected var totalScoreBackFormat:TextFormat;
protected var totalScoreFormat:TextFormat;
protected var baseScore:TextField;
protected var threshold:int;
protected var bonusScoreFormat:TextFormat;
protected var baseScoreFormat:TextFormat;
protected var run:int;// = 1
protected var globalScore:int;
protected var bonusScore:TextField;
protected var totalScore:TextField;
protected var totalScoreBack:TextField;
protected var onLevel:int;
public function percentageScreen(_arg1:int, _arg2:int, _arg3:int):void{
baseScore = new TextField();
baseScoreFormat = new TextFormat();
bonusScore = new TextField();
bonusScoreFormat = new TextFormat();
totalScore = new TextField();
totalScoreFormat = new TextFormat();
totalScoreBack = new TextField();
totalScoreBackFormat = new TextFormat();
run = 1;
super();
this.onLevel = _arg1;
this.threshold = _arg2;
this.globalScore = _arg3;
init();
}
protected function init(){
var _local1:*;
_local1 = new sorterBackground();
_local1.alpha = 0.2;
_local1.x = -4;
addChild(_local1);
baseScoreFormat.color = 0;
baseScoreFormat.size = 100;
baseScoreFormat.font = "Kabel LT Std Book";
baseScoreFormat.align = TextFormatAlign.CENTER;
baseScore.type = TextFieldType.DYNAMIC;
baseScore.selectable = false;
baseScore.defaultTextFormat = baseScoreFormat;
baseScore.x = 125;
baseScore.y = 125;
baseScore.alpha = 0;
baseScore.width = 350;
baseScore.embedFonts = true;
baseScore.text = ("Level " + (onLevel + 1));
addChild(baseScore);
bonusScoreFormat.color = 0;
bonusScoreFormat.size = 42;
bonusScoreFormat.font = "Kabel LT Std Book";
bonusScoreFormat.align = TextFormatAlign.CENTER;
bonusScore.type = TextFieldType.DYNAMIC;
bonusScore.selectable = false;
bonusScore.defaultTextFormat = bonusScoreFormat;
bonusScore.x = 175;
bonusScore.y = 240;
bonusScore.alpha = 0;
bonusScore.width = 250;
bonusScore.height = 150;
bonusScore.embedFonts = true;
bonusScore.text = ((("Need " + threshold) + "%\n") + "to pass");
totalScoreFormat.color = 0;
totalScoreFormat.size = 36;
totalScoreFormat.font = "Kabel LT Std Book";
totalScoreFormat.align = TextFormatAlign.CENTER;
totalScore.type = TextFieldType.DYNAMIC;
totalScore.selectable = false;
totalScore.defaultTextFormat = totalScoreFormat;
totalScore.x = 175;
totalScore.y = 50;
totalScore.alpha = 1;
totalScore.width = 250;
totalScore.embedFonts = true;
totalScore.text = globalScore.toString();
totalScoreBackFormat.color = 0;
totalScoreBackFormat.size = 22;
totalScoreBackFormat.font = "Kabel LT Std Book";
totalScoreBackFormat.align = TextFormatAlign.CENTER;
totalScoreBack.type = TextFieldType.DYNAMIC;
totalScoreBack.selectable = false;
totalScoreBack.defaultTextFormat = totalScoreBackFormat;
totalScoreBack.x = 175;
totalScoreBack.y = 30;
totalScoreBack.alpha = 0.2;
totalScoreBack.width = 250;
totalScoreBack.embedFonts = true;
totalScoreBack.text = "Total Score";
addChild(baseScore);
addChild(bonusScore);
addChild(totalScore);
addChild(totalScoreBack);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function onEnterFrame(_arg1:Event){
if (run == 1){
if (baseScore.alpha < 1){
baseScore.alpha = (baseScore.alpha + 0.05);
} else {
run++;
};
};
if (run == 2){
if (bonusScore.alpha < 1){
bonusScore.alpha = (bonusScore.alpha + 0.1);
} else {
run++;
};
};
if ((((run < 100)) && ((run > 2)))){
run++;
};
if (run == 100){
if (this.alpha > 0){
this.alpha = (this.alpha - 0.1);
} else {
dispatchEvent(new Event("scoredone"));
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
};
}
}
}//package com.wefiends.sorterbob
Section 25
//Pipe (com.wefiends.sorterbob.Pipe)
package com.wefiends.sorterbob {
import flash.display.*;
public class Pipe extends MovieClip {
protected var pipeType:String;
protected var xoffset:int;
protected var yoffset:int;
public function Pipe(_arg1:String){
this.pipeType = _arg1;
init();
}
private function init():void{
var _local1:redPipe;
var _local2:greenPipe;
var _local3:orangePipe;
var _local4:bluePipe;
var _local5:yellowPipe;
var _local6:purplePipe;
this.x = -75;
this.y = 40;
if (pipeType == "red"){
_local1 = new redPipe();
addChild(_local1);
_local1.scaleX = 1.2;
_local1.scaleY = 1.2;
} else {
if (pipeType == "green"){
_local2 = new greenPipe();
addChild(_local2);
_local2.scaleX = 1.2;
_local2.scaleY = 1.2;
} else {
if (pipeType == "orange"){
_local3 = new orangePipe();
addChild(_local3);
_local3.scaleX = 1.2;
_local3.scaleY = 1.2;
} else {
if (pipeType == "blue"){
_local4 = new bluePipe();
addChild(_local4);
_local4.scaleX = 1.2;
_local4.scaleY = 1.2;
} else {
if (pipeType == "yellow"){
_local5 = new yellowPipe();
addChild(_local5);
_local5.scaleX = 1.2;
_local5.scaleY = 1.2;
} else {
if (pipeType == "purple"){
_local6 = new purplePipe();
addChild(_local6);
_local6.scaleX = 1.2;
_local6.scaleY = 1.2;
};
};
};
};
};
};
}
public function get type():String{
return (pipeType);
}
}
}//package com.wefiends.sorterbob
Section 26
//pipeGenerator (com.wefiends.sorterbob.pipeGenerator)
package com.wefiends.sorterbob {
import flash.display.*;
public class pipeGenerator extends MovieClip {
var onWidget:int;// = 0
var claw:Claw;
var pipeArray:Array;
var widgetVariety:int;
var mainstage:Stage;
public function pipeGenerator(_arg1:Stage, _arg2:Array, _arg3:Claw, _arg4:int){
onWidget = 0;
super();
this.mainstage = _arg1;
this.pipeArray = _arg2;
this.claw = _arg3;
this.widgetVariety = _arg4;
init();
}
function init(){
var _local1:Pipe;
var _local2:Pipe;
var _local3:Pipe;
var _local4:Pipe;
var _local5:Pipe;
var _local6:Pipe;
if (widgetVariety > 0){
_local1 = new Pipe("red");
pipeArray.push(_local1);
addChild(_local1);
};
if (widgetVariety > 1){
_local2 = new Pipe("green");
_local2.x = 490;
pipeArray.push(_local2);
addChild(_local2);
};
if (widgetVariety > 2){
_local3 = new Pipe("orange");
_local3.y = 120;
pipeArray.push(_local3);
addChild(_local3);
};
if (widgetVariety > 3){
_local4 = new Pipe("blue");
_local4.x = 490;
_local4.y = 120;
pipeArray.push(_local4);
addChild(_local4);
};
if (widgetVariety > 4){
_local5 = new Pipe("yellow");
_local5.y = 200;
pipeArray.push(_local5);
addChild(_local5);
};
if (widgetVariety > 5){
_local6 = new Pipe("purple");
_local6.x = 490;
_local6.y = 200;
pipeArray.push(_local6);
addChild(_local6);
};
}
}
}//package com.wefiends.sorterbob
Section 27
//purpleWidget (com.wefiends.sorterbob.purpleWidget)
package com.wefiends.sorterbob {
import flash.display.*;
public class purpleWidget extends Widget {
public function purpleWidget(_arg1:Stage=null, _arg2:Claw=null, _arg3:Number=1){
super(_arg1, _arg2, _arg3);
}
override public function init():void{
this.alpha = 0;
super.init();
}
}
}//package com.wefiends.sorterbob
Section 28
//redWidget (com.wefiends.sorterbob.redWidget)
package com.wefiends.sorterbob {
import flash.display.*;
public class redWidget extends Widget {
public function redWidget(_arg1:Stage=null, _arg2:Claw=null, _arg3:Number=1){
super(_arg1, _arg2, _arg3);
}
override public function init():void{
this.alpha = 0;
super.init();
}
}
}//package com.wefiends.sorterbob
Section 29
//scoreKeeper (com.wefiends.sorterbob.scoreKeeper)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.text.*;
public class scoreKeeper extends Sprite {
protected var widgetPercentage:TextField;
protected var widgetRatioTextFormat:TextFormat;
protected var widgetPercentageTextFormat:TextFormat;
protected var widgetRatio:TextField;
protected var widgetTime:TextField;
protected var numberCreated:int;// = 0
protected var widgetTotal:int;
protected var threshold:int;
protected var widgetTimeTextFormat:TextFormat;
protected var timeRemain:int;
public var percentage:int;// = 0
public var numberPiped:int;// = 0
protected var patternsMatched:int;// = 0
protected var time:int;
protected var tester:Tester;
protected var generator:Generator;
protected var countchan:SoundChannel;
protected var currentTime:int;
public function scoreKeeper(_arg1:Tester, _arg2:Generator, _arg3:int, _arg4:int, _arg5:int):void{
widgetRatio = new TextField();
widgetPercentage = new TextField();
widgetTime = new TextField();
widgetRatioTextFormat = new TextFormat();
widgetPercentageTextFormat = new TextFormat();
widgetTimeTextFormat = new TextFormat();
numberPiped = 0;
numberCreated = 0;
percentage = 0;
countchan = new SoundChannel();
patternsMatched = 0;
super();
this.tester = _arg1;
this.generator = _arg2;
this.threshold = _arg3;
this.widgetTotal = _arg5;
this.time = _arg4;
init();
}
protected function addCreated(_arg1:Event){
numberCreated++;
percentage = int(((numberPiped / numberCreated) * 100));
widgetRatio.text = ((numberPiped + "/") + numberCreated);
if (percentage >= threshold){
widgetPercentageTextFormat.color = 0xCC00;
widgetPercentage.defaultTextFormat = widgetPercentageTextFormat;
} else {
widgetPercentageTextFormat.color = 0xFF0000;
widgetPercentage.defaultTextFormat = widgetPercentageTextFormat;
};
widgetPercentage.text = (percentage + "%");
}
protected function init(){
widgetRatioTextFormat.color = 0;
widgetRatioTextFormat.size = 24;
widgetRatioTextFormat.font = "Kabel LT Std Book";
widgetRatioTextFormat.align = TextFormatAlign.RIGHT;
widgetPercentageTextFormat.color = 0xFF0000;
widgetPercentageTextFormat.size = 50;
widgetPercentageTextFormat.font = "Kabel LT Std Book";
widgetPercentageTextFormat.align = TextFormatAlign.RIGHT;
widgetTimeTextFormat.color = 0;
widgetTimeTextFormat.size = 50;
widgetTimeTextFormat.font = "Kabel LT Std Book";
widgetTimeTextFormat.align = TextFormatAlign.CENTER;
widgetRatio.type = TextFieldType.DYNAMIC;
widgetRatio.selectable = false;
widgetRatio.defaultTextFormat = widgetRatioTextFormat;
widgetRatio.x = 490;
widgetRatio.y = 370;
widgetRatio.width = 100;
widgetRatio.text = "0/0";
widgetRatio.embedFonts = true;
widgetPercentage.type = TextFieldType.DYNAMIC;
widgetPercentage.selectable = false;
widgetPercentage.defaultTextFormat = widgetPercentageTextFormat;
widgetPercentage.x = 490;
widgetPercentage.y = 400;
widgetPercentage.width = 100;
widgetPercentage.text = "0%";
widgetPercentage.embedFonts = true;
widgetTime.type = TextFieldType.DYNAMIC;
widgetTime.selectable = false;
widgetTime.defaultTextFormat = widgetTimeTextFormat;
widgetTime.x = 250;
widgetTime.y = 400;
widgetTime.width = 100;
widgetTime.text = time.toString();
widgetTime.embedFonts = true;
addChild(widgetPercentage);
addChild(widgetTime);
tester.addEventListener(Tester.PIPED, addPiped);
generator.addEventListener(Generator.CREATED, addCreated);
}
public function removeEnterFrame(){
tester.removeEventListener(Tester.PIPED, addPiped);
generator.removeEventListener(Generator.CREATED, addCreated);
}
public function score():Array{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:*;
var _local5:int;
var _local6:Array;
if (time == 30){
_local1 = 1;
} else {
if (time == 20){
_local1 = 1.6;
} else {
if (time == 12){
_local1 = 2.2;
} else {
if (time == 10){
_local1 = 3;
} else {
_local1 = 1;
};
};
};
};
_local2 = ((patternsMatched * 0.5) + 1);
if ((percentage / threshold) < 1){
_local3 = int((5000 * (percentage / threshold)));
} else {
_local3 = 5000;
};
_local3 = (_local3 * _local1);
_local3 = (_local3 * _local2);
_local4 = 0;
if (percentage != threshold){
if ((percentage / threshold) > 1){
_local4 = (150 * (percentage - threshold));
};
} else {
_local4 = 0;
};
_local5 = (_local3 + _local4);
_local6 = [percentage, threshold, _local3, _local4, _local5, patternsMatched, _local2];
return (_local6);
}
public function second(){
var _local1:SoundTransform;
var _local2:Countdown;
currentTime++;
timeRemain = (time - currentTime);
if (timeRemain < 4){
widgetTimeTextFormat.color = 16724787;
widgetTime.defaultTextFormat = widgetTimeTextFormat;
};
if (timeRemain == 3){
_local1 = new SoundTransform();
_local2 = new Countdown();
_local1.volume = 0.4;
countchan = _local2.play(0, 1);
countchan.soundTransform = _local1;
};
widgetTime.text = timeRemain.toString();
}
protected function addPiped(_arg1:Event){
numberPiped++;
percentage = int(((numberPiped / numberCreated) * 100));
widgetRatio.text = ((numberPiped + "/") + numberCreated);
if (percentage >= threshold){
widgetPercentageTextFormat.color = 0xCC00;
widgetPercentage.defaultTextFormat = widgetPercentageTextFormat;
} else {
widgetPercentageTextFormat.color = 0xFF0000;
widgetPercentage.defaultTextFormat = widgetPercentageTextFormat;
};
widgetPercentage.text = (percentage + "%");
}
public function patternMatched():void{
patternsMatched++;
}
}
}//package com.wefiends.sorterbob
Section 30
//scoreScreen (com.wefiends.sorterbob.scoreScreen)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class scoreScreen extends MovieClip {
protected var totalScoreBackFormat:TextFormat;
protected var totalScoreFormat:TextFormat;
protected var baseScore:TextField;
protected var initScore:int;// = 0
protected var bonusScoreFormat:TextFormat;
protected var multiplierText:TextField;
protected var baseScoreFormat:TextFormat;
protected var run:int;// = 1
protected var globalScore:int;
protected var bonusScore:TextField;
protected var totalScore:TextField;
protected var globalMinus:int;
protected var multiplierFormat:TextFormat;
protected var totalScoreBack:TextField;
protected var scoreArray:Array;
public function scoreScreen(_arg1:Array, _arg2:int):void{
baseScore = new TextField();
baseScoreFormat = new TextFormat();
bonusScore = new TextField();
bonusScoreFormat = new TextFormat();
totalScore = new TextField();
totalScoreFormat = new TextFormat();
totalScoreBack = new TextField();
totalScoreBackFormat = new TextFormat();
multiplierFormat = new TextFormat();
multiplierText = new TextField();
run = 1;
initScore = 0;
super();
this.scoreArray = _arg1;
this.globalScore = _arg2;
init();
}
protected function init(){
var _local1:*;
_local1 = new sorterBackground();
_local1.alpha = 0.2;
_local1.x = -4;
addChild(_local1);
baseScoreFormat.color = 0;
baseScoreFormat.size = 96;
baseScoreFormat.font = "Kabel LT Std Book";
baseScoreFormat.align = TextFormatAlign.CENTER;
baseScore.type = TextFieldType.DYNAMIC;
baseScore.selectable = false;
baseScore.defaultTextFormat = baseScoreFormat;
baseScore.x = 175;
baseScore.y = 250;
baseScore.alpha = 0;
baseScore.width = 250;
baseScore.embedFonts = true;
baseScore.text = "0";
addChild(baseScore);
bonusScoreFormat.color = 0;
bonusScoreFormat.size = 36;
bonusScoreFormat.font = "Kabel LT Std Book";
bonusScoreFormat.align = TextFormatAlign.CENTER;
bonusScore.type = TextFieldType.DYNAMIC;
bonusScore.selectable = false;
bonusScore.defaultTextFormat = bonusScoreFormat;
bonusScore.x = 125;
bonusScore.y = 200;
bonusScore.alpha = 0;
bonusScore.width = 350;
bonusScore.height = 225;
bonusScore.embedFonts = true;
bonusScore.text = (((((("Needed " + scoreArray[1]) + "%.\nSorted ") + scoreArray[0]) + "%\n+") + scoreArray[3]) + " bonus");
multiplierFormat.color = 0;
multiplierFormat.size = 52;
multiplierFormat.font = "Kabel LT Std Book";
multiplierFormat.align = TextFormatAlign.CENTER;
totalScore.type = TextFieldType.DYNAMIC;
multiplierText.selectable = false;
multiplierText.defaultTextFormat = multiplierFormat;
multiplierText.x = 125;
multiplierText.y = 315;
multiplierText.alpha = 0;
multiplierText.width = 350;
multiplierText.height = 225;
multiplierText.embedFonts = true;
multiplierText.text = (("x" + scoreArray[6]) + "\nMultipler");
totalScoreFormat.color = 0;
totalScoreFormat.size = 36;
totalScoreFormat.font = "Kabel LT Std Book";
totalScoreFormat.align = TextFormatAlign.CENTER;
totalScore.type = TextFieldType.DYNAMIC;
totalScore.selectable = false;
totalScore.defaultTextFormat = totalScoreFormat;
totalScore.x = 175;
totalScore.y = 50;
totalScore.alpha = 1;
totalScore.width = 250;
totalScore.embedFonts = true;
globalMinus = (globalScore - scoreArray[4]);
totalScore.text = globalMinus.toString();
totalScoreBackFormat.color = 0;
totalScoreBackFormat.size = 22;
totalScoreBackFormat.font = "Kabel LT Std Book";
totalScoreBackFormat.align = TextFormatAlign.CENTER;
totalScoreBack.type = TextFieldType.DYNAMIC;
totalScoreBack.selectable = false;
totalScoreBack.defaultTextFormat = totalScoreBackFormat;
totalScoreBack.x = 175;
totalScoreBack.y = 30;
totalScoreBack.alpha = 0.2;
totalScoreBack.width = 250;
totalScoreBack.embedFonts = true;
totalScoreBack.text = "Total Score";
addChild(baseScore);
addChild(bonusScore);
addChild(totalScore);
addChild(totalScoreBack);
if (scoreArray[6] > 1.1){
addChild(multiplierText);
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function onEnterFrame(_arg1:Event){
if (run == 1){
if (baseScore.alpha < 1){
baseScore.alpha = (baseScore.alpha + 0.1);
};
if (baseScore.y > 100){
baseScore.y = (baseScore.y - 3);
};
if (initScore < scoreArray[2]){
initScore = (initScore + 100);
baseScore.text = initScore.toString();
} else {
baseScore.text = scoreArray[2].toString();
if (baseScore.y <= 100){
run++;
};
};
};
if (run == 2){
if (bonusScore.alpha < 1){
bonusScore.alpha = (bonusScore.alpha + 0.05);
multiplierText.alpha = (multiplierText.alpha + 0.05);
};
if (initScore < scoreArray[4]){
initScore = (initScore + 150);
baseScore.text = initScore.toString();
} else {
if (bonusScore.alpha >= 1){
baseScore.text = scoreArray[4].toString();
run++;
};
};
};
if ((((run < 50)) && ((run > 2)))){
run++;
};
if (run == 50){
if (globalMinus < globalScore){
globalMinus = (globalMinus + 200);
if ((initScore - 200) > 0){
initScore = (initScore - 200);
};
totalScore.text = globalMinus.toString();
baseScore.text = initScore.toString();
} else {
totalScore.text = globalScore.toString();
baseScore.text = "0";
run++;
};
};
if ((((run < 90)) && ((run > 50)))){
run++;
};
if (run == 90){
if (this.alpha > 0){
this.alpha = (this.alpha - 0.1);
} else {
initScore = 0;
bonusScore.alpha = 0;
multiplierText.alpha = 0;
dispatchEvent(new Event("scoredone"));
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
};
}
}
}//package com.wefiends.sorterbob
Section 31
//Segment (com.wefiends.sorterbob.Segment)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.geom.*;
public class Segment extends Sprite {
protected var segmentHeight:int;
protected var segmentWidth:int;
protected var color:uint;
public var vx:Number;// = 0
public var vy:Number;// = 0
protected var halfSegmentHeight:int;
protected var half180:Number;// = 0.00555555555555556
public function Segment(_arg1:int, _arg2:int, _arg3:uint=0xFFFFFF){
half180 = (1 / 180);
vx = 0;
vy = 0;
super();
this.segmentWidth = _arg1;
this.segmentHeight = _arg2;
this.halfSegmentHeight = (_arg2 >> 1);
this.color = _arg3;
init();
}
public function init():void{
graphics.lineStyle();
graphics.beginFill(color);
graphics.drawRoundRect(-(halfSegmentHeight), -(halfSegmentHeight), (segmentWidth + segmentHeight), segmentHeight, segmentHeight, segmentHeight);
graphics.endFill();
graphics.lineStyle(0, 0x666666);
graphics.drawCircle(0, 0, 2);
graphics.drawCircle(segmentWidth, 0, 2);
}
public function getPin():Point{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = ((rotation * Math.PI) * half180);
_local2 = (x + (Math.cos(_local1) * segmentWidth));
_local3 = (y + (Math.sin(_local1) * segmentWidth));
return (new Point(_local2, _local3));
}
}
}//package com.wefiends.sorterbob
Section 32
//Tester (com.wefiends.sorterbob.Tester)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class Tester extends MovieClip {
var dragingWidget:int;
var draging:Boolean;// = false
protected var dingchan:SoundChannel;
var claw:Claw;
var pipeArray:Array;
protected var dingtrans:SoundTransform;
var widgetArray:Array;
var widgetVariety:int;
var pattern:Pattern;
var mainstage:Stage;
public static var PIPED:String = "piped";
public function Tester(_arg1:Stage, _arg2:Array, _arg3:Array, _arg4:Claw, _arg5:int){
draging = false;
dingchan = new SoundChannel();
dingtrans = new SoundTransform();
super();
this.mainstage = _arg1;
this.widgetArray = _arg2;
this.pipeArray = _arg3;
this.claw = _arg4;
this.widgetVariety = _arg5;
init();
}
function init(){
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function removeEnterFrame():void{
var _local1:int;
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeEventListener(MouseEvent.MOUSE_DOWN, changeState);
dragingWidget = 0;
graphics.clear();
_local1 = 0;
while (_local1 < widgetArray.length) {
widgetArray[_local1].removeEnterFrame();
_local1++;
};
}
public function setWidgetPattern(_arg1:Pattern){
this.pattern = _arg1;
}
private function onEnterFrame(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:*;
var _local6:String;
var _local7:C;
var _local8:D;
var _local9:E;
var _local10:F;
var _local11:G;
var _local12:B;
_local2 = 0;
while (_local3 < widgetArray.length) {
if (widgetArray[_local2].y > 525){
widgetArray[_local2].removeEnterFrame();
widgetArray[_local2].parent.removeChild(widgetArray[_local2]);
widgetArray[_local2] = null;
widgetArray.splice(widgetArray[_local2], 1);
dragingWidget--;
break;
};
_local3++;
};
if (!draging){
mainstage.removeEventListener(MouseEvent.CLICK, changeState);
_local3 = 0;
while (_local3 < widgetArray.length) {
if (((widgetArray[_local3].hitTestPoint(claw.getPin().x, claw.getPin().y, true)) || (widgetArray[_local3].hitTestPoint(claw.getPin2().x, claw.getPin2().y, true)))){
dragingWidget = _local3;
mainstage.addEventListener(MouseEvent.MOUSE_DOWN, changeState);
break;
} else {
mainstage.removeEventListener(MouseEvent.MOUSE_DOWN, changeState);
};
_local3++;
};
} else {
if (draging){
_local4 = 0;
while (_local4 < pipeArray.length) {
if (pipeArray[_local4].hitTestPoint(claw.getPin().x, claw.getPin().y, true)){
_local5 = (pipeArray[_local4].height * 0.5);
_local6 = widgetArray[dragingWidget].toString();
if ((((((_local6 == "[object redWidget]")) && ((pipeArray[_local4].type == "red")))) && ((widgetVariety > 0)))){
widgetArray[dragingWidget].y = (pipeArray[_local4].y + _local5);
pipeArray[_local4].alpha = 0.2;
widgetArray[dragingWidget].rotation = 0;
widgetArray[dragingWidget].setState = "piped";
widgetArray[dragingWidget].setPipe = pipeArray[_local4];
widgetArray[dragingWidget] = null;
widgetArray.splice(dragingWidget, 1);
draging = false;
claw.changeColor(0xCCCCCC);
_local7 = new C();
dingtrans.volume = 1;
dingchan = _local7.play(0, 1);
dingchan.soundTransform = dingtrans;
pattern.patternTest("red");
dispatchPipedEvent();
} else {
if ((((((_local6 == "[object greenWidget]")) && ((pipeArray[_local4].type == "green")))) && ((widgetVariety > 1)))){
widgetArray[dragingWidget].y = (pipeArray[_local4].y + _local5);
pipeArray[_local4].alpha = 0.2;
widgetArray[dragingWidget].rotation = 0;
widgetArray[dragingWidget].setState = "pipedright";
widgetArray[dragingWidget].setPipe = pipeArray[_local4];
widgetArray[dragingWidget] = null;
widgetArray.splice(dragingWidget, 1);
draging = false;
claw.changeColor(0xCCCCCC);
_local8 = new D();
dingtrans.volume = 1;
dingchan = _local8.play(0, 1);
dingchan.soundTransform = dingtrans;
pattern.patternTest("green");
dispatchPipedEvent();
} else {
if ((((((_local6 == "[object orangeWidget]")) && ((pipeArray[_local4].type == "orange")))) && ((widgetVariety > 2)))){
widgetArray[dragingWidget].y = (pipeArray[_local4].y + _local5);
pipeArray[_local4].alpha = 0.2;
widgetArray[dragingWidget].rotation = 0;
widgetArray[dragingWidget].setState = "piped";
widgetArray[dragingWidget].setPipe = pipeArray[_local4];
widgetArray[dragingWidget] = null;
widgetArray.splice(dragingWidget, 1);
draging = false;
claw.changeColor(0xCCCCCC);
_local9 = new E();
dingtrans.volume = 1;
dingchan = _local9.play(0, 1);
dingchan.soundTransform = dingtrans;
pattern.patternTest("orange");
dispatchPipedEvent();
} else {
if ((((((_local6 == "[object blueWidget]")) && ((pipeArray[_local4].type == "blue")))) && ((widgetVariety > 3)))){
widgetArray[dragingWidget].y = (pipeArray[_local4].y + _local5);
pipeArray[_local4].alpha = 0.2;
widgetArray[dragingWidget].rotation = 0;
widgetArray[dragingWidget].setState = "pipedright";
widgetArray[dragingWidget].setPipe = pipeArray[_local4];
widgetArray[dragingWidget] = null;
widgetArray.splice(dragingWidget, 1);
draging = false;
claw.changeColor(0xCCCCCC);
_local10 = new F();
dingtrans.volume = 1;
dingchan = _local10.play(0, 1);
dingchan.soundTransform = dingtrans;
pattern.patternTest("blue");
dispatchPipedEvent();
} else {
if ((((((_local6 == "[object yellowWidget]")) && ((pipeArray[_local4].type == "yellow")))) && ((widgetVariety > 4)))){
widgetArray[dragingWidget].y = (pipeArray[_local4].y + _local5);
pipeArray[_local4].alpha = 0.2;
widgetArray[dragingWidget].rotation = 0;
widgetArray[dragingWidget].setState = "piped";
widgetArray[dragingWidget].setPipe = pipeArray[_local4];
widgetArray[dragingWidget] = null;
widgetArray.splice(dragingWidget, 1);
draging = false;
claw.changeColor(0xCCCCCC);
_local11 = new G();
dingtrans.volume = 1;
dingchan = _local11.play(0, 1);
dingchan.soundTransform = dingtrans;
pattern.patternTest("yellow");
dispatchPipedEvent();
} else {
if ((((((_local6 == "[object purpleWidget]")) && ((pipeArray[_local4].type == "purple")))) && ((widgetVariety > 5)))){
widgetArray[dragingWidget].y = (pipeArray[_local4].y + _local5);
pipeArray[_local4].alpha = 0.2;
widgetArray[dragingWidget].rotation = 0;
widgetArray[dragingWidget].setState = "pipedright";
widgetArray[dragingWidget].setPipe = pipeArray[_local4];
widgetArray[dragingWidget] = null;
widgetArray.splice(dragingWidget, 1);
draging = false;
claw.changeColor(0xCCCCCC);
_local12 = new B();
dingtrans.volume = 1;
dingchan = _local12.play(0, 1);
dingchan.soundTransform = dingtrans;
pattern.patternTest("purple");
dispatchPipedEvent();
};
};
};
};
};
};
};
_local4++;
};
};
};
}
private function changeState(_arg1:MouseEvent):void{
var event = _arg1;
draging = !(draging);
if (!draging){
mainstage.removeEventListener(MouseEvent.MOUSE_DOWN, changeState);
try {
widgetArray[dragingWidget].setState = "falling";
} catch(error:TypeError) {
};
claw.changeColor(0xCCCCCC);
widgetArray[dragingWidget] = null;
widgetArray.splice(dragingWidget, 1);
} else {
if (widgetArray.length > 0){
widgetArray[dragingWidget].setState = "dragon";
claw.changeColor(0x666666);
};
};
}
private function dispatchPipedEvent():void{
dispatchEvent(new Event(Tester.PIPED));
}
}
}//package com.wefiends.sorterbob
Section 33
//Widget (com.wefiends.sorterbob.Widget)
package com.wefiends.sorterbob {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class Widget extends MovieClip {
protected var ax:Number;// = 0
protected var claw:Claw;
protected var speed:Number;
protected var widgetState:String;// = "conveyor"
protected var pickupchan:SoundChannel;
protected var mainstage:Stage;
protected var pipedInto:Pipe;
public function Widget(_arg1:Stage, _arg2:Claw, _arg3:Number){
ax = 0;
pickupchan = new SoundChannel();
widgetState = "conveyor";
super();
this.mainstage = _arg1;
this.claw = _arg2;
this.speed = _arg3;
init();
}
public function init():void{
this.x = (Math.round((Math.random() * 50)) + 275);
this.y = 130;
this.scaleX = 0.5;
this.scaleY = 0.5;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function removeEnterFrame():void{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
graphics.clear();
widgetState = "conveyor";
}
public function set setPipe(_arg1:Pipe){
this.pipedInto = _arg1;
}
private function onEnterFrame(_arg1:Event){
if (widgetState == "conveyor"){
if (this.alpha < 1){
this.alpha = (this.alpha + 0.1);
this.y = (this.y + (speed * 0.5));
} else {
this.y = (this.y + speed);
if (this.x >= 300){
this.x = (this.x + 0.2);
} else {
if (this.x < 300){
this.x = (this.x - 0.2);
};
};
this.scaleX = (this.scaleX + 0.0025);
this.scaleY = (this.scaleY + 0.0025);
};
};
if (widgetState == "dragon"){
this.x = claw.getPin().x;
this.y = claw.getPin().y;
this.rotation = claw.rotation;
this.scaleX = 1;
this.scaleY = 1;
};
if (widgetState == "falling"){
this.y = (this.y + 4);
if (this.alpha > 0){
this.alpha = (this.alpha - 0.05);
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
graphics.clear();
parent.removeChild(this);
};
};
if (widgetState == "piped"){
if (ax < 12){
ax = (ax + 0.5);
} else {
ax = 0;
};
this.x = (this.x - ax);
if (this.x < -100){
pipedInto.alpha = 1;
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
graphics.clear();
parent.removeChild(this);
};
};
if (widgetState == "pipedright"){
if (ax < 12){
ax = (ax + 0.5);
} else {
ax = 0;
};
this.x = (this.x + ax);
if (this.x > 700){
pipedInto.alpha = 1;
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
graphics.clear();
parent.removeChild(this);
};
};
if (widgetState == "pattern"){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
}
public function set setState(_arg1:String){
var _local2:SoundTransform;
var _local3:Pickup;
var _local4:SoundTransform;
var _local5:Drop;
var _local6:SoundTransform;
var _local7:Suck;
this.widgetState = _arg1;
if (widgetState == "dragon"){
_local2 = new SoundTransform();
_local3 = new Pickup();
_local2.volume = 1;
pickupchan = _local3.play(0, 1);
pickupchan.soundTransform = _local2;
} else {
if (widgetState == "falling"){
_local4 = new SoundTransform();
_local5 = new Drop();
_local4.volume = 1;
pickupchan = _local5.play(0, 1);
pickupchan.soundTransform = _local4;
} else {
if ((((widgetState == "piped")) || ((widgetState == "pipedright")))){
_local6 = new SoundTransform();
_local7 = new Suck();
_local6.volume = 0.2;
pickupchan = _local7.play(0, 1);
pickupchan.soundTransform = _local6;
};
};
};
}
}
}//package com.wefiends.sorterbob
Section 34
//winScreen (com.wefiends.sorterbob.winScreen)
package com.wefiends.sorterbob {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
import flash.text.*;
import com.hurlant.util.*;
import com.hurlant.crypto.prng.*;
import flash.net.*;
public class winScreen extends MovieClip {
var win:youWin;
protected var key:String;// = "4C16FDBE4A754A1EAFF7681C68460EB328308D411D9B82344D31EBB6A84E5CB8"
protected var keydata:ByteArray;
protected var globalScore:int;
protected var moregames:TextField;
protected var Name:TextInput;
protected var retryFormat:TextFormat;
protected var onLevel:int;
public function winScreen(_arg1:int, _arg2:int){
win = new youWin();
moregames = new TextField();
retryFormat = new TextFormat();
Name = new TextInput();
key = "4C16FDBE4A754A1EAFF7681C68460EB328308D411D9B82344D31EBB6A84E5CB8";
super();
this.globalScore = _arg1;
this.onLevel = (_arg2 + 1);
init();
}
protected function init():void{
win.x = 165;
win.y = 170;
addChild(win);
createNameInput();
retryFormat.color = 0;
retryFormat.size = 36;
retryFormat.font = "Kabel LT Std Book";
retryFormat.align = TextFormatAlign.CENTER;
moregames.type = TextFieldType.DYNAMIC;
moregames.selectable = false;
moregames.defaultTextFormat = retryFormat;
moregames.x = 265;
moregames.y = 150;
moregames.alpha = 1;
moregames.width = 250;
moregames.height = 42;
moregames.embedFonts = true;
moregames.text = "We Fiends\nGames";
addChild(moregames);
moregames.addEventListener(MouseEvent.MOUSE_OVER, onOver2);
moregames.addEventListener(MouseEvent.MOUSE_OUT, onOut2);
moregames.addEventListener(MouseEvent.CLICK, urltoMoreGames);
}
protected function onOut2(_arg1:MouseEvent){
retryFormat.color = 0;
moregames.defaultTextFormat = retryFormat;
moregames.text = "We Fiends\nGames";
}
protected function onOver2(_arg1:MouseEvent){
retryFormat.color = 16724787;
moregames.defaultTextFormat = retryFormat;
moregames.text = "We Fiends\nGames";
}
protected function submitScore2(_arg1:MouseEvent){
var _local2:*;
var _local3:URLVariables;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:URLRequest;
_local2 = getTimer();
_local2 = int((_local2 / 1000));
_local3 = new URLVariables();
keydata = Hex.toArray(Hex.fromString(key));
_local4 = new ARC4(keydata);
_local5 = ((((((((Name.text + ";") + globalScore.toString()) + ";") + loaderInfo.url) + ";") + onLevel) + ";") + _local2);
_local6 = Hex.toArray(Hex.fromString(_local5));
_local4.encrypt(_local6);
_local3.gamedata = Hex.fromArray(_local6);
_local7 = new URLRequest();
_local7.url = "http://www.wefiends.com/games/sorterbob/scoreboard/submit/";
_local7.method = "GET";
_local7.data = _local3;
navigateToURL(_local7, "_blank");
}
protected function createNameInput(){
var nameFormat:TextFormat;
var submitTextField:TextField;
var onOver3:Function;
var onOut3:Function;
onOver3 = function (_arg1:MouseEvent){
nameFormat.color = 16724787;
submitTextField.defaultTextFormat = nameFormat;
submitTextField.text = "Submit your score";
};
onOut3 = function (_arg1:MouseEvent){
nameFormat.color = 0;
submitTextField.defaultTextFormat = nameFormat;
submitTextField.text = "Submit your score";
};
nameFormat = new TextFormat();
nameFormat.color = 0;
nameFormat.size = 28;
nameFormat.font = "Kabel LT Std Book";
nameFormat.align = TextFormatAlign.CENTER;
Name.x = 265;
Name.y = 225;
Name.height = 28;
Name.width = 250;
Name.setStyle("embedFonts", true);
Name.setStyle("textFormat", nameFormat);
Name.maxChars = 25;
Name.text = "Your Name";
addChild(Name);
Name.addEventListener(ComponentEvent.ENTER, submitScore);
submitTextField = new TextField();
submitTextField.selectable = false;
submitTextField.embedFonts = true;
submitTextField.defaultTextFormat = nameFormat;
submitTextField.width = 250;
submitTextField.x = 265;
submitTextField.y = 260;
submitTextField.text = "Submit your score";
addChild(submitTextField);
submitTextField.addEventListener(MouseEvent.CLICK, submitScore2);
submitTextField.addEventListener(MouseEvent.MOUSE_OVER, onOver3);
submitTextField.addEventListener(MouseEvent.MOUSE_OUT, onOut3);
}
protected function submitScore(_arg1:ComponentEvent){
var _local2:*;
var _local3:URLVariables;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:URLRequest;
_local2 = getTimer();
_local2 = int((_local2 / 1000));
_local3 = new URLVariables();
keydata = Hex.toArray(Hex.fromString(key));
_local4 = new ARC4(keydata);
_local5 = ((((((((Name.text + ";") + globalScore.toString()) + ";") + loaderInfo.url) + ";") + onLevel) + ";") + _local2);
_local6 = Hex.toArray(Hex.fromString(_local5));
_local4.encrypt(_local6);
_local3.gamedata = Hex.fromArray(_local6);
_local7 = new URLRequest();
_local7.url = "http://www.wefiends.com/games/sorterbob/scoreboard/submit/";
_local7.method = "GET";
_local7.data = _local3;
navigateToURL(_local7, "_blank");
}
private function urltoMoreGames(_arg1:MouseEvent):void{
NewgroundsAPI.loadCustomLink("We Fiends Games");
}
}
}//package com.wefiends.sorterbob
Section 35
//yellowWidget (com.wefiends.sorterbob.yellowWidget)
package com.wefiends.sorterbob {
import flash.display.*;
public class yellowWidget extends Widget {
public function yellowWidget(_arg1:Stage=null, _arg2:Claw=null, _arg3:Number=1){
super(_arg1, _arg2, _arg3);
}
override public function init():void{
this.alpha = 0;
super.init();
}
}
}//package com.wefiends.sorterbob
Section 36
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 37
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 38
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 39
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 40
//TextInput (fl.controls.TextInput)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 41
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 42
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 43
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 44
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 45
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 46
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 47
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 48
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 49
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 50
//NG_TANK_3 (sorterbob_fla.NG_TANK_3)
package sorterbob_fla {
import flash.display.*;
import flash.events.*;
public dynamic class NG_TANK_3 extends MovieClip {
public var NG_Logo:SimpleButton;
public function NG_TANK_3(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
function frame1(){
NG_Logo.addEventListener(MouseEvent.CLICK, loadNGSite);
}
}
}//package sorterbob_fla
Section 51
//Symbol2_20 (sorterbob_fla.Symbol2_20)
package sorterbob_fla {
import flash.display.*;
public dynamic class Symbol2_20 extends MovieClip {
public function Symbol2_20(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package sorterbob_fla
Section 52
//WeFiendsIntroAnimation_47 (sorterbob_fla.WeFiendsIntroAnimation_47)
package sorterbob_fla {
import flash.display.*;
import flash.events.*;
public dynamic class WeFiendsIntroAnimation_47 extends MovieClip {
public function WeFiendsIntroAnimation_47(){
addFrameScript(0, frame1, 196, frame197);
}
function frame1(){
stop();
}
function frame197(){
stop();
dispatchEvent(new Event("introdone"));
}
}
}//package sorterbob_fla
Section 53
//B (B)
package {
import flash.media.*;
public dynamic class B extends Sound {
}
}//package
Section 54
//backPipe (backPipe)
package {
import flash.display.*;
public dynamic class backPipe extends MovieClip {
}
}//package
Section 55
//Begin (Begin)
package {
import flash.display.*;
public dynamic class Begin extends SimpleButton {
}
}//package
Section 56
//belt (belt)
package {
import flash.media.*;
public dynamic class belt extends Sound {
}
}//package
Section 57
//bluePipe (bluePipe)
package {
import flash.display.*;
public dynamic class bluePipe extends MovieClip {
}
}//package
Section 58
//blueWidgetPattern (blueWidgetPattern)
package {
import flash.display.*;
public dynamic class blueWidgetPattern extends MovieClip {
}
}//package
Section 59
//C (C)
package {
import flash.media.*;
public dynamic class C extends Sound {
}
}//package
Section 60
//ConveyorBelt (ConveyorBelt)
package {
import flash.display.*;
public dynamic class ConveyorBelt extends MovieClip {
}
}//package
Section 61
//ConveyorBeltSlow (ConveyorBeltSlow)
package {
import flash.display.*;
public dynamic class ConveyorBeltSlow extends MovieClip {
}
}//package
Section 62
//Countdown (Countdown)
package {
import flash.media.*;
public dynamic class Countdown extends Sound {
}
}//package
Section 63
//D (D)
package {
import flash.media.*;
public dynamic class D extends Sound {
}
}//package
Section 64
//Drop (Drop)
package {
import flash.media.*;
public dynamic class Drop extends Sound {
}
}//package
Section 65
//E (E)
package {
import flash.media.*;
public dynamic class E extends Sound {
}
}//package
Section 66
//F (F)
package {
import flash.media.*;
public dynamic class F extends Sound {
}
}//package
Section 67
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 68
//G (G)
package {
import flash.media.*;
public dynamic class G extends Sound {
}
}//package
Section 69
//greenPipe (greenPipe)
package {
import flash.display.*;
public dynamic class greenPipe extends MovieClip {
}
}//package
Section 70
//greenWidgetPattern (greenWidgetPattern)
package {
import flash.display.*;
public dynamic class greenWidgetPattern extends MovieClip {
}
}//package
Section 71
//hard (hard)
package {
import flash.display.*;
public dynamic class hard extends MovieClip {
}
}//package
Section 72
//Highscore (Highscore)
package {
import flash.display.*;
public dynamic class Highscore extends SimpleButton {
}
}//package
Section 73
//impassible (impassible)
package {
import flash.display.*;
public dynamic class impassible extends MovieClip {
}
}//package
Section 74
//Instructions (Instructions)
package {
import flash.display.*;
public dynamic class Instructions extends MovieClip {
}
}//package
Section 75
//Instructions2 (Instructions2)
package {
import flash.display.*;
public dynamic class Instructions2 extends MovieClip {
}
}//package
Section 76
//Intro (Intro)
package {
import flash.display.*;
public dynamic class Intro extends MovieClip {
public var introstuff:MovieClip;
}
}//package
Section 77
//Kabel (Kabel)
package {
import flash.text.*;
public dynamic class Kabel extends Font {
}
}//package
Section 78
//MenuAnimation (MenuAnimation)
package {
import flash.display.*;
import com.wefiends.sorterbob.*;
public dynamic class MenuAnimation extends MovieClip {
public var menu:Menu;
public function MenuAnimation(){
addFrameScript(81, frame82);
}
function frame82(){
stop();
}
}
}//package
Section 79
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 80
//MoreGames (MoreGames)
package {
import flash.display.*;
public dynamic class MoreGames extends SimpleButton {
}
}//package
Section 81
//Music (Music)
package {
import flash.media.*;
public dynamic class Music extends Sound {
}
}//package
Section 82
//NewgroundsAPI (NewgroundsAPI)
package {
import flash.display.*;
import flash.events.*;
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){
}
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){
}
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 83
//NG_AD_OBJECT (NG_AD_OBJECT)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class NG_AD_OBJECT extends MovieClip {
public var ng_ad:MovieClip;
public var NG_Button:SimpleButton;
public function NG_AD_OBJECT(){
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
Section 84
//normal (normal)
package {
import flash.display.*;
public dynamic class normal extends MovieClip {
}
}//package
Section 85
//orangePipe (orangePipe)
package {
import flash.display.*;
public dynamic class orangePipe extends MovieClip {
}
}//package
Section 86
//orangeWidgetPattern (orangeWidgetPattern)
package {
import flash.display.*;
public dynamic class orangeWidgetPattern extends MovieClip {
}
}//package
Section 87
//PatternComplete (PatternComplete)
package {
import flash.media.*;
public dynamic class PatternComplete extends Sound {
}
}//package
Section 88
//Pickup (Pickup)
package {
import flash.media.*;
public dynamic class Pickup extends Sound {
}
}//package
Section 89
//purplePipe (purplePipe)
package {
import flash.display.*;
public dynamic class purplePipe extends MovieClip {
}
}//package
Section 90
//purpleWidgetPattern (purpleWidgetPattern)
package {
import flash.display.*;
public dynamic class purpleWidgetPattern extends MovieClip {
}
}//package
Section 91
//redPipe (redPipe)
package {
import flash.display.*;
public dynamic class redPipe extends MovieClip {
}
}//package
Section 92
//redWidgetPattern (redWidgetPattern)
package {
import flash.display.*;
public dynamic class redWidgetPattern extends MovieClip {
}
}//package
Section 93
//sorterBackground (sorterBackground)
package {
import flash.display.*;
public dynamic class sorterBackground extends MovieClip {
}
}//package
Section 94
//Suck (Suck)
package {
import flash.media.*;
public dynamic class Suck extends Sound {
}
}//package
Section 95
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 96
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package
Section 97
//WeFiends (WeFiends)
package {
import flash.display.*;
public dynamic class WeFiends extends SimpleButton {
}
}//package
Section 98
//yellowPipe (yellowPipe)
package {
import flash.display.*;
public dynamic class yellowPipe extends MovieClip {
}
}//package
Section 99
//yellowWidgetPattern (yellowWidgetPattern)
package {
import flash.display.*;
public dynamic class yellowWidgetPattern extends MovieClip {
}
}//package
Section 100
//youWin (youWin)
package {
import flash.display.*;
public dynamic class youWin extends MovieClip {
}
}//package