[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Section 1 (13.87 KiB) ● ●
//CDK (com.coreyoneil.collision.CDK)
package com.coreyoneil.collision {
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.text.*;
import flash.errors.*;
public class CDK {
private var colorTransform2:ColorTransform;
private var colorTransform1:ColorTransform;
private var _returnAngleType:String;
private var pixels1:ByteArray;
private var pixels2:ByteArray;
private var bmdResample:BitmapData;
private var _returnAngle:Boolean;
private var transMatrix2:Matrix;
private var rect1:Rectangle;
private var rect2:Rectangle;
private var transMatrix1:Matrix;
protected var objectCheckArray:Array;
private var _alphaThreshold:Number;
private var item1Registration:Point;
private var bmd1:BitmapData;
private var bmd2:BitmapData;
protected var objectArray:Array;
private var item2Registration:Point;
protected var objectCollisionArray:Array;
private var _numChildren:uint;
private var colorExclusionArray:Array;
public function CDK():void{
if (getQualifiedClassName(this) == "com.coreyoneil.collision::CDK"){
throw (new Error("CDK is an abstract class and is not meant for instantiation - use CollisionGroup or CollisionList"));
};
init();
}
public function get returnAngle():Boolean{
return (_returnAngle);
}
public function set returnAngle(_arg1:Boolean):void{
_returnAngle = _arg1;
}
protected function findCollisions(_arg1, _arg2):void{
var item1xDiff:Number;
var item1yDiff:Number;
var locY:Number;
var locX:Number;
var locStage:Point;
var alpha1:uint;
var alpha2:uint;
var colorFlag:Boolean;
var red1:uint;
var red2:uint;
var green1:uint;
var green2:uint;
var blue1:uint;
var blue2:uint;
var colorObj:Object;
var aPlus:uint;
var aMinus:uint;
var rPlus:uint;
var rMinus:uint;
var gPlus:uint;
var gMinus:uint;
var bPlus:uint;
var bMinus:uint;
var item1Flags:uint;
var item2Flags:uint;
var n:uint;
var angle:Number;
var recordedCollision:Object;
var item1 = _arg1;
var item2 = _arg2;
var item1_isText:Boolean;
var item2_isText:Boolean;
if ((item1 is TextField)){
item1_isText = ((item1.antiAliasType)=="advanced") ? true : false;
item1.antiAliasType = ((item1.antiAliasType)=="advanced") ? "normal" : item1.antiAliasType;
};
if ((item2 is TextField)){
item2_isText = ((item2.antiAliasType)=="advanced") ? true : false;
item2.antiAliasType = ((item2.antiAliasType)=="advanced") ? "normal" : item2.antiAliasType;
};
colorTransform1 = item1.transform.colorTransform;
colorTransform2 = item2.transform.colorTransform;
item1Registration = new Point();
item2Registration = new Point();
item1Registration = item1.localToGlobal(item1Registration);
item2Registration = item2.localToGlobal(item2Registration);
bmd1 = new BitmapData(item1.width, item1.height, true, 0xFFFFFF);
bmd2 = new BitmapData(item1.width, item1.height, true, 0xFFFFFF);
transMatrix1 = item1.transform.matrix;
var currentObj:* = item1;
while (currentObj.parent != null) {
transMatrix1.concat(currentObj.parent.transform.matrix);
currentObj = currentObj.parent;
};
rect1 = item1.getBounds(currentObj);
if (item1 != currentObj){
rect1.x = (rect1.x + currentObj.x);
rect1.y = (rect1.y + currentObj.y);
};
var _local4 = (item1Registration.x - rect1.left);
item1xDiff = _local4;
transMatrix1.tx = _local4;
_local4 = (item1Registration.y - rect1.top);
item1yDiff = _local4;
transMatrix1.ty = _local4;
transMatrix2 = item2.transform.matrix;
currentObj = item2;
while (currentObj.parent != null) {
transMatrix2.concat(currentObj.parent.transform.matrix);
currentObj = currentObj.parent;
};
transMatrix2.tx = (item2Registration.x - rect1.left);
transMatrix2.ty = (item2Registration.y - rect1.top);
bmd1.draw(item1, transMatrix1, colorTransform1, null, null, true);
bmd2.draw(item2, transMatrix2, colorTransform2, null, null, true);
pixels1 = bmd1.getPixels(new Rectangle(0, 0, bmd1.width, bmd1.height));
pixels2 = bmd2.getPixels(new Rectangle(0, 0, bmd1.width, bmd1.height));
var k:uint;
var value1:uint;
var value2:uint;
var collisionPoint:Number = -1;
var overlap:Boolean;
var overlapping:Array = [];
var hasColors:int = colorExclusionArray.length;
pixels1.position = 0;
pixels2.position = 0;
var pixelLength:int = pixels1.length;
while (k < pixelLength) {
k = pixels1.position;
try {
value1 = pixels1.readUnsignedInt();
value2 = pixels2.readUnsignedInt();
} catch(e:EOFError) {
break;
};
alpha1 = ((value1 >> 24) & 0xFF);
alpha2 = ((value2 >> 24) & 0xFF);
if ((((alpha1 > _alphaThreshold)) && ((alpha2 > _alphaThreshold)))){
colorFlag = false;
if (hasColors){
red1 = ((value1 >> 16) & 0xFF);
red2 = ((value2 >> 16) & 0xFF);
green1 = ((value1 >> 8) & 0xFF);
green2 = ((value2 >> 8) & 0xFF);
blue1 = (value1 & 0xFF);
blue2 = (value2 & 0xFF);
n = 0;
while (n < hasColors) {
colorObj = Object(colorExclusionArray[n]);
item1Flags = 0;
item2Flags = 0;
if ((((blue1 >= colorObj.bMinus)) && ((blue1 <= colorObj.bPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((blue2 >= colorObj.bMinus)) && ((blue2 <= colorObj.bPlus)))){
item2Flags = (item2Flags + 1);
};
if ((((green1 >= colorObj.gMinus)) && ((green1 <= colorObj.gPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((green2 >= colorObj.gMinus)) && ((green2 <= colorObj.gPlus)))){
item2Flags = (item2Flags + 1);
};
if ((((red1 >= colorObj.rMinus)) && ((red1 <= colorObj.rPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((red2 >= colorObj.rMinus)) && ((red2 <= colorObj.rPlus)))){
item2Flags = (item2Flags + 1);
};
if ((((alpha1 >= colorObj.aMinus)) && ((alpha1 <= colorObj.aPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((alpha2 >= colorObj.aMinus)) && ((alpha2 <= colorObj.aPlus)))){
item2Flags = (item2Flags + 1);
};
if ((((item1Flags == 4)) || ((item2Flags == 4)))){
colorFlag = true;
};
n = (n + 1);
};
};
if (!colorFlag){
overlap = true;
collisionPoint = (k >> 2);
locY = (collisionPoint / bmd1.width);
locX = (collisionPoint % bmd1.width);
locY = (locY - item1yDiff);
locX = (locX - item1xDiff);
locStage = item1.localToGlobal(new Point(locX, locY));
overlapping.push(locStage);
};
};
};
if (overlap){
angle = (_returnAngle) ? findAngle(item1, item2) : 0;
recordedCollision = {object1:item1, object2:item2, angle:angle, overlapping:overlapping};
objectCollisionArray.push(recordedCollision);
};
if (item1_isText){
item1.antiAliasType = "advanced";
};
if (item2_isText){
item2.antiAliasType = "advanced";
};
_local4 = false;
item2_isText = _local4;
item1_isText = _local4;
}
private function init():void{
objectCheckArray = [];
objectCollisionArray = [];
objectArray = [];
colorExclusionArray = [];
_alphaThreshold = 0;
_returnAngle = true;
_returnAngleType = "RADIANS";
}
public function dispose():void{
objectArray = [];
}
public function excludeColor(_arg1:uint, _arg2:uint=0xFF, _arg3:uint=20, _arg4:uint=20, _arg5:uint=20):void{
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local6:int = colorExclusionArray.length;
var _local7:uint;
while (_local7 < _local6) {
if (colorExclusionArray[_local7].color == _arg1){
throw (new Error((("Color could not be added - color already in the exclusion list [" + _arg1) + "]")));
};
_local7++;
};
_local8 = (((_arg1 >> 24) & 0xFF) + _arg2);
_local9 = (_local8 - (_arg2 << 1));
_local10 = (((_arg1 >> 16) & 0xFF) + _arg3);
_local11 = (_local10 - (_arg3 << 1));
_local12 = (((_arg1 >> 8) & 0xFF) + _arg4);
_local13 = (_local12 - (_arg4 << 1));
_local14 = ((_arg1 & 0xFF) + _arg5);
_local15 = (_local14 - (_arg5 << 1));
var _local16:Object = {color:_arg1, aPlus:_local8, aMinus:_local9, rPlus:_local10, rMinus:_local11, gPlus:_local12, gMinus:_local13, bPlus:_local14, bMinus:_local15};
colorExclusionArray.push(_local16);
}
public function get numChildren():uint{
return (objectArray.length);
}
public function get alphaThreshold():Number{
return (_alphaThreshold);
}
public function removeItem(_arg1):void{
var _local2:int = objectArray.indexOf(_arg1);
if (_local2 > -1){
objectArray.splice(_local2, 1);
} else {
throw (new Error((_arg1 + " could not be removed - object not found in item list.")));
};
}
public function set returnAngleType(_arg1:String):void{
_arg1 = _arg1.toUpperCase();
switch (_arg1){
case "DEGREES":
case "DEGREE":
case "DEG":
case "DEGS":
_returnAngleType = "DEGREES";
break;
case "RADIANS":
case "RADIAN":
case "RAD":
case "RADS":
_returnAngleType = "RADIANS";
break;
default:
throw (new Error("returnAngleType expects 'DEGREES' or 'RADIANS'"));
};
}
private function findAngle(_arg1:DisplayObject, _arg2:DisplayObject):Number{
var pixel:uint;
var thisAlpha:uint;
var lastAlpha:int;
var edgePoint:int;
var k:uint;
var upperLimit:int;
var colorFlag:Boolean;
var red1:uint;
var green1:uint;
var blue1:uint;
var colorObj:Object;
var a:uint;
var r:uint;
var g:uint;
var b:uint;
var item1Flags:uint;
var n:uint;
var item1 = _arg1;
var item2 = _arg2;
var center:Point = new Point((item1.width >> 1), (item1.height >> 1));
var pixels:ByteArray = pixels2;
transMatrix2.tx = (transMatrix2.tx + center.x);
transMatrix2.ty = (transMatrix2.ty + center.y);
bmdResample = new BitmapData((item1.width << 1), (item1.height << 1), true, 0xFFFFFF);
bmdResample.draw(item2, transMatrix2, colorTransform2, null, null, true);
pixels = bmdResample.getPixels(new Rectangle(0, 0, bmdResample.width, bmdResample.height));
center.x = (bmdResample.width >> 1);
center.y = (bmdResample.height >> 1);
var columnHeight:uint = Math.round(bmdResample.height);
var rowWidth:uint = Math.round(bmdResample.width);
var edgeArray:Array = [];
var hasColors:int = colorExclusionArray.length;
var j:uint;
while (j < columnHeight) {
k = ((j * rowWidth) << 2);
pixels.position = k;
lastAlpha = -1;
upperLimit = (((j + 1) * rowWidth) << 2);
while (k < upperLimit) {
k = pixels.position;
try {
pixel = pixels.readUnsignedInt();
} catch(e:EOFError) {
break;
};
thisAlpha = ((pixel >> 24) & 0xFF);
if (lastAlpha == -1){
lastAlpha = thisAlpha;
} else {
if (thisAlpha > _alphaThreshold){
colorFlag = false;
if (hasColors){
red1 = ((pixel >> 16) & 0xFF);
green1 = ((pixel >> 8) & 0xFF);
blue1 = (pixel & 0xFF);
n = 0;
while (n < hasColors) {
colorObj = Object(colorExclusionArray[n]);
item1Flags = 0;
if ((((blue1 >= colorObj.bMinus)) && ((blue1 <= colorObj.bPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((green1 >= colorObj.gMinus)) && ((green1 <= colorObj.gPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((red1 >= colorObj.rMinus)) && ((red1 <= colorObj.rPlus)))){
item1Flags = (item1Flags + 1);
};
if ((((thisAlpha >= colorObj.aMinus)) && ((thisAlpha <= colorObj.aPlus)))){
item1Flags = (item1Flags + 1);
};
if (item1Flags == 4){
colorFlag = true;
};
n = (n + 1);
};
};
if (!colorFlag){
edgeArray.push((k >> 2));
};
};
};
};
j = (j + 1);
};
var numEdges:int = edgeArray.length;
var slopeYAvg:Number = 0;
var slopeXAvg:Number = 0;
j = 0;
while (j < numEdges) {
edgePoint = int(edgeArray[j]);
slopeYAvg = (slopeYAvg + (center.y - (edgePoint / rowWidth)));
slopeXAvg = (slopeXAvg + ((edgePoint % rowWidth) - center.x));
j = (j + 1);
};
var average:Number = -(Math.atan2(slopeYAvg, slopeXAvg));
average = ((_returnAngleType == "RADIANS")) ? average : (average * 57.2957795);
return (average);
}
public function addItem(_arg1):void{
if ((_arg1 is DisplayObject)){
objectArray.push(_arg1);
} else {
throw (new Error((("Cannot add item: " + _arg1) + " - item must be a Display Object.")));
};
}
public function get returnAngleType():String{
return (_returnAngleType);
}
public function set alphaThreshold(_arg1:Number):void{
if ((((_arg1 <= 1)) && ((_arg1 >= 0)))){
_alphaThreshold = (_arg1 * 0xFF);
} else {
throw (new Error("alphaThreshold expects a value from 0 to 1"));
};
}
public function removeExcludeColor(_arg1:uint):void{
var _local2:Boolean;
var _local3:int = colorExclusionArray.length;
var _local4:uint;
while (_local4 < _local3) {
if (colorExclusionArray[_local4].color == _arg1){
colorExclusionArray.splice(_local4, 1);
_local2 = true;
break;
};
_local4++;
};
if (!_local2){
throw (new Error((("Color could not be removed - color not found in exclusion list [" + _arg1) + "]")));
};
}
protected function clearArrays():void{
objectCheckArray = [];
objectCollisionArray = [];
}
}
}//package com.coreyoneil.collision
Section 2 (1.81 KiB) ●
//CollisionList (com.coreyoneil.collision.CollisionList)
package com.coreyoneil.collision {
import flash.display.*;
public class CollisionList extends CDK {
public function CollisionList(_arg1, ... _args):void{
addItem(_arg1);
var _local3:uint;
while (_local3 < _args.length) {
addItem(_args[_local3]);
_local3++;
};
}
public function checkCollisions():Array{
var _local3:DisplayObject;
clearArrays();
var _local1:uint = objectArray.length;
var _local2:* = DisplayObject(objectArray[0]);
var _local4:uint = 1;
while (_local4 < _local1) {
_local3 = DisplayObject(objectArray[_local4]);
if (_local2.hitTestObject(_local3)){
if ((_local3.width * _local3.height) > (_local2.width * _local2.height)){
objectCheckArray.push([_local2, _local3]);
} else {
objectCheckArray.push([_local3, _local2]);
};
};
_local4++;
};
_local1 = objectCheckArray.length;
_local4 = 0;
while (_local4 < _local1) {
findCollisions(DisplayObject(objectCheckArray[_local4][0]), DisplayObject(objectCheckArray[_local4][1]));
_local4++;
};
return (objectCollisionArray);
}
public function swapTarget(_arg1):void{
if ((_arg1 is DisplayObject)){
objectArray[0] = _arg1;
} else {
throw (new Error((("Cannot swap target: " + _arg1) + " - item must be a Display Object.")));
};
}
override public function removeItem(_arg1):void{
var _local2:int = objectArray.indexOf(_arg1);
if (_local2 > 0){
objectArray.splice(_local2, 1);
} else {
if (_local2 == 0){
throw (new Error("You cannot remove the target from CollisionList. Use swapTarget to change the target."));
};
throw (new Error((_arg1 + " could not be removed - object not found in item list.")));
};
}
}
}//package com.coreyoneil.collision
Section 3 (1.04 KiB) ●
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class AdLoader extends Sprite {
private var cpmstarLoader:Loader;
private var contentspotid:String;
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function dispatchHandler(_arg1:Event):void{
dispatchEvent(_arg1);
}
private function addedHandler(_arg1:Event):void{
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
var _local2 = "http://server.cpmstar.com/adviewas3.swf";
var _local3:DisplayObjectContainer = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
}
}//package CPMStar
Section 4 (277 B)
//button_22 (Frustration_fla.button_22)
package Frustration_fla {
import flash.display.*;
public dynamic class button_22 extends MovieClip {
public function button_22(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Frustration_fla
Section 5 (321 B)
//checkpoint_56 (Frustration_fla.checkpoint_56)
package Frustration_fla {
import flash.display.*;
public dynamic class checkpoint_56 extends MovieClip {
public function checkpoint_56(){
addFrameScript(0, frame1);
}
function frame1(){
mainClass(root).curLev.addCP(this);
}
}
}//package Frustration_fla
Section 6 (400 B)
//effectCrash_60 (Frustration_fla.effectCrash_60)
package Frustration_fla {
import flash.display.*;
import main.*;
public dynamic class effectCrash_60 extends MovieClip {
public function effectCrash_60(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
effectObject(parent).dispatchEvent(new FSMEvent(FSMEvent.ONPOSTED, "removeIt"));
}
}
}//package Frustration_fla
Section 7 (412 B)
//effectCrashTXT_63 (Frustration_fla.effectCrashTXT_63)
package Frustration_fla {
import flash.display.*;
import main.*;
public dynamic class effectCrashTXT_63 extends MovieClip {
public function effectCrashTXT_63(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
effectObject(parent).dispatchEvent(new FSMEvent(FSMEvent.ONPOSTED, "removeIt"));
}
}
}//package Frustration_fla
Section 8 (392 B)
//effectWin_62 (Frustration_fla.effectWin_62)
package Frustration_fla {
import flash.display.*;
import main.*;
public dynamic class effectWin_62 extends MovieClip {
public function effectWin_62(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
effectObject(parent).dispatchEvent(new FSMEvent(FSMEvent.ONPOSTED, "removeIt"));
}
}
}//package Frustration_fla
Section 9 (748 B)
//Level11_ColDet02_99 (Frustration_fla.Level11_ColDet02_99)
package Frustration_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Level11_ColDet02_99 extends MovieClip {
public function Level11_ColDet02_99(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.dontStop = true;
}
}
}//package Frustration_fla
Section 10 (977 B)
//Level12_ColDet01_111 (Frustration_fla.Level12_ColDet01_111)
package Frustration_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Level12_ColDet01_111 extends MovieClip {
public var det3:MovieClip;
public var det1:MovieClip;
public var det2:MovieClip;
public function Level12_ColDet01_111(){
addFrameScript(0, frame1, 58, frame59);
}
function frame59(){
stop();
}
function frame1(){
stop();
this.dontStop = true;
det1.scaleX = -1;
det1.scaleY = -1;
det2.rotation = 180;
det3.scaleY = -1;
}
}
}//package Frustration_fla
Section 11 (802 B)
//Level13_ColDet01_102 (Frustration_fla.Level13_ColDet01_102)
package Frustration_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Level13_ColDet01_102 extends MovieClip {
public function Level13_ColDet01_102(){
addFrameScript(0, frame1, 19, frame20);
}
function frame20(){
stop();
}
function frame1(){
stop();
this.dontStop = true;
}
}
}//package Frustration_fla
Section 12 (802 B)
//Level13_ColDet02_103 (Frustration_fla.Level13_ColDet02_103)
package Frustration_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Level13_ColDet02_103 extends MovieClip {
public function Level13_ColDet02_103(){
addFrameScript(0, frame1, 19, frame20);
}
function frame20(){
stop();
}
function frame1(){
stop();
this.dontStop = true;
}
}
}//package Frustration_fla
Section 13 (330 B)
//Level13_ColDet04_108 (Frustration_fla.Level13_ColDet04_108)
package Frustration_fla {
import flash.display.*;
public dynamic class Level13_ColDet04_108 extends MovieClip {
public function Level13_ColDet04_108(){
addFrameScript(0, frame1);
}
function frame1(){
visible = false;
}
}
}//package Frustration_fla
Section 14 (321 B)
//Level15_ColDet01_120 (Frustration_fla.Level15_ColDet01_120)
package Frustration_fla {
import flash.display.*;
public dynamic class Level15_ColDet01_120 extends MovieClip {
public function Level15_ColDet01_120(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Frustration_fla
Section 15 (326 B)
//Level18_ColDet2_129 (Frustration_fla.Level18_ColDet2_129)
package Frustration_fla {
import flash.display.*;
public dynamic class Level18_ColDet2_129 extends MovieClip {
public function Level18_ColDet2_129(){
addFrameScript(0, frame1);
}
function frame1(){
visible = false;
}
}
}//package Frustration_fla
Section 16 (326 B)
//Level18_ColDet3_131 (Frustration_fla.Level18_ColDet3_131)
package Frustration_fla {
import flash.display.*;
public dynamic class Level18_ColDet3_131 extends MovieClip {
public function Level18_ColDet3_131(){
addFrameScript(0, frame1);
}
function frame1(){
visible = false;
}
}
}//package Frustration_fla
Section 17 (313 B)
//Level2_ColDet01_67 (Frustration_fla.Level2_ColDet01_67)
package Frustration_fla {
import flash.display.*;
public dynamic class Level2_ColDet01_67 extends MovieClip {
public function Level2_ColDet01_67(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Frustration_fla
Section 18 (313 B)
//Level3_ColDet01_72 (Frustration_fla.Level3_ColDet01_72)
package Frustration_fla {
import flash.display.*;
public dynamic class Level3_ColDet01_72 extends MovieClip {
public function Level3_ColDet01_72(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Frustration_fla
Section 19 (775 B)
//Level3_ColDet02_70 (Frustration_fla.Level3_ColDet02_70)
package Frustration_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Level3_ColDet02_70 extends MovieClip {
public var block:MovieClip;
public function Level3_ColDet02_70(){
addFrameScript(0, frame1);
}
function frame1(){
this.dontStop = true;
stop();
}
}
}//package Frustration_fla
Section 20 (744 B)
//Level6_ColDet02_83 (Frustration_fla.Level6_ColDet02_83)
package Frustration_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Level6_ColDet02_83 extends MovieClip {
public function Level6_ColDet02_83(){
addFrameScript(0, frame1);
}
function frame1(){
this.dontStop = true;
stop();
}
}
}//package Frustration_fla
Section 21 (744 B)
//Level6_ColDet03_84 (Frustration_fla.Level6_ColDet03_84)
package Frustration_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class Level6_ColDet03_84 extends MovieClip {
public function Level6_ColDet03_84(){
addFrameScript(0, frame1);
}
function frame1(){
this.dontStop = true;
stop();
}
}
}//package Frustration_fla
Section 22 (789 B)
//OGSplash_13 (Frustration_fla.OGSplash_13)
package Frustration_fla {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class OGSplash_13 extends MovieClip {
public function OGSplash_13(){
addFrameScript(169, frame170);
}
function frame170(){
stop();
if (MovieClip(parent)["transFX"]){
MovieClip(parent)["transFX"].startFadeIn();
};
}
}
}//package Frustration_fla
Section 23 (306 B)
//path_marker_73 (Frustration_fla.path_marker_73)
package Frustration_fla {
import flash.display.*;
public dynamic class path_marker_73 extends MovieClip {
public function path_marker_73(){
addFrameScript(0, frame1);
}
function frame1(){
visible = false;
}
}
}//package Frustration_fla
Section 24 (297 B)
//SoundSwitch_50 (Frustration_fla.SoundSwitch_50)
package Frustration_fla {
import flash.display.*;
public dynamic class SoundSwitch_50 extends MovieClip {
public function SoundSwitch_50(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Frustration_fla
Section 25 (928 B)
//actorObject (main.actorObject)
package main {
import flash.display.*;
import flash.ui.*;
public class actorObject extends MovieClip {
public var arrPoints:Array;
public var lastPointId:int;// = 0
public var speed:Number;// = 1
public function actorObject(){
arrPoints = new Array();
super();
}
public function updateActor():void{
var _local1:ageVector;
if (arrPoints.length == 0){
return;
};
if (ageMath.Distance(arrPoints[lastPointId].x, arrPoints[lastPointId].y, x, y) < (speed * 2)){
lastPointId++;
if (lastPointId == arrPoints.length){
lastPointId = 0;
};
};
_local1 = new ageVector(x, y);
_local1.x = (_local1.x - arrPoints[lastPointId].x);
_local1.y = (_local1.y - arrPoints[lastPointId].y);
_local1.x = -(_local1.x);
_local1.y = -(_local1.y);
_local1.setLen(speed);
x = (x + _local1.x);
y = (y + _local1.y);
}
}
}//package main
Section 26 (869 B)
//adMY (main.adMY)
package main {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.ui.*;
import flash.filters.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class adMY extends MovieClip {
public function adMY(){
addFrameScript(0, frame1);
}
public function clickHandler(_arg1:Event):void{
navigateToURL(new URLRequest("http://www.onlinegamer.cc?utm_source=FrustraBit&utm_medium=myADS"), "_blank");
}
function frame1(){
addEventListener(MouseEvent.CLICK, clickHandler);
this.ButtonMode = true;
}
}
}//package main
Section 27 (6.44 KiB) ● ●
//ageMath (main.ageMath)
package main {
public dynamic class ageMath {
public static function trimToRange(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (((_arg1)>_arg3) ? _arg3 : ((_arg1)<_arg2) ? _arg2 : _arg1);
}
public static function min3(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (Math.min(_arg1, Math.min(_arg2, _arg3)));
}
public static function getClosest(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (Math.abs((_arg1 - _arg2)) < Math.abs((_arg1 - _arg3))){
return (_arg2);
};
return (_arg3);
}
public static function DistanceVec(_arg1:ageVector, _arg2:ageVector):Number{
return (Distance(_arg1.x, _arg1.y, _arg2.x, _arg2.y));
}
public static function aproxEqual(_arg1:Number, _arg2:Number, _arg3:Number=1E-5):Boolean{
return ((Math.abs((_arg2 - _arg1)) <= _arg3));
}
public static function Random(_arg1:Number, _arg2:Number):Number{
return ((Math.round((Math.random() * (_arg2 - _arg1))) + _arg1));
}
public static function IsLinesCross(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):Boolean{
var _local9:Number = (((_arg3 - _arg1) * (_arg6 - _arg8)) - ((_arg5 - _arg7) * (_arg4 - _arg2)));
if (_local9 == 0){
return (false);
};
var _local10:Number = (((_arg5 - _arg1) * (_arg6 - _arg8)) - ((_arg5 - _arg7) * (_arg6 - _arg2)));
var _local11:Number = (((_arg3 - _arg1) * (_arg6 - _arg2)) - ((_arg5 - _arg1) * (_arg4 - _arg2)));
var _local12:Number = (_local10 / _local9);
var _local13:Number = (_local11 / _local9);
if ((((((((_local12 >= 0)) && ((_local12 <= 1)))) && ((_local13 >= 0)))) && ((_local13 <= 1)))){
return (true);
};
return (false);
}
public static function RandomInt(_arg1:int, _arg2:int):int{
return (Math.round(Random(_arg1, _arg2)));
}
public static function max3(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (Math.max(_arg1, Math.max(_arg2, _arg3)));
}
public static function Distance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.sqrt((((_arg1 - _arg3) * (_arg1 - _arg3)) + ((_arg2 - _arg4) * (_arg2 - _arg4)))));
}
public static function Lerp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return ((_arg1 + (_arg3 * (_arg2 - _arg1))));
}
public static function RemapVal(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Number{
return ((_arg4 + (((_arg5 - _arg4) * (_arg1 - _arg2)) / (_arg3 - _arg2))));
}
public static function getLineCrossRect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):ageVector{
var _local9:Number;
var _local10:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:ageVector;
var _local11:Number = 0;
var _local12:Number = 1;
_local9 = (_arg3 - _arg1);
_local10 = (_arg4 - _arg2);
_local13 = -(_local9);
_local14 = _local9;
_local15 = -(_local10);
_local16 = _local10;
_local17 = (_arg1 - _arg5);
_local18 = (_arg7 - _arg1);
_local19 = (_arg2 - _arg6);
_local20 = (_arg8 - _arg2);
if ((((((((((_local13 == 0)) && ((_local17 < 0)))) || ((((_local14 == 0)) && ((_local18 < 0)))))) || ((((_local15 == 0)) && ((_local19 < 0)))))) || ((((_local16 == 0)) && ((_local20 < 0)))))){
return (null);
};
if (_local13 < 0){
_local21 = (_local17 / _local13);
_local11 = Math.max(_local11, _local21);
};
if (_local14 < 0){
_local22 = (_local18 / _local14);
_local11 = Math.max(_local11, _local22);
};
if (_local15 < 0){
_local23 = (_local19 / _local15);
_local11 = Math.max(_local11, _local23);
};
if (_local16 < 0){
_local24 = (_local20 / _local16);
_local11 = Math.max(_local11, _local24);
};
if (_local13 > 0){
_local21 = (_local17 / _local13);
_local12 = Math.min(_local12, _local21);
};
if (_local14 > 0){
_local22 = (_local18 / _local14);
_local12 = Math.min(_local12, _local22);
};
if (_local15 > 0){
_local23 = (_local19 / _local15);
_local12 = Math.min(_local12, _local23);
};
if (_local16 > 0){
_local24 = (_local20 / _local16);
_local12 = Math.min(_local12, _local24);
};
if (_local11 > _local12){
return (null);
};
if ((((_local11 == 0)) && ((_local12 == 1)))){
return (null);
};
if ((((((_local11 < _local12)) && (!((_local11 == 0))))) && (!((_local12 == 1))))){
_local25 = (_arg1 + (_local9 * _local11));
_local26 = (_arg2 + (_local10 * _local11));
_local27 = (_arg1 + (_local9 * _local12));
_local28 = (_arg2 + (_local10 * _local12));
_local29 = new ageVector();
if (Distance(_local25, _local26, _arg1, _arg2) < Distance(_local27, _local28, _arg1, _arg2)){
_local29.set(_local25, _local26);
return (_local29);
};
_local29.set(_local27, _local28);
return (_local29);
};
return (null);
}
public static function getLinesCross(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):ageVector{
var _local14:ageVector;
var _local9:Number = (((_arg3 - _arg1) * (_arg6 - _arg8)) - ((_arg5 - _arg7) * (_arg4 - _arg2)));
if (_local9 == 0){
return (null);
};
var _local10:Number = (((_arg5 - _arg1) * (_arg6 - _arg8)) - ((_arg5 - _arg7) * (_arg6 - _arg2)));
var _local11:Number = (((_arg3 - _arg1) * (_arg6 - _arg2)) - ((_arg5 - _arg1) * (_arg4 - _arg2)));
var _local12:Number = (_local10 / _local9);
var _local13:Number = (_local11 / _local9);
if ((((((((_local12 >= 0)) && ((_local12 <= 1)))) && ((_local13 >= 0)))) && ((_local13 <= 1)))){
_local14 = new ageVector();
_local14.set(((_local12 * _arg3) + ((1 - _local12) * _arg1)), ((_local12 * _arg4) + ((1 - _local12) * _arg2)));
return (_local14);
};
return (null);
}
public static function inRange(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
return ((((_arg1 > _arg2)) && ((_arg1 < _arg3))));
}
}
}//package main
Section 28 (3.1 KiB) ●
//ageVector (main.ageVector)
package main {
public class ageVector {
var x:Number;
var y:Number;
public function ageVector(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
}
function sub(_arg1:ageVector):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
function copy(_arg1:ageVector):void{
x = _arg1.x;
y = _arg1.y;
}
function getAngleDegNorm():Number{
var _local1:Number = ((Math.atan2(y, x) / Math.PI) * 180);
if (_local1 < 0){
_local1 = (360 + _local1);
} else {
if (_local1 >= 360){
_local1 = (_local1 - 360);
};
};
return (_local1);
}
function ProjOnScalar(_arg1:ageVector):Number{
return ((dot(_arg1) / _arg1.len()));
}
function dot(_arg1:ageVector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
function mulScalar(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
function getAngleNorm():Number{
var _local1:Number = Math.atan2(y, x);
if (_local1 < 0){
_local1 = ((Math.PI * 2) + _local1);
} else {
if (_local1 >= (Math.PI * 2)){
_local1 = (_local1 - (Math.PI * 2));
};
};
return (_local1);
}
function trimLen(_arg1:Number):void{
if (len2() > (_arg1 * _arg1)){
normThis();
mulScalar(_arg1);
};
}
function len():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
function rot(_arg1:Number):void{
var _local2:Number = x;
x = ((_local2 * Math.cos(_arg1)) - (y * Math.sin(_arg1)));
y = ((y * Math.cos(_arg1)) + (_local2 * Math.sin(_arg1)));
}
function setLen(_arg1:Number):void{
normThis();
mulScalar(_arg1);
}
function getAngle():Number{
return (Math.atan2(y, x));
}
function add(_arg1:ageVector):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
function set(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
}
function getAngleDeg():Number{
return (((Math.atan2(y, x) / Math.PI) * 180));
}
function isEqual(_arg1:ageVector, _arg2:Number=1E-5):Boolean{
return (((ageMath.aproxEqual(x, _arg1.x, _arg2)) && (ageMath.aproxEqual(y, _arg1.y, _arg2))));
}
function rotDeg(_arg1:Number):void{
var _local2:Number = x;
var _local3:Number = ((_arg1 * Math.PI) / 180);
x = ((_local2 * Math.cos(_local3)) - (y * Math.sin(_local3)));
y = ((y * Math.cos(_local3)) + (_local2 * Math.sin(_local3)));
}
function lerpThis(_arg1:ageVector, _arg2:Number):void{
var _local3:ageVector = new ageVector();
_local3.copy(_arg1);
_local3.sub(this);
_local3.mulScalar(_arg2);
add(_local3);
}
function normThis():void{
var _local1:Number = len();
if (_local1){
x = (x / _local1);
y = (y / _local1);
};
}
function norm():ageVector{
var _local1:Number = len();
var _local2:ageVector = new ageVector(x, y);
if (_local1){
_local2.x = (_local2.x / _local1);
_local2.y = (_local2.y / _local1);
};
return (_local2);
}
function len2():Number{
return (((x * x) + (y * y)));
}
function ProjOnVec(_arg1:ageVector):ageVector{
var _local2:ageVector = _arg1.norm();
_local2.mulScalar(ProjOnScalar(_arg1));
return (_local2);
}
}
}//package main
Section 29 (1.38 KiB) ●
//alphaFader (main.alphaFader)
package main {
import flash.display.*;
import flash.events.*;
public class alphaFader extends MovieClip {
var use_force_restart:Boolean;// = true
public var fadeSpeed:Number;// = 0.07
public var fadeMinLimit:Number;// = 0
public var fadingout:Boolean;// = false
public var fadeMaxLimit:Number;// = 1
public function alphaFader(){
fadingout = false;
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
}
public function clearAlphaFader(){
removeEventListener(Event.ENTER_FRAME, update);
}
public function update(_arg1:Event):void{
if (visible){
if (fadingout){
if (alpha <= fadeMinLimit){
alpha = fadeMinLimit;
visible = false;
fadingout = false;
} else {
alpha = (alpha - fadeSpeed);
};
} else {
if (alpha >= fadeMaxLimit){
alpha = fadeMaxLimit;
} else {
alpha = (alpha + fadeSpeed);
};
};
};
}
public function startFadeOut():void{
if (((!(ageMath.aproxEqual(alpha, fadeMaxLimit))) && (!(use_force_restart)))){
return;
};
alpha = fadeMaxLimit;
visible = true;
fadingout = true;
}
public function startFadeIn():void{
if (((!(ageMath.aproxEqual(alpha, fadeMinLimit))) && (!(use_force_restart)))){
return;
};
alpha = fadeMinLimit;
visible = true;
fadingout = false;
}
}
}//package main
Section 30 (259 B)
//bonus (main.bonus)
package main {
import flash.display.*;
public dynamic class bonus extends MovieClip {
public function bonus(){
addFrameScript(0, frame1);
}
function frame1(){
mainClass(root).curLev.addBonus(this);
}
}
}//package main
Section 31 (2.02 KiB) ●
//Controls (main.Controls)
package main {
import flash.events.*;
import flash.ui.*;
public dynamic class Controls {
public static var keyNew:Array = new Array(0x0100);
public static var mouseKeyNew:Boolean;
public static var mousePosX:Number;
public static var mousePosY:Number;
public static var mouseGlobalPosX:Number;
public static var mouseGlobalPosY:Number;
public static var key:Array = new Array(0x0100);
public static var curReg;
public static var mouseKey:Boolean;
public static function mouseMove(_arg1:MouseEvent):void{
mousePosX = _arg1.stageX;
mousePosY = _arg1.stageY;
mouseGlobalPosX = (mousePosX - curReg.x);
mouseGlobalPosY = (mousePosY - curReg.y);
}
public static function keyUp(_arg1:KeyboardEvent){
key[_arg1.keyCode] = false;
}
public static function mouseUp(_arg1:MouseEvent):void{
mouseKey = false;
mouseKeyNew = false;
}
public static function keyDown(_arg1:KeyboardEvent){
key[_arg1.keyCode] = true;
keyNew[_arg1.keyCode] = true;
}
public static function mouseDown(_arg1:MouseEvent):void{
mouseKey = true;
mouseKeyNew = true;
}
public static function updateKeyNew(){
var _local1:int;
_local1 = 0;
while (_local1 < 0x0100) {
keyNew[_local1] = false;
_local1++;
};
mouseKeyNew = false;
}
public static function unregMC(){
curReg.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
curReg.removeEventListener(MouseEvent.MOUSE_UP, mouseUp);
curReg.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
curReg.removeEventListener(KeyboardEvent.KEY_UP, keyUp);
curReg.removeEventListener(KeyboardEvent.KEY_DOWN, keyDown);
curReg = null;
}
public static function regMC(_arg1){
curReg = _arg1;
_arg1.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
_arg1.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyUp);
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
}
}
}//package main
Section 32 (794 B)
//effectObject (main.effectObject)
package main {
import flash.display.*;
import flash.events.*;
public class effectObject extends MovieClip {
public var pic:MovieClip;
public function effectObject(_arg1:String=""){
addFrameScript(0, frame1);
mouseEnabled = false;
mouseChildren = false;
gotoAndStop(_arg1);
addEventListener(FSMEvent.ONPOSTED, onFSMPosted, false, 0, true);
}
private function onFSMPosted(_arg1:FSMEvent):void{
if (_arg1.data == "removeIt"){
fxcache.destroyFX(this);
};
}
public function onEntFrame(_arg1:Event):void{
if (MovieClip(getChildByName("pic"))){
MovieClip(getChildByName("pic")).gotoAndPlay(1);
removeEventListener(Event.ENTER_FRAME, onEntFrame);
};
}
function frame1(){
stop();
}
}
}//package main
Section 33 (110 B)
//enemy1 (main.enemy1)
package main {
public dynamic class enemy1 extends actorObject {
}
}//package main
Section 34 (299 B)
//FSMEvent (main.FSMEvent)
package main {
import flash.events.*;
public dynamic class FSMEvent extends Event {
public var data;
public static const ONPOSTED:String = "OnPosted";
public function FSMEvent(_arg1:String, _arg2){
this.data = _arg2;
super(_arg1);
}
}
}//package main
Section 35 (1.43 KiB) ●
//fxcache (main.fxcache)
package main {
import flash.display.*;
import flash.events.*;
public class fxcache {
protected static var last_id:int;
protected static var capacity:int = 500;
protected static var cacheArr:Array;
public static function init(){
cacheArr = new Array(capacity);
last_id = (capacity - 1);
var _local1:int;
while (_local1 < capacity) {
cacheArr[_local1] = new effectObject("null");
_local1++;
};
}
public static function createFX(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number):effectObject{
var _local5:effectObject;
if (last_id >= 0){
last_id--;
cacheArr[(last_id + 1)].x = _arg3;
cacheArr[(last_id + 1)].y = _arg4;
_arg1.addChild(cacheArr[(last_id + 1)]);
cacheArr[(last_id + 1)].gotoAndStop(_arg2);
cacheArr[(last_id + 1)].addEventListener(Event.ENTER_FRAME, cacheArr[(last_id + 1)].onEntFrame);
return (cacheArr[(last_id + 1)]);
};
_local5 = new effectObject(_arg2);
_local5.x = _arg3;
_local5.y = _arg4;
_arg1.addChild(_local5);
_local5.gotoAndStop(_arg2);
_local5.addEventListener(Event.ENTER_FRAME, _local5.onEntFrame);
return (_local5);
}
public static function destroyFX(_arg1:effectObject):void{
last_id++;
if (_arg1.parent){
_arg1.parent.removeChild(_arg1);
};
if (last_id == cacheArr.length){
cacheArr.push(_arg1);
} else {
cacheArr[last_id] = _arg1;
};
}
}
}//package main
Section 36 (2.78 KiB) ●
//ingameMenu (main.ingameMenu)
package main {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class ingameMenu extends MovieClip {
public var butOG:SimpleButton;
public var butEscaped:SimpleButton;
public var butContinue:SimpleButton;
public var butWalk:SimpleButton;
var transitTo:String;// = ""
var transitToLevel:int;// = 0
public var butTed:SimpleButton;
public var butExit:SimpleButton;
public function ingameMenu(){
addFrameScript(0, frame1);
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
butContinue.addEventListener(MouseEvent.CLICK, butContinue_Click);
butWalk.addEventListener(MouseEvent.CLICK, butWalk_Click);
butExit.addEventListener(MouseEvent.CLICK, butExit_Click);
butOG.addEventListener(MouseEvent.CLICK, butOG_Click);
butTed.addEventListener(MouseEvent.CLICK, butTed_Click);
butEscaped.addEventListener(MouseEvent.CLICK, butEscaped_Click);
}
function butEscaped_Click(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://onlinegamer.cc/Puzzle/186/Escaped.html?utm_source=FrustraBit&utm_medium=EscapedGame"), "_blank");
sounds.PlaySnd("menuClick");
}
function frame1(){
visible = false;
}
function butOG_Click(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.onlinegamer.cc?utm_source=FrustraBit&utm_medium=gameMenu"), "_blank");
sounds.PlaySnd("menuClick");
}
function butExit_Click(_arg1:MouseEvent):void{
transitTo = "mainMenu";
mainClass(root).transFX.startFadeIn();
sounds.PlaySnd("menuClick");
}
function butContinue_Click(_arg1:MouseEvent):void{
var _local2:* = mainClass(root);
_local2.levStartMenu.visible = true;
_local2.levStartMenu.levStartMask.x = _local2.curLev.hero.x;
_local2.levStartMenu.levStartMask.y = _local2.curLev.hero.y;
_local2.curLev.setPause(true);
_local2.curLev.newStart = false;
this.visible = false;
sounds.PlaySnd("menuClick");
}
public function update(_arg1:Event):void{
var _local2:*;
if (mainClass(parent).transFX.alpha > 0.99){
if (transitTo == "mainMenu"){
_local2 = mainClass(root);
_local2.delLevel();
transitTo = "";
this.visible = false;
_local2.levStartMenu.visible = false;
_local2.transFX.startFadeOut();
_local2.mainMenu.visible = true;
};
};
}
function butWalk_Click(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://onlinegamer.cc/index.php?task=view_page&id=3&utm_source=FrustraBit&utm_medium=WalkGameMenu"), "_blank");
sounds.PlaySnd("menuClick");
}
function butTed_Click(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://onlinegamer.cc/Shooter/238/Stark-Raving-Ted.html?utm_source=FrustraBit&utm_medium=TedGame"), "_blank");
sounds.PlaySnd("menuClick");
}
}
}//package main
Section 37 (33.68 KiB) ● ● ● ●
//Level (main.Level)
package main {
import flash.display.*;
import flash.events.*;
import com.coreyoneil.collision.*;
import flash.net.*;
import flash.media.*;
import flash.ui.*;
public class Level extends MovieClip {
public var pauseGame:Boolean;// = false
public var bonuses:Array;
public var b1:MovieClip;
public var b2:MovieClip;
public var b3:MovieClip;
public var b4:MovieClip;
public var colMC:MovieClip;
public var winLevelTimer:int;// = 0
public var enemies:Array;
public var levelLast:int;// = 18
public var button1:MovieClip;
public var button2:MovieClip;
public var button3:MovieClip;
public var button4:MovieClip;
public var button5:MovieClip;
public var button6:MovieClip;
public var button7:MovieClip;
public var button8:MovieClip;
public var button9:MovieClip;
public var windSnd:Sound;
public var CPid:int;// = -1
public var flag:MovieClip;
public var CP:Array;
public var lastY:Number;// = -100
public var p11:MovieClip;
public var p12:MovieClip;
public var p10:MovieClip;
public var lastX:Number;// = -100
public var windSndCh:SoundChannel;
public var movedPlayedNow:Boolean;// = false
public var newStart:Boolean;// = true
public var pixToButt:int;// = 28
public var p1:MovieClip;
public var p2:MovieClip;
public var p3:MovieClip;
public var p4:MovieClip;
public var p5:MovieClip;
public var p6:MovieClip;
public var p7:MovieClip;
public var p8:MovieClip;
public var p9:MovieClip;
public var resetLevelTimer:int;// = 0
public var button10:MovieClip;
public var button11:MovieClip;
public var curLevelNum:int;
public var bonusCollected:int;// = 0
public var _collisionList:CollisionList;
public var hero:MovieClip;
public function Level(){
bonuses = new Array();
CP = new Array();
enemies = new Array();
super();
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
addEventListener(MouseEvent.CLICK, Start_Click);
_collisionList = new CollisionList(colMC);
_collisionList.addItem(hero);
flag.stop();
windSnd = new sndmoved();
movedPlayedNow = false;
}
function Start_Click(_arg1:MouseEvent):void{
if (mainClass(root).levStartMenu.visible){
setPause(false);
mainClass(root).levStartMenu.visible = false;
Mouse.hide();
sounds.PlaySnd("Start");
if (newStart){
if (curLevelNum == 3){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p4);
colMC.enemy1.speed = 3;
enemies.push(colMC.enemy1);
colMC.enemy2.arrPoints.push(p5);
colMC.enemy2.arrPoints.push(p6);
colMC.enemy2.speed = 3;
enemies.push(colMC.enemy2);
} else {
if (curLevelNum == 4){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.speed = 3;
enemies.push(colMC.enemy1);
colMC.enemy2.arrPoints.push(p3);
colMC.enemy2.arrPoints.push(p1);
colMC.enemy2.speed = 3;
enemies.push(colMC.enemy2);
} else {
if (curLevelNum == 5){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p4);
colMC.enemy1.arrPoints.push(p5);
colMC.enemy1.arrPoints.push(p6);
colMC.enemy1.arrPoints.push(p7);
colMC.enemy1.speed = 4;
enemies.push(colMC.enemy1);
} else {
if (curLevelNum == 6){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p4);
colMC.enemy1.speed = 3;
enemies.push(colMC.enemy1);
colMC.enemy2.arrPoints.push(p3);
colMC.enemy2.arrPoints.push(p4);
colMC.enemy2.arrPoints.push(p1);
colMC.enemy2.arrPoints.push(p2);
colMC.enemy2.speed = 3;
enemies.push(colMC.enemy2);
} else {
if (curLevelNum == 8){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p4);
colMC.enemy1.arrPoints.push(p5);
colMC.enemy1.arrPoints.push(p6);
colMC.enemy1.arrPoints.push(p7);
colMC.enemy1.arrPoints.push(p8);
colMC.enemy1.speed = 6;
enemies.push(colMC.enemy1);
colMC.enemy2.arrPoints.push(p1);
colMC.enemy2.arrPoints.push(p2);
colMC.enemy2.arrPoints.push(p3);
colMC.enemy2.arrPoints.push(p4);
colMC.enemy2.arrPoints.push(p5);
colMC.enemy2.arrPoints.push(p6);
colMC.enemy2.arrPoints.push(p7);
colMC.enemy2.arrPoints.push(p8);
colMC.enemy2.speed = 6;
enemies.push(colMC.enemy2);
colMC.enemy3.arrPoints.push(p1);
colMC.enemy3.arrPoints.push(p2);
colMC.enemy3.arrPoints.push(p3);
colMC.enemy3.arrPoints.push(p4);
colMC.enemy3.arrPoints.push(p5);
colMC.enemy3.arrPoints.push(p6);
colMC.enemy3.arrPoints.push(p7);
colMC.enemy3.arrPoints.push(p8);
colMC.enemy3.speed = 6;
enemies.push(colMC.enemy3);
colMC.enemy4.arrPoints.push(p1);
colMC.enemy4.arrPoints.push(p2);
colMC.enemy4.arrPoints.push(p3);
colMC.enemy4.arrPoints.push(p4);
colMC.enemy4.arrPoints.push(p5);
colMC.enemy4.arrPoints.push(p6);
colMC.enemy4.arrPoints.push(p7);
colMC.enemy4.arrPoints.push(p8);
colMC.enemy4.speed = 6;
enemies.push(colMC.enemy4);
colMC.enemy5.arrPoints.push(p1);
colMC.enemy5.arrPoints.push(p2);
colMC.enemy5.arrPoints.push(p3);
colMC.enemy5.arrPoints.push(p4);
colMC.enemy5.arrPoints.push(p5);
colMC.enemy5.arrPoints.push(p6);
colMC.enemy5.arrPoints.push(p7);
colMC.enemy5.arrPoints.push(p8);
colMC.enemy5.speed = 6;
enemies.push(colMC.enemy5);
colMC.enemy6.arrPoints.push(p7);
colMC.enemy6.arrPoints.push(p8);
colMC.enemy6.arrPoints.push(p1);
colMC.enemy6.arrPoints.push(p2);
colMC.enemy6.arrPoints.push(p3);
colMC.enemy6.arrPoints.push(p4);
colMC.enemy6.arrPoints.push(p5);
colMC.enemy6.arrPoints.push(p6);
colMC.enemy6.speed = 6;
enemies.push(colMC.enemy6);
colMC.enemy7.arrPoints.push(p7);
colMC.enemy7.arrPoints.push(p8);
colMC.enemy7.arrPoints.push(p1);
colMC.enemy7.arrPoints.push(p2);
colMC.enemy7.arrPoints.push(p3);
colMC.enemy7.arrPoints.push(p4);
colMC.enemy7.arrPoints.push(p5);
colMC.enemy7.arrPoints.push(p6);
colMC.enemy7.speed = 6;
enemies.push(colMC.enemy7);
colMC.enemy8.arrPoints.push(p7);
colMC.enemy8.arrPoints.push(p8);
colMC.enemy8.arrPoints.push(p1);
colMC.enemy8.arrPoints.push(p2);
colMC.enemy8.arrPoints.push(p3);
colMC.enemy8.arrPoints.push(p4);
colMC.enemy8.arrPoints.push(p5);
colMC.enemy8.arrPoints.push(p6);
colMC.enemy8.speed = 6;
enemies.push(colMC.enemy8);
colMC.enemy9.arrPoints.push(p7);
colMC.enemy9.arrPoints.push(p8);
colMC.enemy9.arrPoints.push(p1);
colMC.enemy9.arrPoints.push(p2);
colMC.enemy9.arrPoints.push(p3);
colMC.enemy9.arrPoints.push(p4);
colMC.enemy9.arrPoints.push(p5);
colMC.enemy9.arrPoints.push(p6);
colMC.enemy9.speed = 6;
enemies.push(colMC.enemy9);
colMC.enemy10.arrPoints.push(p7);
colMC.enemy10.arrPoints.push(p8);
colMC.enemy10.arrPoints.push(p1);
colMC.enemy10.arrPoints.push(p2);
colMC.enemy10.arrPoints.push(p3);
colMC.enemy10.arrPoints.push(p4);
colMC.enemy10.arrPoints.push(p5);
colMC.enemy10.arrPoints.push(p6);
colMC.enemy10.speed = 6;
enemies.push(colMC.enemy10);
} else {
if (curLevelNum == 9){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p4);
colMC.enemy1.speed = 3;
enemies.push(colMC.enemy1);
colMC.enemy2.arrPoints.push(p3);
colMC.enemy2.arrPoints.push(p4);
colMC.enemy2.arrPoints.push(p1);
colMC.enemy2.arrPoints.push(p2);
colMC.enemy2.speed = 3;
enemies.push(colMC.enemy2);
colMC.sp1.visible = false;
colMC.sp2.visible = false;
} else {
if (curLevelNum == 10){
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p4);
colMC.enemy1.arrPoints.push(p5);
colMC.enemy1.arrPoints.push(p6);
colMC.enemy1.arrPoints.push(p7);
colMC.enemy1.arrPoints.push(p8);
colMC.enemy1.arrPoints.push(p9);
colMC.enemy1.arrPoints.push(p10);
colMC.enemy1.speed = 6;
enemies.push(colMC.enemy1);
colMC.enemy2.arrPoints.push(p1);
colMC.enemy2.arrPoints.push(p5);
colMC.enemy2.arrPoints.push(p6);
colMC.enemy2.arrPoints.push(p7);
colMC.enemy2.arrPoints.push(p3);
colMC.enemy2.arrPoints.push(p4);
colMC.enemy2.arrPoints.push(p8);
colMC.enemy2.arrPoints.push(p2);
colMC.enemy2.arrPoints.push(p9);
colMC.enemy2.arrPoints.push(p10);
colMC.enemy2.speed = 6;
enemies.push(colMC.enemy2);
colMC.enemy3.arrPoints.push(p1);
colMC.enemy3.arrPoints.push(p3);
colMC.enemy3.arrPoints.push(p8);
colMC.enemy3.arrPoints.push(p9);
colMC.enemy3.arrPoints.push(p10);
colMC.enemy3.arrPoints.push(p4);
colMC.enemy3.arrPoints.push(p2);
colMC.enemy3.arrPoints.push(p5);
colMC.enemy3.arrPoints.push(p6);
colMC.enemy3.arrPoints.push(p7);
colMC.enemy3.speed = 6;
enemies.push(colMC.enemy3);
colMC.enemy4.arrPoints.push(p1);
colMC.enemy4.arrPoints.push(p4);
colMC.enemy4.arrPoints.push(p5);
colMC.enemy4.arrPoints.push(p7);
colMC.enemy4.arrPoints.push(p8);
colMC.enemy4.arrPoints.push(p2);
colMC.enemy4.arrPoints.push(p3);
colMC.enemy4.arrPoints.push(p6);
colMC.enemy4.arrPoints.push(p9);
colMC.enemy4.arrPoints.push(p10);
colMC.enemy4.speed = 6;
enemies.push(colMC.enemy4);
colMC.enemy5.arrPoints.push(p1);
colMC.enemy5.arrPoints.push(p5);
colMC.enemy5.arrPoints.push(p6);
colMC.enemy5.arrPoints.push(p7);
colMC.enemy5.arrPoints.push(p2);
colMC.enemy5.arrPoints.push(p4);
colMC.enemy5.arrPoints.push(p10);
colMC.enemy5.arrPoints.push(p8);
colMC.enemy5.arrPoints.push(p9);
colMC.enemy5.arrPoints.push(p3);
colMC.enemy5.speed = 6;
enemies.push(colMC.enemy5);
colMC.benemy1.arrPoints.push(b1);
colMC.benemy1.arrPoints.push(b2);
colMC.benemy1.speed = 6;
enemies.push(colMC.benemy1);
colMC.benemy2.arrPoints.push(b4);
colMC.benemy2.arrPoints.push(b3);
colMC.benemy2.speed = 6;
enemies.push(colMC.benemy2);
} else {
if (curLevelNum == 12){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p4);
colMC.enemy1.speed = 6;
enemies.push(colMC.enemy1);
colMC.enemy2.arrPoints.push(p6);
colMC.enemy2.arrPoints.push(p5);
colMC.enemy2.arrPoints.push(p3);
colMC.enemy2.arrPoints.push(p4);
colMC.enemy2.speed = 6;
enemies.push(colMC.enemy2);
} else {
if (curLevelNum == 16){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p4);
colMC.enemy1.arrPoints.push(p5);
colMC.enemy1.arrPoints.push(p6);
colMC.enemy1.arrPoints.push(p7);
colMC.enemy1.arrPoints.push(p8);
colMC.enemy1.arrPoints.push(p9);
colMC.enemy1.arrPoints.push(p10);
colMC.enemy1.arrPoints.push(p11);
colMC.enemy1.arrPoints.push(p12);
colMC.enemy1.speed = 3;
enemies.push(colMC.enemy1);
} else {
if (curLevelNum == 18){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.speed = 6;
enemies.push(colMC.enemy1);
};
};
};
};
};
};
};
};
};
};
};
};
}
public function movedStop(){
}
public function term(){
removeEventListener(Event.ENTER_FRAME, update);
removeEventListener(MouseEvent.CLICK, Start_Click);
}
public function movedPlay(){
}
function setPause(_arg1:Boolean){
pauseGame = _arg1;
if (pauseGame){
pauseAllElements();
} else {
playAllElements();
};
}
public function restartLevel():void{
var _local1:* = mainClass(root);
_local1.loadLevel(curLevelNum);
_local1.levStartMenu.visible = true;
_local1.curLev.curLevelNum = curLevelNum;
_local1.curLev.setPause(true);
_local1.levStartMenu.levStartMask.x = _local1.curLev.hero.x;
_local1.levStartMenu.levStartMask.y = _local1.curLev.hero.y;
Mouse.show();
}
public function addCP(_arg1):void{
CP.push(_arg1);
}
function pauseAllElements(){
var _local1:int;
var _local2:*;
var _local3:int;
var _local4:*;
_local1 = 0;
while (_local1 < colMC.numChildren) {
_local2 = colMC.getChildAt(_local1);
if ((_local2 is MovieClip)){
if (!_local2.dontStop){
_local2.stop();
_local3 = 0;
while (_local3 < _local2.numChildren) {
_local4 = _local2.getChildAt(_local3);
if ((_local4 is MovieClip)){
if (!_local4.dontStop){
_local4.stop();
};
};
_local3++;
};
};
};
_local1++;
};
}
function playAllElements(){
var _local1:int;
var _local2:*;
var _local3:int;
var _local4:*;
_local1 = 0;
while (_local1 < colMC.numChildren) {
_local2 = colMC.getChildAt(_local1);
if ((_local2 is MovieClip)){
if (!_local2.dontStop){
_local2.play();
_local3 = 0;
while (_local3 < _local2.numChildren) {
_local4 = _local2.getChildAt(_local3);
if ((_local4 is MovieClip)){
if (!_local4.dontStop){
_local4.play();
};
};
_local3++;
};
};
};
_local1++;
};
}
function update(_arg1:Event):void{
var _local2:int;
var _local7:int;
var _local8:*;
var _local9:int;
var _local10:int;
var _local11:enemy1;
var _local12:Array;
var _local13:effectHero;
var _local14:int;
if (!mainClass(root).easyMode){
_local2 = 0;
while (_local2 < CP.length) {
CP[_local2].visible = false;
_local2++;
};
};
if (resetLevelTimer > 0){
resetLevelTimer--;
if (resetLevelTimer == 0){
_local8 = mainClass(root);
if (CPid == -1){
restartLevel();
} else {
_local8.levStartMenu.visible = true;
hero.visible = true;
hero.x = CP[CPid].x;
hero.y = CP[CPid].y;
lastX = -100;
lastY = -100;
_local8.levStartMenu.levStartMask.x = hero.x;
_local8.levStartMenu.levStartMask.y = hero.y;
_local8.curLev.setPause(true);
newStart = false;
};
return;
};
};
if (winLevelTimer > 0){
winLevelTimer--;
if (winLevelTimer == 0){
if (curLevelNum == levelLast){
_local8 = mainClass(root);
_local8.curLev.setPause(true);
_local8.winMenu.startFadeIn();
_local8.winMenu.init();
} else {
_local8 = mainClass(root);
_local8.loadLevel((curLevelNum + 1));
_local8.levStartMenu.visible = true;
_local8.levStartMenu.levStartMask.x = _local8.curLev.hero.x;
_local8.levStartMenu.levStartMask.y = _local8.curLev.hero.y;
_local8.curLev.setPause(true);
return;
};
};
};
var _local3:int = Math.round((mainClass(root).curFrameNum / 30));
mainClass(root).gameGUI.txtTime.text = (_local3 + " sec");
mainClass(root).gameGUI.txtOrb.text = ((("Orbs " + bonusCollected) + "/") + bonuses.length);
mainClass(root).gameGUI.txtLevel.text = ((("Level " + curLevelNum) + "/") + levelLast);
if (((Controls.keyNew[87]) || (Controls.keyNew[27]))){
if (Controls.keyNew[87]){
navigateToURL(new URLRequest("http://onlinegamer.cc/index.php?task=view_page&id=3&utm_source=FrustraBit&utm_medium=WalkInGame"), "_blank");
};
sounds.PlaySnd("menuClick");
setPause(true);
Mouse.show();
mainClass(root).ingame.visible = true;
Controls.updateKeyNew();
return;
};
if (Controls.keyNew[82]){
restartLevel();
sounds.PlaySnd("Death");
CPid = -1;
Controls.updateKeyNew();
return;
};
if (((mainClass(root).levStartMenu.visible) || (pauseGame))){
return;
};
_local2 = 0;
while (_local2 < enemies.length) {
if (enemies[_local2].visible){
enemies[_local2].updateActor();
};
_local2++;
};
if (curLevelNum == 2){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
if (colMC["moveBlock1"].currentFrame == 40){
colMC["moveBlock1"].stop();
movedStop();
} else {
colMC["moveBlock1"].play();
movedPlay();
};
} else {
colMC["moveBlock1"].stop();
movedStop();
};
};
if (curLevelNum == 3){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
colMC["rotBlock1"].block.spikes.play();
movedPlay();
} else {
colMC["rotBlock1"].block.spikes.stop();
movedStop();
};
if ((((ageMath.Distance(this["button2"].x, this["button2"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
colMC["rotBlock1"].play();
movedPlay();
} else {
colMC["rotBlock1"].stop();
movedStop();
};
};
if (curLevelNum == 4){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
colMC["rotBlock1"].rotation = (colMC["rotBlock1"].rotation + 2);
movedPlay();
} else {
movedStop();
};
};
if (curLevelNum == 6){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
colMC["block1"].visible = !(colMC["block1"].visible);
};
if ((((ageMath.Distance(this["button2"].x, this["button2"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
if (colMC["moveBlock1"].currentFrame == 20){
colMC["moveBlock1"].stop();
movedStop();
} else {
colMC["moveBlock1"].play();
movedPlay();
};
if (colMC.enemy3.arrPoints.length == 0){
colMC.enemy3.arrPoints.push(p5);
colMC.enemy3.arrPoints.push(p4);
colMC.enemy3.arrPoints.push(p5);
colMC.enemy3.arrPoints.push(p6);
colMC.enemy3.arrPoints.push(p7);
colMC.enemy3.arrPoints.push(p6);
colMC.enemy3.speed = 3;
enemies.push(colMC.enemy3);
};
} else {
colMC["moveBlock1"].stop();
movedStop();
};
if ((((ageMath.Distance(this["button3"].x, this["button3"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
if (colMC["moveBlock2"].currentFrame == 40){
colMC["moveBlock2"].stop();
movedStop();
} else {
colMC["moveBlock2"].play();
movedPlay();
};
} else {
colMC["moveBlock2"].stop();
movedStop();
};
};
if (curLevelNum == 9){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det1"].visible = !(colMC["det1"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button2"].x, this["button2"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det2"].visible = !(colMC["det2"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button3"].x, this["button3"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det3"].visible = !(colMC["det3"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button4"].x, this["button4"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det4"].visible = !(colMC["det4"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button5"].x, this["button5"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det9"].visible = !(colMC["det9"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button6"].x, this["button6"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det6"].visible = !(colMC["det6"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button7"].x, this["button7"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det5"].visible = !(colMC["det5"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button8"].x, this["button8"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det6"].visible = !(colMC["det6"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button9"].x, this["button9"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det7"].visible = !(colMC["det7"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button11"].x, this["button11"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det8"].visible = !(colMC["det8"].visible);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button10"].x, this["button10"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["sp1"].visible = true;
colMC["sp2"].visible = true;
sounds.PlaySnd("Butt");
};
};
if (curLevelNum == 11){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det1"].scaleY = -(colMC["det1"].scaleY);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button2"].x, this["button2"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["det1"].scaleX = -(colMC["det1"].scaleX);
sounds.PlaySnd("Butt");
};
if ((((ageMath.Distance(this["button3"].x, this["button3"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
if (colMC["det2"].currentFrame == 30){
colMC["det2"].stop();
movedStop();
} else {
colMC["det2"].play();
movedPlay();
};
if (colMC.enemy1.arrPoints.length == 0){
colMC.enemy1.arrPoints.push(p1);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.arrPoints.push(p3);
colMC.enemy1.arrPoints.push(p2);
colMC.enemy1.speed = 6;
enemies.push(colMC.enemy1);
};
} else {
colMC["det2"].stop();
movedStop();
};
};
if (curLevelNum == 12){
if (colMC["slovo"].currentFrame == 1){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC["slovo"].det1.scaleY = -(colMC["slovo"].det1.scaleY);
};
};
if (colMC["slovo"].currentFrame == 1){
if ((((ageMath.Distance(this["button2"].x, this["button2"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC["slovo"].det1.scaleX = -(colMC["slovo"].det1.scaleX);
};
};
if (colMC["slovo"].currentFrame == 1){
if ((((ageMath.Distance(this["button3"].x, this["button3"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC["slovo"].det2.scaleY = -(colMC["slovo"].det2.scaleY);
};
};
if (colMC["slovo"].currentFrame == 1){
if ((((ageMath.Distance(this["button4"].x, this["button4"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
colMC["slovo"].det2.rotation = (colMC["slovo"].det2.rotation + 90);
sounds.PlaySnd("Butt");
if (colMC["slovo"].det2.rotation > 359){
colMC["slovo"].det2.rotation = 0;
};
};
};
if (colMC["slovo"].currentFrame == 1){
if ((((ageMath.Distance(this["button5"].x, this["button5"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC["slovo"].det3.scaleY = -(colMC["slovo"].det3.scaleY);
};
};
if (colMC["slovo"].currentFrame == 1){
if ((((ageMath.Distance(this["button6"].x, this["button6"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC["slovo"].det3.scaleX = -(colMC["slovo"].det3.scaleX);
};
};
if (colMC["slovo"].currentFrame == 1){
if ((((((((((((colMC["slovo"].det1.scaleX == 1)) && ((colMC["slovo"].det1.scaleY == 1)))) && ((colMC["slovo"].det3.scaleX == 1)))) && ((colMC["slovo"].det3.scaleY == 1)))) && ((colMC["slovo"].det2.scaleY == 1)))) && ((colMC["slovo"].det2.rotation == 0)))){
colMC["slovo"].gotoAndPlay(2);
sounds.PlaySnd("Cool");
};
};
};
if (curLevelNum == 13){
if (!colMC.cool.visible){
if (colMC.tetris.lines >= colMC.tetris.lineMax){
sounds.PlaySnd("Cool");
colMC.tetris.isRunning = false;
colMC.tetris.visible = false;
colMC.cool.visible = true;
colMC.det1.play();
colMC.det2.play();
};
};
if (!colMC.cool.visible){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC.tetris.key_pressed(32);
if (colMC.vis1.visible){
sounds.PlaySnd("Bad");
};
colMC.vis1.visible = false;
colMC.vis2.visible = false;
};
};
if (!colMC.cool.visible){
if ((((ageMath.Distance(this["button2"].x, this["button2"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC.tetris.key_pressed(37);
};
};
if (!colMC.cool.visible){
if ((((ageMath.Distance(this["button3"].x, this["button3"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC.tetris.key_pressed(39);
};
};
if (!colMC.cool.visible){
if ((((ageMath.Distance(this["button5"].x, this["button5"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKeyNew))){
sounds.PlaySnd("Butt");
colMC.tetris.key_pressed(38);
};
};
if (!colMC.cool.visible){
if ((((ageMath.Distance(this["button4"].x, this["button4"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
colMC.tetris.key_pressed(40);
} else {
colMC.tetris.key_released(40);
};
};
};
if (curLevelNum == 15){
_local9 = 1;
while (_local9 < 10) {
if ((((ageMath.Distance(this[("button" + _local9)].x, this[("button" + _local9)].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
colMC[("det" + _local9)].play();
movedPlay();
} else {
colMC[("det" + _local9)].stop();
movedStop();
};
_local9++;
};
};
if (curLevelNum == 16){
_local10 = (bonusCollected + 1);
if (colMC.getChildByName(("enemy" + _local10)) == undefined){
_local11 = new enemy1();
_local11.name = ("enemy" + _local10);
_local11.x = p12.x;
_local11.y = p12.y;
_local11.arrPoints.push(p1);
_local11.arrPoints.push(p2);
_local11.arrPoints.push(p3);
_local11.arrPoints.push(p4);
_local11.arrPoints.push(p5);
_local11.arrPoints.push(p6);
_local11.arrPoints.push(p7);
_local11.arrPoints.push(p8);
_local11.arrPoints.push(p9);
_local11.arrPoints.push(p10);
_local11.arrPoints.push(p11);
_local11.arrPoints.push(p12);
_local11.speed = 3;
enemies.push(_local11);
colMC.addChild(_local11);
};
};
if (curLevelNum == 18){
if ((((ageMath.Distance(this["button1"].x, this["button1"].y, hero.x, hero.y) < pixToButt)) && (Controls.mouseKey))){
if (Controls.mouseKeyNew){
sounds.PlaySnd("Butt");
};
if (colMC["moveBlock1"].currentFrame == 40){
colMC["moveBlock1"].stop();
movedStop();
} else {
colMC["moveBlock1"].play();
movedPlay();
};
if (colMC.enemy2.arrPoints.length == 0){
colMC.enemy2.arrPoints.push(p3);
colMC.enemy2.arrPoints.push(p4);
colMC.enemy2.speed = 3;
enemies.push(colMC.enemy2);
};
} else {
colMC["moveBlock1"].stop();
movedStop();
};
if (colMC["unVisDet"].visible == false){
if (hero.y < 223){
sounds.PlaySnd("Bad");
colMC["unVisDet"].visible = true;
colMC["bigDet"].visible = false;
colMC["notTXT"].visible = true;
};
};
};
var _local4 = 1;
while (this[("button" + _local4)]) {
if (ageMath.Distance(this[("button" + _local4)].x, this[("button" + _local4)].y, hero.x, hero.y) < pixToButt){
this[("button" + _local4)].gotoAndStop(2);
} else {
this[("button" + _local4)].gotoAndStop(1);
};
_local4++;
};
if ((((lastX > -100)) && ((((ageMath.Distance(lastX, lastY, this.mouseX, this.mouseY) > 80)) && (Controls.mouseKey))))){
restartLevel();
sounds.PlaySnd("Death");
CPid = -1;
Controls.updateKeyNew();
return;
};
var _local5:ageVector = new ageVector((this.mouseX - lastX), (this.mouseY - lastY));
var _local6:int = int((_local5.len() / hero.width));
_local5.setLen(hero.width);
if (_local6 <= 1){
_local6 = 1;
_local5.set((this.mouseX - lastX), (this.mouseY - lastY));
};
_local7 = 0;
while (_local7 < _local6) {
hero.x = (hero.x + _local5.x);
hero.y = (hero.y + _local5.y);
if ((((_local7 == (_local6 - 1))) || ((lastX < -10)))){
hero.x = this.mouseX;
hero.y = this.mouseY;
};
_local2 = 0;
while (_local2 < bonuses.length) {
if (bonuses[_local2].visible){
if (ageMath.Distance(bonuses[_local2].x, bonuses[_local2].y, hero.x, hero.y) < 25){
bonuses[_local2].visible = false;
bonuses[_local2].x = (bonuses[_local2].x - 1000);
bonusCollected++;
sounds.PlaySnd("Orb");
};
};
_local2++;
};
if (mainClass(root).easyMode){
_local2 = 0;
while (_local2 < CP.length) {
if (CP[_local2].visible){
if (hero.hitTestObject(CP[_local2])){
if (CPid != _local2){
sounds.PlaySnd("CP");
};
CPid = _local2;
};
if (_local2 == CPid){
CP[_local2].alpha = 1;
} else {
CP[_local2].alpha = 0.5;
};
};
_local2++;
};
};
_local12 = _collisionList.checkCollisions();
if (_local12.length){
hero.visible = false;
setPause(true);
Mouse.show();
resetLevelTimer = 30;
mainClass(root).curFrameNum = (mainClass(root).curFrameNum + (30 * 5));
fxcache.createFX(this, "crash", hero.x, hero.y);
fxcache.createFX(this, "crash", (hero.x + 8), hero.y).rotation = 90;
fxcache.createFX(this, "crash", (hero.x - 8), (hero.y - 8)).rotation = 180;
fxcache.createFX(this, "crash", hero.x, (hero.y - 8)).rotation = 90;
fxcache.createFX(this, "5sec", hero.x, (hero.y - 15));
sounds.PlaySnd("Death");
return;
};
_local7++;
};
lastX = hero.x;
lastY = hero.y;
if (bonusCollected == bonuses.length){
flag.play();
};
if (((((hero.visible) && ((ageMath.Distance(flag.x, flag.y, hero.x, hero.y) < 44)))) && ((bonusCollected == bonuses.length)))){
hero.visible = false;
setPause(true);
Mouse.show();
winLevelTimer = 20;
_local13 = new effectHero();
_local13.x = hero.x;
_local13.y = hero.y;
_local14 = getChildIndex(hero);
addChildAt(_local13, (_local14 + 1));
sounds.PlaySnd("Win");
};
Controls.updateKeyNew();
mainClass(root).curFrameNum++;
}
public function addBonus(_arg1):void{
bonuses.push(_arg1);
}
}
}//package main
Section 38 (104 B)
//Level1 (main.Level1)
package main {
public dynamic class Level1 extends Level {
}
}//package main
Section 39 (107 B)
//Level10 (main.Level10)
package main {
public dynamic class Level10 extends Level {
}
}//package main
Section 40 (107 B)
//Level11 (main.Level11)
package main {
public dynamic class Level11 extends Level {
}
}//package main
Section 41 (107 B)
//Level12 (main.Level12)
package main {
public dynamic class Level12 extends Level {
}
}//package main
Section 42 (107 B)
//Level13 (main.Level13)
package main {
public dynamic class Level13 extends Level {
}
}//package main
Section 43 (107 B)
//Level14 (main.Level14)
package main {
public dynamic class Level14 extends Level {
}
}//package main
Section 44 (107 B)
//Level15 (main.Level15)
package main {
public dynamic class Level15 extends Level {
}
}//package main
Section 45 (107 B)
//Level16 (main.Level16)
package main {
public dynamic class Level16 extends Level {
}
}//package main
Section 46 (107 B)
//Level17 (main.Level17)
package main {
public dynamic class Level17 extends Level {
}
}//package main
Section 47 (107 B)
//Level18 (main.Level18)
package main {
public dynamic class Level18 extends Level {
}
}//package main
Section 48 (104 B)
//Level2 (main.Level2)
package main {
public dynamic class Level2 extends Level {
}
}//package main
Section 49 (104 B)
//Level3 (main.Level3)
package main {
public dynamic class Level3 extends Level {
}
}//package main
Section 50 (104 B)
//Level4 (main.Level4)
package main {
public dynamic class Level4 extends Level {
}
}//package main
Section 51 (104 B)
//Level5 (main.Level5)
package main {
public dynamic class Level5 extends Level {
}
}//package main
Section 52 (104 B)
//Level6 (main.Level6)
package main {
public dynamic class Level6 extends Level {
}
}//package main
Section 53 (104 B)
//Level7 (main.Level7)
package main {
public dynamic class Level7 extends Level {
}
}//package main
Section 54 (104 B)
//Level8 (main.Level8)
package main {
public dynamic class Level8 extends Level {
}
}//package main
Section 55 (104 B)
//Level9 (main.Level9)
package main {
public dynamic class Level9 extends Level {
}
}//package main
Section 56 (1.96 KiB) ●
//mainMenu (main.mainMenu)
package main {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class mainMenu extends MovieClip {
var transitToLevel:int;// = 0
public var butCred:SimpleButton;
public var butPlay:SimpleButton;
public var butMore:SimpleButton;
public var myLogo:MovieClip;
public var anegLogo:MovieClip;
var transitTo:String;// = ""
public function mainMenu(){
addFrameScript(0, frame1);
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
butPlay.addEventListener(MouseEvent.CLICK, butPlay_Click);
butCred.addEventListener(MouseEvent.CLICK, butCred_Click);
butMore.addEventListener(MouseEvent.CLICK, butMore_Click);
mainClass(root).transFX.startFadeOut();
}
public function clickanegLogo(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.anegmetex.com"), "_blank");
}
function frame1(){
myLogo.buttonMode = true;
myLogo.addEventListener(MouseEvent.CLICK, clickmyLogo);
anegLogo.buttonMode = true;
anegLogo.addEventListener(MouseEvent.CLICK, clickanegLogo);
}
function butMore_Click(_arg1:MouseEvent):void{
sounds.PlaySnd("menuClick");
navigateToURL(new URLRequest("http://www.onlinegamer.cc?utm_source=FrustraBit&utm_medium=moreGames"), "_blank");
}
public function update(_arg1:Event):void{
}
function butPlay_Click(_arg1:MouseEvent):void{
mainClass(parent).modeMenu.startFadeIn();
mainClass(parent).modeMenu.playMode.visible = true;
mainClass(parent).modeMenu.leaderMode.visible = false;
sounds.PlaySnd("menuClick");
}
function butCred_Click(_arg1:MouseEvent):void{
sounds.PlaySnd("menuClick");
mainClass(parent).modeMenu.startFadeIn();
mainClass(parent).modeMenu.playMode.visible = false;
mainClass(parent).modeMenu.leaderMode.visible = true;
}
public function clickmyLogo(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.onlinegamer.cc?utm_source=FrustraBit&utm_medium=menuLogo"), "_blank");
}
}
}//package main
Section 57 (4.01 KiB) ●
//modeMenu (main.modeMenu)
package main {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
public class modeMenu extends alphaFader {
public var leaderMode:MovieClip;
var transitToLevel:int;// = 0
public var playMode:MovieClip;
var transitTo:String;// = ""
public function modeMenu(){
addFrameScript(0, frame1);
addEventListener(Event.ENTER_FRAME, updated, false, 0, true);
playMode.butEasy.addEventListener(MouseEvent.CLICK, butEasy1_Click);
playMode.butHard.addEventListener(MouseEvent.CLICK, butHard1_Click);
leaderMode.butEasy.addEventListener(MouseEvent.CLICK, butEasy2_Click);
leaderMode.butHard.addEventListener(MouseEvent.CLICK, butHard2_Click);
}
public function updated(_arg1:Event):void{
if (playMode.visible){
if (playMode.butEasy.hitTestPoint(Controls.mousePosX, Controls.mousePosY)){
playMode.txtDesc.text = "I'm cute casual player.";
} else {
if (playMode.butHard.hitTestPoint(Controls.mousePosX, Controls.mousePosY)){
playMode.txtDesc.text = "I'm insane hardcore gamer!";
} else {
playMode.txtDesc.text = "";
};
};
};
if (mainClass(parent).transFX.alpha > 0.99){
if (transitTo == "level"){
transitTo = "";
mainClass(root).loadLevel(transitToLevel);
mainClass(root).levStartMenu.visible = true;
mainClass(root).levStartMenu.levStartMask.x = mainClass(root).curLev.hero.x;
mainClass(root).levStartMenu.levStartMask.y = mainClass(root).curLev.hero.y;
mainClass(root).curLev.setPause(true);
mainClass(root).curLev.curLevelNum = transitToLevel;
visible = false;
mainClass(root).mainMenu.visible = false;
mainClass(parent).transFX.startFadeOut();
} else {
if (transitTo == "scoreEasy"){
transitTo = "";
showScoreBoardEasy();
} else {
if (transitTo == "scoreHard"){
transitTo = "";
showScoreBoardHard();
};
};
};
};
}
function showScoreBoardHard():void{
var o:Object = {n:[14, 12, 10, 1, 7, 0, 8, 4, 3, 8, 8, 0, 1, 0, 12, 9], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, onDisplay:function (){
}, onClose:function (){
mainClass(root).scoreBoardShowed = false;
mainClass(root).transFX.startFadeOut();
visible = false;
sounds.PlaySnd("menuClick");
}});
}
function frame1(){
visible = false;
}
function butHard2_Click(_arg1:MouseEvent):void{
sounds.PlaySnd("menuClick");
mainClass(root).scoreBoardShowed = true;
mainClass(root).transFX.startFadeIn();
transitTo = "scoreHard";
}
function butHard1_Click(_arg1:MouseEvent):void{
sounds.PlaySnd("menuClick");
transitTo = "level";
transitToLevel = 1;
mainClass(parent).transFX.startFadeIn();
mainClass(parent).curFrameNum = 0;
mainClass(parent).easyMode = false;
}
function butEasy2_Click(_arg1:MouseEvent):void{
sounds.PlaySnd("menuClick");
mainClass(root).scoreBoardShowed = true;
mainClass(root).transFX.startFadeIn();
transitTo = "scoreEasy";
}
function showScoreBoardEasy():void{
var o:Object = {n:[7, 2, 3, 0, 13, 8, 8, 10, 2, 6, 14, 6, 13, 0, 3, 13], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, onDisplay:function (){
}, onClose:function (){
mainClass(root).scoreBoardShowed = false;
mainClass(root).transFX.startFadeOut();
visible = false;
sounds.PlaySnd("menuClick");
}});
}
function butEasy1_Click(_arg1:MouseEvent):void{
sounds.PlaySnd("menuClick");
transitTo = "level";
transitToLevel = 1;
mainClass(parent).transFX.startFadeIn();
mainClass(parent).curFrameNum = 0;
mainClass(parent).easyMode = true;
}
}
}//package main
Section 58 (2.76 KiB) ●
//musicEnv (main.musicEnv)
package main {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import flash.media.*;
public dynamic class musicEnv {
static var t1:SoundTransform = new SoundTransform();
public static var curCh:SoundChannel;
public static var timerVolFader:Timer = new Timer(10);
static var mus:Object;
public static var vol:Number = 0.9;
public static var volFadeSpeed:Number = 0.01;
public static var curMusName:String = "";
public static var offVol:Number = 0;
public static var musEnable:Boolean = true;
public static var curVol:Number = 0;
public static var offCh:SoundChannel;
public static var curPos:Number = 0;
public static var isplayed:Boolean = false;
static var t2:SoundTransform = new SoundTransform();
public static function init(){
timerVolFader.stop();
mus = new Object();
mus["mainmusic"] = new mainmusic();
}
public static function played(_arg1:Boolean):void{
if (_arg1 == isplayed){
return;
};
if (_arg1){
if (curMusName != ""){
fadeTo(curMusName);
};
} else {
isplayed = false;
if (curCh){
curCh.stop();
curPos = curCh.position;
};
if (offCh){
offCh.stop();
};
offVol = 0;
curVol = vol;
if (timerVolFader.running){
timerVolFader.stop();
timerVolFader.removeEventListener(TimerEvent.TIMER, timerVolFader_Timer);
};
};
}
public static function fadeTo(_arg1:String){
var _local2:SoundTransform;
curMusName = _arg1;
if (!musEnable){
return;
};
isplayed = true;
_local2 = new SoundTransform();
_local2.volume = 0;
if (offCh){
offCh.stop();
};
offCh = curCh;
if ((((curMusName == "musLose")) || ((curMusName == "musWin")))){
curCh = mus[_arg1].play(0, 1, _local2);
} else {
curCh = mus[_arg1].play(0, int.MAX_VALUE, _local2);
};
curVol = 0;
offVol = vol;
if (!timerVolFader.running){
timerVolFader.addEventListener(TimerEvent.TIMER, timerVolFader_Timer, false, 0, true);
timerVolFader.start();
};
}
public static function timerVolFader_Timer(_arg1:TimerEvent):void{
if (offCh != null){
if (offVol > 0){
offVol = (offVol - volFadeSpeed);
} else {
offVol = 0;
};
t1.volume = offVol;
offCh.soundTransform = t1;
};
if (((!((curCh == null))) && ((((offVol < (vol / 2))) || ((offCh == null)))))){
if (curVol < vol){
curVol = (curVol + volFadeSpeed);
} else {
curVol = vol;
};
t2.volume = curVol;
curCh.soundTransform = t2;
};
if (curVol > (vol - 0.0001)){
if (offCh != null){
offCh.stop();
};
timerVolFader.stop();
timerVolFader.removeEventListener(TimerEvent.TIMER, timerVolFader_Timer);
};
}
}
}//package main
Section 59 (1.91 KiB) ●
//preloader (main.preloader)
package main {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
public dynamic class preloader extends MovieClip {
var timerLoadAds:Timer;
public var progressBar:MovieClip;
public var playButt:SimpleButton;
public function preloader(){
timerLoadAds = new Timer(3000, 1);
super();
addFrameScript(0, frame1, 1, frame2);
if (0){
} else {
addEventListener(Event.ENTER_FRAME, Update);
timerLoadAds.start();
};
}
public function playButt_Click(_arg1:MouseEvent):void{
if ((parent is MovieClip)){
parent.removeChild(parent["adBox"]);
(parent as MovieClip).play();
};
}
public function isUrl(_arg1:Array):Boolean{
var _local2:String = stage.loaderInfo.loaderURL;
var _local3:Number = (_local2.indexOf("://") + 3);
var _local4:Number = _local2.indexOf("/", _local3);
var _local5:String = _local2.substring(_local3, _local4);
var _local6:Number = (_local5.lastIndexOf(".") - 1);
var _local7:Number = (_local5.lastIndexOf(".", _local6) + 1);
_local5 = _local5.substring(_local7, _local5.length);
var _local8:int;
while (_local8 < _arg1.length) {
if (_local5 == _arg1[_local8]){
return (true);
};
_local8++;
};
return (false);
}
public function Update(_arg1:Event):void{
var _local2:Number = stage.loaderInfo.bytesLoaded;
var _local3:Number = stage.loaderInfo.bytesTotal;
var _local4 = "";
var _local5:Number = 0;
if (_local3 > 0){
_local5 = Math.floor(((_local2 / _local3) * 10));
};
this.progressBar.gotoAndStop((_local5 + 1));
if ((((_local2 == _local3)) || ((_local3 == 0)))){
if (!timerLoadAds.running){
removeEventListener(Event.ENTER_FRAME, Update);
gotoAndStop(2);
};
};
}
function frame1(){
stop();
}
function frame2(){
playButt.addEventListener(MouseEvent.CLICK, playButt_Click);
}
}
}//package main
Section 60 (124 B)
//screenBlink (main.screenBlink)
package main {
public dynamic class screenBlink extends alphaFader {
}
}//package main
Section 61 (1.8 KiB) ●
//sounds (main.sounds)
package main {
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.media.*;
public dynamic class sounds {
static var snd:Object;
public static var cenX:Number = 0;
public static var cenY:Number = 0;
static var stageRadius:Number;
public static var vol:Number = 0.9;
public static var sndEnable:Boolean = true;
public static function PlaySnd(_arg1:String, _arg2:Number=NaN, _arg3:MovieClip=null, _arg4:Stage=null):void{
var _local5:SoundTransform;
var _local6:Number;
var _local7:Number;
var _local8:Point;
var _local9:ageVector;
if (!sndEnable){
return;
};
if (_arg3 == null){
_local5 = new SoundTransform();
_local5.volume = vol;
snd[_arg1].play(0, 0, _local5);
} else {
if (((!(vol)) || ((_arg4 == null)))){
return;
};
_local5 = new SoundTransform();
_local8 = _arg3.parent.localToGlobal(new Point(_arg3.x, _arg3.y));
_local6 = (_local8.x - cenX);
_local7 = (_local8.y - cenY);
_local9 = new ageVector();
_local9.set(_local6, _local7);
_local5.volume = ageMath.trimToRange((vol * ageMath.RemapVal(_local9.len(), 0, (_arg2 * stageRadius), 1, 0)), 0, 1);
_local5.pan = ageMath.trimToRange(ageMath.RemapVal(_local9.x, (-(stageRadius) / 2), (stageRadius / 2), -1, 1), -1, 1);
snd[_arg1].play(0, 0, _local5);
};
}
public static function init(_arg1:Number, _arg2:Number){
snd = new Object();
snd["Death"] = new sndDeath();
snd["Win"] = new sndWin();
snd["Time"] = new sndTime();
snd["Orb"] = new sndOrb();
snd["Cool"] = new sndCool();
snd["CP"] = new sndTime();
snd["menuClick"] = new clickBut();
snd["Start"] = new sndstart();
snd["Butt"] = new sndbutt();
snd["Bad"] = new sndbad();
stageRadius = (_arg1 / 1.4);
}
}
}//package main
Section 62 (3.59 KiB) ●
//winMenu (main.winMenu)
package main {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import flash.utils.*;
import flash.text.*;
public class winMenu extends alphaFader {
public var clickTXT:MovieClip;
public var timer1:Timer;
var transitTo:String;// = ""
var txtTotal_cur:int;// = 0
var txtTotal_max:int;// = 0
public var txtTime:TextField;
public function winMenu(){
timer1 = new Timer(1500, 1);
super();
addFrameScript(0, frame1);
addEventListener(Event.ENTER_FRAME, update2);
timer1.stop();
timer1.addEventListener(TimerEvent.TIMER, timer1_Timer, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
}
public function getOff(_arg1:int):int{
return (int((_arg1 * 0.015)));
}
public function timer1_Timer(_arg1:TimerEvent):void{
if (mainClass(root).easyMode){
showScoreBoardEasy();
} else {
showScoreBoardHard();
};
clickTXT.visible = true;
timer1.stop();
}
function showScoreBoardEasy():void{
mainClass(root).scoreBoardShowed = true;
var o:Object = {n:[7, 2, 3, 0, 13, 8, 8, 10, 2, 6, 14, 6, 13, 0, 3, 13], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
var timeSec:int = Math.round((txtTotal_max / 30));
MochiScores.showLeaderboard({boardID:boardID, score:timeSec, onDisplay:function (){
mainClass(root).transFX.startFadeIn();
}, onClose:function (){
mainClass(root).scoreBoardShowed = false;
mainClass(root).transFX.startFadeOut();
sounds.PlaySnd("menuClick");
}});
}
function showScoreBoardHard():void{
mainClass(root).scoreBoardShowed = true;
var o:Object = {n:[14, 12, 10, 1, 7, 0, 8, 4, 3, 8, 8, 0, 1, 0, 12, 9], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
var timeSec:int = Math.round((txtTotal_max / 30));
MochiScores.showLeaderboard({boardID:boardID, score:timeSec, onDisplay:function (){
mainClass(root).transFX.startFadeIn();
}, onClose:function (){
mainClass(root).scoreBoardShowed = false;
mainClass(root).transFX.startFadeOut();
sounds.PlaySnd("menuClick");
}});
}
function frame1(){
visible = false;
}
public function mouseDown(_arg1:MouseEvent):void{
if (clickTXT.visible){
transitTo = "mainMenu";
mainClass(root).transFX.startFadeIn();
sounds.PlaySnd("Death");
};
}
public function update2(_arg1:Event):void{
var _local2:*;
var _local3:int;
if ((((alpha < 0.9)) || (!(visible)))){
return;
};
txtTime.visible = true;
if (mainClass(parent).transFX.alpha > 0.99){
if (transitTo == "mainMenu"){
_local2 = mainClass(root);
_local2.delLevel();
transitTo = "";
this.visible = false;
_local2.transFX.startFadeOut();
_local2.mainMenu.visible = true;
};
};
if (txtTotal_cur < txtTotal_max){
txtTotal_cur = (txtTotal_cur + getOff(txtTotal_max));
sounds.PlaySnd("Time");
if (txtTotal_cur > txtTotal_max){
txtTotal_cur = txtTotal_max;
};
_local3 = Math.round((txtTotal_cur / 30));
txtTime.text = (("Your time is " + _local3) + " sec.");
} else {
if (!clickTXT.visible){
timer1.start();
};
};
}
public function init(){
txtTotal_cur = 0;
txtTotal_max = mainClass(root).curFrameNum;
clickTXT.visible = false;
txtTime.visible = false;
}
}
}//package main
Section 63 (1.19 KiB) ●
//MochiBot (mochi.as3.MochiBot)
package mochi.as3 {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package mochi.as3
Section 64 (2.56 KiB) ●
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const NO_USER:String = "NoUser";
public static const IO_ERROR:String = "IOError";
public static const ITEM_NEW:String = "ItemNew";
public static const ITEM_OWNED:String = "ItemOwned";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const STORE_SHOW:String = "StoreShow";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _inventory:MochiInventory;
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function showStore(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function requestFunding(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFunding", _arg1);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 65 (1.24 KiB) ●
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function get value():Number{
return (Number(this.toString()));
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 66 (0.98 KiB)
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
}
}//package mochi.as3
Section 67 (2.27 KiB) ●
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local4:Object;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
}
}//package mochi.as3
Section 68 (6.32 KiB) ● ●
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _names:Array;
private var _syncID:Number;
private var _consumableProperties:Object;
private var _storeSync:Object;
private var _outstandingID:Number;
private var _syncPending:Boolean;
public static const READY:String = "InvReady";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
private static const KEY_SALT:String = " syncMaint";
public static const WRITTEN:String = "InvWritten";
public static const NOT_READY:String = "InvNotReady";
public static const VALUE_ERROR:String = "InvValueError";
private static const CONSUMER_KEY:String = "MochiConsumables";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (((_arg1.privateProperties) && (_arg1.privateProperties.consumable))){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[(_local2 + KEY_SALT)].value);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 69 (5.45 KiB) ● ●
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local2:Object = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 70 (20.14 KiB) ● ● ●
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _queue:Array;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _nextCallbackID:Number;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var _callbacks:Object;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _callbacks[cb];
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
};
if (_clip != null){
if (_callbacks != null){
_callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_nextCallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local4:int;
var _local14:Loader;
var _local3:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
private static function detach(_arg1:Event):void{
var _local2:LoaderInfo = LoaderInfo(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, detach);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.removeEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
private static function loadLCBridgeComplete(_arg1:Event):void{
var _local2:Loader = LoaderInfo(_arg1.target).loader;
_mochiLocalConnection = MovieClip(_local2.content);
listen();
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.9.1 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_queue))){
while (_queue.length > 0) {
_local2 = _queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _callbacks[_local2.callbackID];
};
delete _callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _arg1.event;
switch (_local2){
case "services":
MochiServices.triggerEvent(_arg1.event, _arg1.args);
break;
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "social":
MochiSocial.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function urlOptions(_arg1:Object):Object{
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var avm1Click:DisplayObject;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
var vars:Object = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
var s = "?";
var i:Number = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://link.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_clip.parent){
_clip.parent.removeChild(_clip);
};
if (_arg1 != null){
if ((_arg1 is DisplayObjectContainer)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is DisplayObjectContainer)){
DisplayObjectContainer(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
public static function get childClip():Object{
return (_clip);
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift());
};
};
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
private static function loadLCBridge(_arg1:Object):void{
var _local2:Loader = new Loader();
var _local3:String = (_servURL + _mochiLC);
var _local4:URLRequest = new URLRequest(_local3);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local2.load(_local4);
_arg1.addChild(_local2);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local3:String = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local3 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local3);
_clip = new MovieClip();
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local4:URLRequest = new URLRequest(_local3);
var _local5:URLVariables = new URLVariables();
_local5.listenLC = _listenChannelName;
_local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local5.api_version = getVersion();
if (widget){
_local5.widget = true;
};
_local4.data = _local5;
_loader.load(_local4);
_clip.addChild(_loader);
_sendChannel = new LocalConnection();
_queue = [];
_nextCallbackID = 0;
_callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
} else {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
};
}
}
}//package mochi.as3
Section 71 (3.57 KiB) ●
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const ACTION_CANCELED:String = "onCancel";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const FRIEND_LIST:String = "FriendsList";
public static const PROFILE_DATA:String = "ProfileData";
public static const GAMEPLAY_DATA:String = "GameplayData";
public static const ACTION_COMPLETE:String = "onComplete";
public static const LOGIN_SHOW:String = "LoginShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const USER_INFO:String = "UserInfo";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const ERROR:String = "Error";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static var _user_info:Object = null;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function requestFan(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFan", _arg1);
}
public static function postToStream(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_postToStream", _arg1);
}
public static function getFriendsList(_arg1:Object=null):void{
MochiServices.send("social_getFriendsList", _arg1);
}
public static function requestLogin(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestLogin", _arg1);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("social_saveUserProperties", _arg1);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function inviteFriends(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_inviteFriends", _arg1);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_showLoginWidget", {options:_arg1});
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function hideLoginWidget():void{
MochiServices.send("social_hideLoginWidget");
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 72 (4.21 KiB) ●
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var callback:Function;// = null
public var operation:String;// = null
public var error:Event;// = null
public var data;// = null
public var _loader:URLLoader;
public var key:String;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function getEvent():void{
request("get", serialize(null));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 73 (130 B)
//adBoxClass (adBoxClass)
package {
import flash.display.*;
public dynamic class adBoxClass extends MovieClip {
}
}//package
Section 74 (659 B)
//Block (Block)
package {
import flash.display.*;
public class Block {
public var sprite:Sprite;
public var ypPrev;
public var xpPrev;
public var xp:int;// = 0
public var type:int;
public var yp:int;// = 0
public var spriteoffset:int;
public function Block(_arg1:int, _arg2:int, _arg3:int):void{
xp = _arg1;
yp = _arg2;
spriteoffset = _arg3;
}
public function Move(_arg1:int, _arg2:int):void{
xpPrev = xp;
ypPrev = yp;
xp = (xp + _arg1);
yp = (yp + _arg2);
}
public function Rewind():void{
xp = xpPrev;
yp = ypPrev;
}
public function StoreState(){
xpPrev = xp;
ypPrev = yp;
}
}
}//package
Section 75 (124 B)
//BlockMap (BlockMap)
package {
import flash.display.*;
public dynamic class BlockMap extends MovieClip {
}
}//package
Section 76 (3.86 KiB) ●
//Body (Body)
package {
import flash.geom.*;
import flash.display.*;
public class Body {
var BB:int;// = 2
var BC:int;// = 5
var BJ:int;// = 1
public var xpPrev:int;
public var block:Array;
var BI:int;// = 6
var BS:int;// = 4
public var yp:int;
var BZ:int;// = 3
var BL:int;// = 0
var patternsX:Array;
var patternsY:Array;
public var bodyColor:Array;
public var ptrGetBlock;// = 0
public var ypPrev:int;
public var bodyType:int;
public var xp:int;
public function Body(_arg1:int=150, _arg2:int=0){
var _local5:int;
bodyColor = new Array();
patternsX = new Array();
patternsY = new Array();
super();
var _local3:* = new Array();
patternsX[BL] = new Array(-1, -1, 0, 1);
patternsY[BL] = new Array(0, 1, 1, 1);
_local3[BL] = 0;
patternsX[BJ] = new Array(-1, -1, 0, 1);
patternsY[BJ] = new Array(1, 0, 0, 0);
_local3[BJ] = 30;
patternsX[BB] = new Array(-1, -1, 0, 0);
patternsY[BB] = new Array(0, 1, 0, 1);
_local3[BB] = 60;
patternsX[BZ] = new Array(-1, 0, 0, 1);
patternsY[BZ] = new Array(1, 1, 0, 0);
_local3[BZ] = 90;
patternsX[BS] = new Array(-1, 0, 0, 1);
patternsY[BS] = new Array(0, 0, 1, 1);
_local3[BS] = 120;
patternsX[BC] = new Array(-1, 0, 0, 1);
patternsY[BC] = new Array(0, 0, 1, 0);
_local3[BC] = 150;
patternsX[BI] = new Array(-1, 0, 1, 2);
patternsY[BI] = new Array(0, 0, 0, 0);
_local3[BI] = 180;
xp = _arg1;
yp = _arg2;
var _local4:int = (Math.random() * 700);
if (_local4 <= 100){
bodyType = 0;
} else {
if (_local4 <= 200){
bodyType = 1;
} else {
if (_local4 <= 300){
bodyType = 2;
} else {
if (_local4 <= 400){
bodyType = 3;
} else {
if (_local4 <= 500){
bodyType = 4;
} else {
if (_local4 <= 600){
bodyType = 5;
} else {
if (_local4 <= 700){
bodyType = 6;
};
};
};
};
};
};
};
block = new Array();
block[0] = new Block((patternsX[bodyType][0] * 30), (patternsY[bodyType][0] * 30), _local3[bodyType]);
block[1] = new Block((patternsX[bodyType][1] * 30), (patternsY[bodyType][1] * 30), _local3[bodyType]);
block[2] = new Block((patternsX[bodyType][2] * 30), (patternsY[bodyType][2] * 30), _local3[bodyType]);
block[3] = new Block((patternsX[bodyType][3] * 30), (patternsY[bodyType][3] * 30), _local3[bodyType]);
}
public function CollisionCheck(_arg1:Block):Boolean{
var _local2:int;
while (_local2 < block.length) {
if (((((xp + block[_local2].xp) == _arg1.xp)) && (((yp + block[_local2].yp) == _arg1.yp)))){
return (true);
};
_local2++;
};
return (false);
}
public function RewindRotate(){
var _local1:int;
while (_local1 < block.length) {
block[_local1].Rewind();
_local1++;
};
}
public function Move(_arg1:int, _arg2:int):void{
xpPrev = xp;
ypPrev = yp;
xp = (xp + _arg1);
yp = (yp + _arg2);
}
public function GetCenter():Point{
var _local1:Number = 0;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:Number = 0;
var _local5:int;
while (_local5 < block.length) {
_local1 = Math.max(block[_local5].xp, _local1);
_local2 = Math.max(block[_local5].yp, _local2);
_local3 = Math.min(block[_local5].xp, _local3);
_local4 = Math.min(block[_local5].yp, _local4);
_local5++;
};
return (new Point(((_local1 + _local3) / 2), ((_local2 + _local4) / 2)));
}
public function Rotate(){
var _local1:int;
var _local2:int;
var _local3:int;
while (_local3 < block.length) {
block[_local3].StoreState();
_local1 = block[_local3].xp;
_local2 = block[_local3].yp;
block[_local3].xp = -(_local2);
block[_local3].yp = _local1;
_local3++;
};
}
public function Rewind():void{
xp = xpPrev;
yp = ypPrev;
}
}
}//package
Section 77 (118 B)
//clickBut (clickBut)
package {
import flash.media.*;
public dynamic class clickBut extends Sound {
}
}//package
Section 78 (256 B)
//effectHero (effectHero)
package {
import flash.display.*;
public dynamic class effectHero extends MovieClip {
public function effectHero(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
visible = false;
}
}
}//package
Section 79 (5.09 KiB) ● ●
//mainClass (mainClass)
package {
import main.*;
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import CPMStar.*;
import flash.ui.*;
import flash.filters.*;
import flash.system.*;
public dynamic class mainClass extends MovieClip {
public var transFX:screenBlink;
var backBuffer:BitmapData;
public var tvFrame:MovieClip;
public var my_cMenu:ContextMenu;
public var myLogoPreload:MovieClip;
public var ingame:ingameMenu;
public var modeMenu:modeMenu;
public var soundSwitch:MovieClip;
public var adBox:adBoxClass;
public var timerLogo2:Timer;
public var CPMStarContentSpotID:String;
public var noAds:Boolean;
public var ad:DisplayObject;
public var gameBG:MovieClip;
public var mainMenu:mainMenu;
public var curFrameNum:int;// = 0
public var mads:adMY;
public var curLev:Level;// = null
public var myLogoSplash:MovieClip;
public var easyMode:Boolean;// = true
public var levStartMenu:MovieClip;
var blur_filter:BlurFilter;
public var winMenu:winMenu;
var b:Bitmap;
public var gameGUI:MovieClip;
public var preloader:preloader;
public var scoreBoardShowed:Boolean;// = false
public function mainClass(){
blur_filter = new BlurFilter(10, 10, 2);
super();
addFrameScript(0, frame1, 1, frame2, 3, frame4);
initBack();
}
public function deinitBack():void{
removeChild(b);
removeEventListener(Event.ENTER_FRAME, update);
}
public function initBack():void{
backBuffer = new BitmapData(stage.stageWidth, stage.stageHeight, false);
b = new Bitmap(backBuffer, PixelSnapping.ALWAYS);
addChild(b);
b.blendMode = BlendMode.DARKEN;
b.alpha = 0.5;
addEventListener(Event.ENTER_FRAME, update);
}
public function clickMyGamPreload(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.onlinegamer.cc?utm_source=FrustraBit&utm_medium=preloader"), "_blank");
}
public function delLevel(){
curLev.term();
removeChild(curLev);
curLev = null;
}
public function timerLogo2_Timer(_arg1:TimerEvent):void{
play();
}
public function update(_arg1:Event):void{
if (((!(scoreBoardShowed)) && (!((currentFrame == 1))))){
b.visible = false;
tvFrame.visible = false;
backBuffer.lock();
backBuffer.draw(this, null, null, null, new Rectangle(0, 0, 640, 480));
backBuffer.applyFilter(backBuffer, new Rectangle(0, 0, 640, 480), new Point(0, 0), blur_filter);
backBuffer.unlock();
b.visible = true;
tvFrame.visible = true;
};
}
public function soundSwitch_Click(_arg1:MouseEvent):void{
if (soundSwitch.currentFrame == 1){
soundSwitch.gotoAndStop(2);
sounds.sndEnable = false;
musicEnv.musEnable = false;
musicEnv.played(false);
if (mainClass(root).curLev){
mainClass(root).curLev.movedStop();
};
} else {
soundSwitch.gotoAndStop(1);
sounds.sndEnable = true;
musicEnv.musEnable = true;
musicEnv.played(true);
};
}
public function loadLevel(_arg1:int){
if (curLev != null){
delLevel();
};
var _local2:String = ("main.Level" + _arg1);
var _local3:Class = (getDefinitionByName(_local2) as Class);
curLev = new (_local3);
curLev.visible = true;
curLev.curLevelNum = _arg1;
gameGUI.visible = true;
levStartMenu.hlp1.visible = (_arg1 == 1);
levStartMenu.hlp2.visible = (_arg1 == 2);
levStartMenu.hlp3.visible = (_arg1 == 3);
levStartMenu.hlp5.visible = (_arg1 == 5);
var _local4:int = getChildIndex(gameBG);
addChildAt(curLev, (_local4 + 1));
}
function frame1(){
tvFrame.mouseEnabled = false;
tvFrame.mouseChildren = false;
stop();
transFX.visible = false;
Controls.regMC(stage);
stage.quality = "medium";
my_cMenu = new ContextMenu();
my_cMenu.hideBuiltInItems();
contextMenu = my_cMenu;
MochiServices.connect("71d1bae1cf33e3c4", stage);
myLogoPreload.buttonMode = true;
myLogoPreload.addEventListener(MouseEvent.CLICK, clickMyGamPreload);
this.noAds = ((preloader.isUrl(["kongregate.com", "www.kongregate.com"])) || (preloader.isUrl(["flashgamelicense.com", "www.flashgamelicense.com"])));
if (!this.noAds){
CPMStarContentSpotID = "4131QFEB364E7";
ad = new AdLoader(CPMStarContentSpotID);
adBox.addChild(ad);
} else {
mads = new adMY();
adBox.addChild(mads);
};
MochiBot.track(this, "bf1c618e");
}
function frame2(){
stop();
sounds.init(stage.stageWidth, stage.stageHeight);
musicEnv.init();
fxcache.init();
timerLogo2 = new Timer(6000, 1);
timerLogo2.start();
timerLogo2.addEventListener(TimerEvent.TIMER, timerLogo2_Timer);
myLogoSplash.buttonMode = true;
myLogoSplash.addEventListener(MouseEvent.CLICK, clickmyLogoSplash);
}
function frame4(){
soundSwitch.buttonMode = true;
soundSwitch.addEventListener(MouseEvent.CLICK, soundSwitch_Click);
stop();
levStartMenu.visible = false;
gameGUI.visible = false;
musicEnv.fadeTo("mainmusic");
}
public function clickmyLogoSplash(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.onlinegamer.cc?utm_source=FrustraBit&utm_medium=splash"), "_blank");
}
}
}//package
Section 80 (121 B)
//mainmusic (mainmusic)
package {
import flash.media.*;
public dynamic class mainmusic extends Sound {
}
}//package
Section 81 (115 B)
//oglogo2 (oglogo2)
package {
import flash.media.*;
public dynamic class oglogo2 extends Sound {
}
}//package
Section 82 (127 B)
//RowEffect (RowEffect)
package {
import flash.display.*;
public dynamic class RowEffect extends MovieClip {
}
}//package
Section 83 (112 B)
//sndbad (sndbad)
package {
import flash.media.*;
public dynamic class sndbad extends Sound {
}
}//package
Section 84 (115 B)
//sndbutt (sndbutt)
package {
import flash.media.*;
public dynamic class sndbutt extends Sound {
}
}//package
Section 85 (115 B)
//sndCool (sndCool)
package {
import flash.media.*;
public dynamic class sndCool extends Sound {
}
}//package
Section 86 (118 B)
//sndDeath (sndDeath)
package {
import flash.media.*;
public dynamic class sndDeath extends Sound {
}
}//package
Section 87 (118 B)
//sndmoved (sndmoved)
package {
import flash.media.*;
public dynamic class sndmoved extends Sound {
}
}//package
Section 88 (112 B)
//sndOrb (sndOrb)
package {
import flash.media.*;
public dynamic class sndOrb extends Sound {
}
}//package
Section 89 (118 B)
//sndstart (sndstart)
package {
import flash.media.*;
public dynamic class sndstart extends Sound {
}
}//package
Section 90 (115 B)
//sndTime (sndTime)
package {
import flash.media.*;
public dynamic class sndTime extends Sound {
}
}//package
Section 91 (112 B)
//sndWin (sndWin)
package {
import flash.media.*;
public dynamic class sndWin extends Sound {
}
}//package
Section 92 (8.82 KiB) ● ●
//Tetris (Tetris)
package {
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import main.*;
public class Tetris extends MovieClip {
const PIECEPOINTS = 10;
public const lineMax = 5;
const LINEPOINTS = 800;
const LEVELINC = 6000;
const BLOCKSIZE = 30;
public var txtScore:TextField;
var rowEffect:MovieClip;
var aryBlockSum;
var score:int;
var moveDown:Boolean;// = false
var aryBlockRow;
var bCanvasBufferData:BitmapData;
var ii:int;
var body:Body;
var bData:BitmapData;
var bPreviewBufferData:BitmapData;
public var dontStop:Boolean;// = false
var nextBody:Body;
var bCanvasBuffer:Bitmap;
var currentConStep:Number;// = 0
var level:int;
var totalSteps:int;// = 20
public var cnvMain:MovieClip;
var jj:int;
var gameOver:Boolean;// = false
public var isRunning:Boolean;// = false
var rowEffectCount;// = 0
public var cnvPreview:MovieClip;
var currentStep:Number;// = 0
var bAlphaData:BitmapData;
public var txtLines:TextField;
var scoreMultiplier:int;
public var txtLevel:TextField;
var bPreviewBuffer:Bitmap;
var levelIncScore:int;
public var lines:int;
public function Tetris():void{
loadGame();
}
public function loadGame():void{
bCanvasBufferData = new BitmapData(cnvMain.width, cnvMain.height, true);
bCanvasBuffer = new Bitmap(bCanvasBufferData);
cnvMain.addChild(bCanvasBuffer);
bPreviewBufferData = new BitmapData(cnvPreview.width, cnvPreview.height);
bPreviewBuffer = new Bitmap(bPreviewBufferData);
cnvPreview.addChild(bPreviewBuffer);
var _local1:MovieClip = new BlockMap();
bData = new BitmapData(210, 28, false);
bData.draw(_local1);
addEventListener(Event.ENTER_FRAME, Run);
init();
}
function collisionCheckRotate():void{
ii = 0;
while (ii < body.block.length) {
if (((((((body.xp + body.block[ii].xp) > (cnvMain.width - BLOCKSIZE))) || (((body.xp + body.block[ii].xp) < 0)))) || (((body.yp + body.block[ii].yp) >= (cnvMain.height - BLOCKSIZE))))){
body.RewindRotate();
return;
};
ii++;
};
jj = 0;
while (jj < aryBlockRow.length) {
ii = 0;
while (ii < aryBlockRow[jj].length) {
if (aryBlockRow[jj][ii]){
if (body.CollisionCheck(aryBlockRow[jj][ii])){
body.RewindRotate();
};
};
ii++;
};
jj++;
};
}
function init():void{
body = new Body(150, -(BLOCKSIZE));
nextBody = new Body(150, -(BLOCKSIZE));
aryBlockRow = new Array();
aryBlockSum = new Array();
ii = 0;
while (ii < 18) {
aryBlockRow[ii] = new Array();
aryBlockSum[ii] = 0;
ii++;
};
if (rowEffect){
cnvMain.removeChild(rowEffect);
};
gameOver = false;
isRunning = false;
score = 0;
lines = 0;
level = 1;
scoreMultiplier = 0;
txtScore.text = "0";
txtLines.text = (("0" + "/") + lineMax.toString());
txtLevel.text = "1";
bCanvasBufferData.fillRect(new Rectangle(0, 0, bCanvasBufferData.width, bCanvasBufferData.height), 0);
bPreviewBufferData.fillRect(new Rectangle(0, 0, bPreviewBufferData.width, bPreviewBufferData.height), 0);
ii = 0;
while (ii < nextBody.block.length) {
bPreviewBufferData.copyPixels(bData, new Rectangle(nextBody.block[ii].spriteoffset, 1, 28, 28), new Point(((nextBody.block[ii].xp - nextBody.GetCenter().x) + 60), ((nextBody.block[ii].yp - nextBody.GetCenter().y) + 26)));
ii++;
};
}
function commitBody(){
var _local1:int;
body.Rewind();
ii = 0;
while (ii < body.block.length) {
if ((body.yp + body.block[ii].yp) <= 0){
isRunning = false;
gameOver = true;
moveDown = false;
return;
};
aryBlockRow[((body.yp + body.block[ii].yp) / BLOCKSIZE)][((body.xp + body.block[ii].xp) / BLOCKSIZE)] = new Block((body.xp + body.block[ii].xp), (body.yp + body.block[ii].yp), body.block[ii].spriteoffset);
score = (score + PIECEPOINTS);
levelIncScore = (levelIncScore + PIECEPOINTS);
txtScore.text = score.toString();
var _local2 = aryBlockSum;
var _local3 = ((body.yp + body.block[ii].yp) / BLOCKSIZE);
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
ii++;
};
ii = 0;
while (ii < aryBlockSum.length) {
if (aryBlockSum[ii] == 10){
score = (score + (scoreMultiplier * LINEPOINTS));
scoreMultiplier++;
levelIncScore = (levelIncScore + (scoreMultiplier * LINEPOINTS));
lines++;
txtScore.text = score.toString();
txtLines.text = ((lines.toString() + "/") + lineMax.toString());
sounds.PlaySnd("Death");
if (rowEffect){
cnvMain.removeChild(rowEffect);
};
rowEffect = new RowEffect();
cnvMain.addChild(rowEffect);
rowEffectCount = 20;
rowEffect.x = (rowEffect.x + 150);
rowEffect.y = (rowEffect.y + (ii * BLOCKSIZE));
aryBlockRow.splice(ii, 1);
aryBlockSum.splice(ii, 1);
aryBlockRow.unshift(new Array());
aryBlockSum.unshift(0);
jj = 0;
while (jj <= ii) {
_local1 = 0;
while (_local1 < aryBlockRow[jj].length) {
if (aryBlockRow[jj][_local1]){
aryBlockRow[jj][_local1].yp = (aryBlockRow[jj][_local1].yp + BLOCKSIZE);
};
_local1++;
};
jj++;
};
};
ii++;
};
scoreMultiplier = 1;
body = nextBody;
nextBody = new Body(150, -(BLOCKSIZE));
bPreviewBufferData.fillRect(new Rectangle(0, 0, bCanvasBufferData.width, bCanvasBufferData.height), 0);
ii = 0;
while (ii < nextBody.block.length) {
bPreviewBufferData.copyPixels(bData, new Rectangle(nextBody.block[ii].spriteoffset, 1, 28, 28), new Point(((nextBody.block[ii].xp - nextBody.GetCenter().x) + 60), ((nextBody.block[ii].yp - nextBody.GetCenter().y) + 26)));
ii++;
};
}
function collisionCheckVertical():void{
ii = 0;
while (ii < body.block.length) {
if ((body.yp + body.block[ii].yp) >= (cnvMain.height - BLOCKSIZE)){
commitBody();
return;
};
ii++;
};
jj = 0;
while (jj < aryBlockRow.length) {
ii = 0;
while (ii < aryBlockRow[jj].length) {
if (aryBlockRow[jj][ii]){
if (body.CollisionCheck(aryBlockRow[jj][ii])){
commitBody();
return;
};
};
ii++;
};
jj++;
};
}
public function key_released(_arg1:int):void{
switch (_arg1){
case 40:
moveDown = false;
break;
};
}
public function key_pressed(_arg1:int):void{
if (isRunning){
switch (_arg1){
case 38:
body.Rotate();
collisionCheckRotate();
break;
case 40:
moveDown = true;
break;
case 37:
body.Move(-(BLOCKSIZE), 0);
collisionCheckHorizontal();
break;
case 39:
body.Move(BLOCKSIZE, 0);
collisionCheckHorizontal();
break;
};
};
if (_arg1 == 32){
isRunning = !(isRunning);
if (gameOver){
init();
isRunning = true;
};
};
}
function collisionCheckHorizontal():void{
ii = 0;
while (ii < body.block.length) {
if (((((body.xp + body.block[ii].xp) > (cnvMain.width - BLOCKSIZE))) || (((body.xp + body.block[ii].xp) < 0)))){
body.Rewind();
return;
};
ii++;
};
jj = 0;
while (jj < aryBlockRow.length) {
ii = 0;
while (ii < aryBlockRow[jj].length) {
if (aryBlockRow[jj][ii]){
if (body.CollisionCheck(aryBlockRow[jj][ii])){
body.Rewind();
};
};
ii++;
};
jj++;
};
}
function Run(_arg1:Event):void{
if (!isRunning){
return;
};
if (gameOver){
init();
return;
};
currentStep = (currentStep + Math.sqrt((1.35 * level)));
currentConStep = (currentConStep + 1);
if (levelIncScore >= LEVELINC){
level++;
levelIncScore = 0;
txtLevel.text = level.toString();
};
if (currentStep >= totalSteps){
currentStep = 0;
body.Move(0, BLOCKSIZE);
collisionCheckVertical();
} else {
if (((((currentConStep * 10) >= totalSteps)) && (moveDown))){
currentConStep = 0;
body.Move(0, BLOCKSIZE);
collisionCheckVertical();
};
};
if (rowEffectCount != 0){
rowEffectCount--;
if (rowEffectCount == 0){
cnvMain.removeChild(rowEffect);
rowEffect = null;
};
};
bCanvasBufferData.fillRect(new Rectangle(0, 0, bCanvasBufferData.width, bCanvasBufferData.height), 0);
ii = 0;
while (ii < body.block.length) {
bCanvasBufferData.copyPixels(bData, new Rectangle(body.block[ii].spriteoffset, 1, 28, 28), new Point(((body.xp + body.block[ii].xp) + 2), ((body.yp + body.block[ii].yp) + 1)));
ii++;
};
jj = 0;
while (jj < aryBlockRow.length) {
ii = 0;
while (ii < aryBlockRow[jj].length) {
if (aryBlockRow[jj][ii]){
bCanvasBufferData.copyPixels(bData, new Rectangle(aryBlockRow[jj][ii].spriteoffset, 1, 28, 28), new Point((aryBlockRow[jj][ii].xp + 2), (aryBlockRow[jj][ii].yp + 1)));
};
ii++;
};
jj++;
};
}
}
}//package