Section 1
//DebugDispatcher (com.blitzagency.xray.logger.events.DebugDispatcher)
package com.blitzagency.xray.logger.events {
import flash.events.*;
public class DebugDispatcher extends EventDispatcher {
public static var TRACE:String = "trace";
public function sendEvent(_arg1:String, _arg2:Object):void{
dispatchEvent(new DebugEvent(DebugDispatcher.TRACE, false, false, _arg2));
}
}
}//package com.blitzagency.xray.logger.events
Section 2
//DebugEvent (com.blitzagency.xray.logger.events.DebugEvent)
package com.blitzagency.xray.logger.events {
import flash.events.*;
public class DebugEvent extends Event {
public var obj:Object;
public function DebugEvent(_arg1:String, _arg2:Boolean, _arg3:Boolean, _arg4:Object):void{
obj = new Object();
super(_arg1, _arg2, _arg3);
obj = _arg4;
}
}
}//package com.blitzagency.xray.logger.events
Section 3
//ObjectTools (com.blitzagency.xray.logger.util.ObjectTools)
package com.blitzagency.xray.logger.util {
import com.blitzagency.xray.logger.*;
import flash.utils.*;
public class ObjectTools {
private static var log:XrayLog = new XrayLog();
public function resolveBaseType(_arg1:Object):String{
return ("");
}
public static function getImmediateClassPath(_arg1:Object):String{
var _local2:String;
var _local3:String;
_local2 = getQualifiedClassName(_arg1);
_local3 = getQualifiedSuperclassName(_arg1);
_local2 = ((_local2.indexOf("::") > -1)) ? _local2.split("::").join(".") : _local2;
if (_local3 == null){
return (_local2);
};
_local3 = ((_local3.indexOf("::") > -1)) ? _local3.split("::").join(".") : _local3;
return (((_local3 + ".") + _local2));
}
public static function getFullClassPath(_arg1:Object):String{
var _local2:XML;
var _local3:Array;
var _local4:String;
var _local5:XML;
var _local6:String;
_local2 = describeType(_arg1);
_local3 = [];
_local4 = getQualifiedClassName(_arg1);
_local4 = ((_local4.indexOf("::") > -1)) ? _local4.split("::").join(".") : _local4;
_local3.push(_local4);
for each (_local5 in _local2.extendsClass) {
_local6 = ((_local5.@type.toString().indexOf("::") > -1)) ? _local5.@type.toString().split("::")[1] : _local5.@type.toString();
_local3.push(_local6);
};
return (_local3.join("."));
}
}
}//package com.blitzagency.xray.logger.util
Section 4
//PropertyTools (com.blitzagency.xray.logger.util.PropertyTools)
package com.blitzagency.xray.logger.util {
import flash.utils.*;
public class PropertyTools {
private static function getVariables():void{
}
public static function getProperties(_arg1:Object):Array{
var ary:Array;
var xmlDoc:XML;
var item:XML;
var name:String;
var type:String;
var value:Object;
var obj = _arg1;
ary = [];
try {
xmlDoc = describeType(obj);
for each (item in xmlDoc.variable) {
name = item.@name.toString();
type = item.@type.toString();
value = ((obj[name])!=null) ? obj[name] : "";
ary.push({name:name, type:type, value:value});
};
} catch(e:Error) {
};
return (ary);
}
private static function getMethods():void{
}
}
}//package com.blitzagency.xray.logger.util
Section 5
//Debug (com.blitzagency.xray.logger.Debug)
package com.blitzagency.xray.logger {
import flash.events.*;
import flash.utils.*;
import com.blitzagency.xray.logger.events.*;
import flash.net.*;
public class Debug {
private static var connected:Boolean = false;
private static var xrayLC:LocalConnection;
private static var ed:DebugDispatcher = new DebugDispatcher();
public static function traceObject(_arg1:Object, _arg2:Number=254, _arg3:Number=0, _arg4:String="", _arg5:Number=0):void{
var recurseDepth:Number;
var indent:Number;
var prop:String;
var lead:String;
var i:Number;
var obj:String;
var o = _arg1;
var pRecurseDepth = _arg2;
var pIndent = _arg3;
var pPackage = _arg4;
var pLevel = _arg5;
try {
recurseDepth = pRecurseDepth;
indent = pIndent;
for (prop in o) {
lead = "";
i = 0;
while (i < indent) {
lead = (lead + " ");
i = (i + 1);
};
obj = o[prop].toString();
if ((o[prop] is Array)){
obj = "[Array]";
};
if (obj == "[object Object]"){
obj = "[Object]";
};
Debug.trace((((lead + prop) + ": ") + obj), pPackage, pLevel);
if (recurseDepth > 0){
Debug.traceObject(o[prop], (recurseDepth - 1), (indent + 1), pPackage, pLevel);
};
};
} catch(e:Error) {
};
}
public static function trace(_arg1:Object, _arg2:String="", _arg3:Number=0):void{
var msg:String;
var pMsg = _arg1;
var pPackage = _arg2;
var pLevel = _arg3;
ed.sendEvent(DebugDispatcher.TRACE, {message:pMsg, classPackage:pPackage});
if (!connected){
makeConnection();
};
if (connected){
try {
msg = ((String(pMsg).length >= 39995)) ? (String(pMsg).substr(0, 39995) + "...") : String(pMsg);
xrayLC.send("_xray_view_conn", "setTrace", msg, pLevel, pPackage);
} catch(e:LogError) {
LogError("No Xray Interface running");
};
};
}
private static function makeConnection():void{
var err:LogError;
xrayLC = new LocalConnection();
xrayLC.addEventListener("status", statusHandler);
xrayLC.allowDomain("*");
try {
xrayLC.connect(("_xray_standAlone_debug" + getTimer()));
connected = true;
} catch(e:Error) {
err = new LogError("log");
setTimeout(makeConnection, 1000);
};
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
ed.addEventListener(_arg1, _arg2);
}
private static function initialize():Boolean{
ed = new DebugDispatcher();
return (true);
}
private static function statusHandler(_arg1:StatusEvent):void{
if ((((((_arg1.code == null)) && ((_arg1.level == "error")))) && (connected))){
connected = false;
} else {
if ((((_arg1.level == "status")) && ((_arg1.code == null)))){
connected = true;
};
};
}
}
}//package com.blitzagency.xray.logger
class LogError extends Error {
private function LogError(_arg1:String){
super(_arg1);
}
}
Section 6
//Log (com.blitzagency.xray.logger.Log)
package com.blitzagency.xray.logger {
import com.blitzagency.xray.logger.util.*;
public class Log {
private var level:Number;
private var caller:String;// = ""
private var classPackage:String;
private var dump:Object;
private var message:String;
public function Log(_arg1:String, _arg2:Object, _arg3:Number, ... _args){
var err:LogError;
var nullArray:Array;
var str:String;
var p_message = _arg1;
var p_dump = _arg2;
var p_level = _arg3;
var rest = _args;
caller = "";
super();
try {
nullArray.push("bogus");
} catch(e:Error) {
err = new LogError("log");
} finally {
if (err.hasOwnProperty("getStackTrace")){
str = err.getStackTrace();
setCaller(resolveCaller(str));
} else {
setCaller("");
};
setMessage(p_message);
setDump(p_dump);
setLevel(p_level);
setClassPackage(p_dump);
};
}
public function setLevel(_arg1:Number):void{
level = _arg1;
}
public function getCaller():String{
return (caller);
}
public function setMessage(_arg1:String):void{
message = _arg1;
}
public function getLevel():Number{
return (level);
}
public function getDump():Object{
return (dump);
}
public function setCaller(_arg1:String):void{
caller = _arg1;
}
public function setClassPackage(_arg1:Object):void{
classPackage = ObjectTools.getImmediateClassPath(_arg1);
}
public function getMessage():String{
return (message);
}
public function getClassPackage():String{
return (classPackage);
}
public function setDump(_arg1:Object):void{
dump = _arg1;
}
private function resolveCaller(_arg1:String):String{
var ary:Array;
var str = _arg1;
ary = [];
try {
str = str.split("\n").join("");
ary = str.split("\tat ");
str = ary[3];
} catch(e:Error) {
} finally {
str = "";
};
return (str);
}
}
}//package com.blitzagency.xray.logger
class LogError extends Error {
private function LogError(_arg1:String){
super(_arg1);
}
}
Section 7
//Logger (com.blitzagency.xray.logger.Logger)
package com.blitzagency.xray.logger {
public interface Logger {
function setLevel(_arg1:Number=0):void;
function debug(_arg1:Log):void;
function fatal(_arg1:Log):void;
function warn(_arg1:Log):void;
function error(_arg1:Log):void;
function log(_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Object=null):void;
function info(_arg1:Log):void;
}
}//package com.blitzagency.xray.logger
Section 8
//XrayLog (com.blitzagency.xray.logger.XrayLog)
package com.blitzagency.xray.logger {
public class XrayLog {
private var logger:XrayLogger;
public function XrayLog(){
logger = XrayLogger.getInstance();
}
public function debug(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
logger.debug(new Log(_arg1, null, XrayLogger.DEBUG));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.debug(new Log(_arg1, _args[_local3], XrayLogger.DEBUG));
_local3++;
};
}
public function fatal(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
logger.fatal(new Log(_arg1, null, XrayLogger.FATAL));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.fatal(new Log(_arg1, _args[_local3], XrayLogger.FATAL));
_local3++;
};
}
public function info(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
logger.info(new Log(_arg1, null, XrayLogger.INFO));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.info(new Log(_arg1, _args[_local3], XrayLogger.INFO));
_local3++;
};
}
public function warn(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
logger.warn(new Log(_arg1, null, XrayLogger.WARN));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.warn(new Log(_arg1, _args[_local3], XrayLogger.WARN));
_local3++;
};
}
public function error(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
logger.error(new Log(_arg1, null, XrayLogger.ERROR));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
logger.error(new Log(_arg1, _args[_local3], XrayLogger.ERROR));
_local3++;
};
}
}
}//package com.blitzagency.xray.logger
Section 9
//XrayLogger (com.blitzagency.xray.logger.XrayLogger)
package com.blitzagency.xray.logger {
import flash.events.*;
import flash.utils.*;
import com.blitzagency.xray.logger.util.*;
public class XrayLogger extends EventDispatcher implements Logger {
private var displayObjectRecursionDepth:Number;// = 3
private var level:Number;// = 0
private var indentation:Number;// = 0
private var objectRecursionDepth:Number;// = 254
private var filters:Array;
public static var FATAL:Number = 4;
public static var WARN:Number = 2;
public static var ERROR:Number = 3;
public static var INFO:Number = 1;
public static var DEBUG:Number = 0;
private static var _instance:XrayLogger = null;
public static var NONE:Number = 5;
public function XrayLogger(){
level = 0;
displayObjectRecursionDepth = 3;
objectRecursionDepth = 254;
indentation = 0;
filters = [];
super();
}
public function checkFilters():Boolean{
var _local1:uint;
if (filters.length == 0){
return (true);
};
_local1 = 0;
while (_local1 < filters.length) {
_local1++;
};
return (true);
}
public function debug(_arg1:Log):void{
if (_arg1.getLevel() == level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 0, _arg1.getDump());
};
}
public function setIndentation(_arg1:Number=0):void{
indentation = _arg1;
}
public function error(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 3, _arg1.getDump());
};
}
public function setLevel(_arg1:Number=0):void{
level = _arg1;
}
public function fatal(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 4, _arg1.getDump());
};
}
public function warn(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 2, _arg1.getDump());
};
}
public function setObjectRecursionDepth(_arg1:Number):void{
objectRecursionDepth = _arg1;
}
public function setDisplayClipRecursionDepth(_arg1:Number):void{
displayObjectRecursionDepth = _arg1;
}
public function info(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 1, _arg1.getDump());
};
}
public function log(_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Object=null):void{
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:Object;
_local6 = (("(" + getTimer()) + ") ");
if (_arg3.length > 0){
_local6 = (_local6 + (_arg2 + "\n"));
};
_local6 = (_local6 + _arg1);
if (_arg1.length > 0){
Debug.trace(_local6, _arg3, _arg4);
};
if (_arg5 == null){
return;
};
_local7 = typeof(_arg5);
if ((((((((((_local7 == "string")) || ((_local7 == "number")))) || ((_local7 == "boolean")))) || ((_local7 == "undefined")))) || ((_local7 == "null")))){
Debug.trace(_arg5, _arg3, _arg4);
} else {
if (_local7 == "xml"){
Debug.trace(_arg5.toString(), _arg3, _arg4);
} else {
_local8 = ObjectTools.getImmediateClassPath(_arg5);
if ((((_local8 == "Object")) || ((_local8 == "Object.Array")))){
Debug.traceObject(_arg5, objectRecursionDepth, indentation, _arg3, _arg4);
} else {
_local9 = PropertyTools.getProperties(_arg5);
Debug.traceObject(_local9, displayObjectRecursionDepth, indentation, _arg3, _arg4);
};
};
};
}
public function setFilters(_arg1:Array):void{
filters = _arg1;
}
public static function getInstance():XrayLogger{
if (_instance == null){
_instance = new (XrayLogger);
};
return (_instance);
}
public static function resolveLevelAsName(_arg1:Number):String{
switch (_arg1){
case 0:
return ("debug");
case 1:
return ("info");
case 2:
return ("warn");
case 3:
return ("error");
case 4:
return ("fatal");
default:
return ("debug");
};
}
}
}//package com.blitzagency.xray.logger
Section 10
//Stinger3D (com.candystand.Stinger.Stinger3D)
package com.candystand.Stinger {
import flash.events.*;
import com.caurina.transitions.*;
import flash.geom.*;
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import com.caurina.transitions.properties.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
public class Stinger3D extends MovieClip {
public var containerMask:MovieClip;
private var camera:Camera3D;
private var anglePerPlane:Number;
private var center:DisplayObject3D;
private var startTime:Number;
public var buttonText:TextField;
private var container:Sprite;
private var planes:Array;
private var radius:Number;// = 540
private var numImages:int;// = 20
private var scene:MovieScene3D;
public static var GAME_NAMES:Array = ["Vector TD2", "Headcase", "Insurgo", "Jetboost", "Linegolfer", "Good Ol' Poker", "Polarity", "Pow Pool", "Streetball Jam", "Slipstream"];
public static var GAME_LINKS:Array = ["http://www.candystand.com/play.do?id=18281", "http://www.candystand.com/play.do?id=18252", "http://www.candystand.com/play.do?id=18303", "http://www.candystand.com/play.do?id=18189", "http://www.candystand.com/play.do?id=18253", "http://www.candystand.com/play.do?id=18316", "http://www.candystand.com/play.do?id=17986", "http://www.candystand.com/play.do?id=18201", "http://www.candystand.com/play.do?id=18309", "http://www.candystand.com/play.do?id=18290"];
public function Stinger3D(){
numImages = 20;
radius = 540;
anglePerPlane = ((Math.PI * 2) / numImages);
super();
DisplayShortcuts.init();
this.addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
trace("Created Stinger3D");
}
public function destroy():void{
this.removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
this.removeEventListener(Event.ENTER_FRAME, this.loop);
this.parent.removeChild(this);
}
private function onPressHandler(_arg1:MouseEvent):void{
var _local2:int;
var _local3:URLRequest;
if (_arg1.target.visible){
_local2 = int(_arg1.target.name.split("_")[1]);
_local3 = new URLRequest(Stinger3D.GAME_LINKS[(_local2 % Stinger3D.GAME_NAMES.length)]);
navigateToURL(_local3, "_blank");
};
}
private function onRollOutHandler(_arg1:MouseEvent):void{
if (_arg1.target.visible){
Tweener.addTween(_arg1.target, {scaleX:1, scaleY:1, time:0.5});
this.buttonText.text = "";
};
}
private function orientPlanes():void{
var _local1:*;
var _local2:*;
var _local3:Number;
var _local4:Number;
_local1 = 0;
while (_local1 < this.numImages) {
_local2 = _local1;
_local3 = (Math.cos((_local2 * this.anglePerPlane)) * this.radius);
_local4 = (Math.sin((_local2 * this.anglePerPlane)) * this.radius);
this.planes[_local1].extra = new Object();
this.planes[_local1].extra.angle = ((_local2 * this.anglePerPlane) * (180 / Math.PI));
Tweener.addTween(this.planes[_local1], {x:_local3, y:0, z:_local4, time:1, delay:((_local1 * 0.1) + 2), onUpdate:this.onMoveUpdate, onUpdateParams:[this.planes[_local1]]});
_local1++;
};
}
private function onMoveUpdate(_arg1:Plane):void{
_arg1.lookAt(this.center);
if (_arg1.z >= 15){
_arg1.container.alpha = 0.3;
} else {
_arg1.container.alpha = 1;
};
}
private function correctDegrees(_arg1:Number):Number{
_arg1 = (_arg1 % 360);
if (_arg1 < 0){
_arg1 = (_arg1 + 360);
};
return (_arg1);
}
private function spinPlanes(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:Number;
var _local6:Number;
_local2 = 0;
while (_local2 < this.numImages) {
_local3 = (this.planes[_local2].extra.angle + _arg1);
this.planes[_local2].extra.angle = _local3;
_local4 = (_local3 * (Math.PI / 180));
_local5 = (Math.cos(_local4) * this.radius);
_local6 = (Math.sin(_local4) * this.radius);
this.planes[_local2].x = _local5;
this.planes[_local2].z = _local6;
this.onMoveUpdate(this.planes[_local2]);
_local2++;
};
}
private function onRollOverHandler(_arg1:MouseEvent):void{
var _local2:int;
if (_arg1.target.visible){
_local2 = int(_arg1.target.name.split("_")[1]);
Tweener.addTween(_arg1.target, {scaleX:1.1, scaleY:1.1, time:0.5});
this.buttonText.text = Stinger3D.GAME_NAMES[(_local2 % Stinger3D.GAME_NAMES.length)].toUpperCase();
};
}
private function onAddedToStage(_arg1:Event):void{
var _local2:int;
var _local3:int;
init3D();
_local2 = 0;
while (_local2 < this.numImages) {
_local3 = (_local2 - 14);
if (_local3 < 0){
_local3 = (_local2 + 6);
};
this.createImagePlane(_local3);
_local2++;
};
this.orientPlanes();
this.startTime = getTimer();
this.addEventListener(Event.ENTER_FRAME, this.loop, false, 0, true);
}
private function loop(_arg1:Event):void{
var _local2:int;
var _local3:Number;
if (getTimer() >= (this.startTime + 3000)){
_local2 = 0;
if ((((this.mouseX > _local2)) || ((this.mouseX < -(_local2))))){
if (this.mouseX < 0){
_local2 = (_local2 * -1);
};
_local3 = ((this.mouseX - _local2) / ((stage.stageWidth / 2) - _local2));
_local3 = (_local3 * -2);
this.spinPlanes(_local3);
};
};
scene.renderCamera(this.camera);
}
private function init3D():void{
var _local1:int;
var _local2:int;
this.container = new Sprite();
this.addChildAt(this.container, this.getChildIndex(this.buttonText));
this.container.x = 0;
this.container.y = 75;
this.scene = new MovieScene3D(this.container);
this.camera = new Camera3D();
this.camera.zoom = 5;
this.camera.focus = 100;
this.center = new DisplayObject3D();
this.planes = new Array();
_local1 = 725;
_local2 = 440;
this.containerMask.width = _local1;
this.containerMask.height = _local2;
this.containerMask.x = -((_local1 / 2));
this.containerMask.y = -((_local2 / 2));
this.container.cacheAsBitmap = true;
this.containerMask.cacheAsBitmap = true;
this.container.mask = this.containerMask;
}
private function createReflectedBitmap(_arg1:BitmapData):BitmapData{
var _local2:Boolean;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:MovieClip;
var _local7:MovieClip;
var _local8:MovieClip;
var _local9:BitmapData;
var _local10:Matrix;
var _local11:MovieClip;
var _local12:*;
_local2 = true;
_local3 = 1;
_local4 = 0.3;
_local5 = Math.floor((Math.random() * 1000000));
_local6 = new MovieClip();
_local7 = new MovieClip();
_local7.addChild(new Bitmap(_arg1));
_local8 = new MovieClip();
_local9 = new BitmapData(_arg1.width, (_arg1.height * 0.6));
_local9.draw(_arg1, new Matrix(1, 0, 0, -1, 0, _arg1.height));
_local8.addChild(new Bitmap(_local9));
_local10 = new Matrix();
_local10.createGradientBox(_local9.width, _local9.height, (Math.PI / 2));
_local11 = new MovieClip();
_local8.y = ((_local7.y + _local7.height) + 5);
_local11.graphics.lineStyle(0, 0xFFFFFF, 0);
_local11.graphics.beginGradientFill("linear", [0, 0xFFFFFF], [_local4, 0], [0, 150], _local10);
_local11.graphics.moveTo(0, 0);
_local11.graphics.lineTo(_arg1.width, 0);
_local11.graphics.lineTo(_arg1.width, (_local9.height * _local3));
_local11.graphics.lineTo(0, (_local9.height * _local3));
_local11.graphics.lineTo(0, 0);
_local11.graphics.endFill();
_local11.x = _local8.x;
_local11.y = _local8.y;
_local6.addChild(_local7);
_local6.addChild(_local8);
_local6.addChild(_local11);
_local8.cacheAsBitmap = true;
_local11.cacheAsBitmap = true;
_local8.mask = _local11;
_local12 = new BitmapData(_local6.width, _local6.height, _local2, 0);
_local12.draw(_local6);
_arg1.dispose();
_local9.dispose();
return (_local12);
}
private function createImagePlane(_arg1:int):void{
var _local2:int;
var _local3:Class;
var _local4:BitmapData;
var _local5:InteractiveBitmapMaterial;
var _local6:Plane;
var _local7:Sprite;
_local2 = (_arg1 % 10);
_local3 = (getDefinitionByName(("CSSet1Image" + _local2)) as Class);
_local4 = new _local3(240, 240);
_local4 = this.createReflectedBitmap(_local4);
_local5 = new InteractiveBitmapMaterial(_local4);
_local5.doubleSided = true;
_local5.updateBitmap();
_local6 = new Plane(_local5, (_local4.width * 0.625), (_local4.height * 0.625), 2, 2);
this.scene.addChild(_local6, ("CSImage" + String(_arg1)));
_local6.x = -500;
_local6.y = -700;
_local6.z = -500;
_local7 = _local6.container;
_local7.name = ("container_" + _arg1);
_local7.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
_local7.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
_local7.addEventListener(MouseEvent.MOUSE_DOWN, onPressHandler);
this.planes.push(_local6);
}
}
}//package com.candystand.Stinger
Section 11
//DisplayShortcuts (com.caurina.transitions.properties.DisplayShortcuts)
package com.caurina.transitions.properties {
import com.caurina.transitions.*;
import flash.geom.*;
public class DisplayShortcuts {
public function DisplayShortcuts(){
trace("This is an static class and should not be instantiated.");
}
public static function init():void{
Tweener.registerSpecialProperty("_frame", _frame_get, _frame_set);
Tweener.registerSpecialProperty("_autoAlpha", _autoAlpha_get, _autoAlpha_set);
Tweener.registerSpecialPropertySplitter("_scale", _scale_splitter);
Tweener.registerSpecialPropertySplitter("_scrollRect", _scrollRect_splitter);
Tweener.registerSpecialProperty("_scrollRect_x", _scrollRect_property_get, _scrollRect_property_set, ["x"]);
Tweener.registerSpecialProperty("_scrollRect_y", _scrollRect_property_get, _scrollRect_property_set, ["y"]);
Tweener.registerSpecialProperty("_scrollRect_left", _scrollRect_property_get, _scrollRect_property_set, ["left"]);
Tweener.registerSpecialProperty("_scrollRect_right", _scrollRect_property_get, _scrollRect_property_set, ["right"]);
Tweener.registerSpecialProperty("_scrollRect_top", _scrollRect_property_get, _scrollRect_property_set, ["top"]);
Tweener.registerSpecialProperty("_scrollRect_bottom", _scrollRect_property_get, _scrollRect_property_set, ["bottom"]);
Tweener.registerSpecialProperty("_scrollRect_width", _scrollRect_property_get, _scrollRect_property_set, ["width"]);
Tweener.registerSpecialProperty("_scrollRect_height", _scrollRect_property_get, _scrollRect_property_set, ["height"]);
}
public static function _frame_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
_arg1.gotoAndStop(Math.round(_arg2));
}
public static function _autoAlpha_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
_arg1.alpha = _arg2;
_arg1.visible = (_arg2 > 0);
}
public static function _frame_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
return (_arg1.currentFrame);
}
public static function _scrollRect_splitter(_arg1:Rectangle, _arg2:Array, _arg3:Object=null):Array{
var _local4:Array;
_local4 = new Array();
if (_arg1 == null){
_local4.push({name:"_scrollRect_x", value:0});
_local4.push({name:"_scrollRect_y", value:0});
_local4.push({name:"_scrollRect_width", value:100});
_local4.push({name:"_scrollRect_height", value:100});
} else {
_local4.push({name:"_scrollRect_x", value:_arg1.x});
_local4.push({name:"_scrollRect_y", value:_arg1.y});
_local4.push({name:"_scrollRect_width", value:_arg1.width});
_local4.push({name:"_scrollRect_height", value:_arg1.height});
};
return (_local4);
}
public static function _autoAlpha_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
return (_arg1.alpha);
}
public static function _scrollRect_property_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
return (_arg1.scrollRect[_arg2[0]]);
}
public static function _scale_splitter(_arg1:Number, _arg2:Array):Array{
var _local3:Array;
_local3 = new Array();
_local3.push({name:"scaleX", value:_arg1});
_local3.push({name:"scaleY", value:_arg1});
return (_local3);
}
public static function _scrollRect_property_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
var _local5:Rectangle;
_local5 = _arg1.scrollRect;
_local5[_arg3[0]] = Math.round(_arg2);
_arg1.scrollRect = _local5;
}
}
}//package com.caurina.transitions.properties
Section 12
//AuxFunctions (com.caurina.transitions.AuxFunctions)
package com.caurina.transitions {
public class AuxFunctions {
public static function concatObjects(... _args):Object{
var _local2:Object;
var _local3:Object;
var _local4:int;
var _local5:String;
_local2 = {};
_local4 = 0;
while (_local4 < _args.length) {
_local3 = _args[_local4];
for (_local5 in _local3) {
if (_local3[_local5] == null){
delete _local2[_local5];
} else {
_local2[_local5] = _local3[_local5];
};
};
_local4++;
};
return (_local2);
}
public static function numberToG(_arg1:Number):Number{
return (((_arg1 & 0xFF00) >> 8));
}
public static function numberToR(_arg1:Number):Number{
return (((_arg1 & 0xFF0000) >> 16));
}
public static function isInArray(_arg1:String, _arg2:Array):Boolean{
var _local3:uint;
var _local4:uint;
_local3 = _arg2.length;
_local4 = 0;
while (_local4 < _local3) {
if (_arg2[_local4] == _arg1){
return (true);
};
_local4++;
};
return (false);
}
public static function getObjectLength(_arg1:Object):uint{
var _local2:uint;
var _local3:String;
_local2 = 0;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function numberToB(_arg1:Number):Number{
return ((_arg1 & 0xFF));
}
}
}//package com.caurina.transitions
Section 13
//Equations (com.caurina.transitions.Equations)
package com.caurina.transitions {
public class Equations {
public function Equations(){
trace("Equations is a static class and should not be instantiated.");
}
public static function easeOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeInOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
};
--_arg1;
return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2));
}
public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
public static function easeInOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2));
};
_arg1 = (_arg1 - 2);
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2));
}
public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2));
}
public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
public static function easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2));
}
public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function init():void{
Tweener.registerTransition("easenone", easeNone);
Tweener.registerTransition("linear", easeNone);
Tweener.registerTransition("easeinquad", easeInQuad);
Tweener.registerTransition("easeoutquad", easeOutQuad);
Tweener.registerTransition("easeinoutquad", easeInOutQuad);
Tweener.registerTransition("easeoutinquad", easeOutInQuad);
Tweener.registerTransition("easeincubic", easeInCubic);
Tweener.registerTransition("easeoutcubic", easeOutCubic);
Tweener.registerTransition("easeinoutcubic", easeInOutCubic);
Tweener.registerTransition("easeoutincubic", easeOutInCubic);
Tweener.registerTransition("easeinquart", easeInQuart);
Tweener.registerTransition("easeoutquart", easeOutQuart);
Tweener.registerTransition("easeinoutquart", easeInOutQuart);
Tweener.registerTransition("easeoutinquart", easeOutInQuart);
Tweener.registerTransition("easeinquint", easeInQuint);
Tweener.registerTransition("easeoutquint", easeOutQuint);
Tweener.registerTransition("easeinoutquint", easeInOutQuint);
Tweener.registerTransition("easeoutinquint", easeOutInQuint);
Tweener.registerTransition("easeinsine", easeInSine);
Tweener.registerTransition("easeoutsine", easeOutSine);
Tweener.registerTransition("easeinoutsine", easeInOutSine);
Tweener.registerTransition("easeoutinsine", easeOutInSine);
Tweener.registerTransition("easeincirc", easeInCirc);
Tweener.registerTransition("easeoutcirc", easeOutCirc);
Tweener.registerTransition("easeinoutcirc", easeInOutCirc);
Tweener.registerTransition("easeoutincirc", easeOutInCirc);
Tweener.registerTransition("easeinexpo", easeInExpo);
Tweener.registerTransition("easeoutexpo", easeOutExpo);
Tweener.registerTransition("easeinoutexpo", easeInOutExpo);
Tweener.registerTransition("easeoutinexpo", easeOutInExpo);
Tweener.registerTransition("easeinelastic", easeInElastic);
Tweener.registerTransition("easeoutelastic", easeOutElastic);
Tweener.registerTransition("easeinoutelastic", easeInOutElastic);
Tweener.registerTransition("easeoutinelastic", easeOutInElastic);
Tweener.registerTransition("easeinback", easeInBack);
Tweener.registerTransition("easeoutback", easeOutBack);
Tweener.registerTransition("easeinoutback", easeInOutBack);
Tweener.registerTransition("easeoutinback", easeOutInBack);
Tweener.registerTransition("easeinbounce", easeInBounce);
Tweener.registerTransition("easeoutbounce", easeOutBounce);
Tweener.registerTransition("easeinoutbounce", easeInOutBounce);
Tweener.registerTransition("easeoutinbounce", easeOutInBounce);
}
public static function easeOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==_arg4) ? (_arg2 + _arg3) : (((_arg3 * 1.001) * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2));
}
public static function easeOutInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBack((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBack(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==0) ? _arg2 : (((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2) - (_arg3 * 0.001)));
}
public static function easeInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
public static function easeInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
}
public static function easeInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2));
}
public static function easeOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
--_arg1;
return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
}
public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeOutInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2) - (_arg3 * 0.0005)));
};
--_arg1;
return (((((_arg3 / 2) * 1.0005) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2));
}
public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2));
}
public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeOutInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
}
}//package com.caurina.transitions
Section 14
//PropertyInfoObj (com.caurina.transitions.PropertyInfoObj)
package com.caurina.transitions {
public class PropertyInfoObj {
public var originalValueComplete:Object;
public var modifierParameters:Array;
public var isSpecialProperty:Boolean;
public var hasModifier:Boolean;
public var valueComplete:Number;
public var extra:Object;
public var valueStart:Number;
public var modifierFunction:Function;
public var arrayIndex:Number;
public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Object, _arg4:Number, _arg5:Object, _arg6:Boolean, _arg7:Function, _arg8:Array){
valueStart = _arg1;
valueComplete = _arg2;
originalValueComplete = _arg3;
arrayIndex = _arg4;
extra = _arg5;
isSpecialProperty = _arg6;
hasModifier = Boolean(_arg7);
modifierFunction = _arg7;
modifierParameters = _arg8;
}
public function toString():String{
var _local1:String;
_local1 = "\n[PropertyInfoObj ";
_local1 = (_local1 + ("valueStart:" + String(valueStart)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("valueComplete:" + String(valueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("originalValueComplete:" + String(originalValueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("arrayIndex:" + String(arrayIndex)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("extra:" + String(extra)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("isSpecialProperty:" + String(isSpecialProperty)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("hasModifier:" + String(hasModifier)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierFunction:" + String(modifierFunction)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierParameters:" + String(modifierParameters)));
_local1 = (_local1 + "]\n");
return (_local1);
}
public function clone():PropertyInfoObj{
var _local1:PropertyInfoObj;
_local1 = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (_local1);
}
}
}//package com.caurina.transitions
Section 15
//SpecialProperty (com.caurina.transitions.SpecialProperty)
package com.caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var preProcess:Function;
public var setValue:Function;
public var getValue:Function;
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){
getValue = _arg1;
setValue = _arg2;
parameters = _arg3;
preProcess = _arg4;
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + "[SpecialProperty ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("setValue:" + String(setValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("preProcess:" + String(preProcess)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package com.caurina.transitions
Section 16
//SpecialPropertyModifier (com.caurina.transitions.SpecialPropertyModifier)
package com.caurina.transitions {
public class SpecialPropertyModifier {
public var getValue:Function;
public var modifyValues:Function;
public function SpecialPropertyModifier(_arg1:Function, _arg2:Function){
modifyValues = _arg1;
getValue = _arg2;
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + "[SpecialPropertyModifier ");
_local1 = (_local1 + ("modifyValues:" + String(modifyValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package com.caurina.transitions
Section 17
//SpecialPropertySplitter (com.caurina.transitions.SpecialPropertySplitter)
package com.caurina.transitions {
public class SpecialPropertySplitter {
public var parameters:Array;
public var splitValues:Function;
public function SpecialPropertySplitter(_arg1:Function, _arg2:Array){
splitValues = _arg1;
parameters = _arg2;
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + "[SpecialPropertySplitter ");
_local1 = (_local1 + ("splitValues:" + String(splitValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package com.caurina.transitions
Section 18
//Tweener (com.caurina.transitions.Tweener)
package com.caurina.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tweener {
private static var _timeScale:Number = 1;
private static var _currentTimeFrame:Number;
private static var _specialPropertySplitterList:Object;
private static var _engineExists:Boolean = false;
private static var _specialPropertyModifierList:Object;
private static var _currentTime:Number;
private static var _tweenList:Array;
private static var _specialPropertyList:Object;
private static var _transitionList:Object;
private static var _inited:Boolean = false;
private static var __tweener_controller__:MovieClip;
public function Tweener(){
trace("Tweener is a static class and should not be instantiated.");
}
public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{
var _local4:SpecialPropertyModifier;
if (!_inited){
init();
};
_local4 = new SpecialPropertyModifier(_arg2, _arg3);
_specialPropertyModifierList[_arg1] = _local4;
}
public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{
var _local6:SpecialProperty;
if (!_inited){
init();
};
_local6 = new SpecialProperty(_arg2, _arg3, _arg4, _arg5);
_specialPropertyList[_arg1] = _local6;
}
public static function init(... _args):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
private static function updateTweens():Boolean{
var _local1:int;
if (_tweenList.length == 0){
return (false);
};
_local1 = 0;
while (_local1 < _tweenList.length) {
if ((((_tweenList[_local1] == undefined)) || (!(_tweenList[_local1].isPaused)))){
if (!updateTweenByIndex(_local1)){
removeTweenByIndex(_local1);
};
if (_tweenList[_local1] == null){
removeTweenByIndex(_local1, true);
_local1--;
};
};
_local1++;
};
return (true);
}
public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Array;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Function;
var _local9:TweenListObj;
var _local10:Number;
var _local11:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local4 = _arg1.concat();
} else {
_local4 = [_arg1];
};
_local5 = _arg2;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
_local6 = (isNaN(_local5.time)) ? 0 : _local5.time;
_local7 = (isNaN(_local5.delay)) ? 0 : _local5.delay;
if (typeof(_local5.transition) == "string"){
_local11 = _local5.transition.toLowerCase();
_local8 = _transitionList[_local11];
} else {
_local8 = _local5.transition;
};
if (!Boolean(_local8)){
_local8 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local4.length) {
if (_local5.useFrames == true){
_local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams);
} else {
_local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams);
};
_local9.properties = null;
_local9.onStart = _local5.onStart;
_local9.onUpdate = _local5.onUpdate;
_local9.onComplete = _local5.onComplete;
_local9.onOverwrite = _local5.onOverwrite;
_local9.onStartParams = _local5.onStartParams;
_local9.onUpdateParams = _local5.onUpdateParams;
_local9.onCompleteParams = _local5.onCompleteParams;
_local9.onOverwriteParams = _local5.onOverwriteParams;
_local9.onStartScope = _local5.onStartScope;
_local9.onUpdateScope = _local5.onUpdateScope;
_local9.onCompleteScope = _local5.onCompleteScope;
_local9.onOverwriteScope = _local5.onOverwriteScope;
_local9.onErrorScope = _local5.onErrorScope;
_local9.isCaller = true;
_local9.count = _local5.count;
_local9.waitFrames = _local5.waitFrames;
_tweenList.push(_local9);
if ((((_local6 == 0)) && ((_local7 == 0)))){
_local10 = (_tweenList.length - 1);
updateTweenByIndex(_local10);
removeTweenByIndex(_local10);
};
_local3++;
};
return (true);
}
public static function pauseAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
pauseTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function removeTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(removeTweenByIndex, _arg1, _local3));
}
public static function splitTweens(_arg1:Number, _arg2:Array):uint{
var _local3:TweenListObj;
var _local4:TweenListObj;
var _local5:uint;
var _local6:String;
var _local7:Boolean;
_local3 = _tweenList[_arg1];
_local4 = _local3.clone(false);
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = _arg2[_local5];
if (Boolean(_local3.properties[_local6])){
_local3.properties[_local6] = undefined;
delete _local3.properties[_local6];
};
_local5++;
};
for (_local6 in _local4.properties) {
_local7 = false;
_local5 = 0;
while (_local5 < _arg2.length) {
if (_arg2[_local5] == _local6){
_local7 = true;
break;
};
_local5++;
};
if (!_local7){
_local4.properties[_local6] = undefined;
delete _local4.properties[_local6];
};
};
_tweenList.push(_local4);
return ((_tweenList.length - 1));
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function resumeTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj;
var _local3:Number;
_local2 = _tweenList[_arg1];
if ((((_local2 == null)) || (!(_local2.isPaused)))){
return (false);
};
_local3 = getCurrentTweeningTime(_local2);
_local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused));
_local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused));
_local2.timePaused = undefined;
_local2.isPaused = false;
return (true);
}
public static function getVersion():String{
return ("AS3 1.31.71");
}
public static function onEnterFrame(_arg1:Event):void{
var _local2:Boolean;
updateTime();
updateFrame();
_local2 = false;
_local2 = updateTweens();
if (!_local2){
stopEngine();
};
}
public static function updateTime():void{
_currentTime = getTimer();
}
private static function updateTweenByIndex(_arg1:Number):Boolean{
var tTweening:TweenListObj;
var isOver:Boolean;
var mustUpdate:Boolean;
var nv:Number;
var t:Number;
var b:Number;
var c:Number;
var d:Number;
var pName:String;
var eventScope:Object;
var tScope:Object;
var cTime:Number;
var tProperty:Object;
var pv:Number;
var i = _arg1;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
isOver = false;
cTime = getCurrentTweeningTime(tTweening);
if (cTime >= tTweening.timeStart){
tScope = tTweening.scope;
if (tTweening.isCaller){
do {
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1));
b = tTweening.timeStart;
c = (tTweening.timeComplete - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
} while (!(cTime >= nv));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (cTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope;
try {
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
} catch(e:Error) {
handleError(tTweening, e, "onStart");
};
};
for (pName in tTweening.properties) {
if (tTweening.properties[pName].isSpecialProperty){
if (Boolean(_specialPropertyList[pName].preProcess)){
tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra);
};
pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
pv = tScope[pName];
};
tTweening.properties[pName].valueStart = (isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv;
};
mustUpdate = true;
tTweening.hasStarted = true;
};
if (mustUpdate){
for (pName in tTweening.properties) {
tProperty = tTweening.properties[pName];
if (isOver){
nv = tProperty.valueComplete;
} else {
if (tProperty.hasModifier){
t = (cTime - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams);
nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters);
} else {
t = (cTime - tTweening.timeStart);
b = tProperty.valueStart;
c = (tProperty.valueComplete - tProperty.valueStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d, tTweening.transitionParams);
};
};
if (tTweening.rounded){
nv = Math.round(nv);
};
if (tProperty.isSpecialProperty){
_specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
tScope[pName] = nv;
};
};
tTweening.updatesSkipped = 0;
if (Boolean(tTweening.onUpdate)){
eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope;
try {
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
} catch(e:Error) {
handleError(tTweening, e, "onUpdate");
};
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope;
try {
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
} catch(e:Error) {
handleError(tTweening, e, "onComplete");
};
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (isNaN(_arg1)){
_arg1 = 1;
};
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
if (_arg1 != _timeScale){
if (_tweenList != null){
_local2 = 0;
while (_local2 < _tweenList.length) {
_local3 = getCurrentTweeningTime(_tweenList[_local2]);
_tweenList[_local2].timeStart = (_local3 - (((_local3 - _tweenList[_local2].timeStart) * _timeScale) / _arg1));
_tweenList[_local2].timeComplete = (_local3 - (((_local3 - _tweenList[_local2].timeComplete) * _timeScale) / _arg1));
if (_tweenList[_local2].timePaused != undefined){
_tweenList[_local2].timePaused = (_local3 - (((_local3 - _tweenList[_local2].timePaused) * _timeScale) / _arg1));
};
_local2++;
};
};
_timeScale = _arg1;
};
}
public static function resumeAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
resumeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
private static function handleError(_arg1:TweenListObj, _arg2:Error, _arg3:String):void{
var eventScope:Object;
var pTweening = _arg1;
var pError = _arg2;
var pCallBackName = _arg3;
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){
eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope;
try {
pTweening.onError.apply(eventScope, [pTweening.scope, pError]);
} catch(metaError:Error) {
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + metaError.getStackTrace()));
};
} else {
if (!Boolean(pTweening.onError)){
printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace()));
};
};
}
private static function startEngine():void{
_engineExists = true;
_tweenList = new Array();
__tweener_controller__ = new MovieClip();
__tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
_currentTimeFrame = 0;
updateTime();
}
public static function removeAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
removeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Array;
var _local7:Object;
var _local8:Number;
var _local9:Number;
var _local10:Array;
var _local11:Object;
var _local12:Object;
var _local13:Function;
var _local14:Object;
var _local15:TweenListObj;
var _local16:Number;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local6 = _arg1.concat();
} else {
_local6 = [_arg1];
};
_local7 = TweenListObj.makePropertiesChain(_arg2);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
_local8 = (isNaN(_local7.time)) ? 0 : _local7.time;
_local9 = (isNaN(_local7.delay)) ? 0 : _local7.delay;
_local10 = new Array();
_local11 = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true};
_local12 = new Object();
for (_local5 in _local7) {
if (!_local11[_local5]){
if (_specialPropertySplitterList[_local5]){
_local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters);
_local3 = 0;
while (_local3 < _local17.length) {
if (_specialPropertySplitterList[_local17[_local3].name]){
_local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters);
_local4 = 0;
while (_local4 < _local18.length) {
_local10[_local18[_local4].name] = {valueStart:undefined, valueComplete:_local18[_local4].value, arrayIndex:_local18[_local4].arrayIndex, isSpecialProperty:false};
_local4++;
};
} else {
_local10[_local17[_local3].name] = {valueStart:undefined, valueComplete:_local17[_local3].value, arrayIndex:_local17[_local3].arrayIndex, isSpecialProperty:false};
};
_local3++;
};
} else {
if (_specialPropertyModifierList[_local5] != undefined){
_local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]);
_local3 = 0;
while (_local3 < _local19.length) {
_local12[_local19[_local3].name] = {modifierParameters:_local19[_local3].parameters, modifierFunction:_specialPropertyModifierList[_local5].getValue};
_local3++;
};
} else {
_local10[_local5] = {valueStart:undefined, valueComplete:_local7[_local5]};
};
};
};
};
for (_local5 in _local10) {
if (_specialPropertyList[_local5] != undefined){
_local10[_local5].isSpecialProperty = true;
} else {
if (_local6[0][_local5] == undefined){
printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property."));
};
};
};
for (_local5 in _local12) {
if (_local10[_local5] != undefined){
_local10[_local5].modifierParameters = _local12[_local5].modifierParameters;
_local10[_local5].modifierFunction = _local12[_local5].modifierFunction;
};
};
if (typeof(_local7.transition) == "string"){
_local20 = _local7.transition.toLowerCase();
_local13 = _transitionList[_local20];
} else {
_local13 = _local7.transition;
};
if (!Boolean(_local13)){
_local13 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local6.length) {
_local14 = new Object();
for (_local5 in _local10) {
_local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters);
};
if (_local7.useFrames == true){
_local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams);
} else {
_local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams);
};
_local15.properties = _local14;
_local15.onStart = _local7.onStart;
_local15.onUpdate = _local7.onUpdate;
_local15.onComplete = _local7.onComplete;
_local15.onOverwrite = _local7.onOverwrite;
_local15.onError = _local7.onError;
_local15.onStartParams = _local7.onStartParams;
_local15.onUpdateParams = _local7.onUpdateParams;
_local15.onCompleteParams = _local7.onCompleteParams;
_local15.onOverwriteParams = _local7.onOverwriteParams;
_local15.onStartScope = _local7.onStartScope;
_local15.onUpdateScope = _local7.onUpdateScope;
_local15.onCompleteScope = _local7.onCompleteScope;
_local15.onOverwriteScope = _local7.onOverwriteScope;
_local15.onErrorScope = _local7.onErrorScope;
_local15.rounded = _local7.rounded;
_local15.skipUpdates = _local7.skipUpdates;
removeTweensByTime(_local15.scope, _local15.properties, _local15.timeStart, _local15.timeComplete);
_tweenList.push(_local15);
if ((((_local8 == 0)) && ((_local9 == 0)))){
_local16 = (_tweenList.length - 1);
updateTweenByIndex(_local16);
removeTweenByIndex(_local16);
};
_local3++;
};
return (true);
}
public static function registerTransition(_arg1:String, _arg2:Function):void{
if (!_inited){
init();
};
_transitionList[_arg1] = _arg2;
}
public static function printError(_arg1:String):void{
trace(("## [Tweener] Error: " + _arg1));
}
private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{
var _local4:Boolean;
var _local5:uint;
var _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
_local4 = false;
if (!Boolean(_tweenList)){
return (false);
};
_local5 = 0;
while (_local5 < _tweenList.length) {
if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){
if (_arg3.length == 0){
_arg1(_local5);
_local4 = true;
} else {
_local6 = new Array();
_local7 = 0;
while (_local7 < _arg3.length) {
if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){
_local6.push(_arg3[_local7]);
};
_local7++;
};
if (_local6.length > 0){
_local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties);
if (_local8 == _local6.length){
_arg1(_local5);
_local4 = true;
} else {
_local9 = splitTweens(_local5, _local6);
_arg1(_local9);
_local4 = true;
};
};
};
};
_local5++;
};
return (_local4);
}
public static function getTweens(_arg1:Object):Array{
var _local2:uint;
var _local3:String;
var _local4:Array;
if (!Boolean(_tweenList)){
return ([]);
};
_local4 = new Array();
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
for (_local3 in _tweenList[_local2].properties) {
_local4.push(_local3);
};
};
_local2++;
};
return (_local4);
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
return (true);
};
_local2++;
};
return (false);
}
public static function pauseTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj;
_local2 = _tweenList[_arg1];
if ((((_local2 == null)) || (_local2.isPaused))){
return (false);
};
_local2.timePaused = getCurrentTweeningTime(_local2);
_local2.isPaused = true;
return (true);
}
public static function getCurrentTweeningTime(_arg1:Object):Number{
return ((_arg1.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getTweenCount(_arg1:Object):Number{
var _local2:uint;
var _local3:Number;
if (!Boolean(_tweenList)){
return (0);
};
_local3 = 0;
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
_local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties));
};
_local2++;
};
return (_local3);
}
private static function stopEngine():void{
_engineExists = false;
_tweenList = null;
_currentTime = 0;
_currentTimeFrame = 0;
__tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
__tweener_controller__ = null;
}
public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{
var removed:Boolean;
var removedLocally:Boolean;
var i:uint;
var tl:uint;
var pName:String;
var eventScope:Object;
var p_scope = _arg1;
var p_properties = _arg2;
var p_timeStart = _arg3;
var p_timeComplete = _arg4;
removed = false;
tl = _tweenList.length;
i = 0;
while (i < tl) {
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){
removedLocally = false;
for (pName in _tweenList[i].properties) {
if (Boolean(p_properties[pName])){
if (Boolean(_tweenList[i].onOverwrite)){
eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
try {
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
} catch(e:Error) {
handleError(_tweenList[i], e, "onOverwrite");
};
};
_tweenList[i].properties[pName] = undefined;
delete _tweenList[i].properties[pName];
removedLocally = true;
removed = true;
};
};
if (removedLocally){
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){
removeTweenByIndex(i);
};
};
};
};
i = (i + 1);
};
return (removed);
}
public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{
var _local4:SpecialPropertySplitter;
if (!_inited){
init();
};
_local4 = new SpecialPropertySplitter(_arg2, _arg3);
_specialPropertySplitterList[_arg1] = _local4;
}
public static function removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{
_tweenList[_arg1] = null;
if (_arg2){
_tweenList.splice(_arg1, 1);
};
return (true);
}
public static function resumeTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(resumeTweenByIndex, _arg1, _local3));
}
public static function pauseTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(pauseTweenByIndex, _arg1, _local3));
}
}
}//package com.caurina.transitions
Section 19
//TweenListObj (com.caurina.transitions.TweenListObj)
package com.caurina.transitions {
public class TweenListObj {
public var onUpdate:Function;
public var useFrames:Boolean;
public var hasStarted:Boolean;
public var onOverwriteParams:Array;
public var timeStart:Number;
public var count:Number;
public var timeComplete:Number;
public var onStartParams:Array;
public var onUpdateScope:Object;
public var rounded:Boolean;
public var onUpdateParams:Array;
public var properties:Object;
public var onComplete:Function;
public var transitionParams:Object;
public var updatesSkipped:Number;
public var onStart:Function;
public var onOverwriteScope:Object;
public var skipUpdates:Number;
public var onStartScope:Object;
public var scope:Object;
public var transition:Function;
public var timePaused:Number;
public var onCompleteParams:Array;
public var timesCalled:Number;
public var isCaller:Boolean;
public var onError:Function;
public var onErrorScope:Object;
public var onOverwrite:Function;
public var isPaused:Boolean;
public var waitFrames:Boolean;
public var onCompleteScope:Object;
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){
scope = _arg1;
timeStart = _arg2;
timeComplete = _arg3;
useFrames = _arg4;
transition = _arg5;
transitionParams = _arg6;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(_arg1:Boolean):TweenListObj{
var _local2:TweenListObj;
var _local3:String;
_local2 = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
_local2.properties = new Array();
for (_local3 in properties) {
_local2.properties[_local3] = properties[_local3].clone();
};
_local2.skipUpdates = skipUpdates;
_local2.updatesSkipped = updatesSkipped;
if (!_arg1){
_local2.onStart = onStart;
_local2.onUpdate = onUpdate;
_local2.onComplete = onComplete;
_local2.onOverwrite = onOverwrite;
_local2.onError = onError;
_local2.onStartParams = onStartParams;
_local2.onUpdateParams = onUpdateParams;
_local2.onCompleteParams = onCompleteParams;
_local2.onOverwriteParams = onOverwriteParams;
_local2.onStartScope = onStartScope;
_local2.onUpdateScope = onUpdateScope;
_local2.onCompleteScope = onCompleteScope;
_local2.onOverwriteScope = onOverwriteScope;
_local2.onErrorScope = onErrorScope;
};
_local2.rounded = rounded;
_local2.isPaused = isPaused;
_local2.timePaused = timePaused;
_local2.isCaller = isCaller;
_local2.count = count;
_local2.timesCalled = timesCalled;
_local2.waitFrames = waitFrames;
_local2.hasStarted = hasStarted;
return (_local2);
}
public function toString():String{
var _local1:String;
var _local2:Boolean;
var _local3:String;
_local1 = "\n[TweenListObj ";
_local1 = (_local1 + ("scope:" + String(scope)));
_local1 = (_local1 + ", properties:");
_local2 = true;
for (_local3 in properties) {
if (!_local2){
_local1 = (_local1 + ",");
};
_local1 = (_local1 + ("[name:" + properties[_local3].name));
_local1 = (_local1 + (",valueStart:" + properties[_local3].valueStart));
_local1 = (_local1 + (",valueComplete:" + properties[_local3].valueComplete));
_local1 = (_local1 + "]");
_local2 = false;
};
_local1 = (_local1 + (", timeStart:" + String(timeStart)));
_local1 = (_local1 + (", timeComplete:" + String(timeComplete)));
_local1 = (_local1 + (", useFrames:" + String(useFrames)));
_local1 = (_local1 + (", transition:" + String(transition)));
_local1 = (_local1 + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
_local1 = (_local1 + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
_local1 = (_local1 + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
_local1 = (_local1 + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
_local1 = (_local1 + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
_local1 = (_local1 + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
_local1 = (_local1 + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
_local1 = (_local1 + (", onError:" + String(onError)));
};
if (onStartParams){
_local1 = (_local1 + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
_local1 = (_local1 + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
_local1 = (_local1 + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
_local1 = (_local1 + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
_local1 = (_local1 + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
_local1 = (_local1 + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
_local1 = (_local1 + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
_local1 = (_local1 + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
_local1 = (_local1 + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
_local1 = (_local1 + (", rounded:" + String(rounded)));
};
if (isPaused){
_local1 = (_local1 + (", isPaused:" + String(isPaused)));
};
if (timePaused){
_local1 = (_local1 + (", timePaused:" + String(timePaused)));
};
if (isCaller){
_local1 = (_local1 + (", isCaller:" + String(isCaller)));
};
if (count){
_local1 = (_local1 + (", count:" + String(count)));
};
if (timesCalled){
_local1 = (_local1 + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
_local1 = (_local1 + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
_local1 = (_local1 + (", hasStarted:" + String(hasStarted)));
};
_local1 = (_local1 + "]\n");
return (_local1);
}
public static function makePropertiesChain(_arg1:Object):Object{
var _local2:Object;
var _local3:Object;
var _local4:Object;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local2 = _arg1.base;
if (_local2){
_local3 = {};
if ((_local2 is Array)){
_local4 = [];
_local8 = 0;
while (_local8 < _local2.length) {
_local4.push(_local2[_local8]);
_local8++;
};
} else {
_local4 = [_local2];
};
_local4.push(_arg1);
_local6 = _local4.length;
_local7 = 0;
while (_local7 < _local6) {
if (_local4[_local7]["base"]){
_local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]);
} else {
_local5 = _local4[_local7];
};
_local3 = AuxFunctions.concatObjects(_local3, _local5);
_local7++;
};
if (_local3["base"]){
delete _local3["base"];
};
return (_local3);
//unresolved jump
};
return (_arg1);
}
}
}//package com.caurina.transitions
Section 20
//FPSMeter (com.clutronflux.UI.Widget.FPSMeter)
package com.clutronflux.UI.Widget {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class FPSMeter extends MovieClip {
private var frameCheckInterval:int;
private var lastFrameCounter:int;
private var fpsTextFormat:TextFormat;
private var fpsText:TextField;
private var framerate:int;
private var frameCounter:int;
public function FPSMeter(){
this.frameCounter = 0;
this.framerate = 0;
this.lastFrameCounter = 0;
this.fpsTextFormat = new TextFormat();
this.fpsTextFormat.font = new pixelFont1().fontName;
this.fpsTextFormat.color = 0xFF0000;
this.fpsTextFormat.size = 8;
this.fpsText = new TextField();
this.fpsText.embedFonts = true;
this.fpsText.defaultTextFormat = fpsTextFormat;
this.addChild(this.fpsText);
this.fpsText.text = "0 fps";
this.fpsText.selectable = false;
this.addEventListener(Event.ENTER_FRAME, frameLoop);
clearInterval(this.frameCheckInterval);
this.frameCheckInterval = setInterval(this.checkFrameRate, 1000);
}
public function frameLoop(_arg1:Event=null):void{
this.frameCounter++;
}
public function checkFrameRate():void{
this.framerate = (this.frameCounter - this.lastFrameCounter);
this.fpsText.text = (this.framerate + " fps");
this.lastFrameCounter = this.frameCounter;
}
}
}//package com.clutronflux.UI.Widget
Section 21
//ActiveGraph (com.misc.utils.ActiveGraph)
package com.misc.utils {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import flash.system.*;
public class ActiveGraph extends Sprite {
private const MEGABYTES:Number = 9.5367431640625E-7;
private const HEIGHT:Number = 15;
private const PAGE:Number = 0x1000;
private const WIDTH:Number = 50;
private var output:String;
private var graphBackground:Sprite;
private var average:int;
private var plotLength:int;
private var old:int;
private var verboseMode:Boolean;
private var backY:Number;
private var low:Number;
private var caught2:Boolean;// = false
private var timer:Timer;
private var backX:Number;
private var plotLine:Shape;
private var textBox:TextField;
private var lastPlot2:int;
private var textFormat:TextFormat;
private var numerator:Number;
private var denominator:Number;
private var lastPlot1:int;
private var history:Array;
private var high:Number;
private var sign:String;
private var fn:Function;
private var itr:Number;
private var returnVal:Boolean;
private var plot:int;
public function ActiveGraph(_arg1:Number=0, _arg2:Boolean=false, _arg3:Boolean=true, _arg4:int=2):void{
caught2 = false;
super();
_arg4 = Math.min(_arg4, 2);
lastPlot1 = (lastPlot2 = (plot = (plotLength = 0)));
history = new Array();
numerator = (denominator = (average = 0));
timer = new Timer(_arg1);
verboseMode = _arg2;
switch (_arg4){
case 0:
fn = test0;
break;
case 2:
fn = test2;
break;
default:
fn = test1;
break;
};
if (_arg3){
textBox = new TextField();
textFormat = new TextFormat();
graphBackground = new Sprite();
plotLine = new Shape();
textFormat.size = 9;
textFormat.font = "Monaco";
textFormat.color = 0xFFFFFF;
textBox.selectable = false;
textBox.autoSize = TextFieldAutoSize.LEFT;
textBox.x = (WIDTH + 5);
textBox.height = HEIGHT;
graphBackground.graphics.beginFill(0);
graphBackground.graphics.drawRect(0, 0, (WIDTH + 85), HEIGHT);
graphBackground.graphics.endFill();
graphBackground.graphics.lineStyle(0.5, 0xFFFFFF);
graphBackground.graphics.drawRect(0, 0, WIDTH, (HEIGHT - 1));
this.addChild(graphBackground);
this.addChild(plotLine);
this.addChild(textBox);
timer.addEventListener(TimerEvent.TIMER, drawMem, false, 0, true);
textBox.mouseEnabled = false;
backX = x;
backY = y;
} else {
trace("ActiveGraph Running.");
timer.addEventListener(TimerEvent.TIMER, trackMem, false, 0, true);
};
timer.start();
}
private function drawMem(_arg1:TimerEvent=null):void{
if (trackMem()){
plotLine.graphics.clear();
if (plotLength == 21){
history.shift();
plotLength--;
};
if (plot > history[int((plotLength - 1))]){
sign = "+ , ";
} else {
if (plot < history[int((plotLength - 1))]){
sign = "- , ";
} else {
sign = " , ";
};
};
history.push(plot);
plotLength = history.length;
if (plotLength > 1){
plotLine.graphics.lineStyle(2.5, 0xFF0000);
high = 0;
low = Infinity;
itr = 0;
while (itr < plotLength) {
high = Math.max(history[itr], high);
low = Math.min(history[itr], low);
itr++;
};
plotLine.graphics.moveTo(0, (HEIGHT * (1 - ((history[0] - low) / (high - low)))));
itr = 1;
while (itr < plotLength) {
plotLine.graphics.lineTo(((WIDTH * itr) / (plotLength - 1)), (HEIGHT * (1 - ((history[itr] - low) / (high - low)))));
itr++;
};
};
output = (plot + sign);
textBox.text = (String(output) + String(average));
textBox.setTextFormat(textFormat);
};
}
private function loadDrag(_arg1:Event):void{
this.stage.addEventListener(Event.MOUSE_LEAVE, handleDrag, false, 0, true);
}
private function handleDrag(_arg1:Event):void{
switch (_arg1.type){
case MouseEvent.MOUSE_DOWN:
backX = x;
backY = y;
startDrag();
break;
case MouseEvent.MOUSE_UP:
stopDrag();
break;
case Event.MOUSE_LEAVE:
stopDrag();
x = backX;
y = backY;
break;
};
}
private function trackMem(_arg1:TimerEvent=null):Boolean{
returnVal = false;
plot = (System.totalMemory / PAGE);
old = average;
numerator = (numerator + plot);
denominator++;
average = (numerator / denominator);
if (((fn()) && (verboseMode))){
trace(plot);
};
return (returnVal);
}
public function get data():Number{
return (plot);
}
private function test0():Boolean{
if (lastPlot1 != plot){
returnVal = true;
lastPlot1 = plot;
};
return (returnVal);
}
private function test2():Boolean{
if ((((lastPlot1 > plot)) || (!(lastPlot1)))){
if ((((lastPlot2 > plot)) || (!(lastPlot2)))){
caught2 = true;
};
lastPlot2 = plot;
} else {
if ((((lastPlot1 < plot)) && (caught2))){
plot = lastPlot2;
returnVal = true;
caught2 = false;
};
};
lastPlot1 = plot;
return (returnVal);
}
private function test1():Boolean{
returnVal = ((!(lastPlot1)) || ((lastPlot1 > plot)));
lastPlot1 = plot;
return (returnVal);
}
}
}//package com.misc.utils
Section 22
//PixelPerfectCollisionDetection (com.troygilbert.CollisionDetection.PixelPerfectCollisionDetection)
package com.troygilbert.CollisionDetection {
import flash.geom.*;
import flash.display.*;
public class PixelPerfectCollisionDetection {
public static function getCollisionRect(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Rectangle{
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:Rectangle;
var _local9:BitmapData;
var _local10:BitmapData;
var _local11:uint;
var _local12:Rectangle;
var _local13:int;
_local6 = _arg1.getBounds(_arg3);
_local7 = _arg2.getBounds(_arg3);
_local8 = _local6.intersection(_local7);
if (_local8.size.length > 0){
if (_arg4){
_local8.width = Math.ceil(_local8.width);
_local8.height = Math.ceil(_local8.height);
_local9 = getAlphaMap(_arg1, _local8, BitmapDataChannel.RED, _arg3);
_local10 = getAlphaMap(_arg2, _local8, BitmapDataChannel.GREEN, _arg3);
_local9.draw(_local10, null, null, BlendMode.LIGHTEN);
if (_arg5 <= 0){
_local11 = 65792;
} else {
if (_arg5 > 1){
_arg5 = 1;
};
_local13 = Math.round((_arg5 * 0xFF));
_local11 = (((_local13 << 16) | (_local13 << 8)) | 0);
};
_local12 = _local9.getColorBoundsRect(_local11, _local11);
_local9.getColorBoundsRect(_local11, _local11).x = (_local12.x + _local8.x);
_local12.y = (_local12.y + _local8.y);
return (_local12);
} else {
return (_local8);
};
//unresolved jump
};
return (null);
}
public static function isColliding(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Boolean{
var _local6:Rectangle;
_local6 = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
return (true);
};
return (false);
}
public static function getCollisionPoint(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Point{
var _local6:Rectangle;
var _local7:Number;
var _local8:Number;
_local6 = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
_local7 = ((_local6.left + _local6.right) / 2);
_local8 = ((_local6.top + _local6.bottom) / 2);
return (new Point(_local7, _local8));
};
return (null);
}
private static function getAlphaMap(_arg1:DisplayObject, _arg2:Rectangle, _arg3:uint, _arg4:DisplayObjectContainer):BitmapData{
var _local5:Matrix;
var _local6:Matrix;
var _local7:BitmapData;
var _local8:BitmapData;
_local5 = _arg4.transform.concatenatedMatrix.clone();
_local5.invert();
_local6 = _arg1.transform.concatenatedMatrix.clone();
_local6.concat(_local5);
_local6.translate(-(_arg2.x), -(_arg2.y));
_local7 = new BitmapData(_arg2.width, _arg2.height, true, 0);
_local7.draw(_arg1, _local6);
_local8 = new BitmapData(_arg2.width, _arg2.height, false, 0);
_local8.copyChannel(_local7, _local7.rect, new Point(0, 0), BitmapDataChannel.ALPHA, _arg3);
return (_local8);
}
}
}//package com.troygilbert.CollisionDetection
Section 23
//AudioPlayer (com.wddg.Audio.AudioPlayer)
package com.wddg.Audio {
import flash.events.*;
import flash.utils.*;
import com.wddg.Event.*;
import flash.media.*;
public class AudioPlayer extends EventDispatcher {
private var nextMusicFile:String;// = null
private var isFXPlaying:Boolean;// = false
private var isMusicPlaying:Boolean;// = false
private var musicChannel:SoundChannel;
private var nextFXFile:String;// = null
private var currentFXFile:String;// = null
private var currentMusicFile:String;// = null
private var fxChannel:SoundChannel;
private var fxLevel:Number;// = 1
private var musicLevel:Number;// = 0.8
private var isMute:Boolean;// = false
public static const MUSIC_TITLE:String = "title";
public static const MUSIC_GAME2:String = "JP_start";
public static const MUSIC_GAME3:String = "intense_start";
public static const JP_PLAYERHIT:String = "ZG_playerhit";
public static const SL_PLAYERHIT:String = "SL_playerhit";
public static const SL_REFUEL:String = "SL_refuel3";
public static const SL_LAND:String = "SL_landing2";
public static const ZG_ARMORBONUS:String = "ZG_armor";
public static const ZG_X2BONUS:String = "ZG_multiplier";
public static const MUSIC_GAME1:String = "ZG_loop";
public static const FX_BADGE:String = "badge2";
public static const MUSIC_GAME4:String = "loop1";
public static const MUSIC_GAME3_LOOP:String = "intense_loop";
public static const FX_ROLLOVER:String = "rollover";
public static const ZG_PLAYERHIT:String = "ZG_playerhit";
public static const ZG_ITEM:String = "ZG_item";
public static const ZG_PLAYERARMORHIT:String = "ZG_armorhit";
public static const MUSIC_WRAPUP:String = "loop1";
public static const ZG_PLAYEROBSTACLEHIT:String = "ZG_obstaclehit";
public static const JP_ITEM:String = "JP_fuel";
public static const JP_THRUST:String = "thrust2";
public static const FX_TIMERALARM:String = "alarm2";
public static const FX_CLICK:String = "click";
public static const MUSIC_GAME2_LOOP:String = "JP_loop";
public static const SL_THRUST:String = "thrust2";
public function AudioPlayer(){
musicLevel = 0.8;
fxLevel = 1;
isMusicPlaying = false;
isFXPlaying = false;
isMute = false;
currentFXFile = null;
nextFXFile = null;
currentMusicFile = null;
nextMusicFile = null;
super();
}
public function playFX(_arg1:String, _arg2:Boolean=false):void{
var classType:Class;
var sound:Sound;
var path = _arg1;
var loop = _arg2;
this.currentFXFile = path;
try {
classType = (getDefinitionByName(path) as Class);
sound = new (classType);
this.fxChannel = sound.play();
this.fxChannel.addEventListener(Event.SOUND_COMPLETE, this.onFXComplete);
if (loop){
this.nextFXFile = path;
} else {
this.nextFXFile = null;
};
this.isFXPlaying = true;
this.setFXVolume(this.fxLevel);
} catch(e:Error) {
};
}
public function get mute():Boolean{
return (this.isMute);
}
public function set mute(_arg1:Boolean):void{
var _local2:SoundTransform;
this.isMute = _arg1;
_local2 = SoundMixer.soundTransform;
if (_arg1){
_local2.volume = 0;
SoundMixer.soundTransform = _local2;
this.dispatchEvent(new AudioEvent(AudioEvent.SOUND_MUTE));
} else {
_local2.volume = 1;
SoundMixer.soundTransform = _local2;
this.dispatchEvent(new AudioEvent(AudioEvent.SOUND_UNMUTE));
};
}
public function get musicFile():String{
return (new String(this.currentMusicFile));
}
public function stopMusic():void{
if (this.isMusicPlaying){
this.isMusicPlaying = false;
this.musicChannel.stop();
this.nextMusicFile = null;
this.onMusicComplete(null);
this.currentMusicFile = null;
};
}
public function restartMusic():void{
}
public function playMusic(_arg1:String, _arg2:Boolean=false):void{
var classType:Class;
var sound:Sound;
var path = _arg1;
var loop = _arg2;
this.currentMusicFile = path;
try {
classType = (getDefinitionByName(path) as Class);
sound = new (classType);
if (loop){
this.musicChannel = sound.play(0);
this.nextMusicFile = path;
if (path.indexOf("start") != -1){
this.nextMusicFile = (path.split("_")[0] + "_loop");
};
} else {
this.musicChannel = sound.play(0);
this.nextMusicFile = null;
};
this.musicChannel.addEventListener(Event.SOUND_COMPLETE, this.onMusicComplete);
this.isMusicPlaying = true;
this.setMusicVolume(this.musicLevel);
} catch(e:Error) {
};
}
public function stopFX():void{
if (this.isFXPlaying){
this.isFXPlaying = false;
this.fxChannel.stop();
this.nextFXFile = null;
this.onFXComplete(null);
this.currentFXFile = null;
};
}
public function setMusicVolume(_arg1:Number):void{
var _local2:SoundTransform;
if (this.musicChannel){
_local2 = this.musicChannel.soundTransform;
this.musicLevel = _arg1;
_local2.volume = this.musicLevel;
this.musicChannel.soundTransform = _local2;
};
}
public function getFXVolume():Number{
return (this.fxLevel);
}
private function onIOError(_arg1:IOErrorEvent):void{
trace("Sound Not Found");
}
private function onMusicComplete(_arg1:Event):void{
this.isMusicPlaying = false;
this.currentMusicFile = null;
if (this.nextMusicFile){
this.playMusic(this.nextMusicFile, true);
} else {
this.dispatchEvent(new AudioEvent(AudioEvent.SOUND_COMPLETE, "MUSIC", this.currentMusicFile));
};
}
public function getMusicVolume():Number{
return (this.musicLevel);
}
public function get fxFile():String{
return (new String(this.currentFXFile));
}
public function setFXVolume(_arg1:Number):void{
var _local2:SoundTransform;
if (this.fxChannel){
_local2 = this.fxChannel.soundTransform;
this.fxLevel = _arg1;
_local2.volume = this.fxLevel;
this.fxChannel.soundTransform = _local2;
};
}
private function onFXComplete(_arg1:Event):void{
this.isFXPlaying = false;
this.currentFXFile = null;
if (this.nextFXFile){
this.playFX(this.nextFXFile, true);
} else {
this.dispatchEvent(new AudioEvent(AudioEvent.SOUND_COMPLETE, "FX", this.currentFXFile));
};
}
}
}//package com.wddg.Audio
Section 24
//XMLData (com.wddg.Data.XMLData)
package com.wddg.Data {
import flash.events.*;
import flash.net.*;
public class XMLData extends EventDispatcher {
private var externalLoader:URLLoader;
private var dataPath:String;
private var xmlObject:XML;
public function XMLData(_arg1:String){
this.dataPath = _arg1;
this.externalLoader = new URLLoader(new URLRequest(this.dataPath));
this.externalLoader.addEventListener(Event.COMPLETE, xmlLoaded);
trace("Data CREATED");
}
private function xmlLoaded(_arg1:Event):void{
this.xmlObject = new XML(this.externalLoader.data);
this.dispatchEvent(new Event("onLoadComplete"));
}
public function get xml():XML{
return (this.xmlObject);
}
}
}//package com.wddg.Data
Section 25
//AudioEvent (com.wddg.Event.AudioEvent)
package com.wddg.Event {
import flash.events.*;
public class AudioEvent extends Event {
private var _soundType:String;
private var _soundFile:String;
public static const SOUND_COMPLETE:String = "sound_complete";
public static const SOUND_UNMUTE:String = "sound_unmute";
public static const SOUND_MUTE:String = "sound_mute";
public function AudioEvent(_arg1:String, _arg2:String="", _arg3:String=""){
super(_arg1);
this._soundType = _arg2;
this._soundFile = _arg3;
}
public function get soundType():String{
return (this._soundType);
}
public function get soundFile():String{
return (this._soundFile);
}
}
}//package com.wddg.Event
Section 26
//SPSceneEvent (com.wddg.SpaceChimps.Event.SPSceneEvent)
package com.wddg.SpaceChimps.Event {
import flash.events.*;
public class SPSceneEvent extends Event {
public static const INTRO_COMPLETE:String = "intro_complete";
public static const OUTRO_COMPLETE:String = "outro_complete";
public function SPSceneEvent(_arg1:String){
super(_arg1);
}
}
}//package com.wddg.SpaceChimps.Event
Section 27
//JetPack (com.wddg.SpaceChimps.Game.JetPack.JetPack)
package com.wddg.SpaceChimps.Game.JetPack {
import flash.events.*;
import com.caurina.transitions.*;
import flash.geom.*;
import flash.display.*;
import org.cove.ape.*;
import flash.utils.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
import com.wddg.SpaceChimps.Game.*;
import flash.ui.*;
public class JetPack extends Game {
private var blocker:MovieClip;
private var highScore:int;
private var playerGroup:Group;
private var engineMask:MovieClip;
private var engineContainer:MovieClip;
public var startCountdownHUD:MovieClip;
var gameCourse:JetPackCourse;
private var gameContainer:MovieClip;
public var HUD:MovieClip;
var player:JetPackPlayer;
public var gameOverHUD:MovieClip;
public var startHUD:MovieClip;
public var scrollSpeed:int;
private var boostInterval:int;
private var JPMiscTimeout:int;
private var frameCounter:int;
public static const BOOST_TIME:Number = 1.5;
public static const SCORE_QUOTA:Number = 7500;
public static const PLAYER_MAX_LIVES:int = 2;
public static const GAME_HEIGHT:Number = 440;
public static const GAME_WIDTH:Number = 725;
public static const INVULNERABLILITY_TIME:Number = 1.5;
public static const ENGINE_DAMPING:Number = 0.99;
public static const BOOST_SPEED:Number = 20;
public static const PLAYER_MAX_FUEL:int = 250;
public static const ENGINE_GRAVITY:Number = 8;
public static const SCROLL_SPEED:Number = 10;
public static const BONUS_FUEL:int = 20;
public static const PLAYER_THRUST:Number = 22;
public function JetPack(){
this.gameIndex = 2;
this.quota = JetPack.SCORE_QUOTA;
this.highScore = 0;
this.useTimer = false;
this.HUD.fuelText.HUDText.text = JetPack.PLAYER_MAX_FUEL;
this.HUD.livesText.HUDText.text = JetPack.PLAYER_MAX_LIVES;
this.HUD.highScoreText.HUDText.text = this.highScore;
trace("JetPack Created");
}
public function updateHUDFuel():void{
this.HUD.fuelText.HUDText.text = this.player.fuel;
}
public function updateHUDLives():void{
this.HUD.livesText.HUDText.text = Math.max(this.player.lives, 0);
}
override public function set paused(_arg1:Boolean):void{
this.gameCourse.paused = _arg1;
super.paused = _arg1;
}
override public function intro():void{
Main.audioPlayer.playMusic(AudioPlayer.MUSIC_GAME2, true);
super.intro();
}
function courseComplete():void{
this.paused = true;
this.gameInPlay = false;
this["startCountdownHUD"].HUDText.text = "Course Complete!";
Tweener.addTween(this["startCountdownHUD"], {_autoAlpha:1, time:0.7, transition:"easeOutExpo"});
clearTimeout(this.JPMiscTimeout);
this.JPMiscTimeout = setTimeout(this.gameOver, 2000);
}
override protected function run(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:*;
APEngine.step();
APEngine.paint();
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
for (_local6 in this.currentKeysDown) {
_local5++;
};
if (_local5 == 1){
if (((this.currentKeysDown[Keyboard.SPACE]) || (this.currentKeysDown[Keyboard.UP]))){
if ((((this.player.fuel > 0)) && (this.player.alive))){
_local4 = (this.player.angle % 360);
if (this.player.angle < 0){
_local4 = (360 + this.player.angle);
};
_local2 = (Math.sin(((_local4 * Math.PI) / 180)) * JetPack.PLAYER_THRUST);
_local3 = (Math.cos(((_local4 * Math.PI) / 180)) * -(JetPack.PLAYER_THRUST));
this.player.addForce(new Vector(_local2, _local3));
this.player.animating = true;
this.player.fuel--;
if (Main.audioPlayer.fxFile != AudioPlayer.JP_THRUST){
Main.audioPlayer.playFX(AudioPlayer.JP_THRUST, true);
};
};
};
} else {
this.player.animating = false;
if (Main.audioPlayer.fxFile == AudioPlayer.JP_THRUST){
Main.audioPlayer.stopFX();
};
};
this.gameCourse.scroll(this.scrollSpeed);
if ((((((this.player.y > 250)) && ((this.player.velocity.y > 0)))) || ((((this.player.y < 150)) && ((this.player.velocity.y < 0)))))){
this.gameCourse.scrollV(-(this.player.velocity.y));
};
if (((this.player.alive) && (((frameCounter % 3) == 0)))){
if ((((((this.player.y > 440)) || ((this.player.y < -40)))) || (this.gameCourse.hitTestCourse(this.player)))){
if (this.player.alive){
this.player.explode();
if (this.player.lives >= 0){
this.reset();
} else {
this.gameInPlay = false;
Tweener.addTween(this.blocker, {_autoAlpha:1, time:1.5, transition:"easeInExpo", onComplete:this.gameOver});
};
};
};
if (this.gameCourse.hitTestBonus(this.player)){
Main.audioPlayer.playFX(AudioPlayer.JP_ITEM);
this.player.sparklez();
this.player.fuel = (this.player.fuel + JetPack.BONUS_FUEL);
this.boost();
};
};
this.frameCounter++;
if (this.player.alive){
this.updateScore((this.scrollSpeed / 5));
};
}
private function onFadeOutComplete():void{
this.removeEventListener(Event.ENTER_FRAME, this.run);
this.gameCourse.reset();
this.player.reset();
this.player.x = 150;
this.player.y = 150;
this.score = 0;
APEngine.paint();
Tweener.addTween(this.blocker, {_autoAlpha:0, time:1, transition:"easeOutExpo", onComplete:this.onFadeInComplete});
}
private function stopBoost():void{
clearTimeout(this.boostInterval);
Tweener.addTween(this, {scrollSpeed:JetPack.SCROLL_SPEED, time:1, transition:"easeOutExpo"});
}
override protected function startGameEngine():void{
this.scrollSpeed = JetPack.SCROLL_SPEED;
this.frameCounter = 0;
super.startGameEngine();
}
private function onFadeInComplete():void{
this.gameInPlay = true;
this.addEventListener(Event.ENTER_FRAME, this.run, false, 0, true);
}
override public function init():void{
trace("INIT: JetPack");
super.init();
}
override public function updateScore(_arg1:int, _arg2:Boolean=true):Boolean{
if (this.score > this.highScore){
this.highScore = this.score;
};
if (_arg2){
this.HUD.highScoreText.HUDText.text = this.highScore;
this.HUD.scoreText.HUDText.text = this.score;
};
return (super.updateScore(_arg1, false));
}
private function reset():void{
this.gameInPlay = false;
this.scrollSpeed = JetPack.SCROLL_SPEED;
Tweener.addTween(this.blocker, {_autoAlpha:1, time:2, transition:"easeInExpo", onComplete:this.onFadeOutComplete});
}
override public function startGame():void{
this.gameContainer = new MovieClip();
this.addChildAt(this.gameContainer, this.getChildIndex(this.HUD));
this.gameContainer.x = (stage.stageWidth / -2);
this.gameContainer.y = (stage.stageHeight / -2);
this.gameCourse = new JetPackCourse(0, 0);
this.gameContainer.addChild(this.gameCourse);
this.engineContainer = new MovieClip();
this.gameContainer.addChild(this.engineContainer);
this.engineMask = new MovieClip();
this.engineMask.graphics.clear();
this.engineMask.graphics.lineStyle(1, 0xFFFFFF, 1);
this.engineMask.graphics.beginFill(0xFFFFFF, 1);
this.engineMask.graphics.drawRect(0, 0, JetPack.GAME_WIDTH, JetPack.GAME_HEIGHT);
this.engineMask.graphics.endFill();
this.gameContainer.addChild(this.engineMask);
this.engineMask.x = this.engineContainer.x;
this.engineMask.y = this.engineContainer.y;
this.engineContainer.mask = this.engineMask;
this.blocker = new Blocker();
this.blocker.alpha = 0;
this.blocker.visible = false;
this.gameContainer.addChild(this.blocker);
APEngine.init((1 / 4));
APEngine.container = this.engineContainer;
APEngine.constraintCollisionCycles = 10;
APEngine.addMasslessForce(new Vector(0, JetPack.ENGINE_GRAVITY));
APEngine.damping = JetPack.ENGINE_DAMPING;
this.playerGroup = new Group();
this.player = new JetPackPlayer(150, 150);
this.player.group = this.playerGroup;
this.playerGroup.addParticle(this.player);
APEngine.addGroup(this.playerGroup);
super.startGame();
}
private function boost():void{
var _local1:Point;
_local1 = new Point(this.player.sprite.x, this.player.sprite.y);
_local1 = this.player.sprite.parent.localToGlobal(_local1);
this.createFloater(_local1.x, (_local1.y - 45), (("+" + JetPack.BONUS_FUEL) + " FUEL"));
Tweener.addTween(this, {scrollSpeed:JetPack.BOOST_SPEED, time:1, transition:"easeOutExpo"});
clearTimeout(this.boostInterval);
this.boostInterval = setTimeout(this.stopBoost, (JetPack.BOOST_TIME * 1000));
}
override public function gameOver():void{
Tweener.addTween(this["startCountdownHUD"], {_autoAlpha:0, time:0.5, transition:"easeOutExpo"});
this.setScore(this.highScore);
clearTimeout(this.boostInterval);
super.gameOver();
}
override public function destroy():void{
trace("DESTROY: JetPack");
clearTimeout(this.JPMiscTimeout);
this.player.destroy();
this.gameCourse.destroy();
this.removeChild(this.gameContainer);
APEngine.container = null;
APEngine.destroy();
super.destroy();
}
}
}//package com.wddg.SpaceChimps.Game.JetPack
Section 28
//JetPackCourse (com.wddg.SpaceChimps.Game.JetPack.JetPackCourse)
package com.wddg.SpaceChimps.Game.JetPack {
import flash.display.*;
import org.cove.ape.*;
import flash.utils.*;
import com.troygilbert.CollisionDetection.*;
import com.wddg.SpaceChimps.Game.*;
public class JetPackCourse extends MovieClip {
private const courseLinksC:Array;
private const courseLinksB:Array;
private const courseLinksA:Array;
private var backgroundTiles:Array;// = null
private var topLeftX:Number;// = 0
private var bonuses:Array;// = null
private var background:MovieClip;
private var dynamicCourseArray:Array;
private var tiles:Array;// = null
private var staticCourseArray:Array;
private var bottomRightX:Number;// = 0
private var bottomRightY:Number;// = 0
private var tileIndex:int;// = -1
private var currentTile:MovieClip;
private var topLeftY:Number;// = 0
public function JetPackCourse(_arg1:Number, _arg2:Number){
courseLinksA = new Array("JetPackCourseLink_A_A_00", "JetPackCourseLink_A_B_00", "JetPackCourseLink_A_C_00", "JetPackCourseLink_A_A_01", "JetPackCourseLink_A_C_01", "JetPackCourseLink_A_A_02");
courseLinksB = new Array("JetPackCourseLink_B_A_00", "JetPackCourseLink_B_B_00", "JetPackCourseLink_B_C_00", "JetPackCourseLink_B_B_01", "JetPackCourseLink_B_B_02");
courseLinksC = new Array("JetPackCourseLink_C_A_00", "JetPackCourseLink_C_B_00", "JetPackCourseLink_C_C_00", "JetPackCourseLink_C_C_01", "JetPackCourseLink_C_C_01", "JetPackCourseLink_C_C_02");
topLeftX = 0;
topLeftY = 0;
bottomRightX = 0;
bottomRightY = 0;
backgroundTiles = null;
tiles = null;
tileIndex = -1;
bonuses = null;
staticCourseArray = new Array("JetPackCourseLink_A_A_02", "JetPackCourseLink_A_C_00", "JetPackCourseLink_C_C_02", "JetPackCourseLink_C_C_02", "JetPackCourseLink_C_C_02", "JetPackCourseLink_C_B_00", "JetPackCourseLink_B_B_00", "JetPackCourseLink_B_B_00", "JetPackCourseLink_B_A_00", "JetPackCourseLink_A_A_02");
dynamicCourseArray = new Array();
super();
this.topLeftX = _arg1;
this.topLeftY = _arg2;
this.generateCourse();
this.bonuses = new Array();
this.background = new MovieClip();
this.addChild(this.background);
this.backgroundTiles = new Array();
this.createBGTile();
this.tiles = new Array();
this.currentTile = this.createTile();
trace("JetPackCourse Created");
}
public function destroy():void{
var _local1:int;
_local1 = 0;
while (_local1 < this.tiles.length) {
this.removeChild(this.tiles[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < this.backgroundTiles.length) {
this.background.removeChild(this.backgroundTiles[_local1]);
_local1++;
};
this.backgroundTiles = new Array();
this.tiles = new Array();
this.bonuses = new Array();
}
private function destroyBGTile():void{
var _local1:MovieClip;
_local1 = this.backgroundTiles.shift();
this.background.removeChild(_local1);
}
function scrollV(_arg1:Number):void{
var _local2:Number;
var _local3:JetPackPlayer;
_local2 = JetPack.GAME_HEIGHT;
if (((((((this.y + 785) > _local2)) && ((_arg1 < 0)))) || ((((this.y < -15)) && ((_arg1 > 0)))))){
this.y = (this.y + _arg1);
_local3 = JetPack(Game._instance).player;
_local3.curr.y = (_local3.curr.y + _arg1);
_local3.prev.y = (_local3.prev.y + _arg1);
};
}
function hitTestBonus(_arg1:JetPackPlayer):Boolean{
var _local2:int;
_local2 = 0;
while (_local2 < this.bonuses.length) {
if (this.bonuses[_local2].hitTestObject(_arg1.sprite)){
this.bonuses[_local2].parent.removeChild(this.bonuses[_local2]);
return (true);
};
_local2++;
};
return (false);
}
public function set paused(_arg1:Boolean):void{
var i:int;
var v = _arg1;
i = 0;
try {
if (v){
i = 0;
while (i < this.bonuses.length) {
this.bonuses[i].stop();
i = (i + 1);
};
} else {
i = 0;
while (i < this.bonuses.length) {
this.bonuses[i].play();
i = (i + 1);
};
};
} catch(e:Error) {
};
}
function hitTestCourse(_arg1:JetPackPlayer):Boolean{
var _local2:Boolean;
_local2 = PixelPerfectCollisionDetection.isColliding(_arg1.sprite, this.currentTile.course, _arg1.sprite.parent, true);
return (_local2);
}
public function reset():void{
this.tileIndex = -1;
this.y = 0;
this.destroy();
this.createBGTile();
this.currentTile = this.createTile();
}
private function createBGTile():void{
var _local1:MovieClip;
if (this.backgroundTiles.length == 3){
return;
};
_local1 = new JetPackBackgroundTile();
this.backgroundTiles.push(_local1);
this.background.addChild(_local1);
if (this.backgroundTiles.length > 1){
_local1.x = Math.floor((this.backgroundTiles[(this.backgroundTiles.length - 2)].x + this.backgroundTiles[(this.backgroundTiles.length - 2)].width));
};
}
private function createTile():MovieClip{
var _local1:Class;
var _local2:MovieClip;
var _local3:int;
var _local4:DisplayObject;
if (this.tiles.length == 2){
return (null);
};
this.tileIndex++;
if (this.tileIndex >= this.dynamicCourseArray.length){
JetPack(Game._instance).courseComplete();
return (null);
};
_local1 = (getDefinitionByName(String(this.dynamicCourseArray[this.tileIndex])) as Class);
_local2 = new (_local1);
this.tiles.push(_local2);
this.addChild(_local2);
if (this.tiles.length > 1){
_local2.x = (this.tiles[(this.tiles.length - 2)].x + this.tiles[(this.tiles.length - 2)].width);
};
_local3 = 0;
while (_local3 < _local2.numChildren) {
_local4 = _local2.getChildAt(_local3);
if ((_local4 is JetPackBonus)){
this.bonuses.push(_local4);
};
_local3++;
};
return (_local2);
}
function scroll(_arg1:Number):void{
var _local2:int;
_local2 = 0;
if (this.tiles.length > 0){
_local2 = 0;
while (_local2 < this.tiles.length) {
this.tiles[_local2].x = (this.tiles[_local2].x - _arg1);
_local2++;
};
if (this.tiles[0].x < -(JetPack.GAME_WIDTH)){
this.createTile();
};
if (this.tiles[0].x < (JetPack.GAME_WIDTH * -2)){
this.destroyTile();
};
if (((this.tiles[1]) && ((this.tiles[1].x < (JetPack.GAME_WIDTH * 0.1))))){
this.currentTile = this.tiles[1];
};
};
if (this.backgroundTiles.length > 0){
_local2 = 0;
while (_local2 < this.backgroundTiles.length) {
this.backgroundTiles[_local2].x = (this.backgroundTiles[_local2].x - (_arg1 * 0.5));
_local2++;
};
if ((this.backgroundTiles[0].x + this.backgroundTiles[0].width) < JetPack.GAME_WIDTH){
this.createBGTile();
};
if ((this.backgroundTiles[0].x + this.backgroundTiles[0].width) < 0){
this.destroyBGTile();
};
};
}
private function destroyTile():void{
var _local1:int;
var _local2:MovieClip;
_local1 = (this.bonuses.length - 1);
while (_local1 >= 0) {
if (this.bonuses[_local1].parent == this.tiles[0]){
this.bonuses.splice(_local1, 1);
};
_local1--;
};
_local2 = this.tiles.shift();
this.removeChild(_local2);
}
private function generateCourse():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:String;
var _local7:*;
var _local8:int;
var _local9:String;
_local1 = getTimer();
_local2 = 500;
this.dynamicCourseArray = new Array();
this.dynamicCourseArray = this.dynamicCourseArray.concat(this.staticCourseArray);
_local3 = 0;
while (_local3 < _local2) {
_local5 = this.dynamicCourseArray[(this.dynamicCourseArray.length - 1)].length;
_local6 = this.dynamicCourseArray[(this.dynamicCourseArray.length - 1)].substr((_local5 - 4), 1);
_local7 = this[("courseLinks" + _local6)];
_local8 = (Math.floor((Math.random() * 100)) % _local7.length);
_local9 = _local7[_local8];
this.dynamicCourseArray.push(_local9);
_local3++;
};
_local4 = (getTimer() - _local1);
trace((("FINAL COURSE (" + _local4) + " ms): "));
}
}
}//package com.wddg.SpaceChimps.Game.JetPack
Section 29
//JetPackPlayer (com.wddg.SpaceChimps.Game.JetPack.JetPackPlayer)
package com.wddg.SpaceChimps.Game.JetPack {
import com.caurina.transitions.*;
import flash.geom.*;
import flash.display.*;
import org.cove.ape.*;
import flash.utils.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
import com.wddg.SpaceChimps.Game.*;
public class JetPackPlayer extends RectangleParticle {
private var _invulnerable:Boolean;// = false
private var startInvulnerableTime:int;
private var _lives:int;// = 0
private var _skin:MovieClip;
private var _group:Group;
private var _fuel:int;
private var _alive:Boolean;
private var flashInterval:int;
public function JetPackPlayer(_arg1:Number, _arg2:Number){
_lives = 0;
_invulnerable = false;
super(_arg1, _arg2, 35, 50);
this.elasticity = 0;
this.alwaysRepaint = true;
this._alive = true;
this._fuel = JetPack.PLAYER_MAX_FUEL;
this._lives = JetPack.PLAYER_MAX_LIVES;
this._skin = new JetPackPlayerSkin();
this.setDisplay(this._skin);
this._skin.stop();
this._skin.actor.stop();
this._skin.actor.clip.booster.stop();
this._skin.fuelAnimation.visible = false;
this._skin.fuelAnimation.stop();
}
function get lives():int{
return (this._lives);
}
function set lives(_arg1:int):void{
this._lives = _arg1;
JetPack(Game._instance).updateHUDLives();
}
function sparklez():void{
try {
this._skin.fuelAnimation.visible = true;
this._skin.fuelAnimation.gotoAndPlay(1);
} catch(e:Error) {
};
}
function get invulnerable():Boolean{
return (this._invulnerable);
}
public function reset():void{
clearInterval(this.flashInterval);
this._skin.gotoAndStop(1);
this._skin.rotation = 0;
this._alive = true;
this.fuel = JetPack.PLAYER_MAX_FUEL;
}
function set invulnerable(_arg1:Boolean):void{
this._invulnerable = _arg1;
if (_arg1){
clearInterval(this.flashInterval);
this.flashInterval = setInterval(this.flash, 50);
this.startInvulnerableTime = getTimer();
} else {
clearInterval(this.flashInterval);
this.displayObject.visible = true;
};
}
function set fuel(_arg1:int):void{
this._fuel = Math.max(_arg1, 0);
JetPack(Game._instance).updateHUDFuel();
if (this._fuel == 0){
if (this._skin.actor){
this._skin.actor.gotoAndStop(1);
};
};
}
function get x():Number{
return (this.px);
}
function get group():Group{
return (this._group);
}
function get y():Number{
return (this.py);
}
public function getBounds():Rectangle{
var _local1:Rectangle;
_local1 = this.sprite.getBounds(this.sprite.parent);
return (_local1);
}
function get fuel():int{
return (this._fuel);
}
function set animating(_arg1:Boolean):void{
var _local2:int;
var _local3:*;
var _local4:*;
if (this._skin.actor.clip){
if (_arg1){
_local2 = Math.max(((this._skin.actor.clip.booster.currentFrame + 1) % this._skin.actor.clip.booster.totalFrames), 2);
this._skin.actor.clip.booster.gotoAndStop(_local2);
_local3 = (this._skin.actor.currentFrame + 1);
this._skin.actor.gotoAndStop(_local3);
} else {
this._skin.actor.clip.booster.gotoAndStop(1);
_local4 = (this._skin.actor.currentFrame - 1);
this._skin.actor.gotoAndPlay(_local4);
};
};
}
function get alive():Boolean{
return (this._alive);
}
function explode():void{
Main.audioPlayer.stopFX();
Main.audioPlayer.playFX(AudioPlayer.JP_PLAYERHIT);
this.lives--;
this._alive = false;
this._skin.gotoAndStop(2);
}
function set x(_arg1:Number):void{
this.curr.x = _arg1;
this.prev.x = _arg1;
}
function set y(_arg1:Number):void{
this.curr.y = _arg1;
this.prev.y = _arg1;
}
public function destroy():void{
trace("DESTROY: ShipLandingPlayer");
clearInterval(this.flashInterval);
this._skin = null;
this.group.removeParticle(this);
}
function set group(_arg1:Group):void{
this._group = _arg1;
}
private function flash():void{
this.displayObject.visible = !(this.displayObject.visible);
if ((getTimer() - this.startInvulnerableTime) > JetPack.INVULNERABLILITY_TIME){
clearInterval(this.flashInterval);
this.invulnerable = false;
};
}
}
}//package com.wddg.SpaceChimps.Game.JetPack
Section 30
//Game (com.wddg.SpaceChimps.Game.Game)
package com.wddg.SpaceChimps.Game {
import flash.events.*;
import com.caurina.transitions.*;
import flash.display.*;
import com.wddg.SpaceChimps.Scene.*;
import flash.utils.*;
import flash.text.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
import flash.filters.*;
public class Game extends SPScene {
protected var gameIndex:int;// = 0
private var timerInterval:int;
public var isGame:Boolean;// = true
private var _useTimer:Boolean;// = true
protected var maxTime:int;// = 60
protected var currentKeysDown:Dictionary;
protected var quota:int;// = 0
private var floaters:Array;
protected var score:int;// = 0
private var startGameCountdownValues:Array;
private var _paused:Boolean;// = false
protected var gameInPlay:Boolean;// = false
private var _blur:BlurFilter;
private var pauseKeyPressed:Boolean;// = false
protected var currentTime:int;
private var startGameCounter:int;
private var startGameInterval:int;
public static var _instance:Game;
public function Game(){
isGame = true;
maxTime = 60;
gameIndex = 0;
score = 0;
quota = 0;
gameInPlay = false;
startGameCountdownValues = new Array("3", "2", "1", "START");
pauseKeyPressed = false;
_paused = false;
_useTimer = true;
floaters = new Array();
super();
Game._instance = this;
this["gameOverHUD"].stop();
this["gameOverHUD"].visible = false;
this["gameOverHUD"].alpha = 0;
this["startCountdownHUD"].visible = false;
this["startCountdownHUD"].alpha = 0;
this["startHUD"].stop();
this["startHUD"].startButton.stop();
this["startHUD"].startButton.visible = false;
this["HUD"].pauseButton.stop();
this.setScore(0);
this.currentKeysDown = new Dictionary();
trace("Game Created");
}
public function shake():void{
this.y = ((stage.stageHeight / 2) + 40);
Tweener.addTween(this, {y:(stage.stageHeight / 2), time:1, transition:"easeoutelastic", onComplete:this.onShakeComplete});
}
override protected function onReleaseHandler(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "startButton":
this.outroStartScreen();
break;
case "moreTrainingButton":
Main.launchURL(Main.LEADERBOARD_URL, Main.LEADERBOARD_URL_TARGET);
break;
case "replayButton":
Main._instance.changeScene(Main.SCENE_GAME2);
break;
case "quitButton":
Main._instance.changeScene(Main.SCENE_WRAPUP);
break;
case "menuButton":
if (this.gameInPlay){
Main._instance.gameMenu.display = true;
};
break;
case "pauseButton":
if (this._paused){
this.paused = false;
} else {
this.paused = true;
};
break;
case "linkButton":
Main.launchURL(_arg1.target.link, _arg1.target.linkTarget);
break;
case "promoButton":
Main.launchURL(Main.SITE_URL, Main.SITE_URL_TARGET);
break;
case "logoButton":
Main.launchURL(Main.SITE_URL, Main.SITE_URL_TARGET);
break;
};
super.onReleaseHandler(_arg1);
}
override public function outro():void{
this.onOutroComplete();
}
override public function init():void{
if (this._useTimer){
this.resetTimer();
};
trace("INIT: Game");
this["startHUD"].startButton.visible = true;
this["startHUD"].startButton.play();
this["startHUD"].startButton.tabEnabled = false;
this["startHUD"].startButton.buttonMode = true;
this["startHUD"].startButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this["startHUD"].startButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this["startHUD"].startButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDownHandler, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, this.onKeyUpHandler, false, 0, true);
super.init();
}
protected function startTimer():void{
clearInterval(this.timerInterval);
this.timerInterval = setInterval(this.countdown, 1000);
}
private function onShakeUpdate():void{
this.filters = new Array(this._blur);
}
protected function set useTimer(_arg1:Boolean):void{
this._useTimer = _arg1;
}
override public function onIntroComplete():void{
this["startHUD"].promoButton.buttonText.text = Main.PROMOCOPY;
this["startHUD"].promoButton.buttonMode = true;
this["startHUD"].promoButton.mouseChildren = false;
this["startHUD"].promoButton.tabEnabled = false;
this["startHUD"].promoButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
super.onIntroComplete();
}
protected function startGameCountdown():void{
this.startGameCounter = 0;
clearInterval(this.startGameInterval);
this.startGameInterval = setInterval(this.gameCountdown, 1000);
this["startCountdownHUD"].mouseEnabled = true;
this["startCountdownHUD"].mouseChildren = true;
this["startCountdownHUD"].HUDText.text = this.startGameCountdownValues[this.startGameCounter];
Main.audioPlayer.playFX(AudioPlayer.FX_TIMERALARM);
}
public function get paused():Boolean{
return (this._paused);
}
protected function resetTimer():void{
this.currentTime = this.maxTime;
this.updateHUDTimer();
}
override protected function onRollOutHandler(_arg1:MouseEvent):void{
if ((((_arg1.target.name == "pauseButton")) || ((_arg1.target.name == "menuButton")))){
_arg1.target.buttonText.alpha = 1;
} else {
super.onRollOutHandler(_arg1);
};
}
override protected function onRollOverHandler(_arg1:MouseEvent):void{
if ((((_arg1.target.name == "pauseButton")) || ((_arg1.target.name == "menuButton")))){
_arg1.target.buttonText.alpha = 0.7;
} else {
super.onRollOverHandler(_arg1);
};
}
public function onFloatComplete(_arg1:MovieClip):void{
var _local2:MovieClip;
var _local3:int;
_local2 = _arg1[0];
_local3 = (this.floaters.length - 1);
while (_local3 >= 0) {
if (this.floaters[_local3] == _local2){
this.floaters.splice(_local3, 1);
this.removeChild(_local2);
break;
};
_local3--;
};
}
public function setScore(_arg1:int):void{
var score = _arg1;
this.score = score;
try {
this["HUD"].scoreText.HUDText.text = this.score;
} catch(e) {
trace(e);
};
}
private function gameCountdown():void{
this.startGameCounter++;
if (this.startGameCounter < 4){
this["startCountdownHUD"].HUDText.text = this.startGameCountdownValues[this.startGameCounter];
Main.audioPlayer.playFX(AudioPlayer.FX_TIMERALARM);
};
if (this.startGameCounter == 3){
clearInterval(this.startGameInterval);
this.startGameEngine();
};
}
public function set paused(_arg1:Boolean):void{
if (this.gameInPlay){
this._paused = _arg1;
if (_arg1){
if (this._useTimer){
this.stopTimer();
};
this["HUD"].pauseButton.gotoAndStop(2);
this["startCountdownHUD"].HUDText.text = "PAUSED";
this["startCountdownHUD"].mouseEnabled = false;
this["startCountdownHUD"].mouseChildren = false;
Tweener.addTween(this["startCountdownHUD"], {_autoAlpha:1, time:0.7, transition:"easeOutExpo"});
this.removeEventListener(Event.ENTER_FRAME, this.run);
} else {
if (this._useTimer){
this.startTimer();
};
this["HUD"].pauseButton.gotoAndStop(1);
this["startCountdownHUD"].HUDText.text = "";
this["startCountdownHUD"].mouseEnabled = true;
this["startCountdownHUD"].mouseChildren = true;
Tweener.addTween(this["startCountdownHUD"], {_autoAlpha:0, time:0.7, transition:"easeOutExpo"});
if (Main._instance.gameMenu.display){
Main._instance.gameMenu.display = false;
};
this.addEventListener(Event.ENTER_FRAME, this.run, false, 0, true);
};
};
}
protected function stopTimer():void{
clearInterval(this.timerInterval);
}
public function updateScore(_arg1:int, _arg2:Boolean=true):Boolean{
var _local3:Boolean;
_local3 = true;
this.score = (this.score + _arg1);
if (this.score < 0){
this.score = 0;
_local3 = false;
};
if (_arg2){
this["HUD"].scoreText.HUDText.text = this.score;
};
return (_local3);
}
override public function intro():void{
this["startHUD"].play();
}
public function createFloater(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:MovieClip;
_local4 = new ScoreFloater();
_local4.x = (_arg1 - (stage.stageWidth / 2));
_local4.y = (_arg2 - (stage.stageHeight / 2));
_local4.floatText.text = _arg3;
this.addChild(_local4);
this.floaters.push(_local4);
Tweener.addTween(_local4, {y:(_local4.y - 20), time:5, transition:"easeOutExpo"});
Tweener.addTween(_local4, {_autoAlpha:0, time:5, transition:"easeOutExpo", onComplete:this.onFloatComplete, onCompleteParams:[_local4]});
}
protected function countdown():void{
this.currentTime--;
if (this.currentTime < 10){
Main.audioPlayer.playFX(AudioPlayer.FX_TIMERALARM);
};
this.updateHUDTimer();
if (this.currentTime <= 0){
this.gameOver();
};
}
protected function onKeyDownHandler(_arg1:KeyboardEvent):void{
this.currentKeysDown[_arg1.keyCode] = true;
if ((((_arg1.keyCode == 80)) && (!(this.pauseKeyPressed)))){
this.pauseKeyPressed = true;
this.paused = !(this.paused);
};
}
public function startGame():void{
Tweener.addTween(this["startHUD"], {_autoAlpha:0, time:0.7, transition:"easeOutExpo"});
Tweener.addTween(this["startCountdownHUD"], {_autoAlpha:1, time:0.7, transition:"easeOutExpo"});
this.startGameCountdown();
}
public function outroStartScreen():void{
if (Main.IS_SOUND_MUTE_FROM_EXTERNAL_LINK){
Main.IS_SOUND_MUTE_FROM_EXTERNAL_LINK = false;
Main.audioPlayer.mute = false;
};
this["startHUD"].play();
}
public function introGameOverScreenScreen():void{
Main.audioPlayer.stopMusic();
Main.audioPlayer.playMusic(AudioPlayer.MUSIC_WRAPUP, true);
Tweener.addTween(this["gameOverHUD"], {_autoAlpha:1, time:0.7, transition:"easeOutExpo"});
this["gameOverHUD"].play();
}
public function onGameOverScreenIntroComplete():void{
var _local1:int;
this["gameOverHUD"].replayButton.visible = false;
this["gameOverHUD"].replayButton.alpha = 0;
this["gameOverHUD"].replayButton.buttonMode = true;
this["gameOverHUD"].replayButton.tabEnabled = false;
this["gameOverHUD"].replayButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this["gameOverHUD"].replayButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this["gameOverHUD"].replayButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this["gameOverHUD"].moreTrainingButton.visible = false;
this["gameOverHUD"].moreTrainingButton.alpha = 0;
this["gameOverHUD"].moreTrainingButton.buttonMode = true;
this["gameOverHUD"].moreTrainingButton.tabEnabled = false;
this["gameOverHUD"].moreTrainingButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this["gameOverHUD"].moreTrainingButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this["gameOverHUD"].moreTrainingButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this["gameOverHUD"].quitButton.visible = false;
this["gameOverHUD"].quitButton.alpha = 0;
this["gameOverHUD"].quitButton.buttonMode = true;
this["gameOverHUD"].quitButton.tabEnabled = false;
this["gameOverHUD"].quitButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this["gameOverHUD"].quitButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this["gameOverHUD"].quitButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this["gameOverHUD"].linkButton.buttonText.text = Main[(("VIDEO" + this.gameIndex) + "_NAME")];
this["gameOverHUD"].linkButton.link = Main[(("VIDEO" + this.gameIndex) + "_URL")];
this["gameOverHUD"].linkButton.linkTarget = Main[(("VIDEO" + this.gameIndex) + "_URL_TARGET")];
this["gameOverHUD"].linkButton.visible = false;
this["gameOverHUD"].linkButton.alpha = 0;
this["gameOverHUD"].linkButton.buttonMode = true;
this["gameOverHUD"].linkButton.mouseChildren = false;
this["gameOverHUD"].linkButton.tabEnabled = false;
this["gameOverHUD"].linkButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this["gameOverHUD"].linkButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this["gameOverHUD"].linkButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this["gameOverHUD"].promoButton.buttonText.text = Main.PROMOCOPY;
this["gameOverHUD"].promoButton.buttonMode = true;
this["gameOverHUD"].promoButton.mouseChildren = false;
this["gameOverHUD"].promoButton.tabEnabled = false;
this["gameOverHUD"].promoButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this["gameOverHUD"].logoButton.buttonMode = true;
this["gameOverHUD"].logoButton.tabEnabled = false;
this["gameOverHUD"].logoButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this["gameOverHUD"].scoreText.text = ("FINAL SCORE: " + this.score);
_local1 = 0;
_local1 = 1;
while (_local1 <= 3) {
this["gameOverHUD"][("badge" + _local1)].visible = false;
_local1++;
};
if (this.score >= this.quota){
this["gameOverHUD"].successText.text = "";
this["gameOverHUD"]["badgeBG2"].visible = true;
this["gameOverHUD"]["badge2"].visible = true;
setTimeout(this["gameOverHUD"]["badge2"].play, (500 * _local1));
} else {
this["gameOverHUD"].successText.text = (("You need a score of at least " + this.quota) + " to complete the training.");
_local1 = 1;
while (_local1 <= 3) {
this["gameOverHUD"][("badgeBG" + _local1)].visible = false;
_local1++;
};
};
Tweener.addTween(this["gameOverHUD"].replayButton, {_autoAlpha:1, time:1.5, transition:"easeOutExpo"});
Tweener.addTween(this["gameOverHUD"].moreTrainingButton, {_autoAlpha:1, time:1.5, transition:"easeOutExpo"});
Tweener.addTween(this["gameOverHUD"].quitButton, {_autoAlpha:1, time:1.5, transition:"easeOutExpo"});
if (this["gameOverHUD"].linkButton.link.length > 0){
Tweener.addTween(this["gameOverHUD"].linkButton, {_autoAlpha:1, time:1.5, transition:"easeOutExpo"});
};
}
private function updateHUDTimer():void{
var _local1:String;
var _local2:String;
_local1 = String(Math.floor((this.currentTime / 60)));
_local2 = String(Math.floor((this.currentTime % 60)));
if (_local1.length < 2){
_local1 = ("0" + _local1);
};
if (_local2.length < 2){
_local2 = ("0" + _local2);
};
this["HUD"].timerText.HUDText.text = ((("00:" + _local1) + ":") + _local2);
}
private function onShakeComplete():void{
}
protected function run(_arg1:Event):void{
}
protected function startGameEngine():void{
Tweener.addTween(this["startCountdownHUD"], {_autoAlpha:0, time:0.7, transition:"easeOutExpo"});
this.gameInPlay = true;
this.addEventListener(Event.ENTER_FRAME, this.run, false, 0, true);
this["HUD"].menuButton.buttonMode = true;
this["HUD"].menuButton.tabEnabled = false;
this["HUD"].menuButton.mouseChildren = false;
this["HUD"].menuButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this["HUD"].menuButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this["HUD"].menuButton.addEventListener(MouseEvent.CLICK, onReleaseHandler);
this["HUD"].pauseButton.buttonMode = true;
this["HUD"].pauseButton.tabEnabled = false;
this["HUD"].pauseButton.mouseChildren = false;
this["HUD"].pauseButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this["HUD"].pauseButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this["HUD"].pauseButton.addEventListener(MouseEvent.CLICK, onReleaseHandler);
if (this._useTimer){
this.startTimer();
};
}
protected function onKeyUpHandler(_arg1:KeyboardEvent):void{
delete this.currentKeysDown[_arg1.keyCode];
if ((((_arg1.keyCode == 80)) && (this.pauseKeyPressed))){
this.pauseKeyPressed = false;
};
}
public function gameOver():void{
var _local1:int;
this.gameInPlay = false;
this.removeEventListener(Event.ENTER_FRAME, this.run);
_local1 = 0;
while (_local1 > this.floaters.length) {
this.removeChild(this.floaters[_local1]);
_local1++;
};
this.floaters = new Array();
if (this._useTimer){
this.stopTimer();
};
Main(Main._instance).setGameScore(1, this.score);
this.introGameOverScreenScreen();
}
override public function destroy():void{
var _local1:int;
trace("DESTROY: Game");
stage.removeEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDownHandler);
stage.removeEventListener(KeyboardEvent.KEY_UP, this.onKeyUpHandler);
this.removeEventListener(Event.ENTER_FRAME, this.run);
this.currentKeysDown = null;
_local1 = 0;
while (_local1 < this.floaters.length) {
this.removeChild(this.floaters[_local1]);
_local1++;
};
super.destroy();
}
}
}//package com.wddg.SpaceChimps.Game
Section 31
//GameMenu (com.wddg.SpaceChimps.Menu.GameMenu)
package com.wddg.SpaceChimps.Menu {
import flash.events.*;
import com.caurina.transitions.*;
import flash.display.*;
import flash.utils.*;
import com.wddg.Event.*;
import com.wddg.SpaceChimps.*;
import com.wddg.SpaceChimps.Game.*;
public class GameMenu extends Menu {
public var background:MovieClip;
public var quitButton:MovieClip;
public var siteButton:MovieClip;
public var closeButton:MovieClip;
public var audioButton:MovieClip;
public var moreGamesButton:MovieClip;
override protected function onReleaseHandler(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "closeButton":
this.display = false;
if (Main.IS_SOUND_MUTE_FROM_EXTERNAL_LINK){
Main.IS_SOUND_MUTE_FROM_EXTERNAL_LINK = false;
Main.audioPlayer.mute = false;
};
break;
case "quitButton":
this.display = false;
Game(Main._instance.currentscene).gameOver();
break;
case "audioButton":
if (Main.audioPlayer.mute){
Main.audioPlayer.mute = false;
this.audioButton.gotoAndStop(1);
} else {
Main.audioPlayer.mute = true;
this.audioButton.gotoAndStop(2);
};
break;
case "siteButton":
Main.launchURL(Main.SITE_URL, Main.SITE_URL_TARGET);
break;
case "moreGamesButton":
Main.launchURL(Main.CS_URL, Main.CS_URL_TARGET);
break;
};
super.onReleaseHandler(_arg1);
}
override protected function init():void{
this.closeButton.stop();
this.closeButton.buttonMode = true;
this.closeButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.closeButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.closeButton.addEventListener(MouseEvent.CLICK, onReleaseHandler);
this.quitButton.stop();
this.quitButton.buttonMode = true;
this.quitButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.quitButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.quitButton.addEventListener(MouseEvent.CLICK, onReleaseHandler);
this.audioButton.stop();
this.audioButton.buttonMode = true;
this.audioButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.audioButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.audioButton.addEventListener(MouseEvent.CLICK, onReleaseHandler);
this.siteButton.stop();
this.siteButton.buttonMode = true;
this.siteButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.siteButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.siteButton.addEventListener(MouseEvent.CLICK, onReleaseHandler);
this.moreGamesButton.stop();
this.moreGamesButton.buttonMode = true;
this.moreGamesButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.moreGamesButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.moreGamesButton.addEventListener(MouseEvent.CLICK, onReleaseHandler);
Main.audioPlayer.addEventListener(AudioEvent.SOUND_MUTE, this.onAudioMute, false, 0, true);
Main.audioPlayer.addEventListener(AudioEvent.SOUND_UNMUTE, this.onAudioUnMute, false, 0, true);
super.init();
}
override protected function onDisplayAnimationComplete():void{
if (((!(this.visible)) && ((Main._instance.currentscene is Game)))){
Game(Main._instance.currentscene).paused = false;
};
super.onDisplayAnimationComplete();
}
private function onAudioUnMute(_arg1:Event):void{
this.audioButton.gotoAndStop(1);
}
override public function set display(_arg1:Boolean):void{
if (_arg1){
Game(Main._instance.currentscene).paused = true;
MovieClip(Main._instance.currentscene).startCountdownHUD.alpha = 0;
MovieClip(Main._instance.currentscene).startCountdownHUD.visible = false;
Tweener.removeAllTweens();
};
if (Main.audioPlayer.mute){
this.audioButton.gotoAndStop(2);
} else {
this.audioButton.gotoAndStop(1);
};
super.display = _arg1;
}
private function onAudioMute(_arg1:Event):void{
this.audioButton.gotoAndStop(2);
}
}
}//package com.wddg.SpaceChimps.Menu
Section 32
//Menu (com.wddg.SpaceChimps.Menu.Menu)
package com.wddg.SpaceChimps.Menu {
import flash.events.*;
import com.caurina.transitions.*;
import flash.display.*;
import flash.utils.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
public class Menu extends MovieClip {
private var _display;// = false
public function Menu(){
_display = false;
super();
this.visible = false;
this.alpha = 0;
this.init();
trace("Menu Created");
}
public function destroy():void{
trace("DESTROY: Menu");
}
protected function onReleaseHandler(_arg1:MouseEvent):void{
Main.audioPlayer.playFX(AudioPlayer.FX_CLICK);
}
protected function init():void{
}
protected function onRollOutHandler(_arg1:MouseEvent):void{
_arg1.target.alpha = 1;
}
public function set display(_arg1:Boolean):void{
this._display = _arg1;
if (_arg1){
Tweener.addTween(this, {_autoAlpha:1, time:0.5, transition:"easeOutExpo", onComplete:this.onDisplayAnimationComplete});
} else {
Tweener.addTween(this, {_autoAlpha:0, time:0.5, transition:"easeOutExpo", onComplete:this.onDisplayAnimationComplete});
};
}
protected function onDisplayAnimationComplete():void{
}
protected function onRollOverHandler(_arg1:MouseEvent):void{
Main.audioPlayer.playFX(AudioPlayer.FX_ROLLOVER);
_arg1.target.alpha = 0.7;
}
public function get display():Boolean{
return (this._display);
}
}
}//package com.wddg.SpaceChimps.Menu
Section 33
//InstructionScene (com.wddg.SpaceChimps.Scene.InstructionScene)
package com.wddg.SpaceChimps.Scene {
import flash.events.*;
import com.caurina.transitions.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
public class InstructionScene extends SPScene {
public var nextButton:MovieClip;
public var instructionContent:MovieClip;
public var mainMenuButton:MovieClip;
public var prevButton:MovieClip;
public var playNowButton:MovieClip;
public function InstructionScene(){
addFrameScript(0, frame1);
super();
this.nextButton.buttonMode = true;
this.nextButton.tabEnabled = false;
this.nextButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.nextButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.nextButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.prevButton.buttonMode = true;
this.prevButton.tabEnabled = false;
this.prevButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.prevButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.prevButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.playNowButton.buttonMode = true;
this.playNowButton.tabEnabled = false;
this.playNowButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.playNowButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.playNowButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.mainMenuButton.buttonMode = true;
this.mainMenuButton.tabEnabled = false;
this.mainMenuButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.mainMenuButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.mainMenuButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
trace("InstructionScene Created");
}
override protected function onReleaseHandler(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "nextButton":
this.changeInstructionsToPage((this.instructionContent.currentFrame + 1));
break;
case "prevButton":
this.changeInstructionsToPage((this.instructionContent.currentFrame - 1));
break;
case "playNowButton":
Main._instance.changeScene(Main.SCENE_GAME2);
break;
case "mainMenuButton":
Main._instance.changeScene(Main.SCENE_TITLE);
break;
};
}
override public function init():void{
trace("INIT: WrapUpScene");
super.init();
}
function frame1(){
this.stop();
}
override public function intro():void{
Main.audioPlayer.playMusic(AudioPlayer.MUSIC_WRAPUP, true);
this.changeInstructionsToPage(1);
super.intro();
}
private function changeInstructionsToPage(_arg1:int):void{
this.instructionContent.gotoAndStop(_arg1);
if (_arg1 == 1){
this.playNowButton.visible = false;
this.prevButton.visible = false;
this.nextButton.visible = true;
} else {
if (_arg1 >= this.instructionContent.totalFrames){
this.playNowButton.visible = true;
this.prevButton.visible = true;
this.nextButton.visible = false;
} else {
this.playNowButton.visible = false;
this.prevButton.visible = true;
this.nextButton.visible = true;
};
};
}
override public function destroy():void{
trace("DESTROY: WrapUpScene");
this.nextButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.nextButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.nextButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.prevButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.prevButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.prevButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.playNowButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.playNowButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.playNowButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.mainMenuButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.mainMenuButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.mainMenuButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
super.destroy();
}
}
}//package com.wddg.SpaceChimps.Scene
Section 34
//SPScene (com.wddg.SpaceChimps.Scene.SPScene)
package com.wddg.SpaceChimps.Scene {
import flash.events.*;
import com.caurina.transitions.*;
import flash.display.*;
import com.wddg.SpaceChimps.Event.*;
import flash.utils.*;
import flash.text.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
public class SPScene extends MovieClip {
public function SPScene(){
trace("SPScene Created");
}
public function destroy():void{
trace(("DESTROY: SPScene: " + this.name));
}
protected function onReleaseHandler(_arg1:MouseEvent):void{
Main.audioPlayer.playFX(AudioPlayer.FX_CLICK);
}
public function outro():void{
Tweener.addTween(this, {_autoAlpha:0, time:0.7, transition:"easeOutExpo", onComplete:this.onOutroComplete});
}
public function init():void{
trace(("INIT: SPScene: " + this.name));
}
public function onIntroComplete():void{
this.dispatchEvent(new SPSceneEvent(SPSceneEvent.INTRO_COMPLETE));
this.init();
}
protected function onRollOutHandler(_arg1:MouseEvent):void{
_arg1.target.alpha = 1;
}
public function intro():void{
this.alpha = 0;
Tweener.addTween(this, {_autoAlpha:1, time:1.2, transition:"easeOutExpo", onComplete:this.onIntroComplete});
}
protected function onRollOverHandler(_arg1:MouseEvent):void{
Main.audioPlayer.playFX(AudioPlayer.FX_ROLLOVER);
_arg1.target.alpha = 0.7;
}
public function onOutroComplete():void{
this.destroy();
this.dispatchEvent(new SPSceneEvent(SPSceneEvent.OUTRO_COMPLETE));
this.parent.removeChild(this);
}
}
}//package com.wddg.SpaceChimps.Scene
Section 35
//TitleScene (com.wddg.SpaceChimps.Scene.TitleScene)
package com.wddg.SpaceChimps.Scene {
import flash.events.*;
import com.caurina.transitions.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import com.wddg.Event.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
public class TitleScene extends SPScene {
public var promoCopy:TextField;
public var startButton:MovieClip;
public var instructionsButton:MovieClip;
public var moreTrainingButton:MovieClip;
public var siteButton:MovieClip;
public var audioButton:MovieClip;
public var logoButton:MovieClip;
public var moreGamesButton:MovieClip;
public function TitleScene(){
addFrameScript(0, frame1, 92, frame93, 103, frame104);
super();
this.startButton.stop();
this.startButton.alpha = 0;
this.startButton.visible = false;
this.startButton.buttonMode = true;
this.startButton.tabEnabled = false;
this.startButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.startButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.startButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.moreTrainingButton.stop();
this.moreTrainingButton.alpha = 0;
this.moreTrainingButton.visible = false;
this.moreTrainingButton.stop();
this.moreTrainingButton.buttonMode = true;
this.moreTrainingButton.tabEnabled = false;
this.moreTrainingButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.moreTrainingButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.moreTrainingButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.instructionsButton.stop();
this.instructionsButton.alpha = 0;
this.instructionsButton.visible = false;
this.instructionsButton.stop();
this.instructionsButton.buttonMode = true;
this.instructionsButton.tabEnabled = false;
this.instructionsButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.instructionsButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.instructionsButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.siteButton.stop();
this.siteButton.alpha = 0;
this.siteButton.visible = false;
this.siteButton.stop();
this.siteButton.buttonMode = true;
this.siteButton.tabEnabled = false;
this.siteButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.siteButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.siteButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.moreGamesButton.stop();
this.moreGamesButton.alpha = 0;
this.moreGamesButton.visible = false;
this.moreGamesButton.stop();
this.moreGamesButton.buttonMode = true;
this.moreGamesButton.tabEnabled = false;
this.moreGamesButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.moreGamesButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.moreGamesButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.audioButton.stop();
this.audioButton.visible = false;
this.audioButton.buttonMode = true;
this.audioButton.tabEnabled = false;
this.audioButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.audioButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.audioButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.logoButton.buttonMode = true;
this.logoButton.tabEnabled = false;
this.logoButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
trace("TitleScene Created");
}
override protected function onReleaseHandler(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "startButton":
Main._instance.changeScene(Main.SCENE_GAME2);
break;
case "audioButton":
if (Main.audioPlayer.mute){
Main.audioPlayer.mute = false;
this.audioButton.gotoAndStop(1);
} else {
Main.audioPlayer.mute = true;
this.audioButton.gotoAndStop(2);
};
break;
case "instructionsButton":
Main._instance.changeScene(Main.SCENE_INSTRUCTIONS);
break;
case "moreTrainingButton":
Main.launchURL(Main.LEADERBOARD_URL, Main.LEADERBOARD_URL_TARGET);
break;
case "siteButton":
Main.launchURL(Main.SITE_URL, Main.SITE_URL_TARGET);
break;
case "logoButton":
Main.launchURL(Main.SITE_URL, Main.SITE_URL_TARGET);
break;
case "moreGamesButton":
Main.launchURL(Main.CS_URL, Main.CS_URL_TARGET);
break;
};
super.onReleaseHandler(_arg1);
}
override public function outro():void{
this.play();
}
override public function init():void{
trace("INIT: TitleScene");
Tweener.addTween(this.startButton, {_autoAlpha:100, delay:1, time:1, transition:"easeOutExpo", onComplete:this.startButton.play});
Tweener.addTween(this.moreTrainingButton, {_autoAlpha:100, delay:2, time:1, transition:"easeOutExpo", onComplete:this.moreTrainingButton.play});
Tweener.addTween(this.instructionsButton, {_autoAlpha:100, delay:3, time:1, transition:"easeOutExpo", onComplete:this.instructionsButton.play});
Tweener.addTween(this.siteButton, {_autoAlpha:100, delay:4, time:1, transition:"easeOutExpo", onComplete:this.siteButton.play});
Tweener.addTween(this.moreGamesButton, {_autoAlpha:100, delay:5, time:1, transition:"easeOutExpo", onComplete:this.moreGamesButton.play});
this.promoCopy.text = Main.PROMOCOPY;
this.audioButton.visible = true;
super.init();
}
function frame93(){
this.stop();
SPScene(this).onIntroComplete();
}
private function onAudioUnMute(_arg1:Event):void{
this.audioButton.gotoAndStop(1);
}
function frame1(){
this.stop();
}
override public function intro():void{
this.gotoAndPlay(2);
Main.audioPlayer.playMusic(AudioPlayer.MUSIC_TITLE, true);
Main.audioPlayer.addEventListener(AudioEvent.SOUND_MUTE, this.onAudioMute, false, 0, true);
Main.audioPlayer.addEventListener(AudioEvent.SOUND_UNMUTE, this.onAudioUnMute, false, 0, true);
}
function frame104(){
SPScene(this).onOutroComplete();
}
override public function destroy():void{
trace("DESTROY: TitleScene");
Main.audioPlayer.removeEventListener(AudioEvent.SOUND_MUTE, this.onAudioMute);
Main.audioPlayer.removeEventListener(AudioEvent.SOUND_UNMUTE, this.onAudioUnMute);
this.startButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.startButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.startButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.moreTrainingButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.moreTrainingButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.moreTrainingButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.instructionsButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.instructionsButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.instructionsButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.siteButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.siteButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.siteButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.siteButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.siteButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.siteButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.moreGamesButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.moreGamesButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.moreGamesButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
super.destroy();
}
private function onAudioMute(_arg1:Event):void{
this.audioButton.gotoAndStop(2);
}
}
}//package com.wddg.SpaceChimps.Scene
Section 36
//WrapUpScene (com.wddg.SpaceChimps.Scene.WrapUpScene)
package com.wddg.SpaceChimps.Scene {
import flash.events.*;
import com.caurina.transitions.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
public class WrapUpScene extends SPScene {
public var tryAgainButton:MovieClip;
public var scoreSubmitButton:MovieClip;
public var scoreTotalText:TextField;
public var highScoreText:TextField;
public var name1Text:TextField;
public var siteButton:MovieClip;
public var score1Text:TextField;
public var moreGamesButton:MovieClip;
public function WrapUpScene(){
addFrameScript(0, frame1, 9, frame10);
super();
this.siteButton.buttonMode = true;
this.siteButton.tabEnabled = false;
this.siteButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.siteButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.siteButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.scoreSubmitButton.buttonMode = true;
this.scoreSubmitButton.tabEnabled = false;
this.scoreSubmitButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.scoreSubmitButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.scoreSubmitButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.tryAgainButton.buttonMode = true;
this.tryAgainButton.tabEnabled = false;
this.tryAgainButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.tryAgainButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.tryAgainButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
this.moreGamesButton.buttonMode = true;
this.moreGamesButton.tabEnabled = false;
this.moreGamesButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.moreGamesButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.moreGamesButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
trace("WrapUpScene Created");
}
override protected function onReleaseHandler(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "scoreSubmitButton":
Main.launchURL(Main.LEADERBOARD_URL, Main.LEADERBOARD_URL_TARGET);
break;
case "tryAgainButton":
Main._instance.changeScene(Main.SCENE_TITLE);
break;
case "siteButton":
Main.launchURL(Main.SITE_URL, Main.SITE_URL_TARGET);
break;
case "moreGamesButton":
Main.launchURL(Main.CS_URL, Main.CS_URL_TARGET);
break;
};
}
override public function init():void{
trace("INIT: WrapUpScene");
super.init();
}
function frame10(){
this.stop();
SPScene(this).onIntroComplete();
stop();
}
override public function intro():void{
var _local1:int;
_local1 = 1;
while (_local1 < 2) {
this[(("name" + _local1) + "Text")].text = Main.GAME_TITLES[_local1];
if (Main._instance.scores[_local1]){
this[(("score" + _local1) + "Text")].text = Main._instance.scores[_local1];
} else {
this[(("score" + _local1) + "Text")].text = "0";
};
_local1++;
};
this.scoreTotalText.text = Main._instance.finalScore.toString();
this.highScoreText.text = Main._instance.highScore.toString();
Main.audioPlayer.playMusic(AudioPlayer.MUSIC_WRAPUP, true);
this.gotoAndPlay(2);
}
function frame1(){
this.stop();
}
override public function destroy():void{
trace("DESTROY: WrapUpScene");
this.siteButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.siteButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.siteButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.scoreSubmitButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.scoreSubmitButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.scoreSubmitButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.tryAgainButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.tryAgainButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.tryAgainButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
this.moreGamesButton.removeEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
this.moreGamesButton.removeEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
this.moreGamesButton.removeEventListener(MouseEvent.CLICK, onReleaseHandler);
super.destroy();
}
}
}//package com.wddg.SpaceChimps.Scene
Section 37
//Main (com.wddg.SpaceChimps.Main)
package com.wddg.SpaceChimps {
import flash.events.*;
import com.caurina.transitions.*;
import flash.display.*;
import com.wddg.SpaceChimps.Menu.*;
import com.wddg.SpaceChimps.Scene.*;
import com.wddg.SpaceChimps.Event.*;
import com.wddg.SpaceChimps.Game.JetPack.*;
import com.caurina.transitions.properties.*;
import flash.utils.*;
import flash.text.*;
import com.wddg.Data.*;
import flash.net.*;
import com.wddg.Audio.*;
import com.misc.utils.*;
import com.candystand.Stinger.*;
import com.clutronflux.UI.Widget.*;
public class Main extends MovieClip {
private var _nextscenekey:int;
private var fpsMeter:Sprite;
public var stinger3D:Stinger3D;
public var assets:MovieClip;
public var playButton:MovieClip;
private var _currentscene:SPScene;
private var _content:Sprite;
private var data:XMLData;
private var _scores:Array;
private var _highscore:int;
private var _gameMenu:GameMenu;
private var _currentGameIndex:int;
public static const GAME_TITLES:Array = new Array(null, "JET PACK TRAINING");
public static const SCENE_WRAPUP:int = 2;
public static const SCENE_INSTRUCTIONS:int = 3;
public static const SCENE_TITLE:int = 1;
public static const DEBUG:Boolean = false;
public static const SCENE_GAME2:int = 5;
public static var CS_URL:String = "http://www.candystand.com";
public static var SITE_NAME:String = "";
public static var VIDEO2_URL_TARGET:String = "";
public static var VIDEO2_NAME:String = "";
public static var LEADERBOARD_URL_TARGET:String = "_blank";
public static var VIDEO1_URL_TARGET:String = "";
public static var VIDEO3_NAME:String = "";
public static var CS_URL_TARGET:String = "_blank";
public static var VIDEO1_URL:String = "";
public static var VIDEO2_URL:String = "";
public static var VIDEO3_URL:String = "";
public static var audioPlayer:AudioPlayer;
public static var SITE_URL:String = "";
public static var IS_SOUND_MUTE_FROM_EXTERNAL_LINK:Boolean = false;
public static var PROMOCOPY:String = "";
public static var LEADERBOARD_URL:String = "http://www.candystand.com/play.do?id=18323";
public static var _instance:Main;
public static var VIDEO3_URL_TARGET:String = "";
public static var SITE_URL_TARGET:String = "";
public static var VIDEO1_NAME:String = "";
public function Main(){
addFrameScript(0, frame1);
this.stop();
Main._instance = this;
DisplayShortcuts.init();
this.playButton.tabEnabled = false;
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, this.onGameLoadProgress, false, 0, true);
this.loaderInfo.addEventListener(Event.COMPLETE, this.onGameLoadComplete, false, 0, true);
this.playButton.gotoAndStop(1);
this.playButton.buttonText.text = "PLEASE WAIT...";
trace("Main Created");
}
private function onReleaseHandler(_arg1:MouseEvent):void{
this.stinger3D.destroy();
this.init();
}
private function init():void{
this.gotoAndStop("main");
Main.SITE_URL = "http://www.spacechimpspower.com/";
Main.SITE_URL_TARGET = "_blank";
Main.SITE_NAME = "Official Site";
Main.VIDEO2_URL = "http://www.spacechimpspower.com/candystand/jetpack.html";
Main.VIDEO2_URL_TARGET = "_blank";
Main.VIDEO2_NAME = "BONUS: Watch the clip \"Simulator\"!";
Main.PROMOCOPY = "PLAY THE GAME! SEE THE MOVIE!";
this._content = new Sprite();
this.addChild(this._content);
this._gameMenu = new GameMenu();
this.addChild(this._gameMenu);
this._gameMenu.name = "gameMenu";
this._gameMenu.x = (stage.stageWidth / 2);
this._gameMenu.y = (stage.stageHeight / 2);
this._scores = new Array(0, 0, 0, 0, 0);
this._highscore = 0;
setTimeout(this.changeScene, 500, Main.SCENE_TITLE);
}
public function get highScore():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 1;
while (_local2 < 4) {
_local1 = (_local1 + this._scores[_local2]);
_local2++;
};
if (_local1 > this._highscore){
this._highscore = _local1;
};
return (this._highscore);
}
public function get scores():Array{
var _local1:Array;
var _local2:int;
_local1 = new Array();
_local2 = 0;
while (_local2 < this._scores.length) {
_local1.push(this._scores[_local2]);
_local2++;
};
return (_local1);
}
private function onSPSceneIntroComplete(_arg1:SPSceneEvent):void{
trace("MAIN: INTRO COMPLETE", _arg1.target.name);
}
private function onGameLoadProgress(_arg1:ProgressEvent):void{
var _local2:int;
_local2 = Math.floor(((_arg1.bytesLoaded / _arg1.bytesTotal) * 100));
this.playButton.buttonText.text = (("LOADING " + _local2) + "%");
}
private function onGameLoadComplete(_arg1:Event):void{
var _local2:ActiveGraph;
Main.audioPlayer = new AudioPlayer();
this.playButton.gotoAndStop(2);
this.playButton.buttonText.text = "PLAY SPACE CHIMPS";
this.playButton.buttonText.mouseEnabled = false;
this.playButton.buttonMode = true;
this.playButton.mouseEnabled = true;
this.playButton.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.playButton.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.playButton.addEventListener(MouseEvent.CLICK, onReleaseHandler, false, 0, true);
if (Main.DEBUG){
_local2 = new ActiveGraph();
this.addChildAt(_local2, this.getChildIndex(this._gameMenu));
this.fpsMeter = new FPSMeter();
this.addChildAt(this.fpsMeter, this.getChildIndex(this._gameMenu));
this.fpsMeter.x = (stage.stageWidth / 2);
};
}
function frame1(){
MochiBot.track(this, "eefcce55");
}
public function get gameMenu():GameMenu{
return (this._gameMenu);
}
public function submitScore():void{
trace(("SCORE SUBMIT: " + this.highScore));
}
private function onXMLSceurityError(_arg1:Event):void{
trace("XML LOAD ERROR: SECURITY ERROR");
}
private function onRollOverHandler(_arg1:MouseEvent):void{
Tweener.addTween(_arg1.target, {scaleX:1.75, scaleY:1.75, time:0.5, transition:"easeOutExpo"});
}
public function get currentscene():SPScene{
return (this._currentscene);
}
public function changeScene(_arg1:int):void{
if (this.assets){
this.removeChild(this.assets);
this.assets = null;
};
if (Main.IS_SOUND_MUTE_FROM_EXTERNAL_LINK){
Main.IS_SOUND_MUTE_FROM_EXTERNAL_LINK = false;
Main.audioPlayer.mute = false;
};
this._nextscenekey = _arg1;
if (this._currentscene){
Main.audioPlayer.stopMusic();
this._currentscene.outro();
} else {
this.onSPSceneOutroComplete(null);
};
}
private function onXMLIOError(_arg1:Event):void{
trace("XML LOAD ERROR: IO ERROR");
}
private function onRollOutHandler(_arg1:MouseEvent):void{
Tweener.addTween(_arg1.target, {scaleX:1.45, scaleY:1.45, time:0.5, transition:"easeOutExpo"});
}
public function setGameScore(_arg1:int, _arg2:int):void{
this._scores[_arg1] = _arg2;
trace(((("SETTING SCORE FOR GAME: " + _arg1) + ": ") + _arg2));
}
public function get finalScore():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 1;
while (_local2 < 4) {
_local1 = (_local1 + this._scores[_local2]);
_local2++;
};
return (_local1);
}
private function onSPSceneOutroComplete(_arg1:SPSceneEvent):void{
var _local2:SPScene;
if (_arg1){
trace("MAIN: OUTRO COMPLETE: ", _arg1.target.name);
_arg1.target.removeEventListener(SPSceneEvent.INTRO_COMPLETE, this.onSPSceneIntroComplete);
_arg1.target.removeEventListener(SPSceneEvent.OUTRO_COMPLETE, this.onSPSceneOutroComplete);
};
_local2 = null;
switch (this._nextscenekey){
case Main.SCENE_TITLE:
this._scores = new Array(0, 0, 0, 0, 0);
_local2 = new TitleScene();
_local2.name = "titleScene";
this._content.addChild(_local2);
this._currentGameIndex = 0;
this._currentscene = _local2;
break;
case Main.SCENE_INSTRUCTIONS:
_local2 = new InstructionScene();
_local2.name = "instructionScene";
this._content.addChild(_local2);
this._currentGameIndex = 0;
this._currentscene = _local2;
break;
case Main.SCENE_WRAPUP:
_local2 = new WrapUpScene();
_local2.name = "wrapUpScene";
this._content.addChild(_local2);
this._currentGameIndex = 0;
this._currentscene = _local2;
break;
case Main.SCENE_GAME2:
_local2 = new JetPack();
_local2.name = "game2";
this._content.addChild(_local2);
this._currentGameIndex = 2;
this._currentscene = _local2;
break;
};
trace("CREATE SPScene: ", this._nextscenekey, this._currentscene);
this._currentscene.x = (stage.stageWidth / 2);
this._currentscene.y = (stage.stageHeight / 2);
this._currentscene.addEventListener(SPSceneEvent.INTRO_COMPLETE, this.onSPSceneIntroComplete, false, 0, true);
this._currentscene.addEventListener(SPSceneEvent.OUTRO_COMPLETE, this.onSPSceneOutroComplete, false, 0, true);
this._currentscene.intro();
}
private function onXMLLoaded(_arg1:Event):void{
var e = _arg1;
Main.SITE_URL = this.data.xml.global.(@name == "OFFICIAL_SITE").attribute("url");
Main.SITE_URL_TARGET = this.data.xml.global.(@name == "OFFICIAL_SITE").attribute("target");
Main.SITE_NAME = this.data.xml.global.(@name == "OFFICIAL_SITE").attribute("displayName");
Main.VIDEO2_URL = this.data.xml.global.(@name == "VIDEO2").attribute("url");
Main.VIDEO2_URL_TARGET = this.data.xml.global.(@name == "VIDEO2").attribute("target");
Main.VIDEO2_NAME = this.data.xml.global.(@name == "VIDEO2").attribute("displayName");
Main.PROMOCOPY = this.data.xml.global.(@name == "PROMOCOPY").attribute("displayName");
}
public function changeToNextGame():void{
this.changeScene(Main.SCENE_WRAPUP);
}
public static function launchURL(_arg1:String, _arg2:String):void{
var _local3:URLRequest;
if (!Main.audioPlayer.mute){
Main.IS_SOUND_MUTE_FROM_EXTERNAL_LINK = true;
Main.audioPlayer.mute = true;
};
_local3 = new URLRequest(_arg1);
navigateToURL(_local3, _arg2);
}
}
}//package com.wddg.SpaceChimps
Section 38
//AbstractCollection (org.cove.ape.AbstractCollection)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractCollection {
private var _sprite:Sprite;
private var _isParented:Boolean;
private var _particles:Array;
private var _constraints:Array;
public function AbstractCollection(){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractCollection"){
throw (new ArgumentError("AbstractCollection can't be instantiated directly"));
};
_isParented = false;
_particles = new Array();
_constraints = new Array();
}
public function getAll():Array{
return (particles.concat(constraints));
}
function checkCollisionsVsCollection(_arg1:AbstractCollection):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:AbstractParticle;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:AbstractParticle;
var _local10:SpringConstraint;
var _local11:SpringConstraint;
var _local12:int;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = _particles[_local3];
if (!_local5.collidable){
} else {
_local6 = _arg1.particles.length;
_local7 = 0;
while (_local7 < _local6) {
_local9 = _arg1.particles[_local7];
if (((_local9) && (_local9.collidable))){
CollisionDetector.test(_local5, _local9);
};
_local7++;
};
_local8 = _arg1.constraints.length;
_local7 = 0;
while (_local7 < _local8) {
_local10 = _arg1.constraints[_local7];
if (((_local10.collidable) && (!(_local10.isConnectedTo(_local5))))){
_local10.scp.updatePosition();
CollisionDetector.test(_local5, _local10.scp);
};
_local7++;
};
};
_local3++;
};
_local4 = _constraints.length;
_local3 = 0;
while (_local3 < _local4) {
_local11 = _constraints[_local3];
if (!_local11.collidable){
} else {
_local6 = _arg1.particles.length;
_local12 = 0;
while (_local12 < _local6) {
_local9 = _arg1.particles[_local12];
if (((_local9.collidable) && (!(_local11.isConnectedTo(_local9))))){
_local11.scp.updatePosition();
CollisionDetector.test(_local9, _local11.scp);
};
_local12++;
};
};
_local3++;
};
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
function checkInternalCollisions():void{
var _local1:int;
var _local2:int;
var _local3:AbstractParticle;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:AbstractParticle;
var _local8:SpringConstraint;
_local1 = _particles.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _particles[_local2];
if (!_local3.collidable){
} else {
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local7 = _particles[_local4];
if (_local7.collidable){
CollisionDetector.test(_local3, _local7);
};
_local4++;
};
_local5 = _constraints.length;
_local6 = 0;
while (_local6 < _local5) {
_local8 = _constraints[_local6];
if (((_local8.collidable) && (!(_local8.isConnectedTo(_local3))))){
_local8.scp.updatePosition();
CollisionDetector.test(_local3, _local8.scp);
};
_local6++;
};
};
_local2++;
};
}
public function addParticle(_arg1:AbstractParticle):void{
_arg1.parentCollection = this;
particles.push(_arg1);
if (isParented){
_arg1.init();
};
}
public function removeConstraint(_arg1:AbstractConstraint):void{
var _local2:int;
_local2 = constraints.indexOf(_arg1);
if (_local2 == -1){
return;
};
constraints.splice(_local2, 1);
_arg1.cleanup();
}
function get isParented():Boolean{
return (_isParented);
}
public function init():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].init();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].init();
_local1++;
};
}
function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:AbstractConstraint;
_local1 = _constraints.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _constraints[_local2];
_local3.resolve();
_local2++;
};
}
public function paint():void{
var _local1:AbstractParticle;
var _local2:int;
var _local3:int;
var _local4:SpringConstraint;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = _particles[_local3];
if (((!(_local1.fixed)) || (_local1.alwaysRepaint))){
_local1.paint();
};
_local3++;
};
_local2 = _constraints.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _constraints[_local3];
if (((!(_local4.fixed)) || (_local4.alwaysRepaint))){
_local4.paint();
};
_local3++;
};
}
public function addConstraint(_arg1:AbstractConstraint):void{
_arg1.parentCollection = this;
constraints.push(_arg1);
if (isParented){
_arg1.init();
};
}
function set isParented(_arg1:Boolean):void{
_isParented = _arg1;
}
public function removeParticle(_arg1:AbstractParticle):void{
var _local2:int;
_local2 = particles.indexOf(_arg1);
if (_local2 == -1){
return;
};
particles.splice(_local2, 1);
_arg1.cleanup();
}
public function cleanup():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].cleanup();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].cleanup();
_local1++;
};
}
public function get particles():Array{
return (_particles);
}
function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:AbstractParticle;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _particles[_local3];
_local4.update(_arg1);
_local3++;
};
}
public function get constraints():Array{
return (_constraints);
}
}
}//package org.cove.ape
Section 39
//AbstractConstraint (org.cove.ape.AbstractConstraint)
package org.cove.ape {
import flash.utils.*;
public class AbstractConstraint extends AbstractItem {
private var _stiffness:Number;
private var _parentCollection:AbstractCollection;// = null
public function AbstractConstraint(_arg1:Number){
_parentCollection = null;
super();
if (getQualifiedClassName(this) == "org.cove.ape::AbstractConstraint"){
throw (new ArgumentError("AbstractConstraint can't be instantiated directly"));
};
this.stiffness = _arg1;
setStyle();
}
public function get stiffness():Number{
return (_stiffness);
}
public function set stiffness(_arg1:Number):void{
_stiffness = _arg1;
}
public function set parentCollection(_arg1:AbstractCollection):void{
this._parentCollection = _arg1;
}
function resolve():void{
}
public function get parentCollection():AbstractCollection{
return (this._parentCollection);
}
}
}//package org.cove.ape
Section 40
//AbstractItem (org.cove.ape.AbstractItem)
package org.cove.ape {
import flash.display.*;
public class AbstractItem {
var lineAlpha:Number;
var lineColor:uint;
var displayObjectOffset:Vector;
var lineThickness:Number;
protected var displayObject:DisplayObject;
var fillAlpha:Number;
private var _sprite:Sprite;
var fillColor:uint;
private var _visible:Boolean;
private var _alwaysRepaint:Boolean;
var displayObjectRotation:Number;
public function AbstractItem(){
_visible = true;
_alwaysRepaint = false;
}
public function setLine(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1):void{
lineThickness = _arg1;
lineColor = _arg2;
lineAlpha = _arg3;
}
public function set visible(_arg1:Boolean):void{
_visible = _arg1;
sprite.visible = _arg1;
}
public function setFill(_arg1:uint=0xFFFFFF, _arg2:Number=1):void{
fillColor = _arg1;
fillAlpha = _arg2;
}
public function init():void{
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
public function paint():void{
}
public function cleanup():void{
var _local1:int;
sprite.graphics.clear();
_local1 = 0;
while (_local1 < sprite.numChildren) {
sprite.removeChildAt(_local1);
_local1++;
};
}
public function setStyle(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1, _arg4:uint=0xFFFFFF, _arg5:Number=1):void{
setLine(_arg1, _arg2, _arg3);
setFill(_arg4, _arg5);
}
public function get visible():Boolean{
return (_visible);
}
final public function set alwaysRepaint(_arg1:Boolean):void{
_alwaysRepaint = _arg1;
}
final public function get alwaysRepaint():Boolean{
return (_alwaysRepaint);
}
}
}//package org.cove.ape
Section 41
//AbstractParticle (org.cove.ape.AbstractParticle)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractParticle extends AbstractItem {
private var _collidable:Boolean;
private var _multisample:int;
private var collision:Collision;
public var prev:Vector;
private var _kfr:Number;
public var curr:Vector;
private var _damping:Number;
private var _invMass:Number;
var interval:Interval;
private var _parentCollection:AbstractCollection;// = null
private var _mass:Number;
private var temp:Vector;
private var _friction:Number;
private var forces:Vector;
var samp:Vector;
private var _center:Vector;
private var _fixed:Boolean;
public function AbstractParticle(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Number, _arg5:Number, _arg6:Number){
_parentCollection = null;
super();
if (getQualifiedClassName(this) == "org.cove.ape::AbstractParticle"){
throw (new ArgumentError("AbstractParticle can't be instantiated directly"));
};
interval = new Interval(0, 0);
curr = new Vector(_arg1, _arg2);
prev = new Vector(_arg1, _arg2);
samp = new Vector();
temp = new Vector();
fixed = _arg3;
forces = new Vector();
collision = new Collision(new Vector(), new Vector());
collidable = true;
this.mass = _arg4;
this.elasticity = _arg5;
this.friction = _arg6;
setStyle();
_damping = -1;
_center = new Vector();
_multisample = 0;
}
public function get damping():Number{
return (_damping);
}
public function set friction(_arg1:Number):void{
if ((((_arg1 < 0)) || ((_arg1 > 1)))){
throw (new ArgumentError("Legal friction must be >= 0 and <=1"));
};
_friction = _arg1;
}
public function set damping(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("damping may not be set <= 0"));
};
if (_arg1 > 1){
throw (new ArgumentError("damping may not be set > 1"));
};
_damping = _arg1;
}
public function get px():Number{
return (curr.x);
}
public function get py():Number{
return (curr.y);
}
public function set py(_arg1:Number):void{
curr.y = _arg1;
prev.y = _arg1;
}
function getComponents(_arg1:Vector):Collision{
var _local2:Vector;
var _local3:Number;
_local2 = velocity;
_local3 = _arg1.dot(_local2);
collision.vn = _arg1.mult(_local3);
collision.vt = _local2.minus(collision.vn);
return (collision);
}
public function get parentCollection():AbstractCollection{
return (this._parentCollection);
}
public function get fixed():Boolean{
return (_fixed);
}
public function set px(_arg1:Number):void{
curr.x = _arg1;
prev.x = _arg1;
}
function initDisplay():void{
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
}
function get invMass():Number{
return ((fixed) ? 0 : _invMass);
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
}
public function get position():Vector{
return (new Vector(curr.x, curr.y));
}
public function get multisample():int{
return (_multisample);
}
public function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
curr.plusEquals(_arg1);
velocity = _arg2;
}
public function set mass(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("mass may not be set <= 0"));
};
_mass = _arg1;
_invMass = (1 / _mass);
}
public function set fixed(_arg1:Boolean):void{
_fixed = _arg1;
}
public function addMasslessForce(_arg1:Vector):void{
forces.plusEquals(_arg1);
}
public function set velocity(_arg1:Vector):void{
prev = curr.minus(_arg1);
}
public function set multisample(_arg1:int):void{
_multisample = _arg1;
}
public function get elasticity():Number{
return (_kfr);
}
public function set position(_arg1:Vector):void{
curr.copy(_arg1);
prev.copy(_arg1);
}
public function get center():Vector{
_center.setTo(px, py);
return (_center);
}
public function set parentCollection(_arg1:AbstractCollection):void{
this._parentCollection = _arg1;
}
public function update(_arg1:Number):void{
var _local2:Vector;
if (fixed){
return;
};
addForce(APEngine.force);
addMasslessForce(APEngine.masslessForce);
temp.copy(curr);
_local2 = velocity.plus(forces.multEquals(_arg1));
if (this._damping >= 0){
curr.plusEquals(_local2.multEquals(this._damping));
} else {
curr.plusEquals(_local2.multEquals(APEngine.damping));
};
prev.copy(temp);
forces.setTo(0, 0);
}
public function set collidable(_arg1:Boolean):void{
_collidable = _arg1;
}
public function get velocity():Vector{
return (curr.minus(prev));
}
public function get collidable():Boolean{
return (_collidable);
}
public function addForce(_arg1:Vector):void{
forces.plusEquals(_arg1.mult(invMass));
}
public function set elasticity(_arg1:Number):void{
_kfr = _arg1;
}
public function get friction():Number{
return (_friction);
}
public function get mass():Number{
return (_mass);
}
}
}//package org.cove.ape
Section 42
//APEngine (org.cove.ape.APEngine)
package org.cove.ape {
import flash.display.*;
public final class APEngine {
private static var numGroups:int;
private static var _container:DisplayObjectContainer;
private static var _damping:Number;
private static var _constraintCollisionCycles:int;
private static var groups:Array;
static var masslessForce:Vector;
private static var _constraintCycles:int;
static var force:Vector;
private static var timeStep:Number;
public static function get container():DisplayObjectContainer{
return (_container);
}
public static function get damping():Number{
return (_damping);
}
public static function set damping(_arg1:Number):void{
_damping = _arg1;
}
public static function step():void{
var _local1:int;
var _local2:int;
integrate();
_local1 = 0;
while (_local1 < _constraintCycles) {
satisfyConstraints();
_local1++;
};
_local2 = 0;
while (_local2 < _constraintCollisionCycles) {
satisfyConstraints();
checkCollisions();
_local2++;
};
}
public static function init(_arg1:Number=0.25):void{
timeStep = (_arg1 * _arg1);
numGroups = 0;
groups = new Array();
force = new Vector(0, 0);
masslessForce = new Vector(0, 0);
damping = 1;
_constraintCycles = 0;
_constraintCollisionCycles = 1;
}
public static function get constraintCycles():int{
return (_constraintCycles);
}
public static function set constraintCollisionCycles(_arg1:int):void{
_constraintCollisionCycles = _arg1;
}
public static function set constraintCycles(_arg1:int):void{
_constraintCycles = _arg1;
}
public static function addForce(_arg1:Vector):void{
force.plusEquals(_arg1);
}
public static function get constraintCollisionCycles():int{
return (_constraintCollisionCycles);
}
public static function set container(_arg1:DisplayObjectContainer):void{
_container = _arg1;
}
public static function addGroup(_arg1:Group):void{
groups.push(_arg1);
_arg1.isParented = true;
numGroups++;
_arg1.init();
}
public static function removeGroup(_arg1:Group):void{
var _local2:int;
_local2 = groups.indexOf(_arg1);
if (_local2 == -1){
return;
};
groups.splice(_local2, 1);
_arg1.isParented = false;
numGroups--;
_arg1.cleanup();
}
public static function paint():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.paint();
_local1++;
};
}
private static function checkCollisions():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.checkCollisions();
_local1++;
};
}
private static function integrate():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.integrate(timeStep);
_local1++;
};
}
private static function satisfyConstraints():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.satisfyConstraints();
_local1++;
};
}
public static function destroy():void{
groups = new Array();
}
public static function addMasslessForce(_arg1:Vector):void{
masslessForce.plusEquals(_arg1);
}
}
}//package org.cove.ape
Section 43
//CircleParticle (org.cove.ape.CircleParticle)
package org.cove.ape {
public class CircleParticle extends AbstractParticle {
private var _radius:Number;
public function CircleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0.3, _arg7:Number=0){
super(_arg1, _arg2, _arg4, _arg5, _arg6, _arg7);
_radius = _arg3;
}
function getIntervalY():Interval{
interval.min = (curr.y - _radius);
interval.max = (curr.y + _radius);
return (interval);
}
override public function init():void{
cleanup();
if (displayObject != null){
initDisplay();
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawCircle(0, 0, radius);
sprite.graphics.endFill();
};
paint();
}
function getIntervalX():Interval{
interval.min = (curr.x - _radius);
interval.max = (curr.x + _radius);
return (interval);
}
public function set radius(_arg1:Number):void{
_radius = _arg1;
}
public function get radius():Number{
return (_radius);
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
_local2 = samp.dot(_arg1);
interval.min = (_local2 - _radius);
interval.max = (_local2 + _radius);
return (interval);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
}
}
}//package org.cove.ape
Section 44
//Collision (org.cove.ape.Collision)
package org.cove.ape {
import org.cove.ape.*;
final class Collision {
var vn:Vector;
var vt:Vector;
function Collision(_arg1:Vector, _arg2:Vector){
this.vn = _arg1;
this.vt = _arg2;
}
}
}//package org.cove.ape
Section 45
//CollisionDetector (org.cove.ape.CollisionDetector)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionDetector {
private static function testOBBvsCircle(_arg1:RectangleParticle, _arg2:CircleParticle):Boolean{
var _local3:Vector;
var _local4:Number;
var _local5:Array;
var _local6:int;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
var _local10:Vector;
var _local11:Number;
_local4 = Number.POSITIVE_INFINITY;
_local5 = new Array(2);
_local6 = 0;
while (_local6 < 2) {
_local8 = _arg1.axes[_local6];
_local9 = testIntervals(_arg1.getProjection(_local8), _arg2.getProjection(_local8));
if (_local9 == 0){
return (false);
};
if (Math.abs(_local9) < Math.abs(_local4)){
_local3 = _local8;
_local4 = _local9;
};
_local5[_local6] = _local9;
_local6++;
};
_local7 = _arg2.radius;
if ((((Math.abs(_local5[0]) < _local7)) && ((Math.abs(_local5[1]) < _local7)))){
_local10 = closestVertexOnOBB(_arg2.samp, _arg1);
_local3 = _local10.minus(_arg2.samp);
_local11 = _local3.magnitude();
_local4 = (_local7 - _local11);
if (_local4 > 0){
_local3.divEquals(_local11);
} else {
return (false);
};
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local3, _local4);
return (true);
}
static function test(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
if (((_arg1.fixed) && (_arg2.fixed))){
return;
};
if ((((_arg1.multisample == 0)) && ((_arg2.multisample == 0)))){
normVsNorm(_arg1, _arg2);
} else {
if ((((_arg1.multisample > 0)) && ((_arg2.multisample == 0)))){
sampVsNorm(_arg1, _arg2);
} else {
if ((((_arg2.multisample > 0)) && ((_arg1.multisample == 0)))){
sampVsNorm(_arg2, _arg1);
} else {
if (_arg1.multisample == _arg2.multisample){
sampVsSamp(_arg1, _arg2);
} else {
normVsNorm(_arg1, _arg2);
};
};
};
};
}
private static function testIntervals(_arg1:Interval, _arg2:Interval):Number{
var _local3:Number;
var _local4:Number;
if (_arg1.max < _arg2.min){
return (0);
};
if (_arg2.max < _arg1.min){
return (0);
};
_local3 = (_arg2.max - _arg1.min);
_local4 = (_arg2.min - _arg1.max);
return (((Math.abs(_local3))<Math.abs(_local4)) ? _local3 : _local4);
}
private static function normVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
_arg1.samp.copy(_arg1.curr);
_arg2.samp.copy(_arg2.curr);
testTypes(_arg1, _arg2);
}
private static function testCirclevsCircle(_arg1:CircleParticle, _arg2:CircleParticle):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Vector;
var _local6:Number;
var _local7:Number;
_local3 = testIntervals(_arg1.getIntervalX(), _arg2.getIntervalX());
if (_local3 == 0){
return (false);
};
_local4 = testIntervals(_arg1.getIntervalY(), _arg2.getIntervalY());
if (_local4 == 0){
return (false);
};
_local5 = _arg1.samp.minus(_arg2.samp);
_local6 = _local5.magnitude();
_local7 = ((_arg1.radius + _arg2.radius) - _local6);
if (_local7 > 0){
_local5.divEquals(_local6);
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local5, _local7);
return (true);
};
return (false);
}
private static function testTypes(_arg1:AbstractParticle, _arg2:AbstractParticle):Boolean{
if ((((_arg1 is RectangleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsOBB((_arg1 as RectangleParticle), (_arg2 as RectangleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is CircleParticle)))){
return (testCirclevsCircle((_arg1 as CircleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is RectangleParticle)) && ((_arg2 is CircleParticle)))){
return (testOBBvsCircle((_arg1 as RectangleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsCircle((_arg2 as RectangleParticle), (_arg1 as CircleParticle)));
};
return (false);
}
private static function sampVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_arg2.samp.copy(_arg2.curr);
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
private static function closestVertexOnOBB(_arg1:Vector, _arg2:RectangleParticle):Vector{
var _local3:Vector;
var _local4:Vector;
var _local5:int;
var _local6:Number;
_local3 = _arg1.minus(_arg2.samp);
_local4 = new Vector(_arg2.samp.x, _arg2.samp.y);
_local5 = 0;
while (_local5 < 2) {
_local6 = _local3.dot(_arg2.axes[_local5]);
if (_local6 >= 0){
_local6 = _arg2.extents[_local5];
} else {
if (_local6 < 0){
_local6 = -(_arg2.extents[_local5]);
};
};
_local4.plusEquals(_arg2.axes[_local5].mult(_local6));
_local5++;
};
return (_local4);
}
private static function testOBBvsOBB(_arg1:RectangleParticle, _arg2:RectangleParticle):Boolean{
var _local3:Vector;
var _local4:Number;
var _local5:int;
var _local6:Vector;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Boolean;
_local4 = Number.POSITIVE_INFINITY;
_local5 = 0;
while (_local5 < 2) {
_local6 = _arg1.axes[_local5];
_local7 = testIntervals(_arg1.getProjection(_local6), _arg2.getProjection(_local6));
if (_local7 == 0){
return (false);
};
_local8 = _arg2.axes[_local5];
_local9 = testIntervals(_arg1.getProjection(_local8), _arg2.getProjection(_local8));
if (_local9 == 0){
return (false);
};
_local10 = Math.abs(_local7);
_local11 = Math.abs(_local9);
if ((((_local10 < Math.abs(_local4))) || ((_local11 < Math.abs(_local4))))){
_local12 = (_local10 < _local11);
_local3 = (_local12) ? _local6 : _local8;
_local4 = (_local12) ? _local7 : _local9;
};
_local5++;
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local3, _local4);
return (true);
}
private static function sampVsSamp(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
_arg2.samp.setTo((_arg2.prev.x + (_local4 * (_arg2.curr.x - _arg2.prev.x))), (_arg2.prev.y + (_local4 * (_arg2.curr.y - _arg2.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
}
}//package org.cove.ape
Section 46
//CollisionResolver (org.cove.ape.CollisionResolver)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionResolver {
static function resolveParticleParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Vector, _arg4:Number):void{
var _local5:Vector;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Collision;
var _local10:Collision;
var _local11:Vector;
var _local12:Vector;
var _local13:Vector;
var _local14:Vector;
_arg1.curr.copy(_arg1.samp);
_arg2.curr.copy(_arg2.samp);
_local5 = _arg3.mult(_arg4);
_local6 = (_arg1.elasticity + _arg2.elasticity);
_local7 = (_arg1.invMass + _arg2.invMass);
_local8 = clamp((1 - (_arg1.friction + _arg2.friction)), 0, 1);
_local9 = _arg1.getComponents(_arg3);
_local10 = _arg2.getComponents(_arg3);
_local11 = _local10.vn.mult(((_local6 + 1) * _arg1.invMass)).plus(_local9.vn.mult((_arg2.invMass - (_local6 * _arg1.invMass)))).divEquals(_local7);
_local12 = _local9.vn.mult(((_local6 + 1) * _arg2.invMass)).plus(_local10.vn.mult((_arg1.invMass - (_local6 * _arg2.invMass)))).divEquals(_local7);
_local9.vt.multEquals(_local8);
_local10.vt.multEquals(_local8);
_local13 = _local5.mult((_arg1.invMass / _local7));
_local14 = _local5.mult((-(_arg2.invMass) / _local7));
_local11.plusEquals(_local9.vt);
_local12.plusEquals(_local10.vt);
if (!_arg1.fixed){
_arg1.resolveCollision(_local13, _local11, _arg3, _arg4, -1, _arg2);
};
if (!_arg2.fixed){
_arg2.resolveCollision(_local14, _local12, _arg3, _arg4, 1, _arg1);
};
}
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 > _arg3){
return (_arg3);
};
if (_arg1 < _arg2){
return (_arg2);
};
return (_arg1);
}
}
}//package org.cove.ape
Section 47
//Composite (org.cove.ape.Composite)
package org.cove.ape {
public class Composite extends AbstractCollection {
private var delta:Vector;
public function Composite(){
delta = new Vector();
}
private function getRelativeAngle(_arg1:Vector, _arg2:Vector):Number{
delta.setTo((_arg2.x - _arg1.x), (_arg2.y - _arg1.y));
return (Math.atan2(delta.y, delta.x));
}
public function rotateByRadian(_arg1:Number, _arg2:Vector):void{
var _local3:AbstractParticle;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Number;
_local4 = particles;
_local5 = _local4.length;
_local6 = 0;
while (_local6 < _local5) {
_local3 = _local4[_local6];
_local7 = _local3.center.distance(_arg2);
_local8 = (getRelativeAngle(_arg2, _local3.center) + _arg1);
_local3.px = ((Math.cos(_local8) * _local7) + _arg2.x);
_local3.py = ((Math.sin(_local8) * _local7) + _arg2.y);
_local6++;
};
}
public function rotateByAngle(_arg1:Number, _arg2:Vector):void{
var _local3:Number;
_local3 = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
rotateByRadian(_local3, _arg2);
}
public function set fixed(_arg1:Boolean):void{
var _local2:int;
_local2 = 0;
while (_local2 < particles.length) {
particles[_local2].fixed = _arg1;
_local2++;
};
}
public function get fixed():Boolean{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
if (!particles[_local1].fixed){
return (false);
};
_local1++;
};
return (true);
}
}
}//package org.cove.ape
Section 48
//Group (org.cove.ape.Group)
package org.cove.ape {
public class Group extends AbstractCollection {
private var _collideInternal:Boolean;
private var _composites:Array;
private var _collisionList:Array;
public function Group(_arg1:Boolean=false){
_composites = new Array();
_collisionList = new Array();
this.collideInternal = _arg1;
}
function checkCollisions():void{
var _local1:int;
var _local2:int;
var _local3:Group;
if (collideInternal){
checkCollisionGroupInternal();
};
_local1 = collisionList.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = collisionList[_local2];
checkCollisionVsGroup(_local3);
_local2++;
};
}
public function get composites():Array{
return (_composites);
}
override public function init():void{
var _local1:int;
super.init();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].init();
_local1++;
};
}
public function removeCollidable(_arg1:Group):void{
var _local2:int;
_local2 = collisionList.indexOf(_arg1);
if (_local2 == -1){
return;
};
collisionList.splice(_local2, 1);
}
private function checkCollisionVsGroup(_arg1:Group):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Composite;
var _local6:int;
var _local7:Composite;
checkCollisionsVsCollection(_arg1);
_local2 = _composites.length;
_local3 = _arg1.composites.length;
_local4 = 0;
while (_local4 < _local2) {
_local5 = _composites[_local4];
_local5.checkCollisionsVsCollection(_arg1);
_local6 = 0;
while (_local6 < _local3) {
_local7 = _arg1.composites[_local6];
_local5.checkCollisionsVsCollection(_local7);
_local6++;
};
_local4++;
};
_local6 = 0;
while (_local6 < _local3) {
_local7 = _arg1.composites[_local6];
checkCollisionsVsCollection(_local7);
_local6++;
};
}
override function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.satisfyConstraints();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.satisfyConstraints();
_local2++;
};
}
public function get collideInternal():Boolean{
return (_collideInternal);
}
public function addCollidableList(_arg1:Array):void{
var _local2:int;
var _local3:Group;
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1[_local2];
collisionList.push(_local3);
_local2++;
};
}
public function removeComposite(_arg1:Composite):void{
var _local2:int;
_local2 = composites.indexOf(_arg1);
if (_local2 == -1){
return;
};
composites.splice(_local2, 1);
_arg1.isParented = false;
_arg1.cleanup();
}
override public function cleanup():void{
var _local1:int;
super.cleanup();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].cleanup();
_local1++;
};
}
override public function paint():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.paint();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.paint();
_local2++;
};
}
public function addCollidable(_arg1:Group):void{
collisionList.push(_arg1);
}
override public function getAll():Array{
return (particles.concat(constraints).concat(composites));
}
public function get collisionList():Array{
return (_collisionList);
}
override function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:Composite;
super.integrate(_arg1);
_local2 = _composites.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _composites[_local3];
_local4.integrate(_arg1);
_local3++;
};
}
public function addComposite(_arg1:Composite):void{
composites.push(_arg1);
_arg1.isParented = true;
if (isParented){
_arg1.init();
};
}
private function checkCollisionGroupInternal():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
var _local4:int;
var _local5:Composite;
checkInternalCollisions();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.checkCollisionsVsCollection(this);
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local5 = _composites[_local4];
_local3.checkCollisionsVsCollection(_local5);
_local4++;
};
_local2++;
};
}
public function set collideInternal(_arg1:Boolean):void{
_collideInternal = _arg1;
}
}
}//package org.cove.ape
Section 49
//Interval (org.cove.ape.Interval)
package org.cove.ape {
final class Interval {
var min:Number;
var max:Number;
function Interval(_arg1:Number, _arg2:Number){
this.min = _arg1;
this.max = _arg2;
}
function toString():String{
return (((min + " : ") + max));
}
}
}//package org.cove.ape
Section 50
//MathUtil (org.cove.ape.MathUtil)
package org.cove.ape {
final class MathUtil {
static var ONE_EIGHTY_OVER_PI:Number = 57.2957795130823;
static var PI_OVER_ONE_EIGHTY:Number = 0.0174532925199433;
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
return (_arg2);
};
if (_arg1 > _arg3){
return (_arg3);
};
return (_arg1);
}
static function sign(_arg1:Number):int{
if (_arg1 < 0){
return (-1);
};
return (1);
}
}
}//package org.cove.ape
Section 51
//RectangleParticle (org.cove.ape.RectangleParticle)
package org.cove.ape {
public class RectangleParticle extends AbstractParticle {
private var _axes:Array;
private var _radian:Number;
private var _extents:Array;
public function RectangleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0.3, _arg9:Number=0){
super(_arg1, _arg2, _arg6, _arg7, _arg8, _arg9);
_extents = new Array((_arg3 / 2), (_arg4 / 2));
_axes = new Array(new Vector(0, 0), new Vector(0, 0));
radian = _arg5;
}
override public function init():void{
var _local1:Number;
var _local2:Number;
cleanup();
if (displayObject != null){
initDisplay();
} else {
_local1 = (extents[0] * 2);
_local2 = (extents[1] * 2);
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawRect((-(_local1) / 2), (-(_local2) / 2), _local1, _local2);
sprite.graphics.endFill();
};
paint();
}
public function set width(_arg1:Number):void{
_extents[0] = (_arg1 / 2);
}
function get axes():Array{
return (_axes);
}
public function get height():Number{
return ((_extents[1] * 2));
}
function get extents():Array{
return (_extents);
}
public function set angle(_arg1:Number):void{
radian = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
}
private function setAxes(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.sin(_arg1);
_local3 = Math.cos(_arg1);
axes[0].x = _local3;
axes[0].y = _local2;
axes[1].x = -(_local2);
axes[1].y = _local3;
}
public function get radian():Number{
return (_radian);
}
public function get width():Number{
return ((_extents[0] * 2));
}
public function set height(_arg1:Number):void{
_extents[1] = (_arg1 / 2);
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
var _local3:Number;
_local2 = ((extents[0] * Math.abs(_arg1.dot(axes[0]))) + (extents[1] * Math.abs(_arg1.dot(axes[1]))));
_local3 = samp.dot(_arg1);
interval.min = (_local3 - _local2);
interval.max = (_local3 + _local2);
return (interval);
}
public function set radian(_arg1:Number):void{
_radian = _arg1;
setAxes(_arg1);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
}
}//package org.cove.ape
Section 52
//SpringConstraint (org.cove.ape.SpringConstraint)
package org.cove.ape {
import flash.display.*;
public class SpringConstraint extends AbstractConstraint {
private var _collidable:Boolean;
private var _restLength:Number;
private var p1:AbstractParticle;
private var p2:AbstractParticle;
private var _scp:SpringConstraintParticle;
public function SpringConstraint(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Number=0.5, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=1, _arg7:Boolean=false){
super(_arg3);
this.p1 = _arg1;
this.p2 = _arg2;
checkParticlesLocation();
_restLength = currLength;
setCollidable(_arg4, _arg5, _arg6, _arg7);
}
public function set rectScale(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectScale = _arg1;
}
override public function init():void{
cleanup();
if (collidable){
scp.init();
} else {
if (displayObject != null){
initDisplay();
};
};
paint();
}
function initDisplay():void{
if (collidable){
scp.initDisplay();
} else {
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
};
}
private function checkParticlesLocation():void{
if ((((p1.curr.x == p2.curr.x)) && ((p1.curr.y == p2.curr.y)))){
p2.curr.x = (p2.curr.x + 0.0001);
};
}
public function get radian():Number{
var _local1:Vector;
_local1 = delta;
return (Math.atan2(_local1.y, _local1.x));
}
function get scp():SpringConstraintParticle{
return (_scp);
}
public function get rectHeight():Number{
return (scp.rectHeight);
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
if (collidable){
scp.setDisplay(_arg1, _arg2, _arg3, _arg4);
} else {
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
};
}
public function set restLength(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("restLength must be greater than 0"));
};
_restLength = _arg1;
}
public function get currLength():Number{
return (p1.curr.distance(p2.curr));
}
public function get fixedEndLimit():Number{
return (scp.fixedEndLimit);
}
public function get rectScale():Number{
return (scp.rectScale);
}
override public function set parentCollection(_arg1:AbstractCollection):void{
_scp.parentCollection = _arg1;
super.parentCollection = _arg1;
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
public function get center():Vector{
return (p1.curr.plus(p2.curr).divEquals(2));
}
public function set rectHeight(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectHeight = _arg1;
}
public function get restLength():Number{
return (_restLength);
}
override public function paint():void{
var _local1:Vector;
if (collidable){
scp.paint();
} else {
if (displayObject != null){
_local1 = center;
sprite.x = _local1.x;
sprite.y = _local1.y;
sprite.rotation = angle;
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.moveTo(p1.px, p1.py);
sprite.graphics.lineTo(p2.px, p2.py);
};
};
}
public function setCollidable(_arg1:Boolean, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
_collidable = _arg1;
_scp = null;
if (_collidable){
_scp = new SpringConstraintParticle(p1, p2, this, _arg2, _arg3, _arg4);
};
}
function get delta():Vector{
return (p1.curr.minus(p2.curr));
}
public function isConnectedTo(_arg1:AbstractParticle):Boolean{
return ((((_arg1 == p1)) || ((_arg1 == p2))));
}
override function resolve():void{
var _local1:Number;
var _local2:Number;
var _local3:Vector;
if (((p1.fixed) && (p2.fixed))){
return;
};
_local1 = currLength;
_local2 = ((_local1 - restLength) / (_local1 * (p1.invMass + p2.invMass)));
_local3 = delta.mult((_local2 * stiffness));
p1.curr.minusEquals(_local3.mult(p1.invMass));
p2.curr.plusEquals(_local3.mult(p2.invMass));
}
public function get collidable():Boolean{
return (_collidable);
}
public function get fixed():Boolean{
return (((p1.fixed) && (p2.fixed)));
}
public function set fixedEndLimit(_arg1:Number):void{
if (scp == null){
return;
};
scp.fixedEndLimit = _arg1;
}
}
}//package org.cove.ape
Section 53
//SpringConstraintParticle (org.cove.ape.SpringConstraintParticle)
package org.cove.ape {
import flash.display.*;
import org.cove.ape.*;
class SpringConstraintParticle extends RectangleParticle {
private var _fixedEndLimit:Number;
private var _rectScale:Number;
private var rca:Vector;
private var rcb:Vector;
private var s:Number;
private var parent:SpringConstraint;
private var scaleToLength:Boolean;
private var p1:AbstractParticle;
private var p2:AbstractParticle;
private var lambda:Vector;
private var avgVelocity:Vector;
private var _rectHeight:Number;
function SpringConstraintParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:SpringConstraint, _arg4:Number, _arg5:Number, _arg6:Boolean){
super(0, 0, 0, 0, 0, false);
this.p1 = _arg1;
this.p2 = _arg2;
lambda = new Vector(0, 0);
avgVelocity = new Vector(0, 0);
parent = _arg3;
this.rectScale = _arg5;
this.rectHeight = _arg4;
this.scaleToLength = _arg6;
fixedEndLimit = 0;
rca = new Vector();
rcb = new Vector();
}
private function setCorners(_arg1:RectangleParticle, _arg2:int):void{
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Array;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local3 = _arg1.curr.x;
_local4 = _arg1.curr.y;
_local5 = _arg1.axes;
_local6 = _arg1.extents;
_local7 = (_local5[0].x * _local6[0]);
_local8 = (_local5[0].y * _local6[0]);
_local9 = (_local5[1].x * _local6[1]);
_local10 = (_local5[1].y * _local6[1]);
_local11 = (_local7 - _local9);
_local12 = (_local8 - _local10);
_local13 = (_local7 + _local9);
_local14 = (_local8 + _local10);
if (_arg2 == 0){
rca.x = (_local3 - _local13);
rca.y = (_local4 - _local14);
rcb.x = (_local3 + _local11);
rcb.y = (_local4 + _local12);
} else {
if (_arg2 == 1){
rca.x = (_local3 + _local11);
rca.y = (_local4 + _local12);
rcb.x = (_local3 + _local13);
rcb.y = (_local4 + _local14);
} else {
if (_arg2 == 2){
rca.x = (_local3 + _local13);
rca.y = (_local4 + _local14);
rcb.x = (_local3 - _local11);
rcb.y = (_local4 - _local12);
} else {
if (_arg2 == 3){
rca.x = (_local3 - _local11);
rca.y = (_local4 - _local12);
rcb.x = (_local3 - _local13);
rcb.y = (_local4 - _local14);
};
};
};
};
}
override public function init():void{
var _local1:Sprite;
var _local2:Number;
var _local3:Number;
if (displayObject != null){
initDisplay();
} else {
_local1 = new Sprite();
parent.sprite.addChild(_local1);
_local1.name = "inner";
_local2 = (parent.currLength * rectScale);
_local3 = rectHeight;
_local1.graphics.clear();
_local1.graphics.lineStyle(parent.lineThickness, parent.lineColor, parent.lineAlpha);
_local1.graphics.beginFill(parent.fillColor, parent.fillAlpha);
_local1.graphics.drawRect((-(_local2) / 2), (-(_local3) / 2), _local2, _local3);
_local1.graphics.endFill();
};
paint();
}
function updatePosition():void{
var _local1:Vector;
_local1 = parent.center;
curr.setTo(_local1.x, _local1.y);
width = (scaleToLength) ? (parent.currLength * rectScale) : (parent.restLength * rectScale);
height = rectHeight;
radian = parent.radian;
}
private function closestPtSegmentSegment():Number{
var _local1:Vector;
var _local2:Vector;
var _local3:Vector;
var _local4:Vector;
var _local5:Vector;
var _local6:Vector;
var _local7:Vector;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Vector;
var _local16:Vector;
var _local17:Vector;
_local1 = p1.curr;
_local2 = p2.curr;
_local3 = rca;
_local4 = rcb;
_local5 = _local2.minus(_local1);
_local6 = _local4.minus(_local3);
_local7 = _local1.minus(_local3);
_local9 = _local5.dot(_local5);
_local10 = _local6.dot(_local6);
_local11 = _local6.dot(_local7);
_local12 = _local5.dot(_local7);
_local13 = _local5.dot(_local6);
_local14 = ((_local9 * _local10) - (_local13 * _local13));
if (_local14 != 0){
s = MathUtil.clamp((((_local13 * _local11) - (_local12 * _local10)) / _local14), 0, 1);
} else {
s = 0.5;
};
_local8 = (((_local13 * s) + _local11) / _local10);
if (_local8 < 0){
_local8 = 0;
s = MathUtil.clamp((-(_local12) / _local9), 0, 1);
} else {
if (_local8 > 0){
_local8 = 1;
s = MathUtil.clamp(((_local13 - _local12) / _local9), 0, 1);
};
};
_local15 = _local1.plus(_local5.mult(s));
_local16 = _local3.plus(_local6.mult(_local8));
_local17 = _local15.minus(_local16);
return (_local15.minus(_local16).dot(_local17));
}
function get rectHeight():Number{
return (_rectHeight);
}
function get fixedEndLimit():Number{
return (_fixedEndLimit);
}
private function closestParamPoint(_arg1:Vector):Number{
var _local2:Vector;
var _local3:Number;
_local2 = p2.curr.minus(p1.curr);
_local3 = (_local2.dot(_arg1.minus(p1.curr)) / _local2.dot(_local2));
return (MathUtil.clamp(_local3, 0, 1));
}
function set rectHeight(_arg1:Number):void{
_rectHeight = _arg1;
}
override public function paint():void{
var _local1:Vector;
var _local2:Sprite;
_local1 = parent.center;
_local2 = parent.sprite;
if (scaleToLength){
_local2.getChildByName("inner").width = (parent.currLength * rectScale);
} else {
if (displayObject != null){
_local2.getChildByName("inner").width = (parent.restLength * rectScale);
};
};
_local2.x = _local1.x;
_local2.y = _local1.y;
_local2.rotation = parent.angle;
}
private function getContactPointParam(_arg1:AbstractParticle):Number{
var _local2:Number;
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:int;
var _local7:Number;
if ((_arg1 is CircleParticle)){
_local2 = closestParamPoint(_arg1.curr);
} else {
if ((_arg1 is RectangleParticle)){
_local4 = new Array(4);
_local5 = Number.POSITIVE_INFINITY;
_local6 = 0;
while (_local6 < 4) {
setCorners((_arg1 as RectangleParticle), _local6);
_local7 = closestPtSegmentSegment();
if (_local7 < _local5){
_local5 = _local7;
_local3 = _local6;
_local4[_local6] = s;
};
_local6++;
};
_local2 = _local4[_local3];
};
};
return (_local2);
}
function set fixedEndLimit(_arg1:Number):void{
_fixedEndLimit = _arg1;
}
override function get invMass():Number{
if (((p1.fixed) && (p2.fixed))){
return (0);
};
return ((1 / ((p1.mass + p2.mass) / 2)));
}
override function initDisplay():void{
var _local1:Sprite;
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
_local1 = new Sprite();
_local1.name = "inner";
_local1.addChild(displayObject);
parent.sprite.addChild(_local1);
}
function set rectScale(_arg1:Number):void{
_rectScale = _arg1;
}
override public function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:AbstractParticle;
_local7 = getContactPointParam(_arg6);
_local8 = (1 - _local7);
_local9 = _local7;
if (p1.fixed){
if (_local9 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local9), (_arg1.y / _local9));
p2.curr.plusEquals(lambda);
p2.velocity = _arg2;
} else {
if (p2.fixed){
if (_local8 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local8), (_arg1.y / _local8));
p1.curr.plusEquals(lambda);
p1.velocity = _arg2;
} else {
_local10 = ((_local8 * _local8) + (_local9 * _local9));
if (_local10 == 0){
return;
};
lambda.setTo((_arg1.x / _local10), (_arg1.y / _local10));
p1.curr.plusEquals(lambda.mult(_local8));
p2.curr.plusEquals(lambda.mult(_local9));
if (_local7 == 0.5){
p1.velocity = _arg2;
p2.velocity = _arg2;
} else {
_local11 = ((_local7)<0.5) ? p1 : p2;
_local11.velocity = _arg2;
};
};
};
}
override public function get elasticity():Number{
return (((p1.elasticity + p2.elasticity) / 2));
}
function get rectScale():Number{
return (_rectScale);
}
override public function get velocity():Vector{
var _local1:Vector;
var _local2:Vector;
_local1 = p1.velocity;
_local2 = p2.velocity;
avgVelocity.setTo(((_local1.x + _local2.x) / 2), ((_local1.y + _local2.y) / 2));
return (avgVelocity);
}
override public function get friction():Number{
return (((p1.friction + p2.friction) / 2));
}
override public function get mass():Number{
return (((p1.mass + p2.mass) / 2));
}
}
}//package org.cove.ape
Section 54
//Vector (org.cove.ape.Vector)
package org.cove.ape {
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
}
public function cross(_arg1:Vector):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function magnitude():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function divEquals(_arg1:Number):Vector{
if (_arg1 == 0){
_arg1 = 0.0001;
};
x = (x / _arg1);
y = (y / _arg1);
return (this);
}
public function times(_arg1:Vector):Vector{
return (new Vector((x * _arg1.x), (y * _arg1.y)));
}
public function plusEquals(_arg1:Vector):Vector{
x = (x + _arg1.x);
y = (y + _arg1.y);
return (this);
}
public function dot(_arg1:Vector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function toString():String{
return (((x + " : ") + y));
}
public function normalize():Vector{
var _local1:Number;
_local1 = magnitude();
if (_local1 == 0){
_local1 = 0.0001;
};
return (mult((1 / _local1)));
}
public function copy(_arg1:Vector):void{
x = _arg1.x;
y = _arg1.y;
}
public function minusEquals(_arg1:Vector):Vector{
x = (x - _arg1.x);
y = (y - _arg1.y);
return (this);
}
public function minus(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function plus(_arg1:Vector):Vector{
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function distance(_arg1:Vector):Number{
var _local2:Vector;
_local2 = this.minus(_arg1);
return (_local2.magnitude());
}
public function setTo(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
}
public function multEquals(_arg1:Number):Vector{
x = (x * _arg1);
y = (y * _arg1);
return (this);
}
public function mult(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
}
}//package org.cove.ape
Section 55
//Camera3D (org.papervision3d.cameras.Camera3D)
package org.papervision3d.cameras {
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
public class Camera3D extends CameraObject3D {
public var goto:Number3D;
public var target:DisplayObject3D;
public function Camera3D(_arg1:DisplayObject3D=null, _arg2:Number=2, _arg3:Number=100, _arg4:Object=null){
super(_arg2, _arg3, _arg4);
this.target = ((_arg1) || (DisplayObject3D.ZERO));
this.goto = new Number3D(this.x, this.y, this.z);
}
override public function transformView(_arg1:Matrix3D=null):void{
this.lookAt(this.target);
super.transformView();
}
public function hover(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:DisplayObject3D;
var _local5:Number3D;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local4 = this.target;
_local5 = this.goto;
_local6 = 8;
switch (_arg1){
case 0:
_local7 = (_local5.x - _local4.x);
_local8 = (_local5.z - _local4.z);
_local9 = Math.atan2(_local8, _local7);
_local10 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local11 = (0.5 * _arg2);
_local12 = (_local10 * Math.cos((_local9 - _local11)));
_local13 = (_local10 * Math.sin((_local9 - _local11)));
_local14 = (_local5.y - (300 * _arg3));
this.x = (this.x - ((this.x - _local12) / _local6));
this.y = (this.y - ((this.y - _local14) / _local6));
this.z = (this.z - ((this.z - _local13) / _local6));
break;
case 1:
this.x = (this.x - ((this.x - (1000 * _arg2)) / _local6));
this.y = (this.y - ((this.y - (1000 * _arg3)) / _local6));
break;
};
}
}
}//package org.papervision3d.cameras
Section 56
//DefaultTriangleCuller (org.papervision3d.core.culling.DefaultTriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.proto.*;
public class DefaultTriangleCuller implements ITriangleCuller {
private static var y2:Number;
private static var y1:Number;
private static var y0:Number;
private static var x0:Number;
private static var x1:Number;
private static var x2:Number;
public function testFace(_arg1:DisplayObject3D, _arg2:Face3DInstance, _arg3:Vertex2D, _arg4:Vertex2D, _arg5:Vertex2D):Boolean{
var _local6:MaterialObject3D;
if (((((_arg3.visible) && (_arg4.visible))) && (_arg5.visible))){
_local6 = (_arg2.face.material) ? _arg2.face.material : _arg1.material;
if (_local6.invisible){
return (false);
};
x0 = _arg3.x;
y0 = _arg3.y;
x1 = _arg4.x;
y1 = _arg4.y;
x2 = _arg5.x;
y2 = _arg5.y;
if (_local6.oneSide){
if (_local6.opposite){
if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) > 0){
return (false);
};
} else {
if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) < 0){
return (false);
};
};
};
return (true);
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 57
//ITriangleCuller (org.papervision3d.core.culling.ITriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public interface ITriangleCuller {
function testFace(_arg1:DisplayObject3D, _arg2:Face3DInstance, _arg3:Vertex2D, _arg4:Vertex2D, _arg5:Vertex2D):Boolean;
}
}//package org.papervision3d.core.culling
Section 58
//IFaceDrawer (org.papervision3d.core.draw.IFaceDrawer)
package org.papervision3d.core.draw {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public interface IFaceDrawer {
function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int;
}
}//package org.papervision3d.core.draw
Section 59
//Face3D (org.papervision3d.core.geom.Face3D)
package org.papervision3d.core.geom {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
public class Face3D {
public var vertices:Array;
public var face3DInstance:Face3DInstance;
public var id:Number;
public var uv:Array;
public var material:MaterialObject3D;
private var renderMat:MaterialObject3D;
public var faceNormal:Number3D;
public var screenZ:Number;
public var _materialName:String;
public var visible:Boolean;
public var v0:Vertex3D;
public var v1:Vertex3D;
public var v2:Vertex3D;
private static var _totalFaces:Number = 0;
public function Face3D(_arg1:Array, _arg2:MaterialObject3D=null, _arg3:Array=null){
this.vertices = _arg1;
v0 = _arg1[0];
v1 = _arg1[1];
v2 = _arg1[2];
this.material = _arg2;
this.uv = _arg3;
this.id = _totalFaces++;
face3DInstance = new Face3DInstance(this);
createNormal();
}
protected function createNormal():void{
var _local1:Number3D;
var _local2:Number3D;
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
_local1 = v0.toNumber3D();
_local2 = v1.toNumber3D();
_local3 = v2.toNumber3D();
_local4 = Number3D.sub(_local2, _local1);
_local5 = Number3D.sub(_local3, _local1);
faceNormal = Number3D.cross(_local5, _local4);
faceNormal.normalize();
}
public function render(_arg1:DisplayObject3D, _arg2:Sprite):Number{
renderMat = (material) ? material : _arg1.material;
return (renderMat.drawFace3D(_arg1, this, _arg2.graphics, v0.vertex2DInstance, v1.vertex2DInstance, v2.vertex2DInstance));
}
}
}//package org.papervision3d.core.geom
Section 60
//Face3DInstance (org.papervision3d.core.geom.Face3DInstance)
package org.papervision3d.core.geom {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
public class Face3DInstance {
public var container:Sprite;
public var faceNormal:Number3D;
public var screenZ:Number;
public var visible:Boolean;// = false
public var instance:DisplayObject3D;
public var face:Face3D;
public function Face3DInstance(_arg1:Face3D, _arg2:DisplayObject3D=null){
visible = false;
super();
this.face = _arg1;
this.instance = _arg2;
faceNormal = new Number3D();
}
}
}//package org.papervision3d.core.geom
Section 61
//Mesh3D (org.papervision3d.core.geom.Mesh3D)
package org.papervision3d.core.geom {
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
import flash.utils.*;
import org.papervision3d.core.culling.*;
public class Mesh3D extends Vertices3D {
public function Mesh3D(_arg1:MaterialObject3D, _arg2:Array, _arg3:Array, _arg4:String=null, _arg5:Object=null){
super(_arg2, _arg4, _arg5);
this.geometry.faces = ((_arg3) || (new Array()));
this.material = ((_arg1) || (MaterialObject3D.DEFAULT));
}
override public function project(_arg1:DisplayObject3D, _arg2:CameraObject3D, _arg3:Array=null):Number{
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:ITriangleCuller;
var _local8:Vertex2D;
var _local9:Vertex2D;
var _local10:Vertex2D;
var _local11:Face3DInstance;
var _local12:Face3D;
var _local13:MaterialObject3D;
super.project(_arg1, _arg2, _arg3);
if (!_arg3){
_arg3 = this._sorted;
};
_local4 = this.geometry.faces;
_local5 = 0;
_local6 = 0;
_local7 = scene.triangleCuller;
for each (_local12 in _local4) {
_local13 = (_local12.material) ? _local12.material : material;
_local11 = _local12.face3DInstance;
_local11.instance = this;
_local8 = _local12.v0.vertex2DInstance;
_local9 = _local12.v1.vertex2DInstance;
_local10 = _local12.v2.vertex2DInstance;
if ((_local11.visible = _local7.testFace(this, _local11, _local8, _local9, _local10))){
if (_local13.needsFaceNormals){
_local12.faceNormal.copyTo(_local11.faceNormal);
Matrix3D.multiplyVector3x3(this.view, _local11.faceNormal);
};
if (_local13.needsVertexNormals){
_local12.v0.normal.copyTo(_local12.v0.vertex2DInstance.normal);
Matrix3D.multiplyVector3x3(this.view, _local12.v0.vertex2DInstance.normal);
_local12.v1.normal.copyTo(_local12.v1.vertex2DInstance.normal);
Matrix3D.multiplyVector3x3(this.view, _local12.v1.vertex2DInstance.normal);
_local12.v2.normal.copyTo(_local12.v2.vertex2DInstance.normal);
Matrix3D.multiplyVector3x3(this.view, _local12.v2.vertex2DInstance.normal);
};
switch (meshSort){
case DisplayObject3D.MESH_SORT_CENTER:
_local5 = (_local5 + (_local11.screenZ = (((_local8.z + _local9.z) + _local10.z) * 0.333)));
break;
case DisplayObject3D.MESH_SORT_FAR:
_local5 = (_local5 + (_local11.screenZ = Math.max(_local8.z, _local9.z, _local10.z)));
break;
case DisplayObject3D.MESH_SORT_CLOSE:
_local5 = (_local5 + (_local11.screenZ = Math.min(_local8.z, _local9.z, _local10.z)));
break;
};
_local6++;
_arg3.push(_local11);
} else {
scene.stats.culledTriangles++;
};
};
return ((this.screenZ = (_local5 / _local6)));
}
public function mergeVertices():void{
var _local1:Dictionary;
var _local2:Array;
var _local3:Vertex3D;
var _local4:Face3D;
var _local5:Vertex3D;
_local1 = new Dictionary();
_local2 = new Array();
for each (_local3 in this.geometry.vertices) {
for each (_local5 in _local1) {
if ((((((_local3.x == _local5.x)) && ((_local3.y == _local5.y)))) && ((_local3.z == _local5.z)))){
_local1[_local3] = _local5;
break;
};
};
if (!_local1[_local3]){
_local1[_local3] = _local3;
_local2.push(_local3);
};
};
this.geometry.vertices = _local2;
for each (_local4 in this.geometry.faces) {
_local4.v0 = _local1[_local4.v0];
_local4.v1 = _local1[_local4.v1];
_local4.v2 = _local1[_local4.v2];
};
}
public function projectTexture(_arg1:String="x", _arg2:String="y"):void{
var _local3:Array;
var _local4:Object;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:MaterialObject3D;
var _local10:String;
var _local11:Face3D;
var _local12:Array;
var _local13:Vertex3D;
var _local14:Vertex3D;
var _local15:Vertex3D;
var _local16:NumberUV;
var _local17:NumberUV;
var _local18:NumberUV;
_local3 = this.geometry.faces;
_local4 = this.boundingBox();
_local5 = _local4.min[_arg1];
_local6 = _local4.size[_arg1];
_local7 = _local4.min[_arg2];
_local8 = _local4.size[_arg2];
_local9 = this.material;
for (_local10 in _local3) {
_local11 = _local3[Number(_local10)];
_local12 = _local11.vertices;
_local13 = _local12[0];
_local14 = _local12[1];
_local15 = _local12[2];
_local16 = new NumberUV(((_local13[_arg1] - _local5) / _local6), ((_local13[_arg2] - _local7) / _local8));
_local17 = new NumberUV(((_local14[_arg1] - _local5) / _local6), ((_local14[_arg2] - _local7) / _local8));
_local18 = new NumberUV(((_local15[_arg1] - _local5) / _local6), ((_local15[_arg2] - _local7) / _local8));
_local11.uv = [_local16, _local17, _local18];
};
}
}
}//package org.papervision3d.core.geom
Section 62
//Vertex2D (org.papervision3d.core.geom.Vertex2D)
package org.papervision3d.core.geom {
import org.papervision3d.core.*;
public class Vertex2D {
public var visible:Boolean;
public var normal:Number3D;
public var extra:Object;
public var x:Number;
public var y:Number;
public var z:Number;
public function Vertex2D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.visible = false;
this.normal = new Number3D();
}
public function clone():Vertex2D{
var _local1:Vertex2D;
_local1 = new Vertex2D(x, y, z);
_local1.visible = visible;
_local1.extra = extra;
return (_local1);
}
}
}//package org.papervision3d.core.geom
Section 63
//Vertex3D (org.papervision3d.core.geom.Vertex3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.*;
import flash.utils.*;
public class Vertex3D {
public var vertex2DInstance:Vertex2D;
public var connectedFaces:Dictionary;
public var normal:Number3D;
public var extra:Object;
public var x:Number;
public var y:Number;
public var z:Number;
public function Vertex3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.vertex2DInstance = new Vertex2D();
this.normal = new Number3D();
this.connectedFaces = new Dictionary();
}
public function calculateNormal():void{
var _local1:Face3D;
normal = new Number3D();
for each (_local1 in connectedFaces) {
normal = Number3D.add(_local1.faceNormal, normal);
};
normal.normalize();
}
public function toNumber3D():Number3D{
return (new Number3D(x, y, z));
}
public function clone():Vertex3D{
var _local1:Vertex3D;
_local1 = new Vertex3D(x, y, z);
_local1.extra = extra;
_local1.vertex2DInstance = vertex2DInstance.clone();
_local1.normal = normal.clone();
return (_local1);
}
}
}//package org.papervision3d.core.geom
Section 64
//Vertices3D (org.papervision3d.core.geom.Vertices3D)
package org.papervision3d.core.geom {
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
import org.papervision3d.scenes.*;
public class Vertices3D extends DisplayObject3D {
public function Vertices3D(_arg1:Array, _arg2:String=null, _arg3:Object=null){
super(_arg2, new GeometryObject3D(), _arg3);
this.geometry.vertices = ((_arg1) || (new Array()));
}
override public function project(_arg1:DisplayObject3D, _arg2:CameraObject3D, _arg3:Array=null):Number{
var _local4:Matrix3D;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Vertex3D;
var _local21:Vertex2D;
var _local22:Number;
var _local23:Array;
var _local24:int;
var _local25:Number;
var _local26:Number;
super.project(_arg1, _arg2, _arg3);
_local4 = this.view;
_local5 = _local4.n11;
_local6 = _local4.n12;
_local7 = _local4.n13;
_local8 = _local4.n21;
_local9 = _local4.n22;
_local10 = _local4.n23;
_local11 = _local4.n31;
_local12 = _local4.n32;
_local13 = _local4.n33;
_local23 = this.geometry.vertices;
_local24 = _local23.length;
_local25 = _arg2.focus;
_local26 = (_local25 * _arg2.zoom);
while ((_local20 = _local23[--_local24])) {
_local14 = _local20.x;
_local15 = _local20.y;
_local16 = _local20.z;
_local19 = ((((_local14 * _local11) + (_local15 * _local12)) + (_local16 * _local13)) + _local4.n34);
_local21 = _local20.vertex2DInstance;
if ((_local21.visible = (_local19 > 0))){
_local17 = ((((_local14 * _local5) + (_local15 * _local6)) + (_local16 * _local7)) + _local4.n14);
_local18 = ((((_local14 * _local8) + (_local15 * _local9)) + (_local16 * _local10)) + _local4.n24);
_local22 = (_local26 / (_local25 + _local19));
_local21.x = (_local17 * _local22);
_local21.y = (_local18 * _local22);
_local21.z = _local19;
};
};
return (0);
}
public function transformVertices(_arg1:Matrix3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Array;
var _local15:int;
var _local16:Vertex3D;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
_local2 = _arg1.n11;
_local3 = _arg1.n12;
_local4 = _arg1.n13;
_local5 = _arg1.n21;
_local6 = _arg1.n22;
_local7 = _arg1.n23;
_local8 = _arg1.n31;
_local9 = _arg1.n32;
_local10 = _arg1.n33;
_local11 = _arg1.n14;
_local12 = _arg1.n24;
_local13 = _arg1.n34;
_local14 = this.geometry.vertices;
_local15 = _local14.length;
while ((_local16 = _local14[--_local15])) {
_local17 = _local16.x;
_local18 = _local16.y;
_local19 = _local16.z;
_local20 = ((((_local17 * _local2) + (_local18 * _local3)) + (_local19 * _local4)) + _local11);
_local21 = ((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local12);
_local22 = ((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local13);
_local16.x = _local20;
_local16.y = _local21;
_local16.z = _local22;
};
}
public function boundingBox():Object{
var _local1:Object;
var _local2:Object;
var _local3:String;
var _local4:Vertex3D;
_local1 = this.geometry.vertices;
_local2 = new Object();
_local2.min = new Number3D();
_local2.max = new Number3D();
_local2.size = new Number3D();
for (_local3 in _local1) {
_local4 = _local1[Number(_local3)];
_local2.min.x = ((_local2.min.x)==undefined) ? _local4.x : Math.min(_local4.x, _local2.min.x);
_local2.max.x = ((_local2.max.x)==undefined) ? _local4.x : Math.max(_local4.x, _local2.max.x);
_local2.min.y = ((_local2.min.y)==undefined) ? _local4.y : Math.min(_local4.y, _local2.min.y);
_local2.max.y = ((_local2.max.y)==undefined) ? _local4.y : Math.max(_local4.y, _local2.max.y);
_local2.min.z = ((_local2.min.z)==undefined) ? _local4.z : Math.min(_local4.z, _local2.min.z);
_local2.max.z = ((_local2.max.z)==undefined) ? _local4.z : Math.max(_local4.z, _local2.max.z);
};
_local2.size.x = (_local2.max.x - _local2.min.x);
_local2.size.y = (_local2.max.y - _local2.min.y);
_local2.size.z = (_local2.max.z - _local2.min.z);
return (_local2);
}
}
}//package org.papervision3d.core.geom
Section 65
//CameraObject3D (org.papervision3d.core.proto.CameraObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
public class CameraObject3D extends DisplayObject3D {
public var sort:Boolean;
public var zoom:Number;
public var focus:Number;
private static var _flipY:Matrix3D = Matrix3D.scaleMatrix(1, -1, 1);
public static var DEFAULT_POS:Number3D = new Number3D(0, 0, -1000);
public function CameraObject3D(_arg1:Number=3, _arg2:Number=500, _arg3:Object=null){
this.x = (_arg3) ? ((_arg3.x) || (DEFAULT_POS.x)) : DEFAULT_POS.x;
this.y = (_arg3) ? ((_arg3.y) || (DEFAULT_POS.y)) : DEFAULT_POS.y;
this.z = (_arg3) ? ((_arg3.z) || (DEFAULT_POS.z)) : DEFAULT_POS.z;
this.zoom = _arg1;
this.focus = _arg2;
this.sort = (_arg3) ? !((_arg3.sort == false)) : true;
}
public function transformView(_arg1:Matrix3D=null):void{
this.view = Matrix3D.inverse(Matrix3D.multiply(((_arg1) || (this.transform)), _flipY));
}
public function pan(_arg1:Number):void{
super.yaw(_arg1);
}
public function tilt(_arg1:Number):void{
super.pitch(_arg1);
}
}
}//package org.papervision3d.core.proto
Section 66
//DisplayObjectContainer3D (org.papervision3d.core.proto.DisplayObjectContainer3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import flash.utils.*;
import org.papervision3d.*;
public class DisplayObjectContainer3D extends EventDispatcher {
protected var _children:Dictionary;
public var root:DisplayObjectContainer3D;
private var _childrenTotal:int;
protected var _childrenByName:Object;
public function DisplayObjectContainer3D():void{
this._children = new Dictionary(false);
this._childrenByName = new Dictionary(true);
this._childrenTotal = 0;
}
public function getChildByName(_arg1:String):DisplayObject3D{
return (this._childrenByName[_arg1]);
}
public function addCollada(_arg1:String, _arg2:MaterialsList=null, _arg3:Number=1):void{
Papervision3D.log("The addCollada() method has been deprecated. Use addChildren( new Collada( filename ) )");
}
public function removeChildByName(_arg1:String):DisplayObject3D{
return (removeChild(getChildByName(_arg1)));
}
public function get numChildren():int{
return (this._childrenTotal);
}
override public function toString():String{
return (childrenList());
}
public function addChildren(_arg1:DisplayObject3D):DisplayObjectContainer3D{
var _local2:DisplayObject3D;
for each (_local2 in _arg1.children) {
_arg1.removeChild(_local2);
this.addChild(_local2);
};
return (this);
}
public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
if (_arg1){
delete this._childrenByName[this._children[_arg1]];
delete this._children[_arg1];
_arg1.parent = null;
_arg1.root = null;
return (_arg1);
};
return (null);
}
public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg2 = ((((_arg2) || (_arg1.name))) || (String(_arg1.id)));
this._children[_arg1] = _arg2;
this._childrenByName[_arg2] = _arg1;
this._childrenTotal++;
_arg1.parent = this;
_arg1.root = this.root;
return (_arg1);
}
public function childrenList():String{
var _local1:String;
var _local2:String;
_local1 = "";
for (_local2 in this._children) {
_local1 = (_local1 + (_local2 + "\n"));
};
return (_local1);
}
public function get children():Object{
return (this._childrenByName);
}
}
}//package org.papervision3d.core.proto
Section 67
//GeometryObject3D (org.papervision3d.core.proto.GeometryObject3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import flash.utils.*;
import org.papervision3d.scenes.*;
public class GeometryObject3D extends EventDispatcher {
protected var _boundingSphere2:Number;
protected var _boundingSphereDirty:Boolean;// = true
public var _ready:Boolean;// = false
protected var _material:MaterialObject3D;
public var faces:Array;
public var vertices:Array;
public function GeometryObject3D(_arg1:Object=null):void{
_ready = false;
_boundingSphereDirty = true;
super();
}
public function transformVertices(_arg1:Matrix3D):void{
}
public function get boundingSphere2():Number{
if (_boundingSphereDirty){
return (getBoundingSphere2());
};
return (_boundingSphere2);
}
public function getBoundingSphere2():Number{
var _local1:Number;
var _local2:Number;
var _local3:Vertex3D;
_local1 = 0;
for each (_local3 in this.vertices) {
_local2 = (((_local3.x * _local3.x) + (_local3.y * _local3.y)) + (_local3.z * _local3.z));
_local1 = ((_local2)>_local1) ? _local2 : _local1;
};
this._boundingSphereDirty = false;
return ((_boundingSphere2 = _local1));
}
private function createVertexNormals():void{
var _local1:Dictionary;
var _local2:Face3D;
var _local3:Vertex3D;
_local1 = new Dictionary(true);
for each (_local2 in faces) {
_local2.v0.connectedFaces[_local2] = _local2;
_local2.v1.connectedFaces[_local2] = _local2;
_local2.v2.connectedFaces[_local2] = _local2;
_local1[_local2.v0] = _local2.v0;
_local1[_local2.v1] = _local2.v1;
_local1[_local2.v2] = _local2.v2;
};
for each (_local3 in _local1) {
_local3.calculateNormal();
};
}
public function transformUV(_arg1:MaterialObject3D):void{
var _local2:String;
if (_arg1.bitmap){
for (_local2 in this.faces) {
faces[_local2].transformUV(_arg1);
};
};
}
public function set ready(_arg1:Boolean):void{
if (_arg1){
createVertexNormals();
};
_ready = _arg1;
}
public function get ready():Boolean{
return (_ready);
}
}
}//package org.papervision3d.core.proto
Section 68
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D)
package org.papervision3d.core.proto {
import flash.events.*;
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.draw.*;
public class MaterialObject3D extends EventDispatcher implements IFaceDrawer {
public var widthOffset:Number;// = 0
public var name:String;
public var scene:SceneObject3D;
public var needsVertexNormals:Boolean;// = false
public var heightOffset:Number;// = 0
public var fillAlpha:Number;// = 0
public var fillColor:Number;
public var id:Number;
public var invisible:Boolean;// = false
public var smooth:Boolean;// = false
public var bitmap:BitmapData;
public var lineColor:Number;
public var lineAlpha:Number;// = 0
public var oneSide:Boolean;// = true
public var lineThickness:Number;// = 1
public var opposite:Boolean;// = false
public var maxU:Number;
public var needsFaceNormals:Boolean;// = false
public var tiled:Boolean;// = false
public var maxV:Number;
public static var DEFAULT_COLOR:int = 0;
public static var DEBUG_COLOR:int = 0xFF00FF;
private static var _totalMaterialObjects:Number = 0;
public function MaterialObject3D(){
smooth = false;
tiled = false;
lineColor = DEFAULT_COLOR;
lineAlpha = 0;
lineThickness = 1;
fillColor = DEFAULT_COLOR;
fillAlpha = 0;
oneSide = true;
invisible = false;
opposite = false;
needsFaceNormals = false;
needsVertexNormals = false;
widthOffset = 0;
heightOffset = 0;
super();
this.id = _totalMaterialObjects++;
}
public function get doubleSided():Boolean{
return (!(this.oneSide));
}
public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
return (0);
}
public function set doubleSided(_arg1:Boolean):void{
this.oneSide = !(_arg1);
}
public function updateBitmap():void{
}
override public function toString():String{
return (((((("[MaterialObject3D] bitmap:" + this.bitmap) + " lineColor:") + this.lineColor) + " fillColor:") + fillColor));
}
public function copy(_arg1:MaterialObject3D):void{
this.bitmap = _arg1.bitmap;
this.smooth = _arg1.smooth;
this.lineColor = _arg1.lineColor;
this.lineAlpha = _arg1.lineAlpha;
this.fillColor = _arg1.fillColor;
this.fillAlpha = _arg1.fillAlpha;
this.needsFaceNormals = _arg1.needsFaceNormals;
this.needsVertexNormals = _arg1.needsVertexNormals;
this.oneSide = _arg1.oneSide;
this.opposite = _arg1.opposite;
this.invisible = _arg1.invisible;
this.scene = _arg1.scene;
this.name = _arg1.name;
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
public function clone():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = new MaterialObject3D();
_local1.copy(this);
return (_local1);
}
public static function get DEFAULT():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = new WireframeMaterial();
_local1.lineColor = (0xFFFFFF * Math.random());
_local1.lineAlpha = 1;
_local1.fillColor = DEFAULT_COLOR;
_local1.fillAlpha = 1;
_local1.doubleSided = false;
return (_local1);
}
public static function get DEBUG():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = new (MaterialObject3D);
_local1.lineColor = (0xFFFFFF * Math.random());
_local1.lineAlpha = 1;
_local1.fillColor = DEBUG_COLOR;
_local1.fillAlpha = 0.37;
_local1.doubleSided = true;
return (_local1);
}
}
}//package org.papervision3d.core.proto
Section 69
//SceneObject3D (org.papervision3d.core.proto.SceneObject3D)
package org.papervision3d.core.proto {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import flash.utils.*;
import org.papervision3d.core.stat.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.*;
public class SceneObject3D extends DisplayObjectContainer3D {
public var triangleCuller:ITriangleCuller;
public var container:Sprite;
private var geometries:Dictionary;
public var objects:Array;
public var stats:RenderStatistics;
public var materials:MaterialsList;
public function SceneObject3D(_arg1:Sprite){
triangleCuller = new DefaultTriangleCuller();
super();
if (_arg1){
this.container = _arg1;
} else {
Papervision3D.log("Scene3D: container argument required.");
};
this.objects = new Array();
this.materials = new MaterialsList();
Papervision3D.log((((((Papervision3D.NAME + " ") + Papervision3D.VERSION) + " (") + Papervision3D.DATE) + ")\n"));
this.stats = new RenderStatistics();
this.stats.points = 0;
this.stats.polys = 0;
this.stats.triangles = 0;
this.stats.performance = 0;
this.stats.rendered = 0;
this.root = this;
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
var _local3:DisplayObject3D;
_local3 = super.addChild(_arg1, _arg2);
_arg1.scene = this;
this.objects.push(_local3);
return (_local3);
}
public function renderCamera(_arg1:CameraObject3D):void{
var _local2:Array;
var _local3:DisplayObject3D;
var _local4:Number;
stats.clear();
stats.performance = getTimer();
MovieMaterial.updateAnimatedBitmaps();
if (_arg1){
_arg1.transformView();
_local2 = this.objects;
_local4 = _local2.length;
while ((_local3 = _local2[--_local4])) {
if (_local3.visible){
_local3.project(_arg1, _arg1);
};
};
};
if (_arg1.sort){
this.objects.sortOn("screenZ", Array.NUMERIC);
};
renderObjects(_arg1.sort);
}
protected function renderObjects(_arg1:Boolean):void{
}
override public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
var _local2:int;
super.removeChild(_arg1);
_local2 = 0;
while (_local2 < this.objects.length) {
if (this.objects[_local2] === _arg1){
this.objects.splice(_local2, 1);
return (_arg1);
};
_local2++;
};
return (_arg1);
}
}
}//package org.papervision3d.core.proto
Section 70
//RenderStatistics (org.papervision3d.core.stat.RenderStatistics)
package org.papervision3d.core.stat {
public class RenderStatistics {
public var points:int;// = 0
public var polys:int;// = 0
public var triangles:int;// = 0
public var pixels:Number;
public var performance:int;// = 0
public var rendered:int;// = 0
public var culledTriangles:int;// = 0
public var particles:Number;
public function RenderStatistics(){
performance = 0;
points = 0;
polys = 0;
rendered = 0;
triangles = 0;
culledTriangles = 0;
super();
}
public function clear():void{
performance = 0;
points = 0;
polys = 0;
rendered = 0;
triangles = 0;
pixels = 0;
particles = 0;
culledTriangles = 0;
}
public function toString():String{
return (new String(((((((((("Performance:" + performance) + ", Points:") + points) + " Polys:") + polys) + " Rendered:") + rendered) + " Culled:") + culledTriangles)));
}
}
}//package org.papervision3d.core.stat
Section 71
//Matrix3D (org.papervision3d.core.Matrix3D)
package org.papervision3d.core {
public class Matrix3D {
public var n31:Number;
public var n32:Number;
public var n11:Number;
public var n13:Number;
public var n14:Number;
public var n33:Number;
public var n12:Number;
public var n21:Number;
public var n22:Number;
public var n23:Number;
public var n24:Number;
public var n34:Number;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
public function Matrix3D(_arg1:Array=null){
if (((!(_arg1)) || ((_arg1.length < 12)))){
n11 = (n22 = (n33 = 1));
n12 = (n13 = (n14 = (n21 = (n23 = (n24 = (n31 = (n32 = (n34 = 0))))))));
} else {
n11 = _arg1[0];
n12 = _arg1[1];
n13 = _arg1[2];
n14 = _arg1[3];
n21 = _arg1[4];
n22 = _arg1[5];
n23 = _arg1[6];
n24 = _arg1[7];
n31 = _arg1[8];
n32 = _arg1[9];
n33 = _arg1[10];
n34 = _arg1[11];
};
}
public function calculateMultiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12: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;
_local3 = _arg1.n11;
_local4 = _arg2.n11;
_local5 = _arg1.n21;
_local6 = _arg2.n21;
_local7 = _arg1.n31;
_local8 = _arg2.n31;
_local9 = _arg1.n12;
_local10 = _arg2.n12;
_local11 = _arg1.n22;
_local12 = _arg2.n22;
_local13 = _arg1.n32;
_local14 = _arg2.n32;
_local15 = _arg1.n13;
_local16 = _arg2.n13;
_local17 = _arg1.n23;
_local18 = _arg2.n23;
_local19 = _arg1.n33;
_local20 = _arg2.n33;
this.n11 = (((_local3 * _local4) + (_local9 * _local6)) + (_local15 * _local8));
this.n12 = (((_local3 * _local10) + (_local9 * _local12)) + (_local15 * _local14));
this.n13 = (((_local3 * _local16) + (_local9 * _local18)) + (_local15 * _local20));
this.n21 = (((_local5 * _local4) + (_local11 * _local6)) + (_local17 * _local8));
this.n22 = (((_local5 * _local10) + (_local11 * _local12)) + (_local17 * _local14));
this.n23 = (((_local5 * _local16) + (_local11 * _local18)) + (_local17 * _local20));
this.n31 = (((_local7 * _local4) + (_local13 * _local6)) + (_local19 * _local8));
this.n32 = (((_local7 * _local10) + (_local13 * _local12)) + (_local19 * _local14));
this.n33 = (((_local7 * _local16) + (_local13 * _local18)) + (_local19 * _local20));
}
public function get trace():Number{
return ((((this.n11 + this.n22) + this.n33) + 1));
}
public function get det():Number{
return ((((((this.n11 * this.n22) - (this.n21 * this.n12)) * this.n33) - (((this.n11 * this.n32) - (this.n31 * this.n12)) * this.n23)) + (((this.n21 * this.n32) - (this.n31 * this.n22)) * this.n13)));
}
public function copy3x3(_arg1:Matrix3D):Matrix3D{
this.n11 = _arg1.n11;
this.n12 = _arg1.n12;
this.n13 = _arg1.n13;
this.n21 = _arg1.n21;
this.n22 = _arg1.n22;
this.n23 = _arg1.n23;
this.n31 = _arg1.n31;
this.n32 = _arg1.n32;
this.n33 = _arg1.n33;
return (this);
}
public function calculateAdd(_arg1:Matrix3D, _arg2:Matrix3D):void{
this.n11 = (_arg1.n11 + _arg2.n11);
this.n12 = (_arg1.n12 + _arg2.n12);
this.n13 = (_arg1.n13 + _arg2.n13);
this.n14 = (_arg1.n14 + _arg2.n14);
this.n21 = (_arg1.n21 + _arg2.n21);
this.n22 = (_arg1.n22 + _arg2.n22);
this.n23 = (_arg1.n23 + _arg2.n23);
this.n24 = (_arg1.n24 + _arg2.n24);
this.n31 = (_arg1.n31 + _arg2.n31);
this.n32 = (_arg1.n32 + _arg2.n32);
this.n33 = (_arg1.n33 + _arg2.n33);
this.n34 = (_arg1.n34 + _arg2.n34);
}
public function calculateMultiply(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12: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;
_local3 = _arg1.n11;
_local4 = _arg2.n11;
_local5 = _arg1.n21;
_local6 = _arg2.n21;
_local7 = _arg1.n31;
_local8 = _arg2.n31;
_local9 = _arg1.n12;
_local10 = _arg2.n12;
_local11 = _arg1.n22;
_local12 = _arg2.n22;
_local13 = _arg1.n32;
_local14 = _arg2.n32;
_local15 = _arg1.n13;
_local16 = _arg2.n13;
_local17 = _arg1.n23;
_local18 = _arg2.n23;
_local19 = _arg1.n33;
_local20 = _arg2.n33;
_local21 = _arg1.n14;
_local22 = _arg2.n14;
_local23 = _arg1.n24;
_local24 = _arg2.n24;
_local25 = _arg1.n34;
_local26 = _arg2.n34;
this.n11 = (((_local3 * _local4) + (_local9 * _local6)) + (_local15 * _local8));
this.n12 = (((_local3 * _local10) + (_local9 * _local12)) + (_local15 * _local14));
this.n13 = (((_local3 * _local16) + (_local9 * _local18)) + (_local15 * _local20));
this.n14 = ((((_local3 * _local22) + (_local9 * _local24)) + (_local15 * _local26)) + _local21);
this.n21 = (((_local5 * _local4) + (_local11 * _local6)) + (_local17 * _local8));
this.n22 = (((_local5 * _local10) + (_local11 * _local12)) + (_local17 * _local14));
this.n23 = (((_local5 * _local16) + (_local11 * _local18)) + (_local17 * _local20));
this.n24 = ((((_local5 * _local22) + (_local11 * _local24)) + (_local17 * _local26)) + _local23);
this.n31 = (((_local7 * _local4) + (_local13 * _local6)) + (_local19 * _local8));
this.n32 = (((_local7 * _local10) + (_local13 * _local12)) + (_local19 * _local14));
this.n33 = (((_local7 * _local16) + (_local13 * _local18)) + (_local19 * _local20));
this.n34 = ((((_local7 * _local22) + (_local13 * _local24)) + (_local19 * _local26)) + _local25);
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + ((((((((int((n11 * 1000)) / 1000) + "\t\t") + (int((n12 * 1000)) / 1000)) + "\t\t") + (int((n13 * 1000)) / 1000)) + "\t\t") + (int((n14 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n21 * 1000)) / 1000) + "\t\t") + (int((n22 * 1000)) / 1000)) + "\t\t") + (int((n23 * 1000)) / 1000)) + "\t\t") + (int((n24 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n31 * 1000)) / 1000) + "\t\t") + (int((n32 * 1000)) / 1000)) + "\t\t") + (int((n33 * 1000)) / 1000)) + "\t\t") + (int((n34 * 1000)) / 1000)) + "\n"));
return (_local1);
}
public function copy(_arg1:Matrix3D):Matrix3D{
this.n11 = _arg1.n11;
this.n12 = _arg1.n12;
this.n13 = _arg1.n13;
this.n14 = _arg1.n14;
this.n21 = _arg1.n21;
this.n22 = _arg1.n22;
this.n23 = _arg1.n23;
this.n24 = _arg1.n24;
this.n31 = _arg1.n31;
this.n32 = _arg1.n32;
this.n33 = _arg1.n33;
this.n34 = _arg1.n34;
return (this);
}
public function calculateInverse(_arg1:Matrix3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = _arg1.det;
if (Math.abs(_local2) > 0.001){
_local2 = (1 / _local2);
_local3 = _arg1.n11;
_local4 = _arg1.n21;
_local5 = _arg1.n31;
_local6 = _arg1.n12;
_local7 = _arg1.n22;
_local8 = _arg1.n32;
_local9 = _arg1.n13;
_local10 = _arg1.n23;
_local11 = _arg1.n33;
_local12 = _arg1.n14;
_local13 = _arg1.n24;
_local14 = _arg1.n34;
this.n11 = (_local2 * ((_local7 * _local11) - (_local8 * _local10)));
this.n12 = (-(_local2) * ((_local6 * _local11) - (_local8 * _local9)));
this.n13 = (_local2 * ((_local6 * _local10) - (_local7 * _local9)));
this.n14 = (-(_local2) * (((_local6 * ((_local10 * _local14) - (_local11 * _local13))) - (_local7 * ((_local9 * _local14) - (_local11 * _local12)))) + (_local8 * ((_local9 * _local13) - (_local10 * _local12)))));
this.n21 = (-(_local2) * ((_local4 * _local11) - (_local5 * _local10)));
this.n22 = (_local2 * ((_local3 * _local11) - (_local5 * _local9)));
this.n23 = (-(_local2) * ((_local3 * _local10) - (_local4 * _local9)));
this.n24 = (_local2 * (((_local3 * ((_local10 * _local14) - (_local11 * _local13))) - (_local4 * ((_local9 * _local14) - (_local11 * _local12)))) + (_local5 * ((_local9 * _local13) - (_local10 * _local12)))));
this.n31 = (_local2 * ((_local4 * _local8) - (_local5 * _local7)));
this.n32 = (-(_local2) * ((_local3 * _local8) - (_local5 * _local6)));
this.n33 = (_local2 * ((_local3 * _local7) - (_local4 * _local6)));
this.n34 = (-(_local2) * (((_local3 * ((_local7 * _local14) - (_local8 * _local13))) - (_local4 * ((_local6 * _local14) - (_local8 * _local12)))) + (_local5 * ((_local6 * _local13) - (_local7 * _local12)))));
};
}
public static function rotationMatrixWithReference(_arg1:Number3D, _arg2:Number, _arg3:Number3D):Matrix3D{
var _local4:Matrix3D;
_local4 = Matrix3D.translationMatrix(_arg3.x, -(_arg3.y), _arg3.z);
Matrix3D.translationMatrix(_arg3.x, -(_arg3.y), _arg3.z).calculateMultiply(_local4, Matrix3D.rotationMatrix(_arg1.x, _arg1.y, _arg1.z, _arg2));
_local4.calculateMultiply(_local4, Matrix3D.translationMatrix(-(_arg3.x), _arg3.y, -(_arg3.z)));
return (_local4);
}
public static function multiplyVector3x3(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _arg2.z;
_arg2.x = (((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13));
_arg2.y = (((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23));
_arg2.z = (((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33));
}
public static function multiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.calculateMultiply3x3(_arg1, _arg2);
return (_local3);
}
public static function normalizeQuaternion(_arg1:Object):Object{
var _local2:Number;
_local2 = magnitudeQuaternion(_arg1);
_arg1.x = (_arg1.x / _local2);
_arg1.y = (_arg1.y / _local2);
_arg1.z = (_arg1.z / _local2);
_arg1.w = (_arg1.w / _local2);
return (_arg1);
}
public static function multiplyVector(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _arg2.z;
_arg2.x = ((((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13)) + _arg1.n14);
_arg2.y = ((((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23)) + _arg1.n24);
_arg2.z = ((((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33)) + _arg1.n34);
}
public static function axis2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Object{
var _local5:Number;
var _local6:Number;
var _local7:Object;
_local5 = Math.sin((_arg4 / 2));
_local6 = Math.cos((_arg4 / 2));
_local7 = new Object();
_local7.x = (_arg1 * _local5);
_local7.y = (_arg2 * _local5);
_local7.z = (_arg3 * _local5);
_local7.w = _local6;
return (normalizeQuaternion(_local7));
}
public static function translationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D;
_local4 = IDENTITY;
_local4.n14 = _arg1;
_local4.n24 = _arg2;
_local4.n34 = _arg3;
return (_local4);
}
public static function magnitudeQuaternion(_arg1:Object):Number{
return (Math.sqrt(((((_arg1.w * _arg1.w) + (_arg1.x * _arg1.x)) + (_arg1.y * _arg1.y)) + (_arg1.z * _arg1.z))));
}
public static function euler2quaternion(_arg1:Number, _arg2:Number, _arg3:Number):Object{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Object;
_local4 = Math.sin((_arg1 * 0.5));
_local5 = Math.cos((_arg1 * 0.5));
_local6 = Math.sin((_arg2 * 0.5));
_local7 = Math.cos((_arg2 * 0.5));
_local8 = Math.sin((_arg3 * 0.5));
_local9 = Math.cos((_arg3 * 0.5));
_local10 = (_local5 * _local7);
_local11 = (_local4 * _local6);
_local12 = new Object();
_local12.x = ((_local8 * _local10) - (_local9 * _local11));
_local12.y = (((_local9 * _local4) * _local7) + ((_local8 * _local5) * _local6));
_local12.z = (((_local9 * _local5) * _local6) - ((_local8 * _local4) * _local7));
_local12.w = ((_local9 * _local10) + (_local8 * _local11));
return (_local12);
}
public static function rotationX(_arg1:Number):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local2.n22 = _local3;
_local2.n23 = -(_local4);
_local2.n32 = _local4;
_local2.n33 = _local3;
return (_local2);
}
public static function rotationY(_arg1:Number):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n13 = -(_local4);
_local2.n31 = _local4;
_local2.n33 = _local3;
return (_local2);
}
public static function rotationZ(_arg1:Number):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n12 = -(_local4);
_local2.n21 = _local4;
_local2.n22 = _local3;
return (_local2);
}
public static function clone(_arg1:Matrix3D):Matrix3D{
return (new Matrix3D([_arg1.n11, _arg1.n12, _arg1.n13, _arg1.n14, _arg1.n21, _arg1.n22, _arg1.n23, _arg1.n24, _arg1.n31, _arg1.n32, _arg1.n33, _arg1.n34]));
}
public static function rotationMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Matrix3D;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local5 = IDENTITY;
_local6 = Math.cos(_arg4);
_local7 = Math.sin(_arg4);
_local8 = (1 - _local6);
_local9 = ((_arg1 * _arg2) * _local8);
_local10 = ((_arg2 * _arg3) * _local8);
_local11 = ((_arg1 * _arg3) * _local8);
_local12 = (_local7 * _arg3);
_local13 = (_local7 * _arg2);
_local14 = (_local7 * _arg1);
_local5.n11 = (_local6 + ((_arg1 * _arg1) * _local8));
_local5.n12 = (-(_local12) + _local9);
_local5.n13 = (_local13 + _local11);
_local5.n21 = (_local12 + _local9);
_local5.n22 = (_local6 + ((_arg2 * _arg2) * _local8));
_local5.n23 = (-(_local14) + _local10);
_local5.n31 = (-(_local13) + _local11);
_local5.n32 = (_local14 + _local10);
_local5.n33 = (_local6 + ((_arg3 * _arg3) * _local8));
return (_local5);
}
public static function add(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.calculateAdd(_arg1, _arg2);
return (_local3);
}
public static function rotateAxis(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _arg2.z;
_arg2.x = (((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13));
_arg2.y = (((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23));
_arg2.z = (((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33));
_arg2.normalize();
}
public static function multiply(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.calculateMultiply(_arg1, _arg2);
return (_local3);
}
public static function multiplyQuaternion(_arg1:Object, _arg2:Object):Object{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Object;
_local3 = _arg1.x;
_local4 = _arg1.y;
_local5 = _arg1.z;
_local6 = _arg1.w;
_local7 = _arg2.x;
_local8 = _arg2.y;
_local9 = _arg2.z;
_local10 = _arg2.w;
_local11 = new Object();
_local11.x = ((((_local6 * _local7) + (_local3 * _local10)) + (_local4 * _local9)) - (_local5 * _local8));
_local11.y = ((((_local6 * _local8) + (_local4 * _local10)) + (_local5 * _local7)) - (_local3 * _local9));
_local11.z = ((((_local6 * _local9) + (_local5 * _local10)) + (_local3 * _local8)) - (_local4 * _local7));
_local11.w = ((((_local6 * _local10) - (_local3 * _local7)) - (_local4 * _local8)) - (_local5 * _local9));
return (_local11);
}
public static function euler2matrix(_arg1:Number3D):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local2 = IDENTITY;
_local3 = (_arg1.x * toRADIANS);
_local4 = (_arg1.y * toRADIANS);
_local5 = (_arg1.z * toRADIANS);
_local6 = Math.cos(_local3);
_local7 = Math.sin(_local3);
_local8 = Math.cos(_local4);
_local9 = Math.sin(_local4);
_local10 = Math.cos(_local5);
_local11 = Math.sin(_local5);
_local12 = (_local6 * _local9);
_local13 = (_local7 * _local9);
_local2.n11 = (_local8 * _local10);
_local2.n12 = (-(_local8) * _local11);
_local2.n13 = _local9;
_local2.n21 = ((_local13 * _local10) + (_local6 * _local11));
_local2.n22 = ((-(_local13) * _local11) + (_local6 * _local10));
_local2.n23 = (-(_local7) * _local8);
_local2.n31 = ((-(_local12) * _local10) + (_local7 * _local11));
_local2.n32 = ((_local12 * _local11) + (_local7 * _local10));
_local2.n33 = (_local6 * _local8);
return (_local2);
}
public static function scaleMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D;
_local4 = IDENTITY;
_local4.n11 = _arg1;
_local4.n22 = _arg2;
_local4.n33 = _arg3;
return (_local4);
}
public static function quaternion2matrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Matrix3D;
_local5 = (_arg1 * _arg1);
_local6 = (_arg1 * _arg2);
_local7 = (_arg1 * _arg3);
_local8 = (_arg1 * _arg4);
_local9 = (_arg2 * _arg2);
_local10 = (_arg2 * _arg3);
_local11 = (_arg2 * _arg4);
_local12 = (_arg3 * _arg3);
_local13 = (_arg3 * _arg4);
_local14 = IDENTITY;
_local14.n11 = (1 - (2 * (_local9 + _local12)));
_local14.n12 = (2 * (_local6 - _local13));
_local14.n13 = (2 * (_local7 + _local11));
_local14.n21 = (2 * (_local6 + _local13));
_local14.n22 = (1 - (2 * (_local5 + _local12)));
_local14.n23 = (2 * (_local10 - _local8));
_local14.n31 = (2 * (_local7 - _local11));
_local14.n32 = (2 * (_local10 + _local8));
_local14.n33 = (1 - (2 * (_local5 + _local9)));
return (_local14);
}
public static function inverse(_arg1:Matrix3D):Matrix3D{
var _local2:Matrix3D;
_local2 = new (Matrix3D);
_local2.calculateInverse(_arg1);
return (_local2);
}
public static function matrix2euler(_arg1:Matrix3D):Number3D{
var _local2:Number3D;
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
var _local6:Matrix3D;
var _local7:Matrix3D;
var _local8:Matrix3D;
var _local9:Number;
_local2 = new Number3D();
_local3 = new Number3D(_arg1.n11, _arg1.n21, _arg1.n31);
_local4 = new Number3D(_arg1.n12, _arg1.n22, _arg1.n32);
_local5 = new Number3D(_arg1.n13, _arg1.n23, _arg1.n33);
_local3.normalize();
_local4.normalize();
_local5.normalize();
_local6 = new Matrix3D([_local3.x, _local4.x, _local5.x, 0, _local3.y, _local4.y, _local5.y, 0, _local3.z, _local4.z, _local5.z, 0]);
_local2.x = Math.atan2(_local6.n23, _local6.n33);
_local7 = Matrix3D.rotationX(-(_local2.x));
_local8 = Matrix3D.multiply(_local7, _local6);
_local9 = Math.sqrt(((_local8.n11 * _local8.n11) + (_local8.n21 * _local8.n21)));
_local2.y = Math.atan2(-(_local8.n31), _local9);
_local2.z = Math.atan2(-(_local8.n12), _local8.n11);
if (_local2.x == Math.PI){
if (_local2.y > 0){
_local2.y = (_local2.y - Math.PI);
} else {
_local2.y = (_local2.y + Math.PI);
};
_local2.x = 0;
_local2.z = (_local2.z + Math.PI);
};
_local2.x = (_local2.x * toDEGREES);
_local2.y = (_local2.y * toDEGREES);
_local2.z = (_local2.z * toDEGREES);
return (_local2);
}
public static function get IDENTITY():Matrix3D{
return (new Matrix3D([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0]));
}
}
}//package org.papervision3d.core
Section 72
//Number3D (org.papervision3d.core.Number3D)
package org.papervision3d.core {
public class Number3D {
public var x:Number;
public var y:Number;
public var z:Number;
public function Number3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function toString():String{
return (((((("x:" + x) + " y:") + y) + " z:") + z));
}
public function normalize():void{
var _local1:Number;
_local1 = this.modulo;
if (((!((_local1 == 0))) && (!((_local1 == 1))))){
this.x = (this.x / _local1);
this.y = (this.y / _local1);
this.z = (this.z / _local1);
};
}
public function get modulo():Number{
return (Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z))));
}
public function copyTo(_arg1:Number3D):void{
_arg1.x = x;
_arg1.y = y;
_arg1.z = z;
}
public function clone():Number3D{
return (new Number3D(this.x, this.y, this.z));
}
public static function sub(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y), (_arg1.z - _arg2.z)));
}
public static function add(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z)));
}
public static function cross(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D(((_arg2.y * _arg1.z) - (_arg2.z * _arg1.y)), ((_arg2.z * _arg1.x) - (_arg2.x * _arg1.z)), ((_arg2.x * _arg1.y) - (_arg2.y * _arg1.x))));
}
public static function get ZERO():Number3D{
return (new Number3D(0, 0, 0));
}
public static function dot(_arg1:Number3D, _arg2:Number3D):Number{
return ((((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)) + (_arg2.z * _arg1.z)));
}
}
}//package org.papervision3d.core
Section 73
//NumberUV (org.papervision3d.core.NumberUV)
package org.papervision3d.core {
public class NumberUV {
public var u:Number;
public var v:Number;
public function NumberUV(_arg1:Number=0, _arg2:Number=0){
this.u = _arg1;
this.v = _arg2;
}
public function toString():String{
return (((("u:" + u) + " v:") + v));
}
public function clone():NumberUV{
return (new NumberUV(this.u, this.v));
}
public static function get ZERO():NumberUV{
return (new NumberUV(0, 0));
}
}
}//package org.papervision3d.core
Section 74
//InteractiveScene3DEvent (org.papervision3d.events.InteractiveScene3DEvent)
package org.papervision3d.events {
import flash.events.*;
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.utils.*;
public class InteractiveScene3DEvent extends Event {
public var sprite:Sprite;// = null
public var interactiveContainerData:InteractiveContainerData;// = null
public var displayObject3D:DisplayObject3D;// = null
public var face3d:Face3D;// = null
public static const OBJECT_ADDED:String = "objectAdded";
public static const OBJECT_PRESS:String = "mousePress";
public static const OBJECT_RELEASE:String = "mouseRelease";
public static const OBJECT_CLICK:String = "mouseClick";
public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside";
public static const OBJECT_OUT:String = "mouseOut";
public static const OBJECT_MOVE:String = "mouseMove";
public static const OBJECT_OVER:String = "mouseOver";
public function InteractiveScene3DEvent(_arg1:String, _arg2:DisplayObject3D=null, _arg3:Sprite=null, _arg4:Face3D=null, _arg5:InteractiveContainerData=null, _arg6:Boolean=false, _arg7:Boolean=false){
displayObject3D = null;
sprite = null;
face3d = null;
interactiveContainerData = null;
super(_arg1, _arg6, _arg7);
this.displayObject3D = _arg2;
this.sprite = _arg3;
this.face3d = _arg4;
this.interactiveContainerData = _arg5;
}
}
}//package org.papervision3d.events
Section 75
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial)
package org.papervision3d.materials {
import flash.geom.*;
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.draw.*;
import flash.utils.*;
import org.papervision3d.*;
public class BitmapMaterial extends MaterialObject3D implements IFaceDrawer {
public var uvMatrices:Dictionary;
protected var _texture:Object;
public static var AUTO_MIP_MAPPING:Boolean = false;
protected static var _localMatrix:Matrix = new Matrix();
public static var MIP_MAP_DEPTH:Number = 8;
protected static var _triMatrix:Matrix = new Matrix();
public function BitmapMaterial(_arg1:BitmapData=null){
uvMatrices = new Dictionary();
super();
if (_arg1){
texture = _arg1;
};
}
override public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
var _local7:Matrix;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
if (lineAlpha){
_arg3.lineStyle(0, lineColor, lineAlpha);
};
if (bitmap){
_local7 = ((uvMatrices[_arg2]) || (transformUV(_arg2, _arg1)));
_local8 = _arg4.x;
_local9 = _arg4.y;
_local10 = _arg5.x;
_local11 = _arg5.y;
_local12 = _arg6.x;
_local13 = _arg6.y;
_triMatrix.a = (_local10 - _local8);
_triMatrix.b = (_local11 - _local9);
_triMatrix.c = (_local12 - _local8);
_triMatrix.d = (_local13 - _local9);
_triMatrix.tx = _local8;
_triMatrix.ty = _local9;
_localMatrix.a = _local7.a;
_localMatrix.b = _local7.b;
_localMatrix.c = _local7.c;
_localMatrix.d = _local7.d;
_localMatrix.tx = _local7.tx;
_localMatrix.ty = _local7.ty;
_localMatrix.concat(_triMatrix);
_arg3.beginBitmapFill(bitmap, _localMatrix, tiled, smooth);
};
_arg3.moveTo(_local8, _local9);
_arg3.lineTo(_local10, _local11);
_arg3.lineTo(_local12, _local13);
_arg3.lineTo(_local8, _local9);
if (bitmap){
_arg3.endFill();
};
if (lineAlpha){
_arg3.lineStyle();
};
return (1);
}
public function resetMapping():void{
uvMatrices = new Dictionary();
}
public function transformUV(_arg1:Face3D, _arg2:DisplayObject3D=null):Matrix{
var _local3:Array;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Matrix;
var _local17:Matrix;
if (!_arg1.uv){
Papervision3D.log("MaterialObject3D: transformUV() uv not found!");
} else {
if (bitmap){
_local3 = _arg1.uv;
_local4 = (bitmap.width * maxU);
_local5 = (bitmap.height * maxV);
_local6 = (_local4 * _local3[0].u);
_local7 = (_local5 * (1 - _local3[0].v));
_local8 = (_local4 * _local3[1].u);
_local9 = (_local5 * (1 - _local3[1].v));
_local10 = (_local4 * _local3[2].u);
_local11 = (_local5 * (1 - _local3[2].v));
if ((((((_local6 == _local8)) && ((_local7 == _local9)))) || ((((_local6 == _local10)) && ((_local7 == _local11)))))){
_local6 = (_local6 - ((_local6)>0.05) ? 0.05 : -0.05);
_local7 = (_local7 - ((_local7)>0.07) ? 0.07 : -0.07);
};
if ((((_local10 == _local8)) && ((_local11 == _local9)))){
_local10 = (_local10 - ((_local10)>0.05) ? 0.04 : -0.04);
_local11 = (_local11 - ((_local11)>0.06) ? 0.06 : -0.06);
};
_local12 = (_local8 - _local6);
_local13 = (_local9 - _local7);
_local14 = (_local10 - _local6);
_local15 = (_local11 - _local7);
_local16 = new Matrix(_local12, _local13, _local14, _local15, _local6, _local7);
_local16.invert();
_local17 = ((uvMatrices[_arg1]) || ((uvMatrices[_arg1] = _local16.clone())));
_local17.a = _local16.a;
_local17.b = _local16.b;
_local17.c = _local16.c;
_local17.d = _local16.d;
_local17.tx = _local16.tx;
_local17.ty = _local16.ty;
} else {
Papervision3D.log("MaterialObject3D: transformUV() material.bitmap not found!");
};
};
return (_local17);
}
public function get texture():Object{
return (this._texture);
}
protected function correctBitmap(_arg1:BitmapData):BitmapData{
var _local2:BitmapData;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Boolean;
_local3 = (1 << MIP_MAP_DEPTH);
_local4 = (_arg1.width / _local3);
_local4 = ((_local4 == uint(_local4))) ? _local4 : (uint(_local4) + 1);
_local5 = (_arg1.height / _local3);
_local5 = ((_local5 == uint(_local5))) ? _local5 : (uint(_local5) + 1);
_local6 = (_local3 * _local4);
_local7 = (_local3 * _local5);
_local8 = true;
if (_local6 > 2880){
_local6 = _arg1.width;
_local8 = false;
};
if (_local7 > 2880){
_local7 = _arg1.height;
_local8 = false;
};
if (!_local8){
Papervision3D.log((("Material " + this.name) + ": Texture too big for mip mapping. Resizing recommended for better performance and quality."));
};
if (((_arg1) && (((!(((_arg1.width % _local3) == 0))) || (!(((_arg1.height % _local3) == 0))))))){
_local2 = new BitmapData(_local6, _local7, _arg1.transparent, 0);
widthOffset = _arg1.width;
heightOffset = _arg1.height;
this.maxU = (_arg1.width / _local6);
this.maxV = (_arg1.height / _local7);
_local2.draw(_arg1);
extendBitmapEdges(_local2, _arg1.width, _arg1.height);
} else {
this.maxU = (this.maxV = 1);
_local2 = _arg1;
};
return (_local2);
}
public function set texture(_arg1:Object):void{
if ((_arg1 is BitmapData) == false){
Papervision3D.log("Error: BitmapMaterial.texture requires a BitmapData object for the texture");
return;
};
bitmap = createBitmap(BitmapData(_arg1));
_texture = _arg1;
}
protected function createBitmap(_arg1:BitmapData):BitmapData{
resetMapping();
if (AUTO_MIP_MAPPING){
return (correctBitmap(_arg1));
};
this.maxU = (this.maxV = 1);
return (_arg1);
}
override public function toString():String{
return (((((("Texture:" + this.texture) + " lineColor:") + this.lineColor) + " lineAlpha:") + this.lineAlpha));
}
override public function copy(_arg1:MaterialObject3D):void{
super.copy(_arg1);
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
protected function extendBitmapEdges(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
var _local4:Rectangle;
var _local5:Point;
var _local6:int;
_local4 = new Rectangle();
_local5 = new Point();
if (_arg1.width > _arg2){
_local4.x = (_arg2 - 1);
_local4.y = 0;
_local4.width = 1;
_local4.height = _arg3;
_local5.y = 0;
_local6 = _arg2;
while (_local6 < _arg1.width) {
_local5.x = _local6;
_arg1.copyPixels(_arg1, _local4, _local5);
_local6++;
};
};
if (_arg1.height > _arg3){
_local4.x = 0;
_local4.y = (_arg3 - 1);
_local4.width = _arg1.width;
_local4.height = 1;
_local5.x = 0;
_local6 = _arg3;
while (_local6 < _arg1.height) {
_local5.y = _local6;
_arg1.copyPixels(_arg1, _local4, _local5);
_local6++;
};
};
}
override public function clone():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = super.clone();
_local1.maxU = this.maxU;
_local1.maxV = this.maxV;
return (_local1);
}
}
}//package org.papervision3d.materials
Section 76
//InteractiveBitmapMaterial (org.papervision3d.materials.InteractiveBitmapMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public class InteractiveBitmapMaterial extends BitmapMaterial {
public function InteractiveBitmapMaterial(_arg1:BitmapData){
super(_arg1);
}
override public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
var _local7:int;
_local7 = super.drawFace3D(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
if (((!((_arg1.interactiveSceneManager == null))) && (_local7))){
_arg1.interactiveSceneManager.drawFace(_arg1, _arg2, _arg4.x, _arg5.x, _arg6.x, _arg4.y, _arg5.y, _arg6.y);
};
return (_local7);
}
}
}//package org.papervision3d.materials
Section 77
//InteractiveMovieMaterial (org.papervision3d.materials.InteractiveMovieMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public class InteractiveMovieMaterial extends MovieMaterial {
public function InteractiveMovieMaterial(_arg1:Sprite, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
var _local7:int;
_local7 = super.drawFace3D(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
if (((!((_arg1.interactiveSceneManager == null))) && (_local7))){
_arg1.interactiveSceneManager.drawFace(_arg1, _arg2, _arg4.x, _arg5.x, _arg6.x, _arg4.y, _arg5.y, _arg6.y);
};
return (_local7);
}
}
}//package org.papervision3d.materials
Section 78
//MaterialsList (org.papervision3d.materials.MaterialsList)
package org.papervision3d.materials {
import org.papervision3d.core.proto.*;
import flash.utils.*;
public class MaterialsList {
public var materialsByName:Dictionary;
protected var _materials:Dictionary;
private var _materialsTotal:int;
public function MaterialsList(_arg1=null):void{
var _local2:String;
var _local3:String;
super();
this.materialsByName = new Dictionary(true);
this._materials = new Dictionary(false);
this._materialsTotal = 0;
if (_arg1){
if ((_arg1 is Array)){
for (_local2 in _arg1) {
this.addMaterial(_arg1[_local2]);
};
} else {
if ((_arg1 is Object)){
for (_local3 in _arg1) {
this.addMaterial(_arg1[_local3], _local3);
};
};
};
};
}
public function get numMaterials():int{
return (this._materialsTotal);
}
public function addMaterial(_arg1:MaterialObject3D, _arg2:String=null):MaterialObject3D{
_arg2 = ((((_arg2) || (_arg1.name))) || (String(_arg1.id)));
this._materials[_arg1] = _arg2;
this.materialsByName[_arg2] = _arg1;
this._materialsTotal++;
return (_arg1);
}
public function removeMaterial(_arg1:MaterialObject3D):MaterialObject3D{
delete this.materialsByName[this._materials[_arg1]];
delete this._materials[_arg1];
return (_arg1);
}
public function toString():String{
var _local1:String;
var _local2:MaterialObject3D;
_local1 = "";
for each (_local2 in this.materialsByName) {
_local1 = (_local1 + (this._materials[_local2] + "\n"));
};
return (_local1);
}
public function removeMaterialByName(_arg1:String):MaterialObject3D{
return (removeMaterial(getMaterialByName(_arg1)));
}
public function clone():MaterialsList{
var _local1:MaterialsList;
var _local2:MaterialObject3D;
_local1 = new MaterialsList();
for each (_local2 in this.materialsByName) {
_local1.addMaterial(_local2.clone(), this._materials[_local2]);
};
return (_local1);
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
return ((this.materialsByName[_arg1]) ? this.materialsByName[_arg1] : this.materialsByName["all"]);
}
}
}//package org.papervision3d.materials
Section 79
//MovieMaterial (org.papervision3d.materials.MovieMaterial)
package org.papervision3d.materials {
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
import org.papervision3d.*;
public class MovieMaterial extends BitmapMaterial {
public var movieTransparent:Boolean;
public var allowAutoResize:Boolean;// = true
public var movie:DisplayObject;
private static var animatedMaterials:Dictionary = new Dictionary(false);
public function MovieMaterial(_arg1:DisplayObject=null, _arg2:Boolean=false, _arg3:Boolean=false){
allowAutoResize = true;
super();
movieTransparent = _arg2;
this.animated = _arg3;
if (_arg1){
texture = _arg1;
};
}
public function drawBitmap():void{
var _local1:Matrix;
bitmap.fillRect(bitmap.rect, this.fillColor);
_local1 = new Matrix();
_local1.scale(movie.scaleX, movie.scaleY);
bitmap.draw(movie, _local1, movie.transform.colorTransform);
}
override public function get texture():Object{
return (this._texture);
}
public function get animated():Boolean{
return (animatedMaterials[this]);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is DisplayObject) == false){
Papervision3D.log("Error: MovieMaterial.texture requires a Sprite to be passed as the object");
return;
};
bitmap = createBitmapFromSprite(DisplayObject(_arg1));
_texture = _arg1;
}
protected function createBitmapFromSprite(_arg1:DisplayObject):BitmapData{
movie = _arg1;
initBitmap(movie);
drawBitmap();
bitmap = super.createBitmap(bitmap);
return (bitmap);
}
public function set animated(_arg1:Boolean):void{
animatedMaterials[this] = _arg1;
}
override public function updateBitmap():void{
var _local1:int;
var _local2:int;
_local1 = int(movie.width);
_local2 = int(movie.height);
if (((allowAutoResize) && (((!((_local1 == bitmap.width))) || (!((_local2 == bitmap.height))))))){
initBitmap(movie);
};
drawBitmap();
}
protected function initBitmap(_arg1:DisplayObject):void{
if (bitmap){
bitmap.dispose();
};
bitmap = new BitmapData(_arg1.width, _arg1.height, this.movieTransparent);
}
public static function updateAnimatedBitmaps():void{
var _local1:Object;
for (_local1 in animatedMaterials) {
if (animatedMaterials[_local1]){
_local1.updateBitmap();
};
};
}
}
}//package org.papervision3d.materials
Section 80
//WireframeMaterial (org.papervision3d.materials.WireframeMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.draw.*;
public class WireframeMaterial extends MaterialObject3D implements IFaceDrawer {
public function WireframeMaterial(_arg1:Number=0xFF00FF, _arg2:Number=100){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
this.doubleSided = false;
}
override public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local7 = _arg4.x;
_local8 = _arg4.y;
_local9 = _arg5.x;
_local10 = _arg5.y;
_local11 = _arg6.x;
_local12 = _arg6.y;
if (lineAlpha){
_arg3.lineStyle(0, lineColor, lineAlpha);
_arg3.moveTo(_local7, _local8);
_arg3.lineTo(_local9, _local10);
_arg3.lineTo(_local11, _local12);
_arg3.lineTo(_local7, _local8);
_arg3.lineStyle();
return (1);
};
return (0);
}
override public function toString():String{
return (((("WireframeMaterial - color:" + this.lineColor) + " alpha:") + this.lineAlpha));
}
}
}//package org.papervision3d.materials
Section 81
//DisplayObject3D (org.papervision3d.objects.DisplayObject3D)
package org.papervision3d.objects {
import flash.display.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import com.blitzagency.xray.logger.*;
import org.papervision3d.utils.*;
import org.papervision3d.*;
import org.papervision3d.scenes.*;
public class DisplayObject3D extends DisplayObjectContainer3D {
public var extra:Object;
public var id:int;
private var _rotationY:Number;
private var _rotationZ:Number;
private var _rotationX:Number;
public var material:MaterialObject3D;
public var meshSort:uint;// = 1
public var materials:MaterialsList;
private var _scaleDirty:Boolean;// = false
public var transform:Matrix3D;
public var screenZ:Number;
public var visible:Boolean;
private var _scaleX:Number;
private var _scaleY:Number;
private var _scaleZ:Number;
public var geometry:GeometryObject3D;
public var interactiveSceneManager:InteractiveSceneManager;
public var screen:Number3D;
public var name:String;
public var container:Sprite;
public var world:Matrix3D;
public var parent:DisplayObjectContainer3D;
public var view:Matrix3D;
protected var _scene:SceneObject3D;// = null
public var faces:Array;
protected var _transformDirty:Boolean;// = false
private var _rotationDirty:Boolean;// = false
protected var _sorted:Array;
public static const MESH_SORT_CENTER:uint = 1;
public static const MESH_SORT_CLOSE:uint = 3;
public static const MESH_SORT_FAR:uint = 2;
private static var LEFT:Number3D = new Number3D(-1, 0, 0);
private static var _totalDisplayObjects:int = 0;
private static var UP:Number3D = new Number3D(0, 1, 0);
private static var BACKWARD:Number3D = new Number3D(0, 0, -1);
private static var FORWARD:Number3D = new Number3D(0, 0, 1);
private static var DOWN:Number3D = new Number3D(0, -1, 0);
public static var faceLevelMode:Boolean;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
private static var RIGHT:Number3D = new Number3D(1, 0, 0);
public function DisplayObject3D(_arg1:String=null, _arg2:GeometryObject3D=null, _arg3:Object=null):void{
var _local4:Number;
screen = new Number3D();
_scene = null;
meshSort = MESH_SORT_CENTER;
faces = new Array();
_transformDirty = false;
_rotationDirty = false;
_scaleDirty = false;
super();
Papervision3D.log(("DisplayObject3D: " + _arg1));
this.transform = Matrix3D.IDENTITY;
this.world = Matrix3D.IDENTITY;
this.view = Matrix3D.IDENTITY;
this.x = (_arg3) ? ((_arg3.x) || (0)) : 0;
this.y = (_arg3) ? ((_arg3.y) || (0)) : 0;
this.z = (_arg3) ? ((_arg3.z) || (0)) : 0;
rotationX = (_arg3) ? ((_arg3.rotationX) || (0)) : 0;
rotationY = (_arg3) ? ((_arg3.rotationY) || (0)) : 0;
rotationZ = (_arg3) ? ((_arg3.rotationZ) || (0)) : 0;
_local4 = (Papervision3D.usePERCENT) ? 100 : 1;
scaleX = (_arg3) ? ((_arg3.scaleX) || (_local4)) : _local4;
scaleY = (_arg3) ? ((_arg3.scaleY) || (_local4)) : _local4;
scaleZ = (_arg3) ? ((_arg3.scaleZ) || (_local4)) : _local4;
if (((_arg3) && (_arg3.extra))){
this.extra = _arg3.extra;
};
if (((_arg3) && (_arg3.container))){
this.container = _arg3.container;
};
this.visible = true;
this.id = _totalDisplayObjects++;
this.name = ((_arg1) || (String(this.id)));
if (_arg2){
addGeometry(_arg2);
};
}
public function set z(_arg1:Number):void{
this.transform.n34 = _arg1;
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg1 = super.addChild(_arg1, _arg2);
if (_arg1.scene == null){
_arg1.scene = scene;
};
return (_arg1);
}
public function moveDown(_arg1:Number):void{
translate(_arg1, DOWN);
}
public function set scene(_arg1:SceneObject3D):void{
var _local2:DisplayObject3D;
_scene = _arg1;
for each (_local2 in this._childrenByName) {
if (_local2.scene == null){
_local2.scene = _scene;
};
};
if ((_scene is InteractiveScene3D) == false){
return;
};
interactiveSceneManager = InteractiveScene3D(_scene).interactiveSceneManager;
}
public function project(_arg1:DisplayObject3D, _arg2:CameraObject3D, _arg3:Array=null):Number{
var _local4:Number;
var _local5:Number;
var _local6:DisplayObject3D;
if (this._transformDirty){
updateTransform();
};
this.view.calculateMultiply(_arg1.view, this.transform);
this.world.calculateMultiply(_arg1.world, this.transform);
calculateScreenCoords(_arg2);
_local4 = 0;
_local5 = 0;
if (!_arg3){
_arg3 = new Array();
this._sorted = _arg3;
};
for each (_local6 in this._childrenByName) {
if (_local6.visible){
_local4 = (_local4 + _local6.project(this, _arg2, _arg3));
_local5++;
};
};
return ((this.screenZ = (_local4 / _local5)));
}
private function calculateScreenCoords(_arg1:CameraObject3D):void{
var _local2:Number;
_local2 = ((_arg1.focus * _arg1.zoom) / (_arg1.focus + view.n34));
screen.x = (view.n14 * _local2);
screen.y = (view.n24 * _local2);
screen.z = view.n34;
}
public function lookAt(_arg1:DisplayObject3D, _arg2:Number3D=null):void{
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
var _local6:Number3D;
var _local7:Number3D;
var _local8:Matrix3D;
var _local9:XrayLog;
_local3 = new Number3D(this.x, this.y, this.z);
_local4 = new Number3D(_arg1.x, _arg1.y, _arg1.z);
_local5 = Number3D.sub(_local4, _local3);
_local5.normalize();
if (_local5.modulo > 0.1){
_local6 = Number3D.cross(_local5, ((_arg2) || (UP)));
_local6.normalize();
_local7 = Number3D.cross(_local5, _local6);
_local7.normalize();
_local8 = this.transform;
_local8.n11 = (_local6.x * _scaleX);
_local8.n21 = (_local6.y * _scaleX);
_local8.n31 = (_local6.z * _scaleX);
_local8.n12 = (-(_local7.x) * _scaleY);
_local8.n22 = (-(_local7.y) * _scaleY);
_local8.n32 = (-(_local7.z) * _scaleY);
_local8.n13 = (_local5.x * _scaleZ);
_local8.n23 = (_local5.y * _scaleZ);
_local8.n33 = (_local5.z * _scaleZ);
this._transformDirty = false;
this._rotationDirty = true;
} else {
_local9 = new XrayLog();
_local9.debug("lookAt Error");
};
}
public function set rotationX(_arg1:Number):void{
this._rotationX = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
public function set rotationY(_arg1:Number):void{
this._rotationY = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
public function set rotationZ(_arg1:Number):void{
this._rotationZ = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
public function addGeometry(_arg1:GeometryObject3D=null):void{
if (_arg1){
this.geometry = _arg1;
};
}
public function get sceneX():Number{
return (this.world.n14);
}
public function get scaleX():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
}
public function get scaleY():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleY * 100));
};
return (this._scaleY);
}
public function get scaleZ():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleZ * 100));
};
return (this._scaleZ);
}
public function moveUp(_arg1:Number):void{
translate(_arg1, UP);
}
public function get sceneZ():Number{
return (this.world.n34);
}
public function distanceTo(_arg1:DisplayObject3D):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (this.x - _arg1.x);
_local3 = (this.y - _arg1.y);
_local4 = (this.z - _arg1.z);
return (Math.sqrt((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4))));
}
public function get sceneY():Number{
return (this.world.n24);
}
public function get scale():Number{
if ((((this._scaleX == this._scaleY)) && ((this._scaleX == this._scaleZ)))){
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
//unresolved jump
};
return (NaN);
}
public function hitTestObject(_arg1:DisplayObject3D, _arg2:Number=1):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = (this.x - _arg1.x);
_local4 = (this.y - _arg1.y);
_local5 = (this.z - _arg1.z);
_local6 = (((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5));
_local7 = (this.geometry) ? this.geometry.boundingSphere2 : 0;
_local8 = (_arg1.geometry) ? _arg1.geometry.boundingSphere2 : 0;
_local7 = (_local7 * _arg2);
return (((_local7 + _local8) > _local6));
}
public function translate(_arg1:Number, _arg2:Number3D):void{
var _local3:Number3D;
_local3 = _arg2.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local3);
this.x = (this.x + (_arg1 * _local3.x));
this.y = (this.y + (_arg1 * _local3.y));
this.z = (this.z + (_arg1 * _local3.z));
}
private function updateRotation():void{
var _local1:Number3D;
_local1 = Matrix3D.matrix2euler(this.transform);
this._rotationX = (_local1.x * toRADIANS);
this._rotationY = (_local1.y * toRADIANS);
this._rotationZ = (_local1.z * toRADIANS);
this._rotationDirty = false;
}
public function pitch(_arg1:Number):void{
var _local2:Number3D;
var _local3:Matrix3D;
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
_local2 = RIGHT.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local2);
_local3 = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this._rotationDirty = true;
}
public function yaw(_arg1:Number):void{
var _local2:Number3D;
var _local3:Matrix3D;
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
_local2 = UP.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local2);
_local3 = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this._rotationDirty = true;
}
public function copyTransform(_arg1):void{
var _local2:Matrix3D;
var _local3:Matrix3D;
_local2 = this.transform;
_local3 = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n11 = _local3.n11;
_local2.n12 = _local3.n12;
_local2.n13 = _local3.n13;
_local2.n14 = _local3.n14;
_local2.n21 = _local3.n21;
_local2.n22 = _local3.n22;
_local2.n23 = _local3.n23;
_local2.n24 = _local3.n24;
_local2.n31 = _local3.n31;
_local2.n32 = _local3.n32;
_local2.n33 = _local3.n33;
_local2.n34 = _local3.n34;
this._transformDirty = false;
this._rotationDirty = true;
}
public function get x():Number{
return (this.transform.n14);
}
public function get z():Number{
return (this.transform.n34);
}
override public function toString():String{
return (((((((this.name + ": x:") + Math.round(this.x)) + " y:") + Math.round(this.y)) + " z:") + Math.round(this.z)));
}
public function roll(_arg1:Number):void{
var _local2:Number3D;
var _local3:Matrix3D;
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
_local2 = FORWARD.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local2);
_local3 = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this._rotationDirty = true;
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
var _local2:MaterialObject3D;
var _local3:DisplayObject3D;
_local2 = this.materials.getMaterialByName(_arg1);
if (_local2){
return (_local2);
};
for each (_local3 in this._childrenByName) {
_local2 = _local3.getMaterialByName(_arg1);
if (_local2){
return (_local2);
};
};
return (null);
}
public function moveLeft(_arg1:Number):void{
translate(_arg1, LEFT);
}
public function get scene():SceneObject3D{
return (_scene);
}
public function get y():Number{
return (this.transform.n24);
}
public function set scale(_arg1:Number):void{
if (Papervision3D.usePERCENT){
_arg1 = (_arg1 / 100);
};
this._scaleX = (this._scaleY = (this._scaleZ = _arg1));
this._transformDirty = true;
}
public function render(_arg1:SceneObject3D):void{
var _local2:Array;
var _local3:Sprite;
var _local4:Number;
var _local5:Face3DInstance;
var _local6:Number;
var _local7:int;
_local2 = this._sorted;
_local2.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC));
_local3 = ((this.container) || (_arg1.container));
_local4 = 0;
_local6 = _local2.length;
_local7 = 0;
while (_local7 < _local6) {
_local5 = _local2[_local7];
if (faceLevelMode){
if (!_local5.container){
_local5.container = new InteractiveSprite(this);
_arg1.container.addChild(_local5.container);
} else {
_local5.container.graphics.clear();
};
if (_local5.visible){
_local4 = (_local4 + _local5.face.render(_local5.instance, _local5.container));
};
} else {
if (_local5.visible){
_local4 = (_local4 + _local5.face.render(_local5.instance, _local3));
};
};
_local7++;
};
_arg1.stats.rendered = (_arg1.stats.rendered + _local4);
}
public function get rotationY():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (-(this._rotationY) * toDEGREES) : -(this._rotationY));
}
public function get rotationZ():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (-(this._rotationZ) * toDEGREES) : -(this._rotationZ));
}
public function set scaleY(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleY = (_arg1 / 100);
} else {
this._scaleY = _arg1;
};
this._transformDirty = true;
}
public function set scaleZ(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleZ = (_arg1 / 100);
} else {
this._scaleZ = _arg1;
};
this._transformDirty = true;
}
public function get rotationX():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (-(this._rotationX) * toDEGREES) : -(this._rotationX));
}
public function set scaleX(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this._scaleX = (_arg1 / 100);
} else {
this._scaleX = _arg1;
};
this._transformDirty = true;
}
protected function updateTransform():void{
var _local1:Object;
var _local2:Matrix3D;
var _local3:Matrix3D;
var _local4:Matrix3D;
_local1 = Matrix3D.euler2quaternion(-(this._rotationY), -(this._rotationZ), this._rotationX);
_local2 = Matrix3D.quaternion2matrix(_local1.x, _local1.y, _local1.z, _local1.w);
_local3 = this.transform;
_local2.n14 = _local3.n14;
_local2.n24 = _local3.n24;
_local2.n34 = _local3.n34;
_local3.copy(_local2);
_local4 = Matrix3D.IDENTITY;
_local4.n11 = this._scaleX;
_local4.n22 = this._scaleY;
_local4.n33 = this._scaleZ;
this.transform.calculateMultiply(_local3, _local4);
this._transformDirty = false;
}
public function moveForward(_arg1:Number):void{
translate(_arg1, FORWARD);
}
public function copyPosition(_arg1):void{
var _local2:Matrix3D;
var _local3:Matrix3D;
_local2 = this.transform;
_local3 = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n14 = _local3.n14;
_local2.n24 = _local3.n24;
_local2.n34 = _local3.n34;
}
public function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = (this.x - _arg1);
_local5 = (this.y - _arg2);
_local6 = (this.z - _arg3);
_local7 = (((_arg1 * _arg1) + (_arg2 * _arg2)) + (_arg3 * _arg3));
_local8 = (this.geometry) ? this.geometry.boundingSphere2 : 0;
return ((_local8 > _local7));
}
public function moveRight(_arg1:Number):void{
translate(_arg1, RIGHT);
}
public function moveBackward(_arg1:Number):void{
translate(_arg1, BACKWARD);
}
public function materialsList():String{
var _local1:String;
var _local2:String;
var _local3:DisplayObject3D;
_local1 = "";
for (_local2 in this.materials) {
_local1 = (_local1 + (_local2 + "\n"));
};
for each (_local3 in this._childrenByName) {
for (_local2 in _local3.materials.materialsByName) {
_local1 = (_local1 + (("+ " + _local2) + "\n"));
};
};
return (_local1);
}
public function set x(_arg1:Number):void{
this.transform.n14 = _arg1;
}
public function set y(_arg1:Number):void{
this.transform.n24 = _arg1;
}
public static function get ZERO():DisplayObject3D{
return (new (DisplayObject3D));
}
}
}//package org.papervision3d.objects
Section 82
//Plane (org.papervision3d.objects.Plane)
package org.papervision3d.objects {
import org.papervision3d.core.geom.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
public class Plane extends Mesh3D {
public var segmentsH:Number;
public var segmentsW:Number;
public static var DEFAULT_SCALE:Number = 1;
public static var DEFAULT_SEGMENTS:Number = 1;
public static var DEFAULT_SIZE:Number = 500;
public function Plane(_arg1:MaterialObject3D=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Object=null){
var _local7:Number;
super(_arg1, new Array(), new Array(), null, _arg6);
this.segmentsW = ((_arg4) || (DEFAULT_SEGMENTS));
this.segmentsH = ((_arg5) || (this.segmentsW));
_local7 = DEFAULT_SCALE;
if (!_arg3){
if (_arg2){
_local7 = _arg2;
};
if (((_arg1) && (_arg1.bitmap))){
_arg2 = (_arg1.bitmap.width * _local7);
_arg3 = (_arg1.bitmap.height * _local7);
} else {
_arg2 = (DEFAULT_SIZE * _local7);
_arg3 = (DEFAULT_SIZE * _local7);
};
};
buildPlane(_arg2, _arg3);
}
private function buildPlane(_arg1:Number, _arg2:Number):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Array;
var _local8:Array;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:int;
var _local14:NumberUV;
var _local15:NumberUV;
var _local16:NumberUV;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Vertex3D;
var _local21:Vertex3D;
var _local22:Vertex3D;
_local3 = this.segmentsW;
_local4 = this.segmentsH;
_local5 = (_local3 + 1);
_local6 = (_local4 + 1);
_local7 = this.geometry.vertices;
_local8 = this.geometry.faces;
_local9 = (_arg1 / 2);
_local10 = (_arg2 / 2);
_local11 = (_arg1 / _local3);
_local12 = (_arg2 / _local4);
_local13 = 0;
while (_local13 < (_local3 + 1)) {
_local17 = 0;
while (_local17 < _local6) {
_local18 = ((_local13 * _local11) - _local9);
_local19 = ((_local17 * _local12) - _local10);
_local7.push(new Vertex3D(_local18, _local19, 0));
_local17++;
};
_local13++;
};
_local13 = 0;
while (_local13 < _local3) {
_local17 = 0;
while (_local17 < _local4) {
_local20 = _local7[((_local13 * _local6) + _local17)];
_local21 = _local7[((_local13 * _local6) + (_local17 + 1))];
_local22 = _local7[(((_local13 + 1) * _local6) + _local17)];
_local14 = new NumberUV((_local13 / _local3), (_local17 / _local4));
_local15 = new NumberUV((_local13 / _local3), ((_local17 + 1) / _local4));
_local16 = new NumberUV(((_local13 + 1) / _local3), (_local17 / _local4));
_local8.push(new Face3D([_local20, _local22, _local21], null, [_local14, _local16, _local15]));
_local20 = _local7[(((_local13 + 1) * _local6) + (_local17 + 1))];
_local21 = _local7[(((_local13 + 1) * _local6) + _local17)];
_local22 = _local7[((_local13 * _local6) + (_local17 + 1))];
_local14 = new NumberUV(((_local13 + 1) / _local3), ((_local17 + 1) / _local4));
_local15 = new NumberUV(((_local13 + 1) / _local3), (_local17 / _local4));
_local16 = new NumberUV((_local13 / _local3), ((_local17 + 1) / _local4));
_local8.push(new Face3D([_local20, _local22, _local21], null, [_local14, _local16, _local15]));
_local17++;
};
_local13++;
};
this.geometry.ready = true;
}
}
}//package org.papervision3d.objects
Section 83
//InteractiveScene3D (org.papervision3d.scenes.InteractiveScene3D)
package org.papervision3d.scenes {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.utils.*;
public class InteractiveScene3D extends MovieScene3D {
public var interactiveSceneManager:InteractiveSceneManager;
public function InteractiveScene3D(_arg1:Sprite){
super(_arg1);
interactiveSceneManager = new InteractiveSceneManager(this);
}
override public function renderCamera(_arg1:CameraObject3D):void{
interactiveSceneManager.resetFaces();
super.renderCamera(_arg1);
interactiveSceneManager.sortObjects();
}
}
}//package org.papervision3d.scenes
Section 84
//MovieScene3D (org.papervision3d.scenes.MovieScene3D)
package org.papervision3d.scenes {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import flash.utils.*;
public class MovieScene3D extends Scene3D {
private var spriteList:Dictionary;
private var containerList:Array;
public function MovieScene3D(_arg1:Sprite){
super(_arg1);
this.containerList = new Array();
spriteList = new Dictionary();
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg1 = super.addChild(_arg1, _arg2);
_arg1.container = new Sprite();
container.addChild(_arg1.container);
this.containerList.push(_arg1.container);
spriteList[_arg1] = _arg1.container;
return (_arg1);
}
public function getSprite(_arg1:DisplayObject3D):Sprite{
return (spriteList[_arg1]);
}
override protected function renderObjects(_arg1:Boolean):void{
var _local2:Number;
var _local3:Sprite;
var _local4:Array;
var _local5:Number;
var _local6:DisplayObject3D;
var _local7:Array;
var _local8:Object;
_local2 = this.objects.length;
_local4 = this.containerList;
_local5 = 0;
while ((_local3 = _local4[_local5++])) {
_local3.graphics.clear();
};
_local7 = this.objects;
_local5 = _local7.length;
if (_arg1){
while ((_local6 = _local7[--_local5])) {
if (_local6.visible){
container.addChild(_local6.container);
_local6.render(this);
};
};
} else {
while ((_local6 = _local7[--_local5])) {
if (_local6.visible){
_local6.render(this);
};
};
};
_local8 = this.stats;
_local8.performance = (getTimer() - _local8.performance);
}
override public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
var _local2:DisplayObject3D;
var _local3:int;
_local2 = super.removeChild(_arg1);
_local3 = 0;
while (_local3 < containerList.length) {
if (_local2.container == containerList[_local3]){
this.containerList.splice(_local3, 1);
};
_local3++;
};
container.removeChild(_local2.container);
delete spriteList[_local2];
return (_local2);
}
}
}//package org.papervision3d.scenes
Section 85
//Scene3D (org.papervision3d.scenes.Scene3D)
package org.papervision3d.scenes {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import flash.utils.*;
public class Scene3D extends SceneObject3D {
public function Scene3D(_arg1:Sprite){
super(_arg1);
}
override protected function renderObjects(_arg1:Boolean):void{
var _local2:DisplayObject3D;
var _local3:Array;
var _local4:Number;
var _local5:Object;
this.container.graphics.clear();
_local3 = this.objects;
_local4 = _local3.length;
while ((_local2 = _local3[--_local4])) {
if (_local2.visible){
_local2.render(this);
};
};
_local5 = this.stats;
_local5.performance = (getTimer() - _local5.performance);
}
}
}//package org.papervision3d.scenes
Section 86
//IVirtualMouseEvent (org.papervision3d.utils.virtualmouse.IVirtualMouseEvent)
package org.papervision3d.utils.virtualmouse {
public interface IVirtualMouseEvent {
}
}//package org.papervision3d.utils.virtualmouse
Section 87
//VirtualMouse (org.papervision3d.utils.virtualmouse.VirtualMouse)
package org.papervision3d.utils.virtualmouse {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import com.blitzagency.xray.logger.*;
import flash.utils.*;
public class VirtualMouse extends EventDispatcher {
private var _container:Sprite;
private var lastDownTarget:DisplayObject;
private var target:InteractiveObject;
private var updateMouseDown:Boolean;// = false
private var eventEvent:Class;
private var _lastEvent:Event;
private var mouseEventEvent:Class;
private var location:Point;
private var delta:int;// = 0
private var disabledEvents:Object;
private var log:XrayLog;
private var ignoredInstances:Dictionary;
private var isLocked:Boolean;// = false
private var lastWithinStage:Boolean;// = true
private var lastLocation:Point;
private var isDoubleClickEvent:Boolean;// = false
private var lastMouseDown:Boolean;// = false
private var altKey:Boolean;// = false
private var _useNativeEvents:Boolean;// = false
private var ctrlKey:Boolean;// = false
private var shiftKey:Boolean;// = false
private var _stage:Stage;
public static const UPDATE:String = "update";
private static var _mouseIsDown:Boolean = false;
public function VirtualMouse(_arg1:Stage=null, _arg2:Sprite=null, _arg3:Number=0, _arg4:Number=0){
altKey = false;
ctrlKey = false;
shiftKey = false;
delta = 0;
isLocked = false;
isDoubleClickEvent = false;
disabledEvents = new Object();
ignoredInstances = new Dictionary(true);
lastMouseDown = false;
updateMouseDown = false;
lastWithinStage = true;
_useNativeEvents = false;
eventEvent = VirtualMouseEvent;
mouseEventEvent = VirtualMouseMouseEvent;
log = new XrayLog();
super();
this.stage = _arg1;
this.container = _arg2;
location = new Point(_arg3, _arg4);
lastLocation = location.clone();
addEventListener(UPDATE, handleUpdate);
update();
}
public function get mouseIsDown():Boolean{
return (_mouseIsDown);
}
public function get stage():Stage{
return (_stage);
}
public function exitContainer():void{
var _local1:Point;
_local1 = target.globalToLocal(location);
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
container.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
container.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (target != container){
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
};
target = _stage;
}
public function release():void{
updateMouseDown = true;
_mouseIsDown = false;
if (!isLocked){
update();
};
}
public function click():void{
press();
release();
}
public function get container():Sprite{
return (_container);
}
public function set container(_arg1:Sprite):void{
_container = _arg1;
}
public function get y():Number{
return (location.y);
}
public function set x(_arg1:Number):void{
location.x = _arg1;
if (!isLocked){
update();
};
}
public function disableEvent(_arg1:String):void{
disabledEvents[_arg1] = true;
}
public function get lastEvent():Event{
return (_lastEvent);
}
private function handleUpdate(_arg1:Event):void{
var _local2:Array;
var _local3:InteractiveObject;
var _local4:DisplayObject;
var _local5:int;
var _local6:Point;
var _local7:Point;
var _local8:Boolean;
if (!container){
return;
};
_local2 = container.getObjectsUnderPoint(location);
_local5 = _local2.length;
while (_local5--) {
_local4 = _local2[_local5];
while (_local4) {
if (ignoredInstances[_local4]){
_local3 = null;
break;
};
if (((_local3) && ((_local4 is SimpleButton)))){
_local3 = null;
} else {
if (((_local3) && (!(DisplayObjectContainer(_local4).mouseChildren)))){
_local3 = null;
};
};
if (((((!(_local3)) && ((_local4 is InteractiveObject)))) && (InteractiveObject(_local4).mouseEnabled))){
_local3 = InteractiveObject(_local4);
};
_local4 = _local4.parent;
};
if (_local3){
break;
};
};
if (!_local3){
_local3 = _stage;
log.debug("no new target found, using stage");
};
_local6 = target.globalToLocal(location);
_local7 = _local3.globalToLocal(location);
if (((!((lastLocation.x == location.x))) || (!((lastLocation.y == location.y))))){
_local8 = false;
if (stage){
_local8 = (((((((location.x >= 0)) && ((location.y >= 0)))) && ((location.x <= stage.stageWidth)))) && ((location.y <= stage.stageHeight)));
};
if (((((!(_local8)) && (lastWithinStage))) && (!(disabledEvents[Event.MOUSE_LEAVE])))){
_lastEvent = new eventEvent(Event.MOUSE_LEAVE, false, false);
stage.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (((_local8) && (!(disabledEvents[MouseEvent.MOUSE_MOVE])))){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_MOVE, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local3.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastWithinStage = _local8;
};
if (_local3 != target){
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local6.x, _local6.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local6.x, _local6.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.MOUSE_OVER]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OVER, true, false, _local7.x, _local7.y, target, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local3.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.ROLL_OVER]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OVER, false, false, _local7.x, _local7.y, target, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local3.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
};
if (updateMouseDown){
if (_mouseIsDown){
if (!disabledEvents[MouseEvent.MOUSE_DOWN]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_DOWN, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local3.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastDownTarget = _local3;
updateMouseDown = false;
} else {
if (!disabledEvents[MouseEvent.MOUSE_UP]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_UP, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local3.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (((!(disabledEvents[MouseEvent.CLICK])) && ((_local3 == lastDownTarget)))){
_lastEvent = new mouseEventEvent(MouseEvent.CLICK, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local3.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastDownTarget = null;
updateMouseDown = false;
};
};
if (((((isDoubleClickEvent) && (!(disabledEvents[MouseEvent.DOUBLE_CLICK])))) && (_local3.doubleClickEnabled))){
_lastEvent = new mouseEventEvent(MouseEvent.DOUBLE_CLICK, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local3.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastLocation = location.clone();
lastMouseDown = _mouseIsDown;
target = _local3;
}
public function getLocation():Point{
return (location.clone());
}
public function get x():Number{
return (location.x);
}
public function lock():void{
isLocked = true;
}
public function get useNativeEvents():Boolean{
return (_useNativeEvents);
}
public function setLocation(_arg1, _arg2=null):void{
var _local3:Point;
if ((_arg1 is Point)){
_local3 = Point(_arg1);
location.x = _local3.x;
location.y = _local3.y;
} else {
location.x = Number(_arg1);
location.y = Number(_arg2);
};
if (!isLocked){
update();
};
}
private function keyHandler(_arg1:KeyboardEvent):void{
altKey = _arg1.altKey;
ctrlKey = _arg1.ctrlKey;
shiftKey = _arg1.shiftKey;
}
public function unignore(_arg1:DisplayObject):void{
if ((_arg1 in ignoredInstances)){
delete ignoredInstances[_arg1];
};
}
public function doubleClick():void{
if (isLocked){
release();
} else {
click();
press();
isDoubleClickEvent = true;
release();
isDoubleClickEvent = false;
};
}
public function update():void{
dispatchEvent(new Event(UPDATE, false, false));
}
public function ignore(_arg1:DisplayObject):void{
ignoredInstances[_arg1] = true;
}
public function unlock():void{
isLocked = false;
update();
}
public function enableEvent(_arg1:String):void{
if ((_arg1 in disabledEvents)){
delete disabledEvents[_arg1];
};
}
public function press():void{
updateMouseDown = true;
_mouseIsDown = true;
if (!isLocked){
update();
};
}
public function set useNativeEvents(_arg1:Boolean):void{
if (_arg1 == _useNativeEvents){
return;
};
_useNativeEvents = _arg1;
if (_useNativeEvents){
eventEvent = VirtualMouseEvent;
mouseEventEvent = VirtualMouseMouseEvent;
} else {
eventEvent = Event;
mouseEventEvent = MouseEvent;
};
}
public function set y(_arg1:Number):void{
location.y = _arg1;
if (!isLocked){
update();
};
}
public function set stage(_arg1:Stage):void{
var _local2:Boolean;
if (_stage){
_local2 = true;
_stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
_stage.removeEventListener(KeyboardEvent.KEY_UP, keyHandler);
} else {
_local2 = false;
};
_stage = _arg1;
if (_stage){
_stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
_stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
target = _stage;
if (!_local2){
update();
};
};
}
}
}//package org.papervision3d.utils.virtualmouse
Section 88
//VirtualMouseEvent (org.papervision3d.utils.virtualmouse.VirtualMouseEvent)
package org.papervision3d.utils.virtualmouse {
import flash.events.*;
public class VirtualMouseEvent extends Event implements IVirtualMouseEvent {
public function VirtualMouseEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package org.papervision3d.utils.virtualmouse
Section 89
//VirtualMouseMouseEvent (org.papervision3d.utils.virtualmouse.VirtualMouseMouseEvent)
package org.papervision3d.utils.virtualmouse {
import flash.events.*;
import flash.display.*;
public class VirtualMouseMouseEvent extends MouseEvent implements IVirtualMouseEvent {
public function VirtualMouseMouseEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Number=NaN, _arg5:Number=NaN, _arg6:InteractiveObject=null, _arg7:Boolean=false, _arg8:Boolean=false, _arg9:Boolean=false, _arg10:Boolean=false, _arg11:int=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11);
}
}
}//package org.papervision3d.utils.virtualmouse
Section 90
//InteractiveContainerData (org.papervision3d.utils.InteractiveContainerData)
package org.papervision3d.utils {
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public class InteractiveContainerData extends EventDispatcher {
public var container:InteractiveSprite;
public var displayObject3D:DisplayObject3D;// = null
public var lineColor:Number;
public var lineAlpha:Number;
public var fillAlpha:Number;
public var sort:Boolean;// = false
public var isDrawn:Boolean;// = false
public var color:Number;
public var lineSize:Number;
public var face3d:Face3D;
public function InteractiveContainerData(_arg1, _arg2:Number=0, _arg3:IEventDispatcher=null){
displayObject3D = null;
isDrawn = false;
sort = false;
color = InteractiveSceneManager.DEFAULT_FILL_COLOR;
fillAlpha = InteractiveSceneManager.DEFAULT_FILL_ALPHA;
lineColor = InteractiveSceneManager.DEFAULT_LINE_COLOR;
lineSize = InteractiveSceneManager.DEFAULT_LINE_SIZE;
lineAlpha = InteractiveSceneManager.DEFAULT_LINE_ALPHA;
super(_arg3);
displayObject3D = (((_arg1 is DisplayObject3D) == true)) ? _arg1 : null;
face3d = (((_arg1 is Face3D) == true)) ? _arg1 : null;
if (displayObject3D != null){
this.container = new InteractiveSprite(_arg1);
};
if (face3d != null){
if (face3d.face3DInstance.container != null){
this.container = InteractiveSprite(face3d.face3DInstance.container);
} else {
this.container = new InteractiveSprite();
};
};
color = _arg2;
container.alpha = InteractiveSceneManager.DEFAULT_SPRITE_ALPHA;
container.interactiveContainerData = this;
}
public function get screenZ():Number{
return (((displayObject3D)!=null) ? displayObject3D.screenZ : face3d.screenZ);
}
}
}//package org.papervision3d.utils
Section 91
//InteractiveSceneManager (org.papervision3d.utils.InteractiveSceneManager)
package org.papervision3d.utils {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import com.blitzagency.xray.logger.*;
import flash.utils.*;
import org.papervision3d.utils.virtualmouse.*;
import org.papervision3d.events.*;
public class InteractiveSceneManager extends EventDispatcher {
public var container:Sprite;
public var scene:SceneObject3D;
protected var allowDraw:Boolean;// = true
protected var log:XrayLog;
private var _mouseInteractionMode:Boolean;// = false
public var faceDictionary:Dictionary;
public var mouse3D:Mouse3D;
public var virtualMouse:VirtualMouse;
public var faceLevelMode:Boolean;// = false
public var debug:Boolean;// = false
protected var evaluateClick:Boolean;// = false
public var buttonMode:Boolean;// = false
public var containerDictionary:Dictionary;
public static var DEFAULT_FILL_ALPHA:Number = 1;
public static var DEFAULT_SPRITE_ALPHA:Number = 1;
public static var DEFAULT_FILL_COLOR:Number = 0xFFFFFF;
public static var DEFAULT_LINE_SIZE:Number = 1;
public static var DEFAULT_LINE_ALPHA:Number = 1;
public static var DEFAULT_LINE_COLOR:Number = -1;
public static var MOUSE_IS_DOWN:Boolean = false;
public static var SHOW_DRAWN_FACES:Boolean = false;
public function InteractiveSceneManager(_arg1:SceneObject3D):void{
buttonMode = false;
faceLevelMode = false;
_mouseInteractionMode = false;
faceDictionary = new Dictionary();
containerDictionary = new Dictionary();
container = new InteractiveSprite();
mouse3D = new Mouse3D();
virtualMouse = new VirtualMouse();
debug = false;
allowDraw = true;
evaluateClick = false;
log = new XrayLog();
super();
container.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
scene = _arg1;
scene.container.parent.addChild(container);
container.x = scene.container.x;
container.y = scene.container.y;
enableMouse = false;
}
protected function handleStageMouseMove(_arg1:MouseEvent):void{
allowDraw = true;
}
public function sortObjects():void{
var _local1:Array;
var _local2:InteractiveContainerData;
var _local3:uint;
var _local4:Number;
_local1 = [];
for each (_local2 in faceDictionary) {
if (!_local2.sort){
} else {
_local4 = ((_local2.face3d == null)) ? _local2.screenZ : _local2.face3d.face3DInstance.screenZ;
_local1.push({container:_local2.container, distance:_local4});
};
};
_local1.sortOn("distance", (Array.DESCENDING | Array.NUMERIC));
_local3 = 0;
while (_local3 < _local1.length) {
container.addChild(_local1[_local3].container);
_local3++;
};
if (mouseInteractionMode){
allowDraw = false;
};
}
public function setInteractivityDefaults():void{
SHOW_DRAWN_FACES = false;
DEFAULT_SPRITE_ALPHA = 1;
DEFAULT_FILL_ALPHA = 1;
BitmapMaterial.AUTO_MIP_MAPPING = false;
DisplayObject3D.faceLevelMode = false;
buttonMode = true;
faceLevelMode = true;
mouseInteractionMode = false;
}
public function addInteractiveObject(_arg1:Object):void{
var _local2:InteractiveContainerData;
var _local3:InteractiveSprite;
if (faceDictionary[_arg1] == null){
_local2 = (faceDictionary[_arg1] = new InteractiveContainerData(_arg1));
containerDictionary[_local2.container] = _arg1;
_local3 = _local2.container;
_local3.addEventListener(MouseEvent.MOUSE_DOWN, handleMousePress);
_local3.addEventListener(MouseEvent.MOUSE_UP, handleMouseRelease);
_local3.addEventListener(MouseEvent.CLICK, handleMouseClick);
_local3.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver);
_local3.addEventListener(MouseEvent.MOUSE_OUT, handleMouseOut);
_local3.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
_local3.buttonMode = buttonMode;
if (((!(SHOW_DRAWN_FACES)) && (!(DisplayObject3D.faceLevelMode)))){
_local3.blendMode = BlendMode.ERASE;
};
virtualMouse.ignore(_local3);
dispatchEvent(new InteractiveScene3DEvent(InteractiveScene3DEvent.OBJECT_ADDED, null, _local3));
if (debug){
log.debug("addDisplayObject id", _arg1.id, _arg1.name, DEFAULT_SPRITE_ALPHA);
};
};
}
public function resetFaces():void{
var _local1:InteractiveContainerData;
for each (_local1 in faceDictionary) {
_local1.container.graphics.clear();
_local1.sort = _local1.isDrawn;
_local1.isDrawn = false;
};
resizeStage();
}
public function resizeStage():void{
container.x = scene.container.x;
container.y = scene.container.y;
}
protected function handleMouseClick(_arg1:MouseEvent):void{
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_CLICK, Sprite(_arg1.currentTarget));
}
protected function handleMouseOut(_arg1:MouseEvent):void{
var face3d:Face3D;
var p:Object;
var mat:InteractiveMovieMaterial;
var rect:Rectangle;
var contains:Boolean;
var e = _arg1;
if (((VirtualMouse) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){
try {
face3d = containerDictionary[e.currentTarget];
p = InteractiveUtils.getMapCoordAtPoint(face3d, container.mouseX, container.mouseY);
mat = InteractiveMovieMaterial(face3d.face3DInstance.instance.material);
rect = new Rectangle(0, 0, mat.movie.width, mat.movie.height);
contains = rect.contains(p.x, p.y);
if (!contains){
virtualMouse.exitContainer();
};
} catch(err:Error) {
log.error("material type is not Interactive. If you're using a Collada object, you may have to reassign the material to the object after the collada scene is loaded", err.message);
};
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OUT, Sprite(e.currentTarget));
}
public function drawFace(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):void{
var _local9:Object;
var _local10:InteractiveContainerData;
var _local11:InteractiveSprite;
var _local12:Graphics;
_local9 = _arg1;
if (((faceLevelMode) || (DisplayObject3D.faceLevelMode))){
_local9 = _arg2;
};
if (faceDictionary[_local9] == null){
addInteractiveObject(_local9);
};
if (((allowDraw) && (!(DisplayObject3D.faceLevelMode)))){
_local10 = faceDictionary[_local9];
_local11 = _local10.container;
_local12 = _local11.graphics;
_local11.x0 = _arg3;
_local11.x1 = _arg4;
_local11.x2 = _arg5;
_local11.y0 = _arg6;
_local11.y1 = _arg7;
_local11.y2 = _arg8;
_local12.beginFill(_local10.color, _local10.fillAlpha);
if (((!((_local10.lineColor == -1))) && (SHOW_DRAWN_FACES))){
_local12.lineStyle(_local10.lineSize, _local10.lineColor, _local10.lineAlpha);
};
_local12.moveTo(_arg3, _arg6);
_local12.lineTo(_arg4, _arg7);
_local12.lineTo(_arg5, _arg8);
_local12.endFill();
_local10.isDrawn = true;
};
}
public function set enableMouse(_arg1:Boolean):void{
Mouse3D.enabled = _arg1;
}
protected function dispatchObjectEvent(_arg1:String, _arg2:Sprite):void{
var _local3:Face3D;
var _local4:InteractiveContainerData;
if (debug){
log.debug(_arg1, DisplayObject3D(containerDictionary[_arg2]).name);
};
if ((containerDictionary[_arg2] is DisplayObject3D)){
containerDictionary[_arg2].dispatchEvent(new InteractiveScene3DEvent(_arg1, containerDictionary[_arg2], InteractiveSprite(_arg2)));
dispatchEvent(new InteractiveScene3DEvent(_arg1, containerDictionary[_arg2], InteractiveSprite(_arg2), null, null));
} else {
if ((containerDictionary[_arg2] is Face3D)){
_local3 = containerDictionary[_arg2];
_local4 = faceDictionary[_local3];
dispatchEvent(new InteractiveScene3DEvent(_arg1, null, InteractiveSprite(_arg2), _local3, _local4));
};
};
}
protected function handleMouseMove(_arg1:MouseEvent):void{
var point:Object;
var face3d:Face3D;
var mat:MovieMaterial;
var e = _arg1;
if (((VirtualMouse) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){
face3d = containerDictionary[e.currentTarget];
point = InteractiveUtils.getMapCoordAtPoint(face3d, container.mouseX, container.mouseY);
try {
mat = (face3d.face3DInstance.instance.material as MovieMaterial);
virtualMouse.container = (mat.movie as Sprite);
if (virtualMouse.container){
virtualMouse.setLocation(point.x, point.y);
};
} catch(err:Error) {
log.error("material type is not Inter active. If you're using a Collada object, you may have to reassign the material to the object after the collada scene is loaded", err.message);
};
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, Sprite(e.currentTarget));
if (((Mouse3D.enabled) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){
mouse3D.updatePosition(Face3D(containerDictionary[e.currentTarget]), (e.currentTarget as Sprite));
};
}
protected function handleMouseOver(_arg1:MouseEvent):void{
var _local2:String;
_local2 = (((!(evaluateClick)) || (!(mouseInteractionMode)))) ? InteractiveScene3DEvent.OBJECT_OVER : InteractiveScene3DEvent.OBJECT_CLICK;
evaluateClick = false;
if (((virtualMouse) && ((_local2 == InteractiveScene3DEvent.OBJECT_CLICK)))){
virtualMouse.click();
};
dispatchObjectEvent(_local2, Sprite(_arg1.currentTarget));
}
public function set mouseInteractionMode(_arg1:Boolean):void{
_mouseInteractionMode = _arg1;
allowDraw = !(_arg1);
if (_arg1){
container.stage.addEventListener(MouseEvent.MOUSE_MOVE, handleStageMouseMove);
};
if (!_arg1){
container.stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleStageMouseMove);
};
}
public function get enableMouse():Boolean{
return (Mouse3D.enabled);
}
protected function handleMousePress(_arg1:MouseEvent):void{
MOUSE_IS_DOWN = true;
if (virtualMouse){
virtualMouse.press();
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_PRESS, Sprite(_arg1.currentTarget));
}
protected function handleReleaseOutside(_arg1:MouseEvent):void{
if (debug){
log.debug("releaseOutside");
};
dispatchEvent(new InteractiveScene3DEvent(InteractiveScene3DEvent.OBJECT_RELEASE_OUTSIDE));
MOUSE_IS_DOWN = false;
evaluateClick = true;
allowDraw = true;
}
public function get mouseInteractionMode():Boolean{
return (_mouseInteractionMode);
}
protected function handleAddedToStage(_arg1:Event):void{
container.stage.addEventListener(Event.RESIZE, handleResize);
container.stage.addEventListener(MouseEvent.MOUSE_UP, handleReleaseOutside);
virtualMouse.stage = container.stage;
}
protected function handleMouseRelease(_arg1:MouseEvent):void{
MOUSE_IS_DOWN = false;
if (virtualMouse){
virtualMouse.release();
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_RELEASE, Sprite(_arg1.currentTarget));
}
protected function handleResize(_arg1:Event):void{
resizeStage();
}
}
}//package org.papervision3d.utils
Section 92
//InteractiveSprite (org.papervision3d.utils.InteractiveSprite)
package org.papervision3d.utils {
import flash.display.*;
import org.papervision3d.objects.*;
public class InteractiveSprite extends Sprite {
public var interactiveContainerData:InteractiveContainerData;// = null
public var x1:Number;
public var x2:Number;
public var x0:Number;
public var y0:Number;
public var y2:Number;
public var obj:DisplayObject3D;// = null
public var y1:Number;
public function InteractiveSprite(_arg1:DisplayObject3D=null):void{
obj = null;
interactiveContainerData = null;
super();
this.obj = _arg1;
}
}
}//package org.papervision3d.utils
Section 93
//InteractiveUtils (org.papervision3d.utils.InteractiveUtils)
package org.papervision3d.utils {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
public class InteractiveUtils {
public static function getMapCoordAtPointDO3D(_arg1:DisplayObject3D, _arg2:Number, _arg3:Number):Object{
var _local4:Face3D;
_local4 = _arg1.geometry.faces[0];
return (getMapCoordAtPoint(_local4, _arg2, _arg3));
}
public static function UVatPoint(_arg1:Face3D, _arg2:Number, _arg3:Number):Object{
var _local4:Vertex3D;
var _local5:Vertex3D;
var _local6:Vertex3D;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12: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;
_local4 = _arg1.v0;
_local5 = _arg1.v1;
_local6 = _arg1.v2;
_local7 = _local4.vertex2DInstance.x;
_local8 = _local4.vertex2DInstance.y;
_local9 = _local5.vertex2DInstance.x;
_local10 = _local5.vertex2DInstance.y;
_local11 = _local6.vertex2DInstance.x;
_local12 = _local6.vertex2DInstance.y;
_local13 = (_local11 - _local7);
_local14 = (_local12 - _local8);
_local15 = (_local9 - _local7);
_local16 = (_local10 - _local8);
_local17 = (_arg2 - _local7);
_local18 = (_arg3 - _local8);
_local19 = ((_local13 * _local13) + (_local14 * _local14));
_local20 = ((_local13 * _local15) + (_local14 * _local16));
_local21 = ((_local13 * _local17) + (_local14 * _local18));
_local22 = ((_local15 * _local15) + (_local16 * _local16));
_local23 = ((_local15 * _local17) + (_local16 * _local18));
_local24 = (1 / ((_local19 * _local22) - (_local20 * _local20)));
_local25 = (((_local22 * _local21) - (_local20 * _local23)) * _local24);
_local26 = (((_local19 * _local23) - (_local20 * _local21)) * _local24);
return ({u:_local25, v:_local26});
}
public static function getMapCoordAtPoint(_arg1:Face3D, _arg2:Number, _arg3:Number):Object{
var _local4:Array;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:MaterialObject3D;
var _local17:BitmapData;
var _local18:Number;
var _local19:Number;
_local4 = _arg1.uv;
_local5 = UVatPoint(_arg1, _arg2, _arg3);
_local6 = _local5.u;
_local7 = _local5.v;
_local8 = _local4[0].u;
_local9 = _local4[1].u;
_local10 = _local4[2].u;
_local11 = _local4[0].v;
_local12 = _local4[1].v;
_local13 = _local4[2].v;
_local14 = ((((_local9 - _local8) * _local7) + ((_local10 - _local8) * _local6)) + _local8);
_local15 = ((((_local12 - _local11) * _local7) + ((_local13 - _local11) * _local6)) + _local11);
_local16 = _arg1.face3DInstance.instance.material;
_local17 = _local16.bitmap;
_local18 = 1;
_local19 = 1;
if (_local17){
_local18 = (BitmapMaterial.AUTO_MIP_MAPPING) ? _local16.widthOffset : _local17.width;
_local19 = (BitmapMaterial.AUTO_MIP_MAPPING) ? _local16.heightOffset : _local17.height;
};
return ({x:(_local14 * _local18), y:(_local19 - (_local15 * _local19))});
}
public static function getCoordAtPoint(_arg1:Face3D, _arg2:Number, _arg3:Number):Vertex3D{
var _local4:Object;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local4 = UVatPoint(_arg1, _arg2, _arg3);
_local5 = _arg1.v0.x;
_local6 = _arg1.v0.y;
_local7 = _arg1.v0.z;
_local8 = _arg1.v1.x;
_local9 = _arg1.v1.y;
_local10 = _arg1.v1.z;
_local11 = _arg1.v2.x;
_local12 = _arg1.v2.y;
_local13 = _arg1.v2.z;
_local14 = _local4.u;
_local15 = _local4.v;
_local16 = ((_local5 + ((_local8 - _local5) * _local15)) + ((_local11 - _local5) * _local14));
_local17 = ((_local6 + ((_local9 - _local6) * _local15)) + ((_local12 - _local6) * _local14));
_local18 = ((_local7 + ((_local10 - _local7) * _local15)) + ((_local13 - _local7) * _local14));
return (new Vertex3D(_local16, _local17, _local18));
}
}
}//package org.papervision3d.utils
Section 94
//Mouse3D (org.papervision3d.utils.Mouse3D)
package org.papervision3d.utils {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.*;
public class Mouse3D extends DisplayObject3D {
public static var enabled:Boolean = true;
private static var UP:Number3D = new Number3D(0, 1, 0);
public function Mouse3D(_arg1:Object=null):void{
}
public function updatePosition(_arg1:Face3D, _arg2:Sprite):void{
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
var _local6:Matrix3D;
var _local7:Matrix3D;
var _local8:Number;
var _local9:Number;
var _local10:Number3D;
var _local11:Number3D;
var _local12:Matrix3D;
_local3 = new Number3D(0, 0, 0);
_local4 = new Number3D(_arg1.faceNormal.x, _arg1.faceNormal.y, _arg1.faceNormal.z);
_local5 = Number3D.sub(_local4, _local3);
_local5.normalize();
if (_local5.modulo > 0.1){
_local10 = Number3D.cross(_local5, UP);
_local10.normalize();
_local11 = Number3D.cross(_local5, _local10);
_local11.normalize();
_local12 = this.transform;
_local12.n11 = _local10.x;
_local12.n21 = _local10.y;
_local12.n31 = _local10.z;
_local12.n12 = -(_local11.x);
_local12.n22 = -(_local11.y);
_local12.n32 = -(_local11.z);
_local12.n13 = _local5.x;
_local12.n23 = _local5.y;
_local12.n33 = _local5.z;
};
_local6 = Matrix3D.IDENTITY;
this.transform = Matrix3D.multiply(_arg1.face3DInstance.instance.world, _local12);
_local7 = Matrix3D.IDENTITY;
_local8 = _arg2.mouseX;
_local9 = _arg2.mouseY;
_local7.n14 = InteractiveUtils.getCoordAtPoint(_arg1, _local8, _local9).x;
_local7.n24 = InteractiveUtils.getCoordAtPoint(_arg1, _local8, _local9).y;
_local7.n34 = InteractiveUtils.getCoordAtPoint(_arg1, _local8, _local9).z;
_local6.calculateMultiply(_arg1.face3DInstance.instance.world, _local7);
x = _local6.n14;
y = _local6.n24;
z = _local6.n34;
}
}
}//package org.papervision3d.utils
Section 95
//Papervision3D (org.papervision3d.Papervision3D)
package org.papervision3d {
public class Papervision3D {
public static var useDEGREES:Boolean = true;
public static var VERBOSE:Boolean = true;
public static var AUTHOR:String = "(c) 2006-2007 Copyright by Carlos Ulloa | papervision3d.org | carlos@papervision3d.org";
public static var DATE:String = "20.08.07";
public static var NAME:String = "Papervision3D";
public static var VERSION:String = "Beta 1.7";
public static var usePERCENT:Boolean = false;
public static function log(_arg1:String):void{
if (Papervision3D.VERBOSE){
trace(_arg1);
};
}
}
}//package org.papervision3d
Section 96
//3dcslogo_7 (spacechimps_fla.3dcslogo_7)
package spacechimps_fla {
import flash.display.*;
public dynamic class 3dcslogo_7 extends MovieClip {
public function 3dcslogo_7(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package spacechimps_fla
Section 97
//academylogoanim_64 (spacechimps_fla.academylogoanim_64)
package spacechimps_fla {
import flash.display.*;
public dynamic class academylogoanim_64 extends MovieClip {
public function academylogoanim_64(){
addFrameScript(0, frame1, 116, frame117);
}
function frame1(){
this.stop();
}
function frame117(){
stop();
}
}
}//package spacechimps_fla
Section 98
//additionaltraining_25 (spacechimps_fla.additionaltraining_25)
package spacechimps_fla {
import flash.display.*;
public dynamic class additionaltraining_25 extends MovieClip {
public function additionaltraining_25(){
addFrameScript(13, frame14);
}
function frame14(){
stop();
}
}
}//package spacechimps_fla
Section 99
//anim_3 (spacechimps_fla.anim_3)
package spacechimps_fla {
import flash.display.*;
public dynamic class anim_3 extends MovieClip {
public var cslogo_mc:MovieClip;
}
}//package spacechimps_fla
Section 100
//CSLOGO_4 (spacechimps_fla.CSLOGO_4)
package spacechimps_fla {
import flash.display.*;
public dynamic class CSLOGO_4 extends MovieClip {
public function CSLOGO_4(){
addFrameScript(54, frame55);
}
function frame55(){
stop();
}
}
}//package spacechimps_fla
Section 101
//HamCrashAnimation_88 (spacechimps_fla.HamCrashAnimation_88)
package spacechimps_fla {
import flash.display.*;
public dynamic class HamCrashAnimation_88 extends MovieClip {
public function HamCrashAnimation_88(){
addFrameScript(47, frame48);
}
function frame48(){
this.stop();
}
}
}//package spacechimps_fla
Section 102
//hamjetbody_84 (spacechimps_fla.hamjetbody_84)
package spacechimps_fla {
import flash.display.*;
public dynamic class hamjetbody_84 extends MovieClip {
public var booster:MovieClip;
}
}//package spacechimps_fla
Section 103
//HUDFuel_50 (spacechimps_fla.HUDFuel_50)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HUDFuel_50 extends MovieClip {
public var HUDText:TextField;
}
}//package spacechimps_fla
Section 104
//HUDHiScore_53 (spacechimps_fla.HUDHiScore_53)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HUDHiScore_53 extends MovieClip {
public var HUDText:TextField;
}
}//package spacechimps_fla
Section 105
//HUDLives_51 (spacechimps_fla.HUDLives_51)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HUDLives_51 extends MovieClip {
public var HUDText:TextField;
}
}//package spacechimps_fla
Section 106
//HUDScore_52 (spacechimps_fla.HUDScore_52)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HUDScore_52 extends MovieClip {
public var HUDText:TextField;
}
}//package spacechimps_fla
Section 107
//HUDStartCountdown_76 (spacechimps_fla.HUDStartCountdown_76)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HUDStartCountdown_76 extends MovieClip {
public var background:MovieClip;
public var HUDText:TextField;
}
}//package spacechimps_fla
Section 108
//jetanim_68 (spacechimps_fla.jetanim_68)
package spacechimps_fla {
import flash.display.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
public dynamic class jetanim_68 extends MovieClip {
public function jetanim_68(){
addFrameScript(0, frame1, 29, frame30, 58, frame59);
}
function frame1(){
this.stop();
}
function frame30(){
Main.audioPlayer.playFX(AudioPlayer.FX_BADGE);
}
function frame59(){
this.stop();
}
}
}//package spacechimps_fla
Section 109
//JetPackGameOverHUD_63 (spacechimps_fla.JetPackGameOverHUD_63)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
import com.wddg.SpaceChimps.Game.*;
public dynamic class JetPackGameOverHUD_63 extends MovieClip {
public var badgeBG3:MovieClip;
public var badgeBG1:MovieClip;
public var badgeBG2:MovieClip;
public var background:MovieClip;
public var promoButton:MovieClip;
public var quitButton:MovieClip;
public var moreTrainingButton:MovieClip;
public var logoButton:MovieClip;
public var linkButton:MovieClip;
public var successText:TextField;
public var scoreText:TextField;
public var badge1:MovieClip;
public var badge2:MovieClip;
public var replayButton:MovieClip;
public var badge3:MovieClip;
public function JetPackGameOverHUD_63(){
addFrameScript(23, frame24);
}
function frame24(){
this.stop();
Game(this.parent).onGameOverScreenIntroComplete();
}
}
}//package spacechimps_fla
Section 110
//JetPackHUD_47 (spacechimps_fla.JetPackHUD_47)
package spacechimps_fla {
import flash.display.*;
public dynamic class JetPackHUD_47 extends MovieClip {
public var fuelText:MovieClip;
public var highScoreText:MovieClip;
public var menuButton:MovieClip;
public var pauseButton:MovieClip;
public var livesText:MovieClip;
public var scoreText:MovieClip;
}
}//package spacechimps_fla
Section 111
//JetPackPlayerActor_83 (spacechimps_fla.JetPackPlayerActor_83)
package spacechimps_fla {
import flash.display.*;
public dynamic class JetPackPlayerActor_83 extends MovieClip {
public var clip:MovieClip;
public function JetPackPlayerActor_83(){
addFrameScript(7, frame8);
}
function frame8(){
this.stop();
}
}
}//package spacechimps_fla
Section 112
//JetPackSparklez_79 (spacechimps_fla.JetPackSparklez_79)
package spacechimps_fla {
import flash.display.*;
public dynamic class JetPackSparklez_79 extends MovieClip {
public function JetPackSparklez_79(){
addFrameScript(0, frame1, 28, frame29);
}
function frame1(){
this.stop();
}
function frame29(){
this.visible = false;
this.gotoAndStop(1);
}
}
}//package spacechimps_fla
Section 113
//JetPackStartHUD_55 (spacechimps_fla.JetPackStartHUD_55)
package spacechimps_fla {
import flash.display.*;
import com.wddg.SpaceChimps.Scene.*;
import com.wddg.SpaceChimps.Game.*;
public dynamic class JetPackStartHUD_55 extends MovieClip {
public var background:MovieClip;
public var promoButton:MovieClip;
public var startButton:MovieClip;
public function JetPackStartHUD_55(){
addFrameScript(25, frame26, 46, frame47);
}
function frame26(){
this.stop();
SPScene(this.parent).onIntroComplete();
}
function frame47(){
this.stop();
Game(this.parent).startGame();
}
}
}//package spacechimps_fla
Section 114
//JetPackTitle_60 (spacechimps_fla.JetPackTitle_60)
package spacechimps_fla {
import flash.display.*;
public dynamic class JetPackTitle_60 extends MovieClip {
public function JetPackTitle_60(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package spacechimps_fla
Section 115
//landeranim_70 (spacechimps_fla.landeranim_70)
package spacechimps_fla {
import flash.display.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
public dynamic class landeranim_70 extends MovieClip {
public function landeranim_70(){
addFrameScript(0, frame1, 29, frame30, 58, frame59);
}
function frame1(){
this.stop();
}
function frame30(){
Main.audioPlayer.playFX(AudioPlayer.FX_BADGE);
}
function frame59(){
this.stop();
}
}
}//package spacechimps_fla
Section 116
//linkButton_73 (spacechimps_fla.linkButton_73)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class linkButton_73 extends MovieClip {
public var buttonText:TextField;
}
}//package spacechimps_fla
Section 117
//menuButtonBlack_48 (spacechimps_fla.menuButtonBlack_48)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class menuButtonBlack_48 extends MovieClip {
public var buttonText:TextField;
}
}//package spacechimps_fla
Section 118
//pauseButtonBlack_49 (spacechimps_fla.pauseButtonBlack_49)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class pauseButtonBlack_49 extends MovieClip {
public var buttonText:TextField;
}
}//package spacechimps_fla
Section 119
//playButton_12 (spacechimps_fla.playButton_12)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class playButton_12 extends MovieClip {
public var buttonText:TextField;
}
}//package spacechimps_fla
Section 120
//playmoregames_24 (spacechimps_fla.playmoregames_24)
package spacechimps_fla {
import flash.display.*;
public dynamic class playmoregames_24 extends MovieClip {
public function playmoregames_24(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package spacechimps_fla
Section 121
//promoCopyButton_62 (spacechimps_fla.promoCopyButton_62)
package spacechimps_fla {
import flash.display.*;
import flash.text.*;
public dynamic class promoCopyButton_62 extends MovieClip {
public var buttonText:TextField;
}
}//package spacechimps_fla
Section 122
//ScoresTitle_45 (spacechimps_fla.ScoresTitle_45)
package spacechimps_fla {
import flash.display.*;
public dynamic class ScoresTitle_45 extends MovieClip {
public function ScoresTitle_45(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package spacechimps_fla
Section 123
//textinstructions_21 (spacechimps_fla.textinstructions_21)
package spacechimps_fla {
import flash.display.*;
public dynamic class textinstructions_21 extends MovieClip {
public function textinstructions_21(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package spacechimps_fla
Section 124
//textofficialsite_22 (spacechimps_fla.textofficialsite_22)
package spacechimps_fla {
import flash.display.*;
public dynamic class textofficialsite_22 extends MovieClip {
public function textofficialsite_22(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package spacechimps_fla
Section 125
//textSTART_57 (spacechimps_fla.textSTART_57)
package spacechimps_fla {
import flash.display.*;
public dynamic class textSTART_57 extends MovieClip {
public function textSTART_57(){
addFrameScript(95, frame96);
}
function frame96(){
stop();
}
}
}//package spacechimps_fla
Section 126
//textstarttraining_18 (spacechimps_fla.textstarttraining_18)
package spacechimps_fla {
import flash.display.*;
public dynamic class textstarttraining_18 extends MovieClip {
public function textstarttraining_18(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package spacechimps_fla
Section 127
//vectorBBQ_92 (spacechimps_fla.vectorBBQ_92)
package spacechimps_fla {
import flash.display.*;
public dynamic class vectorBBQ_92 extends MovieClip {
public function vectorBBQ_92(){
addFrameScript(50, frame51);
}
function frame51(){
stop();
}
}
}//package spacechimps_fla
Section 128
//zeroanim_66 (spacechimps_fla.zeroanim_66)
package spacechimps_fla {
import flash.display.*;
import com.wddg.Audio.*;
import com.wddg.SpaceChimps.*;
public dynamic class zeroanim_66 extends MovieClip {
public function zeroanim_66(){
addFrameScript(0, frame1, 29, frame30, 58, frame59);
}
function frame1(){
this.stop();
}
function frame30(){
Main.audioPlayer.playFX(AudioPlayer.FX_BADGE);
}
function frame59(){
this.stop();
}
}
}//package spacechimps_fla
Section 129
//alarm2 (alarm2)
package {
import flash.media.*;
public dynamic class alarm2 extends Sound {
}
}//package
Section 130
//badge2 (badge2)
package {
import flash.media.*;
public dynamic class badge2 extends Sound {
}
}//package
Section 131
//Blocker (Blocker)
package {
import flash.display.*;
public dynamic class Blocker extends MovieClip {
}
}//package
Section 132
//click (click)
package {
import flash.media.*;
public dynamic class click extends Sound {
}
}//package
Section 133
//CSSet1Image0 (CSSet1Image0)
package {
import flash.display.*;
public dynamic class CSSet1Image0 extends BitmapData {
public function CSSet1Image0(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 134
//CSSet1Image1 (CSSet1Image1)
package {
import flash.display.*;
public dynamic class CSSet1Image1 extends BitmapData {
public function CSSet1Image1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 135
//CSSet1Image2 (CSSet1Image2)
package {
import flash.display.*;
public dynamic class CSSet1Image2 extends BitmapData {
public function CSSet1Image2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 136
//CSSet1Image3 (CSSet1Image3)
package {
import flash.display.*;
public dynamic class CSSet1Image3 extends BitmapData {
public function CSSet1Image3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 137
//CSSet1Image4 (CSSet1Image4)
package {
import flash.display.*;
public dynamic class CSSet1Image4 extends BitmapData {
public function CSSet1Image4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 138
//CSSet1Image5 (CSSet1Image5)
package {
import flash.display.*;
public dynamic class CSSet1Image5 extends BitmapData {
public function CSSet1Image5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 139
//CSSet1Image6 (CSSet1Image6)
package {
import flash.display.*;
public dynamic class CSSet1Image6 extends BitmapData {
public function CSSet1Image6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 140
//CSSet1Image7 (CSSet1Image7)
package {
import flash.display.*;
public dynamic class CSSet1Image7 extends BitmapData {
public function CSSet1Image7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 141
//CSSet1Image8 (CSSet1Image8)
package {
import flash.display.*;
public dynamic class CSSet1Image8 extends BitmapData {
public function CSSet1Image8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 142
//CSSet1Image9 (CSSet1Image9)
package {
import flash.display.*;
public dynamic class CSSet1Image9 extends BitmapData {
public function CSSet1Image9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 143
//JetPackBackgroundTile (JetPackBackgroundTile)
package {
import flash.display.*;
public dynamic class JetPackBackgroundTile extends MovieClip {
}
}//package
Section 144
//JetPackBonus (JetPackBonus)
package {
import flash.display.*;
public dynamic class JetPackBonus extends MovieClip {
}
}//package
Section 145
//JetPackCourseLink_A_A_00 (JetPackCourseLink_A_A_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_A_A_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 146
//JetPackCourseLink_A_A_01 (JetPackCourseLink_A_A_01)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_A_A_01 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 147
//JetPackCourseLink_A_A_02 (JetPackCourseLink_A_A_02)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_A_A_02 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 148
//JetPackCourseLink_A_B_00 (JetPackCourseLink_A_B_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_A_B_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 149
//JetPackCourseLink_A_C_00 (JetPackCourseLink_A_C_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_A_C_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 150
//JetPackCourseLink_A_C_01 (JetPackCourseLink_A_C_01)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_A_C_01 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 151
//JetPackCourseLink_B_A_00 (JetPackCourseLink_B_A_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_B_A_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 152
//JetPackCourseLink_B_B_00 (JetPackCourseLink_B_B_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_B_B_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 153
//JetPackCourseLink_B_B_01 (JetPackCourseLink_B_B_01)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_B_B_01 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 154
//JetPackCourseLink_B_B_02 (JetPackCourseLink_B_B_02)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_B_B_02 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 155
//JetPackCourseLink_B_C_00 (JetPackCourseLink_B_C_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_B_C_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 156
//JetPackCourseLink_C_A_00 (JetPackCourseLink_C_A_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_C_A_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 157
//JetPackCourseLink_C_B_00 (JetPackCourseLink_C_B_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_C_B_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 158
//JetPackCourseLink_C_C_00 (JetPackCourseLink_C_C_00)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_C_C_00 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 159
//JetPackCourseLink_C_C_01 (JetPackCourseLink_C_C_01)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_C_C_01 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 160
//JetPackCourseLink_C_C_02 (JetPackCourseLink_C_C_02)
package {
import flash.display.*;
public dynamic class JetPackCourseLink_C_C_02 extends MovieClip {
public var course:MovieClip;
}
}//package
Section 161
//JetPackPlayerSkin (JetPackPlayerSkin)
package {
import flash.display.*;
public dynamic class JetPackPlayerSkin extends MovieClip {
public var actor:MovieClip;
public var fuelAnimation:MovieClip;
}
}//package
Section 162
//JP_fuel (JP_fuel)
package {
import flash.media.*;
public dynamic class JP_fuel extends Sound {
}
}//package
Section 163
//JP_loop (JP_loop)
package {
import flash.media.*;
public dynamic class JP_loop extends Sound {
}
}//package
Section 164
//JP_start (JP_start)
package {
import flash.media.*;
public dynamic class JP_start extends Sound {
}
}//package
Section 165
//loop1 (loop1)
package {
import flash.media.*;
public dynamic class loop1 extends Sound {
}
}//package
Section 166
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 167
//pixelFont1 (pixelFont1)
package {
import flash.text.*;
public dynamic class pixelFont1 extends Font {
}
}//package
Section 168
//PlaneLabel (PlaneLabel)
package {
import flash.display.*;
import flash.text.*;
public dynamic class PlaneLabel extends MovieClip {
public var labelText:TextField;
}
}//package
Section 169
//rollover (rollover)
package {
import flash.media.*;
public dynamic class rollover extends Sound {
}
}//package
Section 170
//ScoreFloater (ScoreFloater)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ScoreFloater extends MovieClip {
public var floatText:TextField;
}
}//package
Section 171
//thrust2 (thrust2)
package {
import flash.media.*;
public dynamic class thrust2 extends Sound {
}
}//package
Section 172
//title (title)
package {
import flash.media.*;
public dynamic class title extends Sound {
}
}//package
Section 173
//ZG_playerhit (ZG_playerhit)
package {
import flash.media.*;
public dynamic class ZG_playerhit extends Sound {
}
}//package