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.display.*;
import flash.events.*;
import com.caurina.transitions.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import flash.utils.*;
import com.caurina.transitions.properties.*;
import flash.text.*;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import flash.net.*;
public class Stinger3D extends MovieClip {
private var planeCounter:Number;// = 0
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;
private static var GAME_NAMES:Array = [];
private static var GAME_LINKS:Array = [];
public function Stinger3D(){
planeCounter = 0;
numImages = 20;
radius = 540;
anglePerPlane = ((Math.PI * 2) / numImages);
super();
DisplayShortcuts.init();
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]], onComplete:this.onMoveComplete});
_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 onMoveComplete():void{
this.planeCounter++;
if (planeCounter == numImages){
this.dispatchEvent(new Event(Event.COMPLETE));
};
}
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;
}
public function onAddedToStage(_arg1:Array, _arg2:Array):void{
var _local3:int;
var _local4:int;
GAME_NAMES = _arg1;
GAME_LINKS = _arg2;
init3D();
_local3 = 0;
while (_local3 < this.numImages) {
_local4 = (_local3 - 14);
if (_local4 < 0){
_local4 = (_local3 + 6);
};
this.createImagePlane(_local4);
_local3++;
};
this.orientPlanes();
this.startTime = getTimer();
this.addEventListener(Event.ENTER_FRAME, this.loop, false, 0, true);
}
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 % GAME_NAMES.length);
_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.display.*;
import flash.events.*;
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
//AddBonusGoal (fe.AddBonusGoal)
package fe {
public final class AddBonusGoal extends Goal {
private var engine:Engine;// = null
private var destination:Position;// = null
private var bonus_type:int;// = 0
private var bonus;// = null
public function AddBonusGoal(_arg1:Engine, _arg2:Gem):void{
engine = null;
bonus_type = 0;
destination = null;
bonus = null;
super();
engine = _arg1;
bonus = _arg2.display.getBonus();
bonus_type = _arg2.bonus;
bonus.x = _arg2.graphicCenter().x;
bonus.y = _arg2.graphicCenter().y;
destination = new Position((Consts.GameWidth - 200), 51);
engine.play_window.bonus_layer.addChild(bonus);
}
public function advance():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = (destination.x - bonus.x);
_local2 = (destination.y - bonus.y);
_local3 = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
if (_local3 < 5){
deactivate();
} else {
_local4 = (_local1 * 0.15);
_local5 = (_local2 * 0.15);
bonus.x = (bonus.x + _local4);
bonus.y = (bonus.y + _local5);
};
}
override public function deactivate():void{
super.deactivate();
engine.play_window.bonus_layer.removeChild(bonus);
bonus.stop();
bonus = null;
engine.bonuss.addBonus(bonus_type);
}
}
}//package fe
Section 21
//AnimatedBitmap (fe.AnimatedBitmap)
package fe {
import flash.display.*;
import flash.geom.*;
public class AnimatedBitmap extends Bitmap {
private var point:Point;// = null
private var rect:Rectangle;// = null
public var curbuffer:BitmapData;// = null
public var nframes:uint;// = 0
public var framen:uint;// = 0
public function AnimatedBitmap(_arg1:BitmapData, _arg2:int, _arg3:int):void{
nframes = 0;
curbuffer = null;
framen = 0;
point = null;
rect = null;
super(new BitmapData(_arg2, _arg3, true, 0), "auto", true);
point = new Point(0, 0);
setBuffer(_arg1);
}
public function setBuffer(_arg1:BitmapData):void{
if (((_arg1) && (!((curbuffer == _arg1))))){
curbuffer = _arg1;
nframes = (curbuffer.width / width);
framen = 0;
draw();
};
}
public function setFrame(_arg1:uint):void{
if (_arg1 == framen){
return;
};
framen = _arg1;
draw();
}
private function draw():void{
var _local1:BitmapData;
_local1 = bitmapData;
rect = new Rectangle((framen * width), 0, width, height);
_local1.copyPixels(curbuffer, rect, point);
bitmapData = _local1;
smoothing = true;
}
}
}//package fe
Section 22
//BonusSystem (fe.BonusSystem)
package fe {
import flash.events.*;
import flash.utils.*;
public class BonusSystem {
private var engine:Engine;// = null
private var heightoffset:int;// = 51
private var bonuses:Dictionary;
private var MoneyDesc:money_description;// = null
private var HammerDesc:hammer_description;// = null
private var TimeDesc:time_description;// = null
private static const StartY:int = 27;
public function BonusSystem(_arg1:Engine):void{
HammerDesc = null;
MoneyDesc = null;
TimeDesc = null;
engine = null;
bonuses = new Dictionary();
heightoffset = 51;
super();
engine = _arg1;
bonuses[Consts.TimeBonus] = new Array();
bonuses[Consts.HammerBonus] = new Array();
bonuses[Consts.ExtraBonus] = new Array();
}
public function checkForHammers():Boolean{
var _local1:*;
_local1 = int(bonuses[Consts.HammerBonus].length);
if (_local1 > 0){
return (true);
};
return (false);
}
private function bonusOver(_arg1:MouseEvent):void{
if (((engine.paused) || (((engine.mutex.isLocked()) && ((_arg1.currentTarget is HammerBonusBMC)))))){
return;
};
if ((_arg1.currentTarget is TimeBonusMC)){
TimeDesc = new time_description();
TimeDesc.y = (_arg1.currentTarget.y + 10);
TimeDesc.x = (_arg1.currentTarget.x - 175);
engine.play_window.bonus_layer.addChild(TimeDesc);
} else {
if ((_arg1.currentTarget is HammerBonusBMC)){
HammerDesc = new hammer_description();
HammerDesc.y = (_arg1.currentTarget.y + 10);
HammerDesc.x = (_arg1.currentTarget.x - 175);
engine.play_window.bonus_layer.addChild(HammerDesc);
} else {
if ((_arg1.currentTarget is DoubleMoneyBonusMC)){
MoneyDesc = new money_description();
MoneyDesc.y = (_arg1.currentTarget.y + 10);
MoneyDesc.x = (_arg1.currentTarget.x - 175);
engine.play_window.bonus_layer.addChild(MoneyDesc);
};
};
};
}
private function applyBonus(_arg1:int, _arg2):void{
var _local3:int;
engine.doBonus(_arg1, _arg2);
bonuses[_arg1].pop();
if (_arg1 == 2){
return;
};
_arg2.removeEventListener(MouseEvent.MOUSE_DOWN, bonusClick);
engine.play_window.bonus_layer.removeChild(_arg2);
if ((((0 == bonuses[_arg1].length)) && ((_arg2.y < (StartY + (heightoffset * 2)))))){
_local3 = 0;
if ((((bonuses[Consts.HammerBonus].length > 0)) && ((bonuses[Consts.HammerBonus][0].y > StartY)))){
_local3 = 0;
while (_local3 < bonuses[Consts.HammerBonus].length) {
bonuses[Consts.HammerBonus][_local3].y = (bonuses[Consts.HammerBonus][_local3].y - heightoffset);
_local3++;
};
};
if ((((bonuses[Consts.TimeBonus].length > 0)) && ((bonuses[Consts.TimeBonus][0].y > StartY)))){
_local3 = 0;
while (_local3 < bonuses[Consts.TimeBonus].length) {
bonuses[Consts.TimeBonus][_local3].y = (bonuses[Consts.TimeBonus][_local3].y - heightoffset);
_local3++;
};
};
if ((((bonuses[Consts.ExtraBonus].length > 0)) && ((bonuses[Consts.ExtraBonus][0].y > StartY)))){
_local3 = 0;
while (_local3 < bonuses[Consts.ExtraBonus].length) {
bonuses[Consts.ExtraBonus][_local3].y = (bonuses[Consts.ExtraBonus][_local3].y - heightoffset);
_local3++;
};
};
};
}
private function bonusClick(_arg1:MouseEvent):void{
bonusOut(_arg1);
if (((engine.paused) || (((engine.mutex.isLocked()) && ((_arg1.currentTarget is HammerBonusBMC)))))){
return;
};
engine.sound(Consts.ClickSound);
if ((_arg1.currentTarget is TimeBonusMC)){
applyBonus(Consts.TimeBonus, _arg1.currentTarget);
} else {
if ((_arg1.currentTarget is HammerBonusBMC)){
applyBonus(Consts.HammerBonus, _arg1.currentTarget);
} else {
if ((_arg1.currentTarget is DoubleMoneyBonusMC)){
applyBonus(Consts.ExtraBonus, _arg1.currentTarget);
};
};
};
}
private function drawBonusCard(_arg1:int, _arg2):void{
var _local3:int;
if (bonuses[_arg1].length > 0){
_arg2.card_number.text = ("x" + int((bonuses[_arg1].length + 1)).toString());
} else {
_arg2.card_number.text = "";
};
_arg2.x = 694;
if (bonuses[_arg1].length > 0){
_arg2.y = bonuses[_arg1][0].y;
} else {
_local3 = StartY;
if (bonuses[Consts.TimeBonus].length > 0){
_local3 = (_local3 + heightoffset);
};
if (bonuses[Consts.HammerBonus].length > 0){
_local3 = (_local3 + heightoffset);
};
if (bonuses[Consts.ExtraBonus].length > 0){
_local3 = (_local3 + heightoffset);
};
_arg2.y = _local3;
};
bonuses[_arg1].push(_arg2);
engine.play_window.bonus_layer.addChild(_arg2);
_arg2.addEventListener(MouseEvent.MOUSE_DOWN, bonusClick);
_arg2.addEventListener(MouseEvent.MOUSE_OVER, bonusOver);
_arg2.addEventListener(MouseEvent.MOUSE_OUT, bonusOut);
}
public function addBonuses(_arg1:Array):void{
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = 0;
_local3 = 0;
_local2 = 0;
while (_local2 < _arg1.length) {
_local4 = 0;
switch (_arg1[_local2][0]){
case "time":
_local4 = Consts.TimeBonus;
break;
case "hammer":
_local4 = Consts.HammerBonus;
break;
case "extra":
_local4 = Consts.ExtraBonus;
break;
};
_local3 = _arg1[_local2][1];
while (_local3 > 0) {
_local3--;
addBonus(_local4);
};
_local2++;
};
}
private function bonusOut(_arg1:MouseEvent):void{
if (((engine.paused) || (((engine.mutex.isLocked()) && ((_arg1.currentTarget is HammerBonusBMC)))))){
return;
};
if ((_arg1.currentTarget is TimeBonusMC)){
if (TimeDesc.parent == engine.play_window.bonus_layer){
engine.play_window.bonus_layer.removeChild(TimeDesc);
};
} else {
if ((_arg1.currentTarget is HammerBonusBMC)){
if (HammerDesc.parent == engine.play_window.bonus_layer){
engine.play_window.bonus_layer.removeChild(HammerDesc);
};
} else {
if ((_arg1.currentTarget is DoubleMoneyBonusMC)){
if (MoneyDesc.parent == engine.play_window.bonus_layer){
engine.play_window.bonus_layer.removeChild(MoneyDesc);
};
};
};
};
}
public function applyHammerBonus(_arg1:int, _arg2):void{
var _local3:int;
_arg2.removeEventListener(MouseEvent.MOUSE_DOWN, bonusClick);
engine.play_window.bonus_layer.removeChild(_arg2);
if ((((0 == bonuses[_arg1].length)) && ((_arg2.y < (StartY + (heightoffset * 2)))))){
_local3 = 0;
if ((((bonuses[Consts.HammerBonus].length > 0)) && ((bonuses[Consts.HammerBonus][0].y > StartY)))){
_local3 = 0;
while (_local3 < bonuses[Consts.HammerBonus].length) {
bonuses[Consts.HammerBonus][_local3].y = (bonuses[Consts.HammerBonus][_local3].y - heightoffset);
_local3++;
};
};
if ((((bonuses[Consts.TimeBonus].length > 0)) && ((bonuses[Consts.TimeBonus][0].y > StartY)))){
_local3 = 0;
while (_local3 < bonuses[Consts.TimeBonus].length) {
bonuses[Consts.TimeBonus][_local3].y = (bonuses[Consts.TimeBonus][_local3].y - heightoffset);
_local3++;
};
};
if ((((bonuses[Consts.ExtraBonus].length > 0)) && ((bonuses[Consts.ExtraBonus][0].y > StartY)))){
_local3 = 0;
while (_local3 < bonuses[Consts.ExtraBonus].length) {
bonuses[Consts.ExtraBonus][_local3].y = (bonuses[Consts.ExtraBonus][_local3].y - heightoffset);
_local3++;
};
};
};
}
public function destroy():void{
var _local1:int;
var _local2:Array;
_local1 = 0;
_local2 = bonuses[Consts.TimeBonus];
_local1 = 0;
while (_local1 < _local2.length) {
engine.play_window.bonus_layer.removeChild(_local2[_local1]);
_local2[_local1].removeEventListener(MouseEvent.MOUSE_DOWN, bonusClick);
_local1++;
};
_local2 = bonuses[Consts.HammerBonus];
_local1 = 0;
while (_local1 < _local2.length) {
engine.play_window.bonus_layer.removeChild(_local2[_local1]);
_local2[_local1].removeEventListener(MouseEvent.MOUSE_DOWN, bonusClick);
_local1++;
};
_local2 = bonuses[Consts.ExtraBonus];
_local1 = 0;
while (_local1 < _local2.length) {
engine.play_window.bonus_layer.removeChild(_local2[_local1]);
_local2[_local1].removeEventListener(MouseEvent.MOUSE_DOWN, bonusClick);
_local1++;
};
}
public function addBonus(_arg1:int):void{
var _local2:TimeBonusMC;
var _local3:HammerBonusBMC;
var _local4:DoubleMoneyBonusMC;
switch (_arg1){
case Consts.TimeBonus:
_local2 = new TimeBonusMC();
drawBonusCard(_arg1, _local2);
break;
case Consts.HammerBonus:
_local3 = new HammerBonusBMC();
drawBonusCard(_arg1, _local3);
break;
case Consts.ExtraBonus:
_local4 = new DoubleMoneyBonusMC();
drawBonusCard(_arg1, _local4);
break;
};
}
}
}//package fe
Section 23
//Consts (fe.Consts)
package fe {
public final class Consts {
public static const OverSound:int = 7;
public static const Horizontal:int = 2;
public static const GemMoveSpeed:int = 1;
public static const GemEaseSpeed:Number = 0.2;
public static const ExtraBonus:int = 3;
public static const GameWidth:int = 750;
public static const Vertical:int = 1;
public static const MergeSound:int = 2;
public static const MappingInsureMult:int = 10000;
public static const HammerBonus:int = 2;
public static const GrowSpeed:Number = 0.02;
public static const ClickSound:int = 3;
public static const DamagedGem:int = 4;
public static const TadaSound:int = 6;
public static const DiceSound:int = 5;
public static const GOALSCLEANPAUSE:uint = 25;
public static const GameHeight:int = 500;
public static const TimeBonus:int = 1;
public static const GemComposedSound:int = 4;
public static const ExtraMoney:int = 50;
public static const TournamentLevel:int = 99;
public static const GemClickSound:int = 1;
}
}//package fe
Section 24
//DiaryMC (fe.DiaryMC)
package fe {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public class DiaryMC extends MovieClip {
public var cs_logo_button:SimpleButton;
public var level_txt:TextField;
private var engine:Engine;// = null
public var play_level:SimpleButton;
public function DiaryMC(_arg1:Engine=null):void{
var _local2:LevelMap;
var _local3:*;
var _local4:int;
var _local5:String;
var _local6:int;
var _local7:GameGoal;
engine = null;
super();
if (_arg1 == null){
return;
};
engine = _arg1;
play_level.addEventListener(MouseEvent.MOUSE_UP, clickPlayLevel);
cs_logo_button.addEventListener(MouseEvent.MOUSE_UP, clickLogo);
_local2 = engine.levels[engine.current_level_number];
trace((("1" + level_txt.text) + "1"));
level_txt.text = String((("Level " + (engine.current_level_number + 1).toString()) + "/20"));
trace((("@" + level_txt.text) + "@"));
_local3 = ((_local2.goals.length * 46) / 2);
_local4 = 0;
_local4 = 0;
while (_local4 < _local2.goals.length) {
_local5 = _local2.goals[_local4][0];
_local6 = _local2.goals[_local4][1];
_local7 = new GameGoal(engine, _local5, _local6);
_local7.x = ((375 - _local3) + (_local4 * 46));
_local7.y = 220;
addChild(_local7);
_local4++;
};
}
public function destroy():void{
play_level.removeEventListener(MouseEvent.MOUSE_UP, clickPlayLevel);
engine.globalstage.removeChild(this);
engine.diary = null;
}
private function clickPlayLevel(_arg1:MouseEvent):void{
engine.sound(Consts.ClickSound);
engine.startLevel(engine.current_level_number);
destroy();
}
private function clickLogo(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.candystand.com/");
navigateToURL(_local2, "_blank");
}
}
}//package fe
Section 25
//Dodecahedron (fe.Dodecahedron)
package fe {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
public class Dodecahedron extends Sprite {
private var spOutline10:Sprite;
private var spOutline11:Sprite;
private var boardSize:Number;
private var destroyed:Boolean;// = false
private var side8Verts:Array;
private var side8DispVerts:Array;
private var spCube:Sprite;
private var side5Verts:Array;
private var curTheta:Number;// = 72
private var side1DispVerts:Array;
private var edge_color:int;// = 0
private var side2Verts:Array;
private var spMask1:Sprite;
private var spMask2:Sprite;
private var spMask3:Sprite;
private var spMask6:Sprite;
private var spMask0:Sprite;
private var spMask8:Sprite;
private var spMask9:Sprite;
private var spSide10:Sprite;
private var spSide11:Sprite;
private var spMask7:Sprite;
private var dodeVerts:Array;
private var side0NewVerts:Array;
private var side4NewVerts:Array;
private var side11NewVerts:Array;
private var side8NewVerts:Array;
private var side2NewVerts:Array;
private var prevY:Number;// = 0
private var spBoard:Sprite;
private var side3DispVerts:Array;
private var prevX:Number;// = 0
private var engine:Engine;// = null
private var side6NewVerts:Array;
private var spMask4:Sprite;
private var spMask5:Sprite;
private var picSize:Number;// = 116
private var sizeFactor:Number;
private var side5DispVerts:Array;
private var dodeFaces:Array;
private var side9Verts:Array;
private var spMask10:Sprite;
private var spMask11:Sprite;
private var side6Verts:Array;
private var side11DispVerts:Array;
private var side3Verts:Array;
private var curPhi:Number;// = 354
private var side7DispVerts:Array;
private var side0Verts:Array;
private var side0DispVerts:Array;
private var side9DispVerts:Array;
private var side10Verts:Array;
private var spSide3:Sprite;
private var spSide6:Sprite;
private var spSide0:Sprite;
private var spSide1:Sprite;
private var spSide9:Sprite;
private var spSide7:Sprite;
private var spSide8:Sprite;
private var spSide2:Sprite;
private var spSide4:Sprite;
private var spSide5:Sprite;
private var rotgoal:RotateGoal;// = null
private var side1NewVerts:Array;
private var side2DispVerts:Array;
private var side10NewVerts:Array;
private var side7Verts:Array;
private var side3NewVerts:Array;
private var side7NewVerts:Array;
private var side9NewVerts:Array;
private var side5NewVerts:Array;
private var dodes:Array;// = null
private var side4DispVerts:Array;
private var spOutline2:Sprite;
private var spOutline4:Sprite;
private var spOutline5:Sprite;
private var spOutline6:Sprite;
private var spOutline7:Sprite;
private var spOutline1:Sprite;
private var side4Verts:Array;
private var spOutline3:Sprite;
private var spOutline8:Sprite;
private var spOutline9:Sprite;
private var spOutline0:Sprite;
private var side1Verts:Array;
private var side10DispVerts:Array;
private var doRotate:Boolean;// = false
private var cubeSize:Number;
private var side6DispVerts:Array;
private var side11Verts:Array;
public function Dodecahedron(_arg1:Engine, _arg2:BitmapData, _arg3:int):void{
var _local4:int;
dodeVerts = [];
dodeFaces = [];
picSize = 116;
sizeFactor = (picSize / 1.154);
cubeSize = (2 * sizeFactor);
boardSize = Math.floor((cubeSize * 1.5));
spBoard = new Sprite();
spCube = new Sprite();
spSide0 = new Sprite();
spSide1 = new Sprite();
spSide2 = new Sprite();
spSide3 = new Sprite();
spSide4 = new Sprite();
spSide5 = new Sprite();
spSide6 = new Sprite();
spSide7 = new Sprite();
spSide8 = new Sprite();
spSide9 = new Sprite();
spSide10 = new Sprite();
spSide11 = new Sprite();
dodes = null;
spOutline0 = new Sprite();
spOutline1 = new Sprite();
spOutline2 = new Sprite();
spOutline3 = new Sprite();
spOutline4 = new Sprite();
spOutline5 = new Sprite();
spOutline6 = new Sprite();
spOutline7 = new Sprite();
spOutline8 = new Sprite();
spOutline9 = new Sprite();
spOutline10 = new Sprite();
spOutline11 = new Sprite();
side0Verts = [];
side1Verts = [];
side2Verts = [];
side3Verts = [];
side4Verts = [];
side5Verts = [];
side6Verts = [];
side7Verts = [];
side8Verts = [];
side9Verts = [];
side10Verts = [];
side11Verts = [];
side0NewVerts = [];
side0DispVerts = [];
side1NewVerts = [];
side1DispVerts = [];
side2NewVerts = [];
side2DispVerts = [];
side3NewVerts = [];
side3DispVerts = [];
side4NewVerts = [];
side4DispVerts = [];
side5NewVerts = [];
side5DispVerts = [];
side6NewVerts = [];
side6DispVerts = [];
side7NewVerts = [];
side7DispVerts = [];
side8NewVerts = [];
side8DispVerts = [];
side9NewVerts = [];
side9DispVerts = [];
side10NewVerts = [];
side10DispVerts = [];
side11NewVerts = [];
side11DispVerts = [];
spMask0 = new Sprite();
spMask1 = new Sprite();
spMask2 = new Sprite();
spMask3 = new Sprite();
spMask4 = new Sprite();
spMask5 = new Sprite();
spMask6 = new Sprite();
spMask7 = new Sprite();
spMask8 = new Sprite();
spMask9 = new Sprite();
spMask10 = new Sprite();
spMask11 = new Sprite();
doRotate = false;
prevX = 0;
prevY = 0;
curTheta = 72;
curPhi = 354;
edge_color = 0;
engine = null;
rotgoal = null;
destroyed = false;
super();
engine = _arg1;
edge_color = _arg3;
dodes = new Array();
_local4 = 0;
_local4 = 0;
while (_local4 < 12) {
dodes[_local4] = new Bitmap(_arg2);
_local4++;
};
this.addChild(spBoard);
spBoard.addChild(spCube);
spCube.addChild(spSide0);
spCube.addChild(spSide1);
spCube.addChild(spSide2);
spCube.addChild(spSide3);
spCube.addChild(spSide4);
spCube.addChild(spSide5);
spCube.addChild(spSide6);
spCube.addChild(spSide7);
spCube.addChild(spSide8);
spCube.addChild(spSide9);
spCube.addChild(spSide10);
spCube.addChild(spSide11);
spSide0.addChild(dodes[0]);
spSide1.addChild(dodes[1]);
spSide2.addChild(dodes[2]);
spSide3.addChild(dodes[3]);
spSide4.addChild(dodes[4]);
spSide5.addChild(dodes[5]);
spSide6.addChild(dodes[6]);
spSide7.addChild(dodes[7]);
spSide8.addChild(dodes[8]);
spSide9.addChild(dodes[9]);
spSide10.addChild(dodes[10]);
spSide11.addChild(dodes[11]);
spCube.addChild(spOutline0);
spCube.addChild(spOutline1);
spCube.addChild(spOutline2);
spCube.addChild(spOutline3);
spCube.addChild(spOutline4);
spCube.addChild(spOutline5);
spCube.addChild(spOutline6);
spCube.addChild(spOutline7);
spCube.addChild(spOutline8);
spCube.addChild(spOutline9);
spCube.addChild(spOutline10);
spCube.addChild(spOutline11);
spSide0.addChild(spMask0);
spSide1.addChild(spMask1);
spSide2.addChild(spMask2);
spSide3.addChild(spMask3);
spSide4.addChild(spMask4);
spSide5.addChild(spMask5);
spSide6.addChild(spMask6);
spSide7.addChild(spMask7);
spSide8.addChild(spMask8);
spSide9.addChild(spMask9);
spSide10.addChild(spMask10);
spSide11.addChild(spMask11);
dodes[0].mask = spMask0;
dodes[1].mask = spMask1;
dodes[2].mask = spMask2;
dodes[3].mask = spMask3;
dodes[4].mask = spMask4;
dodes[5].mask = spMask5;
dodes[6].mask = spMask6;
dodes[7].mask = spMask7;
dodes[8].mask = spMask8;
dodes[9].mask = spMask9;
dodes[10].mask = spMask10;
dodes[11].mask = spMask11;
setDodeVerts();
setDodeFaces();
setSidesVerts();
drawMasks();
renderView(curTheta, curPhi);
}
private function findBitSide(_arg1:Array, _arg2:Array, _arg3:Array, _arg4:Array, _arg5:Array):Array{
var _local6:Array;
var _local7:Array;
var _local8:Array;
_local6 = [];
_local7 = [];
_local8 = [];
_local6 = findVecPlusVec(_arg1, findVecTimesNum(findUnitVec(_arg1, _arg2), (-(sizeFactor) * 0.2205)));
_local8[0] = _local6;
_local6 = findVecPlusVec(_arg2, findVecTimesNum(findUnitVec(_arg1, _arg2), (sizeFactor * 0.2205)));
_local8[1] = _local6;
_local6 = findVecPlusVec(_local8[1], findVecTimesNum(findUnitVec(_local8[1], _arg3), picSize));
_local8[2] = _local6;
_local6 = findVecPlusVec(_local8[2], findVecMinusVec(_local8[0], _local8[1]));
_local8[3] = _local6;
return (_local8);
}
public function startRotation():void{
if (((rotgoal) && (rotgoal.active))){
return;
};
rotgoal = new RotateGoal(this);
engine.goalsys.add(rotgoal);
}
private function drawMasks():void{
var _local1:*;
_local1 = uint;
_local1 = 0;
while (_local1 < 12) {
this[("spMask" + String(_local1))].graphics.lineStyle(1, 0);
this[("spMask" + String(_local1))].graphics.beginFill(0xFF0000, 1);
this[("spMask" + String(_local1))].graphics.moveTo((0.2205 * sizeFactor), 0);
this[("spMask" + String(_local1))].graphics.lineTo((0.9335 * sizeFactor), 0);
this[("spMask" + String(_local1))].graphics.lineTo((1.154 * sizeFactor), (0.6785 * sizeFactor));
this[("spMask" + String(_local1))].graphics.lineTo((0.577 * sizeFactor), (1.098 * sizeFactor));
this[("spMask" + String(_local1))].graphics.lineTo(0, (0.6785 * sizeFactor));
this[("spMask" + String(_local1))].graphics.lineTo((0.2205 * sizeFactor), 0);
this[("spMask" + String(_local1))].graphics.endFill();
_local1++;
};
}
private function setDodeVerts():void{
dodeVerts[0] = [(0.607 * sizeFactor), (0 * sizeFactor), (0.795 * sizeFactor)];
dodeVerts[1] = [(0.188 * sizeFactor), (0.577 * sizeFactor), (0.795 * sizeFactor)];
dodeVerts[2] = [(-0.491 * sizeFactor), (0.357 * sizeFactor), (0.795 * sizeFactor)];
dodeVerts[3] = [(-0.491 * sizeFactor), (-0.357 * sizeFactor), (0.795 * sizeFactor)];
dodeVerts[4] = [(0.188 * sizeFactor), (-0.577 * sizeFactor), (0.795 * sizeFactor)];
dodeVerts[5] = [(0.982 * sizeFactor), (0 * sizeFactor), (0.188 * sizeFactor)];
dodeVerts[6] = [(0.304 * sizeFactor), (0.934 * sizeFactor), (0.188 * sizeFactor)];
dodeVerts[7] = [(-0.795 * sizeFactor), (0.577 * sizeFactor), (0.188 * sizeFactor)];
dodeVerts[8] = [(-0.795 * sizeFactor), (-0.577 * sizeFactor), (0.188 * sizeFactor)];
dodeVerts[9] = [(0.304 * sizeFactor), (-0.934 * sizeFactor), (0.188 * sizeFactor)];
dodeVerts[10] = [(0.795 * sizeFactor), (0.577 * sizeFactor), (-0.188 * sizeFactor)];
dodeVerts[11] = [(-0.304 * sizeFactor), (0.934 * sizeFactor), (-0.188 * sizeFactor)];
dodeVerts[12] = [(-0.983 * sizeFactor), (0 * sizeFactor), (-0.188 * sizeFactor)];
dodeVerts[13] = [(-0.304 * sizeFactor), (-0.934 * sizeFactor), (-0.188 * sizeFactor)];
dodeVerts[14] = [(0.795 * sizeFactor), (-0.577 * sizeFactor), (-0.188 * sizeFactor)];
dodeVerts[15] = [(0.491 * sizeFactor), (0.357 * sizeFactor), (-0.795 * sizeFactor)];
dodeVerts[16] = [(-0.188 * sizeFactor), (0.577 * sizeFactor), (-0.795 * sizeFactor)];
dodeVerts[17] = [(-0.607 * sizeFactor), (0 * sizeFactor), (-0.795 * sizeFactor)];
dodeVerts[18] = [(-0.188 * sizeFactor), (-0.577 * sizeFactor), (-0.795 * sizeFactor)];
dodeVerts[19] = [(0.491 * sizeFactor), (-0.357 * sizeFactor), (-0.795 * sizeFactor)];
}
public function stabilize():void{
curTheta = 72;
curPhi = 354;
renderView(curTheta, curPhi);
}
private function setDodeFaces():void{
dodeFaces[0] = [18, 17, 12, 8, 13];
dodeFaces[1] = [19, 18, 13, 9, 14];
dodeFaces[2] = [1, 2, 7, 11, 6];
dodeFaces[3] = [2, 3, 8, 12, 7];
dodeFaces[4] = [3, 4, 9, 13, 8];
dodeFaces[5] = [17, 16, 11, 7, 12];
dodeFaces[6] = [0, 1, 6, 10, 5];
dodeFaces[7] = [4, 0, 5, 14, 9];
dodeFaces[8] = [4, 3, 2, 1, 0];
dodeFaces[9] = [16, 15, 10, 6, 11];
dodeFaces[10] = [15, 16, 17, 18, 19];
dodeFaces[11] = [15, 19, 14, 5, 10];
}
private function findVecTimesNum(_arg1:Array, _arg2:Number):Array{
return ([(_arg1[0] * _arg2), (_arg1[1] * _arg2), (_arg1[2] * _arg2)]);
}
private function byDist(_arg1:Array, _arg2:Array):Number{
if (_arg1[0] > _arg2[0]){
return (-1);
};
if (_arg1[0] < _arg2[0]){
return (1);
};
return (0);
}
private function pointNewView(_arg1:Array, _arg2:Number, _arg3:Number):Array{
var _local4:Array;
_local4 = [];
_local4[0] = ((((_arg1[0] * Math.cos(_arg2)) * Math.sin(_arg3)) + ((_arg1[1] * Math.sin(_arg2)) * Math.sin(_arg3))) + (_arg1[2] * Math.cos(_arg3)));
_local4[1] = ((-(_arg1[0]) * Math.sin(_arg2)) + (_arg1[1] * Math.cos(_arg2)));
_local4[2] = ((((-(_arg1[0]) * Math.cos(_arg2)) * Math.cos(_arg3)) - ((_arg1[1] * Math.sin(_arg2)) * Math.cos(_arg3))) + (_arg1[2] * Math.sin(_arg3)));
return (_local4);
}
private function setSidesVerts():void{
var _local1:uint;
var _local2:Array;
_local1 = 0;
while (_local1 < 12) {
_local2 = findBitSide(dodeVerts[dodeFaces[_local1][0]], dodeVerts[dodeFaces[_local1][1]], dodeVerts[dodeFaces[_local1][2]], dodeVerts[dodeFaces[_local1][3]], dodeVerts[dodeFaces[_local1][4]]);
this[(("side" + String(_local1)) + "Verts")] = _local2;
_local1++;
};
}
private function findVecMinusVec(_arg1:Array, _arg2:Array):Array{
return ([(_arg1[0] - _arg2[0]), (_arg1[1] - _arg2[1]), (_arg1[2] - _arg2[2])]);
}
private function calcMatrixForSides(_arg1:Array, _arg2:Array, _arg3:Array, _arg4:Array):Matrix{
var _local5:Matrix;
var _local6:Matrix;
var _local7:Array;
var _local8:Array;
_local7 = findVecMinusVec(_arg2, _arg1);
_local8 = findVecMinusVec(_arg4, _arg1);
_local5 = new Matrix((_local7[0] / picSize), (_local7[1] / picSize), (_local8[0] / picSize), (_local8[1] / picSize));
_local6 = new Matrix(1, 0, 0, 1, _arg1[0], _arg1[1]);
_local5.concat(_local6);
return (_local5);
}
private function renderView(_arg1:Number, _arg2:Number):void{
var _local3:int;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:Array;
var _local8:Array;
var _local9:Number;
var _local10:uint;
var _local11:Sprite;
var _local12:Array;
var _local13:Array;
var _local14:Array;
var _local15:Array;
var _local16:Matrix;
_local5 = [];
_local6 = [];
_local7 = [];
_local8 = [];
_local12 = [];
_local13 = [];
_local14 = [];
_local15 = [];
_arg1 = ((_arg1 * Math.PI) / 180);
_arg2 = ((_arg2 * Math.PI) / 180);
_local3 = 0;
while (_local3 < 12) {
this[("spOutline" + String(_local3))].graphics.clear();
_local3++;
};
_local3 = 0;
while (_local3 < 20) {
_local7[_local3] = pointNewView(dodeVerts[_local3], _arg1, _arg2);
_local3++;
};
_local3 = 0;
while (_local3 < 12) {
_local8[0] = 0;
_local8[1] = 0;
_local8[2] = 0;
_local4 = 0;
while (_local4 < 5) {
_local8[0] = (_local8[0] + _local7[dodeFaces[_local3][_local4]][0]);
_local8[1] = (_local8[1] + _local7[dodeFaces[_local3][_local4]][1]);
_local8[2] = (_local8[2] + _local7[dodeFaces[_local3][_local4]][2]);
_local4++;
};
_local8[0] = (_local8[0] / 5);
_local8[1] = (_local8[1] / 5);
_local8[2] = (_local8[2] / 5);
_local9 = -(_local8[0]);
_local5[_local3] = [_local9, _local3];
_local3++;
};
_local5.sort(byDist);
_local3 = 0;
while (_local3 < 20) {
_local6[_local3] = [_local7[_local3][1], -(_local7[_local3][2])];
_local3++;
};
_local4 = 0;
while (_local4 < 12) {
_local3 = 0;
while (_local3 < 4) {
this[(("side" + String(_local4)) + "NewVerts")][_local3] = pointNewView(this[(("side" + String(_local4)) + "Verts")][_local3], _arg1, _arg2);
_local3++;
};
_local4++;
};
_local4 = 0;
while (_local4 < 12) {
_local3 = 0;
while (_local3 < 4) {
this[(("side" + String(_local4)) + "DispVerts")][_local3] = [this[(("side" + String(_local4)) + "NewVerts")][_local3][1], -(this[(("side" + String(_local4)) + "NewVerts")][_local3][2])];
_local3++;
};
_local4++;
};
_local3 = 0;
while (_local3 < 12) {
_local10 = _local5[_local3][1];
spCube.setChildIndex(this[("spSide" + String(_local10))], (spCube.numChildren - 1));
spCube.setChildIndex(this[("spOutline" + String(_local10))], (spCube.numChildren - 1));
_local12 = this[(("side" + String(_local10)) + "DispVerts")][0];
_local13 = this[(("side" + String(_local10)) + "DispVerts")][1];
_local14 = this[(("side" + String(_local10)) + "DispVerts")][2];
_local15 = this[(("side" + String(_local10)) + "DispVerts")][3];
_local16 = calcMatrixForSides(_local12, _local13, _local14, _local15);
this[("spSide" + String(_local10))].transform.matrix = _local16;
this[("spOutline" + String(_local10))].graphics.lineStyle(1, edge_color);
this[("spOutline" + String(_local10))].graphics.moveTo(_local6[dodeFaces[_local10][0]][0], _local6[dodeFaces[_local10][0]][1]);
_local4 = 1;
while (_local4 < 5) {
this[("spOutline" + String(_local10))].graphics.lineTo(_local6[dodeFaces[_local10][_local4]][0], _local6[dodeFaces[_local10][_local4]][1]);
_local4++;
};
this[("spOutline" + String(_local10))].graphics.lineTo(_local6[dodeFaces[_local10][0]][0], _local6[dodeFaces[_local10][0]][1]);
_local3++;
};
}
private function findUnitVec(_arg1:Array, _arg2:Array):Array{
var _local3:Number;
var _local4:Array;
_local4 = [(_arg2[0] - _arg1[0]), (_arg2[1] - _arg1[1]), (_arg2[2] - _arg1[2])];
_local3 = Math.sqrt(((Math.pow(_local4[0], 2) + Math.pow(_local4[1], 2)) + Math.pow(_local4[2], 2)));
if (_local3 == 0){
return ([NaN, NaN, NaN]);
};
return ([(_local4[0] / _local3), (_local4[1] / _local3), (_local4[2] / _local3)]);
}
public function stopRotation():void{
if (((!(rotgoal)) || (!(rotgoal.active)))){
return;
};
rotgoal.deactivate();
rotgoal = null;
}
public function rotate(_arg1:int):void{
var _local2:Number;
var _local3:Number;
if (destroyed){
return;
};
_local2 = prevX;
_local3 = prevY;
prevX = (prevX + _arg1);
prevY = (prevY + _arg1);
curTheta = (curTheta + (prevX - _local2));
curPhi = (curPhi + (prevY - _local3));
renderView(curTheta, curPhi);
}
public function destroy():void{
var _local1:int;
destroyed = true;
_local1 = 0;
_local1 = 0;
while (_local1 < 12) {
dodes[_local1].mask = null;
dodes[_local1].bitmapData.dispose();
_local1++;
};
this.removeChild(spBoard);
spBoard.removeChild(spCube);
spCube.removeChild(spSide0);
spCube.removeChild(spSide1);
spCube.removeChild(spSide2);
spCube.removeChild(spSide3);
spCube.removeChild(spSide4);
spCube.removeChild(spSide5);
spCube.removeChild(spSide6);
spCube.removeChild(spSide7);
spCube.removeChild(spSide8);
spCube.removeChild(spSide9);
spCube.removeChild(spSide10);
spCube.removeChild(spSide11);
spSide0.removeChild(dodes[0]);
spSide1.removeChild(dodes[1]);
spSide2.removeChild(dodes[2]);
spSide3.removeChild(dodes[3]);
spSide4.removeChild(dodes[4]);
spSide5.removeChild(dodes[5]);
spSide6.removeChild(dodes[6]);
spSide7.removeChild(dodes[7]);
spSide8.removeChild(dodes[8]);
spSide9.removeChild(dodes[9]);
spSide10.removeChild(dodes[10]);
spSide11.removeChild(dodes[11]);
spCube.removeChild(spOutline0);
spCube.removeChild(spOutline1);
spCube.removeChild(spOutline2);
spCube.removeChild(spOutline3);
spCube.removeChild(spOutline4);
spCube.removeChild(spOutline5);
spCube.removeChild(spOutline6);
spCube.removeChild(spOutline7);
spCube.removeChild(spOutline8);
spCube.removeChild(spOutline9);
spCube.removeChild(spOutline10);
spCube.removeChild(spOutline11);
spSide0.removeChild(spMask0);
spSide1.removeChild(spMask1);
spSide2.removeChild(spMask2);
spSide3.removeChild(spMask3);
spSide4.removeChild(spMask4);
spSide5.removeChild(spMask5);
spSide6.removeChild(spMask6);
spSide7.removeChild(spMask7);
spSide8.removeChild(spMask8);
spSide9.removeChild(spMask9);
spSide10.removeChild(spMask10);
spSide11.removeChild(spMask11);
}
private function findVecPlusVec(_arg1:Array, _arg2:Array):Array{
return ([(_arg1[0] + _arg2[0]), (_arg1[1] + _arg2[1]), (_arg1[2] + _arg2[2])]);
}
}
}//package fe
Section 26
//EaseGoal (fe.EaseGoal)
package fe {
public class EaseGoal extends Goal {
private var easingSpeed:Number;// = 0
public var subject:Gem;// = null
private var gip:Number;// = 0
private var destination:Position;// = null
public function EaseGoal(_arg1:Gem, _arg2:Position, _arg3:Number):void{
subject = null;
destination = null;
gip = 0;
easingSpeed = 0;
super();
easingSpeed = _arg3;
subject = _arg1;
destination = _arg2;
}
public function advance():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = (destination.x - subject.display.x);
_local2 = (destination.y - subject.display.y);
_local3 = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
if (_local3 < 3){
deactivate();
subject.display.x = destination.x;
subject.display.y = destination.y;
} else {
_local4 = (_local1 * easingSpeed);
_local5 = (_local2 * easingSpeed);
subject.display.x = (subject.display.x + _local4);
subject.display.y = (subject.display.y + _local5);
};
}
}
}//package fe
Section 27
//Engine (fe.Engine)
package fe {
import flash.display.*;
import flash.media.*;
import flash.utils.*;
public class Engine {
public var shop:Shop;// = null
public var nmoney:int;// = 0
public var current_goal:GameGoals;// = null
public var hammer_bonus_placeholder;
public var levelMoney:int;// = 0
public var events:GameEvents;// = null
public var score:int;// = 0
public var actions_volume:Number;// = 1
public var paused:Boolean;// = false
public var globalScore:Number;// = 0
public var playing:Boolean;// = false
public var bonuss:BonusSystem;// = null
public var timeisup_window:TimeIsUpScreenMC;// = null
public var current_level:LevelMap;// = null
public var globalstage:MovieClip;// = null
public var diary:DiaryMC;// = null
public var extra_money:Boolean;// = false
public var goalsys:GoalSystem;// = null
public var play_window:PlayWindow;// = null
public var tutorial:Boolean;// = false
public var hammer_bonus:Boolean;// = false
public var music_channel:SoundChannel;// = null
public var tutorial_panel:TutorialPanel;// = null
public var levelScore:int;// = 0
public var levels:Dictionary;// = null
public var current_level_number:int;// = 0
public var music_volume:Number;// = 0.5
public var music_state:Boolean;// = true
public var gem_board:GemBoard;// = null
public var mutex:Mutex;// = null
public function Engine(_arg1:MovieClip):void{
tutorial = false;
music_state = true;
playing = false;
globalScore = 0;
goalsys = null;
gem_board = null;
globalstage = null;
events = null;
mutex = null;
current_goal = null;
play_window = null;
tutorial_panel = null;
timeisup_window = null;
diary = null;
paused = false;
nmoney = 0;
score = 0;
levelMoney = 0;
levelScore = 0;
bonuss = null;
extra_money = false;
hammer_bonus = false;
levels = null;
current_level = null;
current_level_number = 0;
shop = null;
music_volume = 0.5;
actions_volume = 1;
music_channel = null;
super();
globalstage = _arg1;
events = new GameEvents(this);
levels = new Dictionary();
initLevels();
}
private function playActionsSound(_arg1:Sound):void{
var _local2:SoundTransform;
if (!actions_volume){
return;
};
_local2 = new SoundTransform();
_local2.volume = actions_volume;
_arg1.play(0, 0, _local2);
}
public function balance():Boolean{
var _local1:Array;
var _local2:int;
if (replaceGems(8)){
return (true);
};
_local1 = gem_board.basket.findMergePair();
if (_local1){
goalsys.add(new MergeGoal(this, _local1[0], _local1[1]));
return (true);
};
_local2 = gem_board.basket.calcMoves();
if ((((_local2 == 0)) && (!(bonuss.checkForHammers())))){
play_window.timer.removeTime(100);
goalsys.add(new TextPopupGoal(this, "-100"));
goalsys.add(new PopupCaptionGoal(this, "No More Moves (-100 seconds)", new ShuffleGoal(this, current_level.gen_params)));
return (false);
};
play_window.updateInfo();
return (false);
}
public function doBonus(_arg1:int, _arg2):void{
switch (_arg1){
case Consts.TimeBonus:
play_window.timer.addTime(100);
goalsys.add(new TextPopupGoal(this, "+100"));
break;
case Consts.HammerBonus:
hammer_bonus_placeholder = _arg2;
mutex.lock();
hammer_bonus = true;
play_window.createHammerCursor();
play_window.hammer_cursor.x = globalstage.mouseX;
play_window.hammer_cursor.y = globalstage.mouseY;
break;
case Consts.ExtraBonus:
goalsys.add(new ExtraBonusGoal(this));
break;
};
}
public function pause():void{
if (!play_window){
return;
};
if (paused){
mutex.unlock();
events.register();
play_window.timer.startTimer();
} else {
mutex.lock();
play_window.timer.stopTimer();
events.unregister();
};
paused = !(paused);
}
public function startMusic():void{
if (music_channel){
music_channel.stop();
music_channel = null;
};
music_channel = playMusicSound(new Sound_level_music());
}
public function tutorialFinish(_arg1:TutorialPanel):void{
globalstage.removeChild(_arg1);
}
public function showShop():void{
clearAll();
shop.update();
shop.visible = true;
music_channel = playMusicSound(new Sound_game_shop());
}
public function clearAll():void{
var _local1:int;
var _local2:*;
if (music_channel){
};
if (!play_window){
return;
};
paused = false;
extra_money = false;
hammer_bonus = false;
events.unregister();
_local1 = 0;
_local1 = 0;
while (_local1 < goalsys.goals.length) {
_local2 = goalsys.goals[_local1];
if (_local2.active){
_local2.deactivate();
};
_local1++;
};
gem_board.destroy();
bonuss.destroy();
bonuss = null;
current_goal = null;
mutex = null;
goalsys = null;
play_window.deinitialize();
globalstage.removeChild(play_window);
play_window = null;
}
public function tournamentFinish():void{
clearAll();
mainMenu();
}
public function sound(_arg1:int):void{
switch (_arg1){
case Consts.GemClickSound:
playActionsSound(new Sound_gem_click());
break;
case Consts.MergeSound:
playActionsSound(new Sound_gem_merge());
break;
case Consts.ClickSound:
playActionsSound(new Sound_click());
break;
case Consts.GemComposedSound:
playActionsSound(new Sound_gem_composed());
break;
case Consts.DiceSound:
playActionsSound(new Sound_dice());
break;
case Consts.TadaSound:
playActionsSound(new Sound_tada());
break;
case Consts.OverSound:
playActionsSound(new Sound_over());
break;
};
}
public function resetLevelScores():void{
score = levelScore;
nmoney = levelMoney;
}
private function initLevels():void{
var _local1:XML;
var _local2:XMLList;
var _local3:XML;
_local1 = new XML(Levels.levels);
_local2 = _local1.level;
for each (_local3 in _local2) {
levels[int(_local3.@number)] = new LevelMap(new XML(_local3.toString()));
};
}
public function addMoney(_arg1:int):void{
score = (score + (_arg1 / 5));
nmoney = (nmoney + _arg1);
}
public function exchange(_arg1:Array):void{
goalsys.add(new ExchangeGoal(this, _arg1));
}
public function deactivateGoals(_arg1:Gem):void{
var _local2:int;
var _local3:*;
_local2 = 0;
_local2 = 0;
while (_local2 < goalsys.goals.length) {
_local3 = goalsys.goals[_local2];
if ((((_local3 is RotateGoal)) && ((_local3.dode == _arg1.display.gem_sprite)))){
_local3.deactivate();
};
_local2++;
};
}
private function playMusicSound(_arg1:Sound):SoundChannel{
var _local2:SoundTransform;
_local2 = new SoundTransform();
_local2.volume = music_volume;
return (_arg1.play(0, 99999, _local2));
}
public function mainMenu():void{
if (current_level_number == Consts.TournamentLevel){
if (play_window){
if (play_window){
play_window.visible = false;
};
globalstage.main_menu.resume_game.visible = true;
globalstage.main_menu.title_game.visible = true;
globalstage.main_menu.start_game.visible = false;
globalstage.main_menu.quit_game.x = 418;
};
} else {
if (((((play_window) && (play_window.visible))) || (((shop) && (shop.visible))))){
if (play_window){
play_window.visible = false;
};
if (globalstage.getChildByName("pop_up_caption")){
globalstage.getChildByName("pop_up_caption").visible = false;
};
if (shop){
shop.visible = false;
};
globalstage.main_menu.resume_game.visible = true;
globalstage.main_menu.title_game.visible = true;
globalstage.main_menu.start_game.visible = false;
globalstage.main_menu.quit_game.x = 418;
} else {
globalstage.main_menu.resume_game.visible = false;
globalstage.main_menu.title_game.visible = false;
globalstage.main_menu.start_game.visible = true;
globalstage.main_menu.quit_game.x = 374;
};
};
globalstage.main_menu.visible = true;
}
public function startLevel(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:MapBuilder;
var _local5:Array;
var _local6:int;
levelScore = score;
levelMoney = nmoney;
tutorial = false;
clearAll();
current_level = levels[_arg1];
_local2 = current_level.map_width;
_local3 = current_level.map_height;
mutex = new Mutex();
mutex.lock();
goalsys = new GoalSystem();
gem_board = new GemBoard(this, 628, 460, _local2, _local3);
bonuss = new BonusSystem(this);
_local4 = new MapBuilder(this, _local2, _local3);
_local5 = _local4.generate(current_level.gen_params);
_local6 = 0;
while (_local6 < _local5.length) {
if ((_local5[_local6].mappingKey() in current_level.unmovables)){
_local5[_local6].unmovable = true;
};
if (!gem_board.addGem(_local5[_local6])){
trace("bad gem: ", _local6);
};
_local6++;
};
play_window = new PlayWindow();
play_window.initialize(this, gem_board);
play_window.update();
play_window.setTimer(current_level.level_time, timerIsUp);
play_window.timer.startTimer();
play_window.sound_clip.setEngine(this);
current_goal = new GameGoals(this, current_level.goals);
play_window.makeGoals(current_goal);
globalstage.addChild(play_window);
events.register();
bonuss.addBonuses(current_level.bonuses);
if (_arg1 == Consts.TournamentLevel){
};
play_window.levelgo.visible = true;
play_window.levelgo.gotoAndPlay("go");
balance();
mutex.unlock();
startMusic();
play_window.postInit();
}
public function timerIsUp():void{
clearAll();
if (music_channel){
music_channel.stop();
music_channel = null;
};
sound(Consts.OverSound);
new TimeIsUpScreenMC(this);
}
public function victory():void{
mutex.lock();
play_window.timer.stopTimer();
if ((((current_level_number >= 14)) && (!((current_level_number == Consts.TournamentLevel))))){
play_window.well_done.well_done_1.visible = false;
play_window.well_done.well_done_2.visible = true;
shop.levelsOver();
};
play_window.well_done.visible = true;
if (music_channel){
music_channel.stop();
music_channel = null;
};
sound(Consts.TadaSound);
}
public function nextLevel():void{
diary = new DiaryMC(this);
globalstage.addChild(diary);
}
private function replaceGems(_arg1:int):Boolean{
var _local2:Array;
var _local3:int;
_local2 = gem_board.basket.getGemsGreater(_arg1);
if (_local2.length > 0){
_local3 = 0;
_local3 = 0;
while (_local3 < _local2.length) {
goalsys.add(new GemComposedGoal(this, _local2[_local3]));
_local3++;
};
return (true);
};
return (false);
}
public function startTutorial(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:MapBuilder;
var _local5:Array;
var _local6:int;
tutorial = true;
clearAll();
current_level = levels[_arg1];
_local2 = current_level.map_width;
_local3 = current_level.map_height;
mutex = new Mutex();
mutex.lock();
goalsys = new GoalSystem();
gem_board = new GemBoard(this, 628, 460, _local2, _local3);
bonuss = new BonusSystem(this);
_local4 = new MapBuilder(this, _local2, _local3);
_local5 = _local4.generate(current_level.gen_params);
_local6 = 0;
while (_local6 < _local5.length) {
if ((_local5[_local6].mappingKey() in current_level.unmovables)){
_local5[_local6].unmovable = true;
};
if (!gem_board.addGem(_local5[_local6])){
trace("bad gem: ", _local6);
};
_local6++;
};
play_window = new PlayWindow();
play_window.initialize(this, gem_board);
play_window.update();
play_window.setTimer(current_level.level_time, timerIsUp);
play_window.sound_clip.setEngine(this);
current_goal = new GameGoals(this, current_level.goals);
play_window.makeGoals(current_goal);
globalstage.addChild(play_window);
tutorial_panel = new TutorialPanel(this);
globalstage.addChild(tutorial_panel);
events.register();
if (_arg1 == Consts.TournamentLevel){
};
balance();
mutex.unlock();
}
public function startTournament():void{
score = 0;
nmoney = 0;
current_level_number = Consts.TournamentLevel;
startLevel(Consts.TournamentLevel);
}
public function startGame():void{
if (shop){
globalstage.removeChild(shop);
shop = null;
if (music_channel){
};
};
score = 0;
nmoney = 0;
levelScore = 0;
levelMoney = 0;
shop = new Shop(this);
shop.visible = false;
globalstage.addChild(shop);
shop.update();
current_level_number = 0;
startTutorial(98);
}
}
}//package fe
Section 28
//ExchangeGoal (fe.ExchangeGoal)
package fe {
public class ExchangeGoal extends Goal {
private var engine:Engine;// = null
private var eases:EaseGoal;// = null
private var selected_gems:Array;// = null
private var returning:Boolean;// = false
private var easef:EaseGoal;// = null
public function ExchangeGoal(_arg1:Engine, _arg2:Array):void{
engine = null;
easef = null;
eases = null;
returning = false;
selected_gems = null;
super();
engine = _arg1;
engine.mutex.lock();
selected_gems = _arg2;
easef = new EaseGoal(selected_gems[0], selected_gems[1].graphicCenter(), Consts.GemEaseSpeed);
eases = new EaseGoal(selected_gems[1], selected_gems[0].graphicCenter(), Consts.GemEaseSpeed);
}
public function advance():void{
if (((easef) && (easef.active))){
easef.advance();
};
if (((eases) && (eases.active))){
eases.advance();
return;
};
if (((!(easef.active)) && (!(eases.active)))){
if (returning){
deactivate();
return;
};
engine.gem_board.basket.exchangePositions(easef.subject, eases.subject);
if (engine.balance()){
deactivate();
} else {
returning = true;
engine.gem_board.basket.exchangePositions(easef.subject, eases.subject);
easef = new EaseGoal(selected_gems[0], selected_gems[0].graphicCenter(), Consts.GemEaseSpeed);
eases = new EaseGoal(selected_gems[1], selected_gems[1].graphicCenter(), Consts.GemEaseSpeed);
};
};
}
override public function deactivate():void{
selected_gems[0].display.gem_sprite.stopRotation();
selected_gems[1].display.gem_sprite.stopRotation();
selected_gems.length = 0;
engine.mutex.unlock();
super.deactivate();
}
}
}//package fe
Section 29
//ExtraBonusGoal (fe.ExtraBonusGoal)
package fe {
public class ExtraBonusGoal extends Goal {
private var engine:Engine;// = null
private var duration:int;// = 0
private static const Duration:int = 500;
public function ExtraBonusGoal(_arg1:Engine):void{
engine = null;
duration = 0;
super();
engine = _arg1;
duration = Duration;
engine.play_window.double_bonus_text.visible = true;
engine.play_window.double_bonus_text.gotoAndPlay(0);
engine.extra_money = true;
}
public function advance():void{
duration--;
if (duration <= 0){
engine.play_window.double_bonus_text.stop();
engine.play_window.double_bonus_text.visible = false;
engine.extra_money = false;
deactivate();
};
}
}
}//package fe
Section 30
//FillEmptyGoal (fe.FillEmptyGoal)
package fe {
public class FillEmptyGoal extends Goal {
private var goals:GoalSystem;// = null
private var engine:Engine;// = null
public function FillEmptyGoal(_arg1:Engine):void{
var _local2:Array;
var _local3:int;
var _local4:Gem;
var _local5:Position;
var _local6:int;
engine = null;
goals = null;
super();
engine = _arg1;
engine.mutex.lock();
goals = new GoalSystem();
_local2 = engine.gem_board.basket.fillEmpty(engine.current_level.gen_params);
_local3 = 0;
_local3 = 0;
while (_local3 < _local2.length) {
if (!engine.gem_board.addGem(_local2[_local3])){
trace("FillEmptyGoal - add after fill failed!");
};
_local4 = _local2[_local3];
_local5 = _local4.graphicCenter();
_local6 = ((_local5.y - (Math.random() * 1000)) - 500);
_local4.display.y = _local6;
goals.add(new EaseGoal(_local4, _local5, 0.3));
_local3++;
};
engine.sound(Consts.DiceSound);
}
public function advance():void{
goals.tick();
if (!goals.activeCount()){
deactivate();
};
}
override public function deactivate():void{
engine.balance();
engine.mutex.unlock();
super.deactivate();
}
}
}//package fe
Section 31
//GameEvents (fe.GameEvents)
package fe {
import flash.events.*;
import flash.ui.*;
public class GameEvents {
private var engine:Engine;// = null
public function GameEvents(_arg1:Engine):void{
engine = null;
super();
engine = _arg1;
}
private function onKeyDown(_arg1:KeyboardEvent):void{
if (Keyboard.ESCAPE == _arg1.keyCode){
};
}
public function register():void{
engine.globalstage.stage.addEventListener(Event.ENTER_FRAME, tick);
engine.globalstage.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
engine.globalstage.stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
public function unregister():void{
engine.globalstage.stage.removeEventListener(Event.ENTER_FRAME, tick);
engine.globalstage.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
engine.globalstage.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
public function tick(_arg1:Event):void{
engine.goalsys.tick();
}
private function onMouseMove(_arg1:MouseEvent):void{
if (engine.play_window.hammer_cursor){
engine.play_window.hammer_cursor.x = engine.globalstage.mouseX;
engine.play_window.hammer_cursor.y = engine.globalstage.mouseY;
};
}
}
}//package fe
Section 32
//GameGoal (fe.GameGoal)
package fe {
import flash.display.*;
public final class GameGoal extends Sprite {
public var count:int;// = 0
public var background:AnimatedBitmap;// = null
public var type:String;
private var engine:Engine;// = null
public var full_count:int;// = 0
public var gem_sprite:GoalGems;
private var resolved_goal:GameGoalResolved;// = null
public function GameGoal(_arg1:Engine, _arg2:String, _arg3:int):void{
count = 0;
full_count = 0;
background = null;
engine = null;
resolved_goal = null;
super();
engine = _arg1;
type = _arg2;
full_count = (count = _arg3);
gem_sprite = new GoalGems();
gem_sprite.x = (width / 2);
gem_sprite.y = (height / 2);
trace(_arg2);
gem_sprite.gotoAndStop(_arg2);
if (count < 2){
gem_sprite.gem_total.text = "";
} else {
gem_sprite.gem_total.text = count.toString();
};
addChild(gem_sprite);
}
public function setTotal(_arg1:int):void{
if (_arg1 < 1){
gem_sprite.gem_animation.gotoAndPlay("shrink");
PlayWindow(parent.parent.parent).updatedGoalPositions();
} else {
gem_sprite.gem_animation.gotoAndPlay("pop");
gem_sprite.gem_total.text = _arg1.toString();
};
}
public function resolved():void{
if (resolved_goal){
resolved_goal.deactivate();
};
count--;
resolved_goal = new GameGoalResolved(this);
engine.goalsys.add(resolved_goal);
}
}
}//package fe
Section 33
//GameGoalResolved (fe.GameGoalResolved)
package fe {
public final class GameGoalResolved extends Goal {
private var game_goal:GameGoal;// = null
private var final_scale:Number;// = 0
private var ticker:Number;// = 0
public function GameGoalResolved(_arg1:GameGoal):void{
game_goal = null;
final_scale = 0;
ticker = 0;
super();
game_goal = _arg1;
final_scale = ((_arg1.full_count - _arg1.count) / _arg1.full_count);
}
public function advance():void{
ticker++;
if (ticker > 20){
game_goal.setTotal(game_goal.count);
deactivate();
};
}
}
}//package fe
Section 34
//GameGoals (fe.GameGoals)
package fe {
import flash.display.*;
public final class GameGoals {
private var engine:Engine;// = null
public var goal_map:Map;// = null
public var bar:Sprite;// = null
public var goal:Array;// = null
public var gcaption:GoalCaptionMC;// = null
public function GameGoals(_arg1:Engine, _arg2:Array):void{
goal = null;
bar = null;
gcaption = null;
goal_map = null;
engine = null;
super();
engine = _arg1;
goal_map = new Map();
goal = _arg2;
}
public function buildBar():void{
var _local1:int;
var _local2:GameGoal;
bar = new Sprite();
gcaption = new GoalCaptionMC();
bar.addChild(gcaption);
_local1 = 0;
_local1 = 0;
while (_local1 < goal.length) {
_local2 = new GameGoal(engine, goal[_local1][0], goal[_local1][1]);
_local2.y = bar.height;
bar.addChild(_local2);
goal_map.add(goal[_local1][0], _local2);
_local1++;
};
}
public function findGoal(_arg1:String):GameGoal{
var _local2:GameGoal;
_local2 = goal_map.get(_arg1);
if (((_local2) && ((_local2.count > 0)))){
return (_local2);
};
return (null);
}
public function completed():Boolean{
var _local1:int;
_local1 = 0;
_local1 = 0;
while (_local1 < goal_map.values.length) {
if (goal_map.values[_local1].count > 0){
return (false);
};
_local1++;
};
return (true);
}
public function updatedGoalPositions():void{
var _local1:*;
var _local2:int;
_local1 = 0;
_local2 = 1;
_local2 = 1;
while (_local2 < bar.numChildren) {
if (GameGoal(bar.getChildAt(_local2)).count > 0){
GameGoal(bar.getChildAt(_local2)).y = _local1;
_local1 = (_local1 + 44);
};
_local2++;
};
}
}
}//package fe
Section 35
//Gem (fe.Gem)
package fe {
public class Gem {
public var size:int;// = 0
public var board:GemBoard;// = null
public var display:GemSprite;// = null
public var unmovable:Boolean;// = false
public var type:String;// = ""
public var pos:Position;// = null
public var bonus:int;// = 0
public function Gem(_arg1:String, _arg2:int, _arg3:Position):void{
type = "";
size = 0;
pos = null;
display = null;
board = null;
bonus = 0;
unmovable = false;
super();
type = _arg1;
size = _arg2;
pos = new Position();
pos.copy(_arg3);
}
public function wipe():void{
display.gem_sprite.destroy();
}
public function mappingKey():int{
return (((pos.x * Consts.MappingInsureMult) + pos.y));
}
public function render(_arg1:Engine):GemSprite{
var _local2:Number;
var _local3:Number;
display = new GemSprite(_arg1, type, bonus, unmovable);
display.gem = this;
display.scale(GemOptions.scale(this));
_local2 = (pos.x + (GemOptions.width(this) / 2));
_local3 = (pos.y + (GemOptions.height(this) / 2));
display.x = (_local2 * board.cell_width);
display.y = (_local3 * board.cell_height);
return (display);
}
public function graphicCenter():Position{
return (new Position(((pos.x + (GemOptions.width(this) / 2)) * board.cell_width), ((pos.y + (GemOptions.height(this) / 2)) * board.cell_height)));
}
}
}//package fe
Section 36
//GemBasket (fe.GemBasket)
package fe {
public class GemBasket {
private var moves:MovesCounter;// = null
public var map:MapMatrix;// = null
public var gems:Array;
public var mapping:Map;// = null
public function GemBasket(_arg1:int, _arg2:int):void{
gems = [];
map = null;
mapping = null;
moves = null;
super();
map = new MapMatrix(_arg1, _arg2);
mapping = new Map();
moves = new MovesCounter();
}
private function setCoords(_arg1:Gem):Boolean{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = 0;
_local3 = 0;
_local4 = (_arg1.pos.x + GemOptions.width(_arg1));
_local5 = (_arg1.pos.y + GemOptions.height(_arg1));
_local2 = _arg1.pos.x;
while (_local2 < _local4) {
_local3 = _arg1.pos.y;
while (_local3 < _local5) {
if (map.getxy(_local2, _local3) != 0){
return (false);
};
map.setxy(_local2, _local3, _arg1.size);
_local3++;
};
_local2++;
};
return (true);
}
public function fillEmpty(_arg1:Array):Array{
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:Gem;
var _local6:Array;
var _local7:int;
var _local8:Map;
var _local9:Position;
var _local10:Array;
var _local11:Boolean;
var _local12:String;
var _local13:Boolean;
_local2 = 0;
_local3 = 0;
_local4 = [];
_local5 = null;
_local6 = [];
_local7 = 0;
_local8 = new Map();
_local8.copy(mapping);
_local2 = 0;
while (_local2 < map.width) {
_local3 = 0;
while (_local3 < map.height) {
if (map.getxy(_local2, _local3) == 0){
_local4.push(new Position(_local2, _local3));
};
_local3++;
};
_local2++;
};
while (_local4.length > 0) {
_local9 = _local4.shift();
_local10 = new Array();
_local10 = _local10.concat(_arg1);
_local11 = false;
while (((!(_local11)) && ((_local10.length > 0)))) {
_local7 = Math.min((Math.random() * _local10.length), (_local10.length - 1));
_local12 = _local10[_local7][0];
_local10.splice(_local7, 1);
_local13 = false;
_local5 = _local8.get(((_local9.x * Consts.MappingInsureMult) + (_local9.y - 1)));
if (((_local5) && ((_local5.type == _local12)))){
_local13 = true;
};
if (!_local13){
_local5 = _local8.get(((_local9.x * Consts.MappingInsureMult) + (_local9.y + 1)));
if (((_local5) && ((_local5.type == _local12)))){
_local13 = true;
};
};
if (!_local13){
_local5 = new Gem(_local12, 1, _local9);
_local6.push(_local5);
_local8.add(_local5.mappingKey(), _local5);
_local11 = true;
break;
};
};
if (!_local11){
_local7 = Math.min((Math.random() * _arg1.length), (_arg1.length - 1));
_local5 = new Gem(_arg1[_local7][0], 1, _local9);
_local6.push(_local5);
};
};
return (_local6);
}
public function findFreeCells(_arg1:String):Array{
var _local2:int;
var _local3:int;
var _local4:Array;
_local2 = 0;
_local3 = 0;
_local4 = new Array();
_local2 = 0;
while (_local2 < map.width) {
_local3 = 0;
while (_local3 < map.height) {
if (map.getxy(_local2, _local3) == 0){
if (_local3 > 0){
map.getxy(_local2, (_local3 - 1));
};
};
_local3++;
};
_local2++;
};
return (_local4);
}
public function getGemsGreater(_arg1:int):Array{
var _local2:int;
var _local3:Array;
_local2 = 0;
_local3 = [];
_local2 = 0;
while (_local2 < gems.length) {
if (gems[_local2].size >= _arg1){
_local3.push(gems[_local2]);
};
_local2++;
};
return (_local3);
}
public function findFromPos(_arg1:Position):Gem{
var _local2:int;
var _local3:Gem;
_local2 = 0;
_local3 = null;
_local2 = 0;
while (_local2 < gems.length) {
_local3 = gems[_local2];
if ((((((_local3.pos.x <= _arg1.x)) && (((_local3.pos.x + GemOptions.width(_local3)) > _arg1.x)))) && ((((_local3.pos.y <= _arg1.y)) && (((_local3.pos.y + GemOptions.height(_local3)) > _arg1.y)))))){
return (_local3);
};
_local2++;
};
return (null);
}
public function removeGem(_arg1:Gem):void{
var _local2:int;
clearCoords(_arg1);
_local2 = 0;
while (_local2 < gems.length) {
if (gems[_local2] == _arg1){
gems.splice(_local2, 1);
break;
};
_local2++;
};
mapping.remove(_arg1.mappingKey());
}
public function calcMoves():int{
moves.gems = gems;
moves.mapping = mapping;
return (moves.calc());
}
public function addGem(_arg1:Gem):Boolean{
if (!setCoords(_arg1)){
return (false);
};
gems.push(_arg1);
mapping.add(_arg1.mappingKey(), _arg1);
return (true);
}
public function exchangePositions(_arg1:Gem, _arg2:Gem):void{
var _local3:Position;
mapping.remove(_arg1.mappingKey());
mapping.remove(_arg2.mappingKey());
_local3 = _arg1.pos;
_arg1.pos = _arg2.pos;
_arg2.pos = _local3;
mapping.add(_arg1.mappingKey(), _arg1);
mapping.add(_arg2.mappingKey(), _arg2);
}
public function findMergePair():Array{
var _local1:int;
var _local2:Gem;
var _local3:Gem;
var _local4:Gem;
var _local5:Gem;
var _local6:Gem;
_local1 = 0;
_local1 = 0;
while (_local1 < mapping.values.length) {
_local2 = mapping.values[_local1];
if (_local2.unmovable){
} else {
if (GemOptions.direction(_local2) == Consts.Vertical){
if ((_local2.pos.y - GemOptions.height(_local2)) >= 0){
if (map.getxy(_local2.pos.x, (_local2.pos.y - GemOptions.height(_local2))) == _local2.size){
_local3 = gemByPos(new Position(_local2.pos.x, (_local2.pos.y - GemOptions.height(_local2))));
if (((((_local3) && ((_local3.type == _local2.type)))) && (!(_local3.unmovable)))){
return ([_local2, _local3]);
};
};
} else {
if ((_local2.pos.y + GemOptions.height(_local2)) < map.height){
if (map.getxy(_local2.pos.x, (_local2.pos.y + GemOptions.height(_local2))) == _local2.size){
_local4 = gemByPos(new Position(_local2.pos.x, (_local2.pos.y + GemOptions.height(_local2))));
if (((((_local4) && ((_local4.type == _local2.type)))) && (!(_local4.unmovable)))){
return ([_local2, _local4]);
};
};
};
};
} else {
if (GemOptions.direction(_local2) == Consts.Horizontal){
if ((_local2.pos.x - GemOptions.width(_local2)) >= 0){
if (map.getxy((_local2.pos.x - GemOptions.width(_local2)), _local2.pos.y) == _local2.size){
_local5 = gemByPos(new Position((_local2.pos.x - GemOptions.width(_local2)), _local2.pos.y));
if (((((_local5) && ((_local5.type == _local2.type)))) && (!(_local5.unmovable)))){
return ([_local2, _local5]);
};
};
} else {
if ((_local2.pos.x + GemOptions.width(_local2)) < map.width){
if (map.getxy((_local2.pos.x + GemOptions.width(_local2)), _local2.pos.y) == _local2.size){
_local6 = gemByPos(new Position((_local2.pos.x + GemOptions.width(_local2)), _local2.pos.y));
if (((((_local6) && ((_local6.type == _local2.type)))) && (!(_local6.unmovable)))){
return ([_local2, _local6]);
};
};
};
};
};
};
};
_local1++;
};
return (null);
}
private function clearCoords(_arg1:Gem):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = 0;
_local3 = 0;
_local4 = (_arg1.pos.x + GemOptions.width(_arg1));
_local5 = (_arg1.pos.y + GemOptions.height(_arg1));
_local2 = _arg1.pos.x;
while (_local2 < _local4) {
_local3 = _arg1.pos.y;
while (_local3 < _local5) {
map.setxy(_local2, _local3, 0);
_local3++;
};
_local2++;
};
}
public function gemByPos(_arg1:Position):Gem{
return (mapping.get(((_arg1.x * Consts.MappingInsureMult) + _arg1.y)));
}
}
}//package fe
Section 37
//GemBoard (fe.GemBoard)
package fe {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class GemBoard extends Sprite {
private var background_layer:Sprite;// = null
private var board_width:int;// = 0
private var selected_gems:Array;
private var engine:Engine;// = null
private var play_window:PlayWindow;// = null
private var gem_layer:Sprite;// = null
private var backs:Map;// = null
private var time_bonus_count:int;// = 0
private var board_height:int;// = 0
public var cell_width:int;// = 0
public var cell_height:int;// = 0
public var basket:GemBasket;// = null
private var extra_bonus_count:int;// = 0
private var hammer_bonus_count:int;// = 0
public function GemBoard(_arg1:Engine, _arg2:int, _arg3:int, _arg4:int, _arg5:int):void{
basket = null;
selected_gems = [];
engine = null;
cell_width = 0;
cell_height = 0;
backs = null;
play_window = null;
background_layer = null;
gem_layer = null;
board_width = 0;
board_height = 0;
time_bonus_count = 0;
hammer_bonus_count = 0;
extra_bonus_count = 0;
super();
engine = _arg1;
board_width = _arg2;
board_height = _arg3;
basket = new GemBasket(_arg4, _arg5);
backs = new Map();
cell_width = (board_width / _arg4);
cell_height = (board_height / _arg5);
create();
}
public function destroy():void{
engine.globalstage.stage.removeEventListener(MouseEvent.MOUSE_DOWN, gemMouseDown);
}
private function create():void{
background_layer = new Sprite();
gem_layer = new Sprite();
background_layer.graphics.beginFill(0xFFFFFF, 0.01);
background_layer.graphics.drawRect(0, 0, board_width, board_height);
background_layer.graphics.endFill();
addChildAt(background_layer, 0);
addChildAt(gem_layer, 1);
if (!engine.tutorial){
engine.globalstage.stage.addEventListener(MouseEvent.MOUSE_DOWN, gemMouseDown);
};
}
public function destroyGem(_arg1:Gem):void{
var _local2:int;
if (_arg1.bonus > 0){
doBonus(_arg1);
};
_local2 = 0;
_local2 = 0;
while (_local2 < selected_gems.length) {
if (selected_gems[_local2] == _arg1){
selected_gems.splice(_local2, 1);
};
_local2++;
};
_arg1.wipe();
engine.deactivateGoals(_arg1);
removeBackground(_arg1);
basket.removeGem(_arg1);
gem_layer.removeChild(_arg1.display);
}
public function moveToFront(_arg1:Gem):void{
}
public function gemMouseDown(_arg1:MouseEvent, _arg2=null, _arg3=null):void{
var _local4:*;
var _local5:*;
var _local6:Position;
var _local7:Gem;
var _local8:Boolean;
if (engine.paused){
return;
};
if (_arg2 != null){
_local4 = _arg2;
} else {
_local4 = this.mouseX;
};
if (_arg3 != null){
_local5 = _arg3;
} else {
_local5 = this.mouseY;
};
_local6 = new Position();
if ((_local4 / cell_width) > 0){
_local6.x = (_local4 / cell_width);
} else {
_local6.x = -1;
};
if ((_local5 / cell_height) > 0){
_local6.y = (_local5 / cell_height);
} else {
_local6.y = -1;
};
_local7 = basket.findFromPos(_local6);
if (((!(_local7)) || (((_local7.unmovable) && (!(engine.hammer_bonus)))))){
return;
};
engine.sound(Consts.GemClickSound);
if (!engine.mutex.isLocked()){
if (selected_gems.length == 1){
if ((((selected_gems[0] == _local7)) || (!((selected_gems[0].size == _local7.size))))){
_local8 = (selected_gems[0] == _local7);
selected_gems[0].display.gem_sprite.stopRotation();
selected_gems.length = 0;
if (_local8){
return;
};
};
selected_gems.push(_local7);
if (2 == selected_gems.length){
engine.exchange(selected_gems);
};
} else {
selected_gems.push(_local7);
};
_local7.display.gem_sprite.startRotation();
} else {
if (engine.hammer_bonus){
destroyGem(_local7);
engine.goalsys.add(new FillEmptyGoal(engine));
engine.bonuss.applyHammerBonus(2, engine.hammer_bonus_placeholder);
engine.hammer_bonus_placeholder = null;
engine.hammer_bonus = false;
engine.play_window.removeHammerCursor();
engine.mutex.unlock();
};
};
}
public function doBonus(_arg1:Gem):void{
engine.goalsys.add(new AddBonusGoal(engine, _arg1));
}
private function addBackground(_arg1:Gem):void{
var _local2:int;
var _local3:int;
var _local4:Class;
var _local5:MovieClip;
_local2 = 0;
_local3 = 0;
_local2 = ((GemOptions.width(_arg1) * cell_width) - 6);
_local3 = ((GemOptions.height(_arg1) * cell_height) - 6);
_local4 = (getDefinitionByName(String(((("card_" + _local2) + "_") + _local3))) as Class);
_local5 = new (_local4);
backs.add(_arg1.mappingKey(), _local5);
_local5.x = (_arg1.pos.x * cell_width);
_local5.y = (_arg1.pos.y * cell_height);
if (GemOptions.direction(_arg1) == Consts.Vertical){
};
if (GemOptions.direction(_arg1) == Consts.Horizontal){
};
_local5.cacheAsBitmap = true;
background_layer.addChild(_local5);
}
private function removeBackground(_arg1:Gem):void{
var _local2:*;
_local2 = backs.getout(_arg1.mappingKey());
background_layer.removeChild(_local2);
}
public function addGem(_arg1:Gem):Boolean{
var _local2:GemSprite;
var _local3:Number;
_arg1.board = this;
if (!basket.addGem(_arg1)){
return (false);
};
if (((!(_arg1.unmovable)) && (!(engine.tutorial)))){
_local3 = Math.random();
if ((((((_local3 < 0.01)) && ((time_bonus_count < 10)))) && (!((Consts.TournamentLevel == engine.current_level_number))))){
_arg1.bonus = Consts.TimeBonus;
time_bonus_count++;
} else {
if ((((_local3 < 0.03)) && ((hammer_bonus_count < 8)))){
_arg1.bonus = Consts.HammerBonus;
hammer_bonus_count++;
} else {
if ((((_local3 < 0.05)) && ((extra_bonus_count < 8)))){
_arg1.bonus = Consts.ExtraBonus;
extra_bonus_count++;
};
};
};
};
addBackground(_arg1);
_local2 = _arg1.render(engine);
gem_layer.addChild(_local2);
return (true);
}
}
}//package fe
Section 38
//GemComposedGoal (fe.GemComposedGoal)
package fe {
public class GemComposedGoal extends Goal {
private var goals:GoalSystem;// = null
private var engine:Engine;// = null
private var gem:Gem;// = null
private var game_goal:GameGoal;// = null
public function GemComposedGoal(_arg1:Engine, _arg2:Gem):void{
var _local3:Position;
engine = null;
gem = null;
goals = null;
game_goal = null;
super();
engine = _arg1;
engine.mutex.lock();
gem = _arg2;
goals = new GoalSystem();
_local3 = null;
game_goal = engine.current_goal.findGoal(gem.type);
if (!game_goal){
_local3 = new Position(0, (Consts.GameHeight - 10));
} else {
_local3 = new Position((engine.current_goal.bar.x - 44), (engine.current_goal.bar.y + game_goal.y));
game_goal.resolved();
};
goals.add(new EaseGoal(gem, _local3, 0.3));
goals.add(new SizeReduceGoal(gem));
engine.sound(Consts.GemComposedSound);
}
public function advance():void{
goals.tick();
if (0 == goals.activeCount()){
if (game_goal){
engine.goalsys.add(new MoneyPopupGoal(engine, new Position(340, 20), GemOptions.cost(gem.type)));
if (engine.current_goal.completed()){
engine.victory();
};
} else {
engine.goalsys.add(new MoneyPopupGoal(engine, new Position(0, (Consts.GameHeight - 50)), Consts.ExtraMoney));
};
engine.gem_board.destroyGem(gem);
engine.goalsys.add(new FillEmptyGoal(engine));
deactivate();
};
}
override public function deactivate():void{
engine.mutex.unlock();
super.deactivate();
}
}
}//package fe
Section 39
//GemFactory (fe.GemFactory)
package fe {
import flash.display.*;
public class GemFactory {
public static function get(_arg1:String):BitmapData{
switch (_arg1){
case GemOptions.diamond:
return (new Imagepattern1(0, 0));
case GemOptions.amethyst:
return (new Imageamethyst(0, 0));
case GemOptions.ruby:
return (new Imagered(0, 0));
case GemOptions.sapphire:
return (new Imageblue(0, 0));
case GemOptions.emerald:
return (new Imageemerald(0, 0));
case GemOptions.pyrite:
return (new Imagepyrite(0, 0));
};
return (new Imagered(0, 0));
}
}
}//package fe
Section 40
//GemFadeGoal (fe.GemFadeGoal)
package fe {
public class GemFadeGoal extends Goal {
private var gem:Gem;// = null
public function GemFadeGoal(_arg1:Gem):void{
gem = null;
super();
gem = _arg1;
}
public function advance():void{
gem.display.alpha = (gem.display.alpha - 0.05);
if (gem.display.alpha <= 0){
deactivate();
};
}
}
}//package fe
Section 41
//GemOptions (fe.GemOptions)
package fe {
public final class GemOptions {
public static var sapphire:String = "Sapphire";
public static var emerald:String = "Emerald";
public static var amethyst:String = "Amethyst";
public static var pyrite:String = "Pyrite";
public static var ruby:String = "Ruby";
public static var diamond:String = "Diamond";
public static function scaleForSize(_arg1:int):Number{
switch (_arg1){
case 0:
return (0.14);
case 1:
return (0.15);
case 2:
return (0.25);
case 4:
return (0.5);
case 8:
return (0.8);
case 16:
return (1.2);
case 32:
return (1.8);
case 64:
return (12);
};
return (1);
}
public static function width(_arg1:Gem):int{
switch (_arg1.size){
case 1:
return (1);
case 2:
return (1);
case 4:
return (2);
case 8:
return (2);
case 16:
return (4);
case 32:
return (4);
case 64:
return (10);
};
return (0);
}
public static function height(_arg1:Gem):int{
switch (_arg1.size){
case 1:
return (1);
case 2:
return (2);
case 4:
return (2);
case 8:
return (4);
case 16:
return (4);
case 32:
return (8);
case 64:
return (10);
};
return (0);
}
public static function scale(_arg1:Gem):Number{
return (scaleForSize(_arg1.size));
}
public static function edgeColor(_arg1:String):int{
switch (_arg1){
case diamond:
return (11848648);
case amethyst:
return (13899237);
case ruby:
return (15539750);
case emerald:
return (0x4AE100);
case sapphire:
return (2583780);
case pyrite:
return (16761623);
};
return (0);
}
public static function cost(_arg1:String):int{
switch (_arg1){
case diamond:
return (50000);
case amethyst:
return (500);
case ruby:
return (1500);
case emerald:
return (1000);
case sapphire:
return (10000);
case pyrite:
return (5000);
};
return (0);
}
public static function direction(_arg1:Gem):int{
switch (_arg1.size){
case 1:
case 4:
case 16:
case 64:
return (Consts.Vertical);
};
return (Consts.Horizontal);
}
}
}//package fe
Section 42
//GemSprite (fe.GemSprite)
package fe {
import flash.display.*;
import flash.filters.*;
public class GemSprite extends Sprite {
private var bonus;// = null
public var gem:Gem;// = null
public var gem_sprite:Dodecahedron;// = null
public function GemSprite(_arg1:Engine, _arg2:String, _arg3:int, _arg4:Boolean):void{
var _local5:BitmapData;
var _local6:BitmapFilter;
var _local7:Array;
gem_sprite = null;
gem = null;
bonus = null;
super();
gem = null;
_local5 = GemFactory.get(_arg2);
gem_sprite = new Dodecahedron(_arg1, _local5, GemOptions.edgeColor(_arg2));
gem_sprite.cacheAsBitmap = true;
_local6 = getBitmapFilter();
_local7 = new Array();
_local7.push(_local6);
if (_arg4){
_local7.push(getBevelFilter());
} else {
if (_arg3 > 0){
switch (_arg3){
case Consts.DamagedGem:
_local6 = getBevelFilter();
_local7.push(_local6);
break;
case Consts.TimeBonus:
bonus = new TimeBonusBackMC();
bonus.x = (bonus.x - 25);
bonus.y = (bonus.y - 25);
addChild(bonus);
break;
case Consts.HammerBonus:
bonus = new HammerBonusBackMC();
bonus.x = (bonus.x - 25);
bonus.y = (bonus.y - 25);
addChild(bonus);
break;
case Consts.ExtraBonus:
bonus = new DoubleBonusBackMC();
bonus.x = (bonus.x - 25);
bonus.y = (bonus.y - 25);
addChild(bonus);
break;
};
};
};
gem_sprite.filters = _local7;
addChild(gem_sprite);
gem_sprite.cacheAsBitmap = true;
cacheAsBitmap = true;
}
public function scale(_arg1:Number):void{
scaleX = (scaleY = _arg1);
}
private function getBevelFilter():BitmapFilter{
var _local1:Number;
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:String;
var _local12:Boolean;
_local1 = 20;
_local2 = 45;
_local3 = 0;
_local4 = 0.7;
_local5 = 0;
_local6 = 0.8;
_local7 = 5;
_local8 = 5;
_local9 = 5;
_local10 = BitmapFilterQuality.HIGH;
_local11 = BitmapFilterType.INNER;
_local12 = false;
return (new BevelFilter(_local1, _local2, _local3, _local4, _local5, _local6, _local7, _local8, _local9, _local10, _local11, _local12));
}
public function getBonus(){
removeChild(bonus);
return (bonus);
}
private function getBitmapFilter():BitmapFilter{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Boolean;
var _local9:Boolean;
var _local10:Number;
_local1 = 0;
_local2 = 45;
_local3 = 0.8;
_local4 = 8;
_local5 = 8;
_local6 = 8;
_local7 = 0.8;
_local8 = false;
_local9 = false;
_local10 = BitmapFilterQuality.LOW;
return (new DropShadowFilter(_local6, _local2, _local1, _local3, _local4, _local5, _local7, _local10, _local8, _local9));
}
}
}//package fe
Section 43
//Goal (fe.Goal)
package fe {
public class Goal {
public var active:Boolean;// = true
public function Goal(){
active = true;
super();
}
public function deactivate():void{
active = false;
}
}
}//package fe
Section 44
//GoalSystem (fe.GoalSystem)
package fe {
public class GoalSystem {
public var goals:Array;
private var active_count:int;// = 0
private var counter:int;// = 0
public function GoalSystem(){
goals = [];
counter = 0;
active_count = 0;
super();
}
public function add(_arg1):void{
goals.push(_arg1);
}
public function activeCount():int{
return (active_count);
}
private function cleanGoals():void{
var _local1:int;
_local1 = 0;
while (_local1 < goals.length) {
if (!goals[_local1].active){
delete goals[_local1];
goals.splice(_local1, 1);
} else {
_local1++;
};
};
}
public function tick():void{
var _local1:uint;
_local1 = 0;
active_count = 0;
while (_local1 < goals.length) {
if (goals[_local1].active){
goals[_local1].advance();
active_count++;
};
_local1++;
};
if (!counter){
cleanGoals();
counter = Consts.GOALSCLEANPAUSE;
} else {
counter--;
};
}
}
}//package fe
Section 45
//GrowGoal (fe.GrowGoal)
package fe {
public class GrowGoal extends Goal {
private var grow_gem:Gem;// = null
private var final_scale:Number;// = 0
private var scale:Number;// = 0
public function GrowGoal(_arg1:Gem, _arg2:int):void{
grow_gem = null;
scale = 0;
final_scale = 0;
super();
grow_gem = _arg1;
scale = GemOptions.scale(grow_gem);
final_scale = GemOptions.scaleForSize(_arg2);
}
public function advance():void{
scale = (scale + Consts.GrowSpeed);
if (scale >= final_scale){
scale = final_scale;
deactivate();
};
grow_gem.display.scale(scale);
}
}
}//package fe
Section 46
//LevelMap (fe.LevelMap)
package fe {
import flash.utils.*;
public class LevelMap {
public var goals:Array;
public var map_width:int;// = 0
public var level_time:int;// = 0
public var day:String;
public var bonuses:Array;
public var data:XML;// = null
public var gen_params:Array;
public var map_height:int;// = 0
public var unmovables:Dictionary;
public function LevelMap(_arg1:XML):void{
data = null;
gen_params = [];
goals = [];
unmovables = new Dictionary();
map_width = 0;
map_height = 0;
bonuses = [];
level_time = 0;
super();
data = _arg1;
readLevel();
}
private function readLevel():void{
var _local1:XML;
var _local2:XMLList;
var _local3:XMLList;
var _local4:XMLList;
var _local5:XMLList;
_local1 = null;
_local2 = data.gen_params.gem;
for each (_local1 in _local2) {
gen_params.push([String(_local1.@type), Number(_local1.@count)]);
};
_local1 = null;
_local3 = data.goals.gem;
for each (_local1 in _local3) {
goals.push([String(_local1.@type), int(_local1.@count)]);
};
_local1 = null;
_local4 = data.bonuses.bonus;
for each (_local1 in _local4) {
bonuses.push([String(_local1.@type), int(_local1.@count)]);
};
_local1 = null;
_local5 = data.unmovable.gem;
for each (_local1 in _local5) {
unmovables[((int(_local1.@x) * Consts.MappingInsureMult) + int(_local1.@y))] = 1;
};
map_width = int(data.size.@width);
map_height = int(data.size.@height);
day = data.day;
level_time = int(data.level_time);
}
}
}//package fe
Section 47
//Levels (fe.Levels)
package fe {
public class Levels {
public static const levels:XML = <levels>
<level number='0'>
<gen_params>
<gem type='Emerald' count='0.5'/>
<gem type='Ruby' count='0.5'/>
</gen_params>
<size width='4' height='4'/>
<bonuses>
<bonus type='time' count='1' max='3'/>
<bonus type='hammer' count='1' max='3'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='1'/>
<gem type='Ruby' count='1'/>
</goals>
<unmovable>
</unmovable>
<day>March 1</day>
<level_time>600</level_time>
</level>
<level number='1'>
<gen_params>
<gem type='Amethyst' count='0.5'/>
<gem type='Ruby' count='0.5'/>
</gen_params>
<size width='5' height='5'/>
<bonuses>
<bonus type='hammer' count='1' max='3'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Ruby' count='2'/>
<gem type='Amethyst' count='1'/>
</goals>
<unmovable>
</unmovable>
<day>March 9</day>
<level_time>600</level_time>
</level>
<level number='2'>
<gen_params>
<gem type='Amethyst' count='0.3'/>
<gem type='Ruby' count='0.3'/>
<gem type='Emerald' count='0.4'/>
</gen_params>
<size width='6' height='6'/>
<bonuses>
<bonus type='time' count='1' max='3'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='3'/>
<gem type='Ruby' count='1'/>
<gem type='Amethyst' count='2'/>
</goals>
<unmovable>
</unmovable>
<day>March 15</day>
<level_time>600</level_time>
</level>
<level number='3'>
<gen_params>
<gem type='Ruby' count='0.5'/>
<gem type='Amethyst' count='0.25'/>
<gem type='Emerald' count='0.25'/>
</gen_params>
<size width='6' height='6'/>
<bonuses>
<bonus type='time' count='1' max='3'/>
<bonus type='hammer' count='2' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='4'/>
<gem type='Ruby' count='2'/>
<gem type='Amethyst' count='2'/>
</goals>
<unmovable>
<gem x='2' y='2'/>
<gem x='5' y='0'/>
</unmovable>
<day>March 27</day>
<level_time>600</level_time>
</level>
<level number='4'>
<gen_params>
<gem type='Pyrite' count='0.4'/>
<gem type='Ruby' count='0.3'/>
<gem type='Emerald' count='0.3'/>
</gen_params>
<size width='6' height='6'/>
<bonuses>
<bonus type='time' count='1' max='3'/>
<bonus type='extra' count='2' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='3'/>
<gem type='Ruby' count='3'/>
<gem type='Pyrite' count='3'/>
</goals>
<unmovable>
<gem x='0' y='0'/>
<gem x='5' y='5'/>
<gem x='0' y='5'/>
</unmovable>
<day>April 3</day>
<level_time>600</level_time>
</level>
<level number='5'>
<gen_params>
<gem type='Pyrite' count='0.3'/>
<gem type='Ruby' count='0.3'/>
<gem type='Emerald' count='0.3'/>
<gem type='Amethyst' count='0.1'/>
</gen_params>
<size width='6' height='6'/>
<bonuses>
<bonus type='time' count='1' max='3'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='4'/>
<gem type='Ruby' count='2'/>
<gem type='Pyrite' count='3'/>
<gem type='Amethyst' count='3'/>
</goals>
<unmovable>
<gem x='3' y='3'/>
<gem x='4' y='4'/>
<gem x='5' y='5'/>
</unmovable>
<day>April 12</day>
<level_time>900</level_time>
</level>
<level number='6'>
<gen_params>
<gem type='Pyrite' count='0.3'/>
<gem type='Ruby' count='0.3'/>
<gem type='Emerald' count='0.3'/>
<gem type='Sapphire' count='0.05'/>
<gem type='Amethyst' count='0.05'/>
</gen_params>
<size width='6' height='6'/>
<bonuses>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='2'/>
<gem type='Ruby' count='2'/>
<gem type='Pyrite' count='2'/>
<gem type='Sapphire' count='1'/>
<gem type='Amethyst' count='1'/>
</goals>
<unmovable>
<gem x='0' y='0'/>
<gem x='2' y='2'/>
<gem x='3' y='2'/>
<gem x='5' y='0'/>
</unmovable>
<day>April 20</day>
<level_time>900</level_time>
</level>
<level number='7'>
<gen_params>
<gem type='Pyrite' count='0.3'/>
<gem type='Ruby' count='0.3'/>
<gem type='Emerald' count='0.3'/>
<gem type='Sapphire' count='0.05'/>
<gem type='Amethyst' count='0.05'/>
</gen_params>
<size width='6' height='6'/>
<bonuses>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='5'/>
<gem type='Ruby' count='3'/>
<gem type='Pyrite' count='2'/>
<gem type='Sapphire' count='1'/>
<gem type='Amethyst' count='2'/>
</goals>
<unmovable>
<gem x='0' y='0'/>
<gem x='1' y='1'/>
<gem x='2' y='2'/>
<gem x='2' y='3'/>
<gem x='1' y='4'/>
<gem x='0' y='5'/>
</unmovable>
<day>April 28</day>
<level_time>900</level_time>
</level>
<level number='8'>
<gen_params>
<gem type='Amethyst' count='0.3'/>
<gem type='Ruby' count='0.3'/>
<gem type='Emerald' count='0.3'/>
<gem type='Sapphire' count='0.05'/>
<gem type='Pyrite' count='0.05'/>
</gen_params>
<size width='6' height='6'/>
<bonuses>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='2'/>
<gem type='Ruby' count='10'/>
<gem type='Pyrite' count='3'/>
<gem type='Sapphire' count='1'/>
<gem type='Amethyst' count='2'/>
</goals>
<unmovable>
<gem x='0' y='0'/>
<gem x='5' y='0'/>
<gem x='0' y='5'/>
<gem x='5' y='5'/>
<gem x='3' y='3'/>
<gem x='2' y='2'/>
</unmovable>
<day>May 11</day>
<level_time>1200</level_time>
</level>
<level number='9'>
<gen_params>
<gem type='Amethyst' count='0.3'/>
<gem type='Ruby' count='0.3'/>
<gem type='Emerald' count='0.3'/>
<gem type='Pyrite' count='0.08'/>
<gem type='Sapphire' count='0.02'/>
</gen_params>
<size width='6' height='6'/>
<bonuses>
<bonus type='time' count='2' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='5'/>
<gem type='Ruby' count='5'/>
<gem type='Pyrite' count='5'/>
<gem type='Sapphire' count='2'/>
<gem type='Amethyst' count='5'/>
</goals>
<unmovable>
<gem x='2' y='0'/>
<gem x='3' y='0'/>
<gem x='1' y='1'/>
<gem x='1' y='2'/>
<gem x='1' y='3'/>
<gem x='4' y='1'/>
<gem x='4' y='2'/>
<gem x='4' y='3'/>
<gem x='2' y='5'/>
<gem x='3' y='5'/>
</unmovable>
<day>May 19</day>
<level_time>1200</level_time>
</level>
<level number='10'>
<gen_params>
<gem type='Emerald' count='0.5'/>
<gem type='Amethyst' count='0.1'/>
<gem type='Ruby' count='0.08'/>
<gem type='Pyrite' count='0.3'/>
<gem type='Sapphire' count='0.02'/>
</gen_params>
<size width='7' height='7'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='6'/>
<gem type='Ruby' count='3'/>
<gem type='Pyrite' count='3'/>
<gem type='Sapphire' count='1'/>
<gem type='Amethyst' count='3'/>
</goals>
<unmovable>
<gem x='0' y='0'/>
<gem x='1' y='1'/>
<gem x='2' y='2'/>
<gem x='3' y='3'/>
<gem x='4' y='4'/>
<gem x='5' y='5'/>
</unmovable>
<day>May 23</day>
<level_time>1200</level_time>
</level>
<level number='11'>
<gen_params>
<gem type='Ruby' count='0.5'/>
<gem type='Amethyst' count='0.1'/>
<gem type='Emerald' count='0.08'/>
<gem type='Pyrite' count='0.3'/>
<gem type='Sapphire' count='0.02'/>
</gen_params>
<size width='7' height='7'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='2'/>
<gem type='Ruby' count='5'/>
<gem type='Pyrite' count='3'/>
<gem type='Sapphire' count='1'/>
<gem type='Amethyst' count='5'/>
</goals>
<unmovable>
<gem x='0' y='0'/>
<gem x='1' y='1'/>
<gem x='0' y='5'/>
<gem x='1' y='4'/>
<gem x='5' y='0'/>
<gem x='4' y='1'/>
<gem x='5' y='5'/>
<gem x='4' y='4'/>
</unmovable>
<day>May 30</day>
<level_time>1200</level_time>
</level>
<level number='12'>
<gen_params>
<gem type='Ruby' count='0.3'/>
<gem type='Diamond' count='0.2'/>
<gem type='Amethyst' count='0.1'/>
<gem type='Emerald' count='0.08'/>
<gem type='Pyrite' count='0.3'/>
<gem type='Sapphire' count='0.02'/>
</gen_params>
<size width='7' height='7'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='5'/>
<gem type='Ruby' count='3'/>
<gem type='Pyrite' count='3'/>
<gem type='Sapphire' count='2'/>
<gem type='Amethyst' count='3'/>
</goals>
<unmovable>
<gem x='0' y='0'/>
<gem x='1' y='1'/>
<gem x='0' y='5'/>
<gem x='1' y='4'/>
<gem x='5' y='0'/>
<gem x='4' y='1'/>
<gem x='5' y='5'/>
<gem x='4' y='4'/>
<gem x='2' y='4'/>
<gem x='3' y='4'/>
</unmovable>
<day>June 5</day>
<level_time>1200</level_time>
</level>
<level number='13'>
<gen_params>
<gem type='Ruby' count='0.3'/>
<gem type='Diamond' count='0.2'/>
<gem type='Amethyst' count='0.1'/>
<gem type='Emerald' count='0.08'/>
<gem type='Pyrite' count='0.3'/>
<gem type='Sapphire' count='0.02'/>
</gen_params>
<size width='8' height='8'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='5'/>
<gem type='Ruby' count='5'/>
<gem type='Pyrite' count='3'/>
<gem type='Sapphire' count='3'/>
<gem type='Amethyst' count='3'/>
</goals>
<unmovable>
<gem x='3' y='1'/>
<gem x='4' y='1'/>
<gem x='1' y='3'/>
<gem x='1' y='4'/>
<gem x='3' y='6'/>
<gem x='4' y='6'/>
<gem x='6' y='3'/>
<gem x='6' y='4'/>
</unmovable>
<day>June 10</day>
<level_time>1500</level_time>
</level>
<level number='14'>
<gen_params>
<gem type='Ruby' count='0.3'/>
<gem type='Diamond' count='0.2'/>
<gem type='Amethyst' count='0.1'/>
<gem type='Emerald' count='0.08'/>
<gem type='Pyrite' count='0.3'/>
<gem type='Sapphire' count='0.02'/>
</gen_params>
<size width='8' height='8'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='5'/>
<gem type='Ruby' count='5'/>
<gem type='Pyrite' count='5'/>
<gem type='Sapphire' count='3'/>
<gem type='Amethyst' count='3'/>
<gem type='Diamond' count='1'/>
</goals>
<unmovable>
<gem x='0' y='1'/>
<gem x='1' y='1'/>
<gem x='0' y='5'/>
<gem x='1' y='5'/>
<gem x='4' y='1'/>
<gem x='4' y='2'/>
<gem x='3' y='2'/>
<gem x='3' y='4'/>
<gem x='4' y='4'/>
<gem x='4' y='5'/>
</unmovable>
<day>June 17</day>
<level_time>1500</level_time>
</level>
<level number='15'>
<gen_params>
<gem type='Ruby' count='0.2'/>
<gem type='Diamond' count='0.2'/>
<gem type='Amethyst' count='0.2'/>
<gem type='Pyrite' count='0.2'/>
<gem type='Sapphire' count='0.12'/>
<gem type='Emerald' count='0.08'/>
</gen_params>
<size width='8' height='8'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='5'/>
<gem type='Ruby' count='5'/>
<gem type='Pyrite' count='3'/>
<gem type='Sapphire' count='5'/>
<gem type='Amethyst' count='5'/>
<gem type='Diamond' count='1'/>
</goals>
<unmovable>
<gem x='6' y='0'/>
<gem x='7' y='0'/>
<gem x='6' y='1'/>
<gem x='7' y='1'/>
<gem x='3' y='3'/>
<gem x='4' y='3'/>
<gem x='3' y='4'/>
<gem x='4' y='4'/>
<gem x='0' y='6'/>
<gem x='1' y='6'/>
<gem x='0' y='7'/>
<gem x='1' y='7'/>
</unmovable>
<day>June 29</day>
<level_time>1500</level_time>
</level>
<level number='16'>
<gen_params>
<gem type='Ruby' count='0.2'/>
<gem type='Diamond' count='0.2'/>
<gem type='Amethyst' count='0.2'/>
<gem type='Pyrite' count='0.2'/>
<gem type='Sapphire' count='0.12'/>
<gem type='Emerald' count='0.08'/>
</gen_params>
<size width='8' height='8'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='5'/>
<gem type='Ruby' count='5'/>
<gem type='Pyrite' count='10'/>
<gem type='Sapphire' count='5'/>
<gem type='Amethyst' count='10'/>
<gem type='Diamond' count='1'/>
</goals>
<unmovable>
<gem x='3' y='2'/>
<gem x='4' y='2'/>
<gem x='2' y='3'/>
<gem x='2' y='4'/>
<gem x='3' y='3'/>
<gem x='4' y='3'/>
<gem x='3' y='4'/>
<gem x='4' y='4'/>
<gem x='3' y='5'/>
<gem x='4' y='5'/>
<gem x='5' y='3'/>
<gem x='5' y='4'/>
</unmovable>
<day>Jule 14</day>
<level_time>1500</level_time>
</level>
<level number='17'>
<gen_params>
<gem type='Ruby' count='0.2'/>
<gem type='Diamond' count='0.2'/>
<gem type='Amethyst' count='0.2'/>
<gem type='Pyrite' count='0.2'/>
<gem type='Sapphire' count='0.12'/>
<gem type='Emerald' count='0.08'/>
</gen_params>
<size width='8' height='8'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='8'/>
<gem type='Ruby' count='8'/>
<gem type='Pyrite' count='10'/>
<gem type='Sapphire' count='5'/>
<gem type='Amethyst' count='10'/>
<gem type='Diamond' count='2'/>
</goals>
<unmovable>
<gem x='3' y='2'/>
<gem x='4' y='2'/>
<gem x='2' y='3'/>
<gem x='2' y='4'/>
<gem x='2' y='2'/>
<gem x='5' y='2'/>
<gem x='2' y='5'/>
<gem x='5' y='5'/>
<gem x='3' y='5'/>
<gem x='4' y='5'/>
<gem x='5' y='3'/>
<gem x='5' y='4'/>
</unmovable>
<day>Jule 18</day>
<level_time>1800</level_time>
</level>
<level number='18'>
<gen_params>
<gem type='Ruby' count='0.2'/>
<gem type='Diamond' count='0.2'/>
<gem type='Amethyst' count='0.2'/>
<gem type='Pyrite' count='0.2'/>
<gem type='Sapphire' count='0.12'/>
<gem type='Emerald' count='0.08'/>
</gen_params>
<size width='8' height='8'/>
<bonuses>
<bonus type='time' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='10'/>
<gem type='Ruby' count='10'/>
<gem type='Pyrite' count='10'/>
<gem type='Sapphire' count='5'/>
<gem type='Amethyst' count='10'/>
<gem type='Diamond' count='3'/>
</goals>
<unmovable>
<gem x='3' y='1'/>
<gem x='4' y='1'/>
<gem x='1' y='3'/>
<gem x='1' y='4'/>
<gem x='2' y='2'/>
<gem x='5' y='2'/>
<gem x='2' y='5'/>
<gem x='5' y='5'/>
<gem x='3' y='5'/>
<gem x='4' y='5'/>
<gem x='6' y='3'/>
<gem x='6' y='4'/>
</unmovable>
<day>Jule 24</day>
<level_time>1800</level_time>
</level>
<level number='19'>
<gen_params>
<gem type='Ruby' count='0.2'/>
<gem type='Diamond' count='0.1'/>
<gem type='Amethyst' count='0.2'/>
<gem type='Pyrite' count='0.2'/>
<gem type='Emerald' count='0.18'/>
<gem type='Sapphire' count='0.12'/>
</gen_params>
<size width='8' height='8'/>
<bonuses>
</bonuses>
<goals>
<gem type='Emerald' count='10'/>
<gem type='Ruby' count='10'/>
<gem type='Pyrite' count='10'/>
<gem type='Sapphire' count='10'/>
<gem type='Amethyst' count='10'/>
<gem type='Diamond' count='5'/>
</goals>
<unmovable>
<gem x='1' y='1'/>
<gem x='1' y='2'/>
<gem x='2' y='3'/>
<gem x='2' y='4'/>
<gem x='3' y='5'/>
<gem x='3' y='6'/>
<gem x='4' y='5'/>
<gem x='4' y='6'/>
<gem x='5' y='3'/>
<gem x='5' y='4'/>
<gem x='6' y='1'/>
<gem x='6' y='2'/>
</unmovable>
<day>August 1</day>
<level_time>1800</level_time>
</level>
<level number='98'>
<gen_params>
<gem type='Emerald' count='0.5'/>
<gem type='Ruby' count='0.5'/>
</gen_params>
<size width='5' height='5'/>
<bonuses>
<bonus type='time' count='0' max='0'/>
<bonus type='hammer' count='0' max='0'/>
<bonus type='extra' count='0' max='0'/>
</bonuses>
<goals>
<gem type='Emerald' count='4'/>
<gem type='Ruby' count='2'/>
<gem type='Pyrite' count='4'/>
<gem type='Sapphire' count='2'/>
<gem type='Amethyst' count='4'/>
<gem type='Diamond' count='2'/>
</goals>
<unmovable>
</unmovable>
<day>March 1</day>
<level_time>600</level_time>
</level>
<level number='99'>
<gen_params>
<gem type='Ruby' count='0.2'/>
<gem type='Diamond' count='0.1'/>
<gem type='Amethyst' count='0.2'/>
<gem type='Pyrite' count='0.2'/>
<gem type='Emerald' count='0.18'/>
<gem type='Sapphire' count='0.12'/>
</gen_params>
<size width='8' height='8'/>
<bonuses>
<bonus type='hammer' count='1' max='10'/>
<bonus type='extra' count='1' max='5'/>
</bonuses>
<goals>
<gem type='Emerald' count='5'/>
<gem type='Ruby' count='5'/>
<gem type='Pyrite' count='5'/>
<gem type='Sapphire' count='5'/>
<gem type='Amethyst' count='5'/>
<gem type='Diamond' count='5'/>
</goals>
<unmovable>
<gem x='3' y='2'/>
<gem x='4' y='2'/>
<gem x='2' y='3'/>
<gem x='2' y='4'/>
<gem x='3' y='5'/>
<gem x='4' y='5'/>
<gem x='5' y='3'/>
<gem x='5' y='4'/>
</unmovable>
<day>August 1</day>
<level_time>900</level_time>
</level>
</levels>
;
}
}//package fe
Section 48
//LevelTimer (fe.LevelTimer)
package fe {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class LevelTimer extends MovieClip {
private var initial_width:Number;// = 0
private var timer:Timer;// = null
private var seconds:int;// = 0
private var initial_seconds:int;// = 0
private var max_scale:Number;// = 0
private var timer_line:AnimatedBitmap;// = null
private var time_end_function:Function;// = null
public function LevelTimer(_arg1:int=0, _arg2:Function=null):void{
timer_line = null;
seconds = 0;
initial_seconds = 0;
time_end_function = null;
timer = null;
max_scale = 0;
initial_width = 0;
super();
initial_seconds = (seconds = _arg1);
time_end_function = _arg2;
timer = new Timer(1000, 0);
timer.addEventListener(TimerEvent.TIMER, timerFunction);
}
public function destroy():void{
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, timerFunction);
timer = null;
}
public function addTime(_arg1:int):void{
stopTimer();
seconds = (seconds + _arg1);
initial_seconds = (initial_seconds + _arg1);
max_scale = (220 / initial_width);
startTimer();
timerFunction(null);
}
public function startTimer():void{
timer.start();
}
public function timerFunction(_arg1:TimerEvent):void{
var _local2:String;
var _local3:String;
seconds--;
PlayWindow(parent.parent).updateTimer(seconds);
PlayWindow(parent.parent).updateTimer(seconds);
_local2 = int((seconds / 60)).toString();
_local3 = (seconds % 60).toString();
if (_local2.length == 1){
_local2 = ("0" + _local2);
};
if (_local3.length == 1){
_local3 = ("0" + _local3);
};
if (seconds <= 0){
stopTimer();
time_end_function();
};
}
public function stopTimer():void{
timer.stop();
}
public function removeTime(_arg1:int):void{
stopTimer();
seconds = (seconds - _arg1);
initial_seconds = (initial_seconds - _arg1);
max_scale = (220 / initial_width);
trace("check it");
startTimer();
timerFunction(null);
}
}
}//package fe
Section 49
//MainMenuMC (fe.MainMenuMC)
package fe {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public class MainMenuMC extends MovieClip {
private var PlayDesc:play_description;// = null
public var cs_logo_button:SimpleButton;
public var play_more_games:SimpleButton;
public var title_game:SimpleButton;
public var start_game:SimpleButton;
private var engine:Engine;// = null
public var resume_game:SimpleButton;
public var quit_game:SimpleButton;
public function MainMenuMC(_arg1:Engine=null):void{
PlayDesc = null;
engine = null;
super();
if (_arg1 == null){
return;
};
engine = _arg1;
resume_game.visible = false;
title_game.visible = false;
quit_game.x = 374;
title_game.addEventListener(MouseEvent.MOUSE_UP, clickTitleMenu);
resume_game.addEventListener(MouseEvent.MOUSE_UP, clickResumeGame);
start_game.addEventListener(MouseEvent.MOUSE_UP, clickStartGame);
quit_game.addEventListener(MouseEvent.MOUSE_UP, clickQuit);
quit_game.addEventListener(MouseEvent.MOUSE_OVER, overQuit);
quit_game.addEventListener(MouseEvent.MOUSE_OUT, outQuit);
cs_logo_button.addEventListener(MouseEvent.MOUSE_UP, clickLogo);
play_more_games.addEventListener(MouseEvent.MOUSE_UP, clickLogo);
engine.startMusic();
}
private function clickQuit(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.candystand.com/play.do?id=18317");
navigateToURL(_local2, "_blank");
}
private function clickTitleMenu(_arg1:MouseEvent):void{
engine.playing = false;
engine.mainMenu();
}
private function overQuit(_arg1:MouseEvent):void{
PlayDesc = new play_description();
PlayDesc.y = _arg1.currentTarget.y;
PlayDesc.x = (_arg1.currentTarget.x + 90);
this.addChild(PlayDesc);
}
private function clickLogo(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.candystand.com/");
navigateToURL(_local2, "_blank");
}
private function clickResumeGame(_arg1:MouseEvent):void{
engine.sound(Consts.ClickSound);
if (engine.play_window){
engine.pause();
engine.play_window.visible = true;
} else {
engine.shop.visible = true;
};
if (engine.globalstage.getChildByName("pop_up_caption")){
engine.globalstage.getChildByName("pop_up_caption").visible = true;
};
visible = false;
}
private function clickTournament(_arg1:MouseEvent):void{
engine.sound(Consts.ClickSound);
engine.startTournament();
visible = false;
}
private function outQuit(_arg1:MouseEvent):void{
this.removeChild(PlayDesc);
}
private function clickStartGame(_arg1:MouseEvent):void{
engine.playing = true;
engine.sound(Consts.ClickSound);
engine.startGame();
visible = false;
}
}
}//package fe
Section 50
//Map (fe.Map)
package fe {
public class Map {
public var values:Array;
protected var index_:int;// = 0
public var keys:Array;
public function Map(){
keys = new Array();
values = new Array();
index_ = 0;
super();
}
public function add(_arg1:Object, _arg2):void{
index_ = 0;
find(_arg1);
keys.splice(index_, 0, _arg1);
values.splice(index_, 0, _arg2);
}
public function empty():Boolean{
return ((keys.length == 0));
}
public function shift(){
var _local1:*;
_local1 = values.shift();
keys.shift();
return (_local1);
}
public function remove(_arg1:Object):void{
if (find(_arg1)){
keys.splice(index_, 1);
values.splice(index_, 1);
};
}
public function size():int{
return (keys.length);
}
public function pop(){
var _local1:*;
_local1 = values.pop();
keys.pop();
return (_local1);
}
public function copy(_arg1:Map):void{
var _local2:int;
keys.length = 0;
values.length = 0;
_local2 = 0;
while (_local2 < _arg1.keys.length) {
keys.push(_arg1.keys[_local2]);
values.push(_arg1.values[_local2]);
_local2++;
};
}
public function get(_arg1:Object){
if (!find(_arg1)){
return (null);
};
return (values[index_]);
}
public function getout(_arg1:Object){
var _local2:*;
if (!find(_arg1)){
return (null);
};
_local2 = values[index_];
values.splice(index_, 1);
keys.splice(index_, 1);
return (_local2);
}
public function find(_arg1:Object):Boolean{
var _local2:int;
var _local3:int;
_local2 = 0;
_local3 = (keys.length - 1);
while (_local2 <= _local3) {
index_ = ((_local2 + _local3) >> 1);
if (_arg1 < keys[index_]){
_local3 = (index_ - 1);
} else {
if (_arg1 > keys[index_]){
_local2 = (index_ + 1);
} else {
return (true);
};
};
};
index_ = _local2;
return (false);
}
public function clear():void{
keys.length = 0;
values.length = 0;
index_ = 0;
}
}
}//package fe
Section 51
//MapBuilder (fe.MapBuilder)
package fe {
public class MapBuilder {
private var matrix:Array;
private var engine:Engine;// = null
private var width:int;// = 0
private var result_gems:Array;
private var gemCounter:Number;// = 0
private var height:int;// = 0
private static const empty_cell:String = "empty";
public function MapBuilder(_arg1:Engine, _arg2:int, _arg3:int):void{
var _local4:int;
var _local5:int;
engine = null;
matrix = new Array();
width = 0;
height = 0;
result_gems = [];
gemCounter = 0;
super();
engine = _arg1;
width = _arg2;
height = _arg3;
_local4 = 0;
while (_local4 < height) {
matrix.push(new Array(width));
_local5 = 0;
while (_local5 < width) {
matrix[(matrix.length - 1)][_local5] = empty_cell;
_local5++;
};
_local4++;
};
}
private function emptyCellsFor(_arg1:String):Array{
var _local2:Array;
var _local3:int;
var _local4:int;
_local2 = [];
_local3 = 0;
while (_local3 < height) {
_local4 = 0;
while (_local4 < width) {
if (matrix[_local4][_local3] == empty_cell){
if (cellSuitFor(_local3, _local4, _arg1)){
_local2.push(new Position(_local3, _local4));
};
};
_local4++;
};
_local3++;
};
return (_local2);
}
private function cellSuitFor(_arg1:int, _arg2:int, _arg3:String):Boolean{
if (_arg2 > 0){
if (matrix[(_arg2 - 1)][_arg1] == _arg3){
return (false);
};
};
if (_arg2 < (height - 1)){
if (matrix[(_arg2 + 1)][_arg1] == _arg3){
return (false);
};
};
return (true);
}
public function generate(_arg1:Array):Array{
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:Array;
var _local8:Position;
var _local9:int;
var _local10:Boolean;
var _local11:String;
_local2 = (width * height);
_local3 = _local2;
_local4 = [];
_local5 = 0;
_local5 = 0;
while (_local5 < _arg1.length) {
_local6 = Math.floor((_local2 * _arg1[_local5][1]));
_local3 = (_local3 - _local6);
_local4.push([_arg1[_local5][0], _local6]);
_local5++;
};
while (_local3 > 0) {
var _local12 = _local4[0];
var _local13 = 1;
var _local14 = (_local12[_local13] + 1);
_local12[_local13] = _local14;
_local3--;
};
_local5 = 0;
while (_local5 < _local4.length) {
_local7 = emptyCellsFor(_local4[_local5][0]);
fillCells(_local7, _local4[_local5]);
_local5++;
};
_local7 = emptyCells();
while (_local7.length > 0) {
_local8 = _local7.shift();
_local9 = 0;
_local10 = false;
_local9 = 0;
while (_local9 < _arg1.length) {
_local11 = _arg1[_local9][0];
if ((((((_local8.y > 0)) && (!((matrix[(_local8.y - 1)][_local8.x] == empty_cell))))) && (!((matrix[(_local8.y - 1)][_local8.x] == _local11))))){
if (cellSuitFor(_local8.x, _local8.y, _local11)){
placeGem(_local11, new Position(_local8.x, _local8.y));
_local10 = true;
break;
} else {
moveGem(_local8.x, (_local8.y - 1), _local8.x, _local8.y);
if (cellSuitFor(_local8.x, (_local8.y - 1), _local11)){
placeGem(_local11, new Position(_local8.x, (_local8.y - 1)));
_local10 = true;
break;
};
moveGem(_local8.x, _local8.y, _local8.x, (_local8.y - 1));
};
};
if ((((((_local8.y < (height - 1))) && (!((matrix[(_local8.y + 1)][_local8.x] == empty_cell))))) && (!((matrix[(_local8.y + 1)][_local8.x] == _local11))))){
if (cellSuitFor(_local8.x, _local8.y, _local11)){
placeGem(_local11, new Position(_local8.x, _local8.y));
_local10 = true;
break;
} else {
moveGem(_local8.x, (_local8.y + 1), _local8.x, _local8.y);
if (cellSuitFor(_local8.x, (_local8.y + 1), _local11)){
placeGem(_local11, new Position(_local8.x, (_local8.y + 1)));
_local10 = true;
break;
};
moveGem(_local8.x, _local8.y, _local8.x, (_local8.y + 1));
};
};
_local9++;
};
if (!_local10){
placeGem(_arg1[0][0], _local8);
};
};
return (result_gems);
}
private function placeGem(_arg1:String, _arg2:Position):void{
matrix[_arg2.y][_arg2.x] = _arg1;
result_gems.push(new Gem(_arg1, 1, _arg2));
}
private function emptyCells():Array{
var _local1:Array;
var _local2:int;
var _local3:int;
_local1 = [];
_local2 = 0;
while (_local2 < height) {
_local3 = 0;
while (_local3 < width) {
if (matrix[_local3][_local2] == empty_cell){
_local1.push(new Position(_local2, _local3));
};
_local3++;
};
_local2++;
};
return (_local1);
}
private function fillCells(_arg1:Array, _arg2:Array):void{
var _local3:int;
var _local4:int;
var _local5:Position;
_local3 = 0;
_local4 = 0;
while ((((_arg1.length > 0)) && ((_arg2[1] > 0)))) {
if (!engine.tutorial){
_local4 = (Math.random() * _arg1.length);
if (_local4 >= _arg1.length){
_local4 = (_arg1.length - 1);
};
} else {
_local4 = (Math.random() * _arg1.length);
if (_local4 >= _arg1.length){
_local4 = (_arg1.length - 1);
};
_local4 = gemCounter;
};
trace(_arg2[0]);
_local5 = _arg1[_local4];
placeGem(_arg2[0], _local5);
var _local6 = _arg2;
var _local7 = 1;
var _local8 = (_local6[_local7] - 1);
_local6[_local7] = _local8;
_arg1.splice(_local4, 1);
_local3 = 0;
while (_local3 < _arg1.length) {
if ((((_arg1[_local3].x == _local5.x)) && ((((_arg1[_local3].y == (_local5.y - 1))) || ((_arg1[_local3].y == (_local5.y + 1))))))){
_arg1.splice(_local3, 1);
} else {
_local3++;
};
};
};
}
private function moveGem(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:int;
var _local6:Gem;
_local5 = 0;
_local5 = 0;
while (_local5 < result_gems.length) {
_local6 = result_gems[_local5];
if ((((_local6.pos.x == _arg1)) && ((_local6.pos.y == _arg2)))){
_local6.pos.x = _arg3;
_local6.pos.y = _arg4;
matrix[_arg2][_arg1] = empty_cell;
matrix[_arg4][_arg3] = _local6.type;
return;
};
_local5++;
};
trace("bug__1");
}
}
}//package fe
Section 52
//MapMatrix (fe.MapMatrix)
package fe {
public class MapMatrix {
public var matrix:Array;
public var width:uint;
public var height:uint;
public function MapMatrix(_arg1:uint, _arg2:uint):void{
var _local3:int;
var _local4:int;
matrix = new Array();
super();
width = _arg1;
height = _arg2;
_local3 = 0;
while (_local3 < (height + 1)) {
matrix.push(new Array((width + 1)));
_local4 = 0;
while (_local4 < (width + 1)) {
matrix[(matrix.length - 1)][_local4] = 0;
_local4++;
};
_local3++;
};
}
public function setxy(_arg1:uint, _arg2:uint, _arg3:uint):void{
matrix[_arg2][_arg1] = _arg3;
}
public function clear():void{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < height) {
_local2 = 0;
while (_local2 < width) {
matrix[_local1][_local2] = 0;
_local2++;
};
_local1++;
};
}
public function setpos(_arg1:Position, _arg2:uint):void{
matrix[_arg1.y][_arg1.x] = _arg2;
}
public function copy(_arg1:MapMatrix):void{
var _local2:int;
var _local3:int;
_local2 = 0;
while (_local2 < height) {
_local3 = 0;
while (_local3 < width) {
matrix[_local2][_local3] = _arg1.matrix[_local2][_local3];
_local3++;
};
_local2++;
};
}
public function getxy(_arg1:uint, _arg2:uint):uint{
return (matrix[_arg2][_arg1]);
}
public function getpos(_arg1:Position):uint{
return (matrix[_arg1.y][_arg1.x]);
}
}
}//package fe
Section 53
//MergeGoal (fe.MergeGoal)
package fe {
public class MergeGoal extends Goal {
private var engine:Engine;// = null
private var fgem:Gem;// = null
private var smove:EaseGoal;// = null
private var growGoal:GrowGoal;// = null
private var new_gem:Gem;// = null
private var center:Position;// = null
private var fmove:EaseGoal;// = null
private var sgem:Gem;// = null
public function MergeGoal(_arg1:Engine, _arg2:Gem, _arg3:Gem):void{
engine = null;
fgem = null;
sgem = null;
new_gem = null;
center = null;
fmove = null;
smove = null;
growGoal = null;
super();
engine = _arg1;
engine.mutex.lock();
_arg2.display.gem_sprite.stopRotation();
_arg3.display.gem_sprite.stopRotation();
if (Consts.Vertical == GemOptions.direction(_arg2)){
if (_arg2.pos.y < _arg3.pos.y){
fgem = _arg2;
sgem = _arg3;
} else {
fgem = _arg3;
sgem = _arg2;
};
} else {
if (_arg2.pos.x < _arg3.pos.x){
fgem = _arg2;
sgem = _arg3;
} else {
fgem = _arg3;
sgem = _arg2;
};
};
new_gem = new Gem(fgem.type, (fgem.size * 2), fgem.pos);
new_gem.board = fgem.board;
center = new_gem.graphicCenter();
fmove = new EaseGoal(fgem, center, Consts.GemEaseSpeed);
smove = new EaseGoal(sgem, center, Consts.GemEaseSpeed);
}
public function advance():void{
if (!active){
return;
};
if (((fmove) && (fmove.active))){
fmove.advance();
};
if (((smove) && (smove.active))){
smove.advance();
return;
};
if (((((fmove) && (!(smove.active)))) && (!(fmove.active)))){
smove = null;
fmove = null;
sgem.display.visible = false;
growGoal = new GrowGoal(fgem, (fgem.size * 2));
engine.sound(Consts.MergeSound);
};
if (((growGoal) && (growGoal.active))){
growGoal.advance();
if (!growGoal.active){
growGoal = null;
};
} else {
engine.gem_board.destroyGem(fgem);
engine.gem_board.destroyGem(sgem);
if (engine.extra_money){
engine.goalsys.add(new MoneyPopupGoal(engine, new_gem.graphicCenter(), (Consts.ExtraMoney / 2)));
} else {
engine.score = (engine.score + 1);
engine.play_window.update();
};
if (!engine.gem_board.addGem(new_gem)){
trace("Error: Add after merge failed");
};
deactivate();
engine.balance();
};
}
override public function deactivate():void{
engine.mutex.unlock();
super.deactivate();
}
}
}//package fe
Section 54
//MoneyPopupGoal (fe.MoneyPopupGoal)
package fe {
public final class MoneyPopupGoal extends Goal {
private var money:int;// = 0
private var engine:Engine;// = null
private var top_edge:int;// = 0
private var mpopup:MoneyPopupMC;// = null
public function MoneyPopupGoal(_arg1:Engine, _arg2:Position, _arg3:int):void{
engine = null;
money = 0;
top_edge = 0;
mpopup = null;
super();
engine = _arg1;
money = _arg3;
mpopup = new MoneyPopupMC();
mpopup.txt.text = ("$" + money.toString());
mpopup.x = _arg2.x;
mpopup.y = _arg2.y;
engine.globalstage.addChild(mpopup);
top_edge = (mpopup.y + 40);
engine.addMoney(money);
engine.play_window.update();
}
public function advance():void{
if (mpopup.y > top_edge){
deactivate();
return;
};
mpopup.y++;
}
override public function deactivate():void{
if (mpopup){
engine.globalstage.removeChild(mpopup);
mpopup = null;
};
super.deactivate();
}
}
}//package fe
Section 55
//MovesCounter (fe.MovesCounter)
package fe {
public class MovesCounter {
public var gems:Array;// = null
public var mapping:Map;// = null
private var pairs:Array;// = null
public function MovesCounter():void{
mapping = null;
gems = null;
pairs = null;
super();
}
private function addMove(_arg1:Gem, _arg2:Gem):Boolean{
var _local3:int;
_local3 = 0;
while (_local3 < pairs.length) {
if (((((pairs[_local3][0].isequal(_arg1.pos)) && (pairs[_local3][1].isequal(_arg2.pos)))) || (((pairs[_local3][0].isequal(_arg2.pos)) && (pairs[_local3][1].isequal(_arg1.pos)))))){
return (false);
};
_local3++;
};
pairs.push(new Array(_arg1.pos, _arg2.pos));
return (true);
}
public function calc():int{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Gem;
_local1 = 0;
_local2 = 0;
_local3 = 0;
pairs = new Array();
_local1 = 0;
while (_local1 < gems.length) {
_local4 = gems[_local1];
_local2 = 0;
while (_local2 < gems.length) {
if (((!((_local4.type == gems[_local2].type))) && ((_local4.size == gems[_local2].size)))){
if (tryExchange(_local4, gems[_local2])){
_local3++;
};
if (_local3 > 10){
pairs = null;
return (_local3);
};
};
_local2++;
};
_local1++;
};
pairs = null;
return (_local3);
}
public function tryExchange(_arg1:Gem, _arg2:Gem):Boolean{
var _local3:Position;
var _local4:Gem;
if (((_arg1.unmovable) || (_arg2.unmovable))){
return (false);
};
if (!addMove(_arg1, _arg2)){
return (false);
};
_local3 = null;
_local4 = null;
if (GemOptions.direction(_arg1) == Consts.Vertical){
_local3 = new Position(_arg1.pos.x, (_arg1.pos.y - GemOptions.height(_arg1)));
_local4 = mapping.get(((_local3.x * Consts.MappingInsureMult) + _local3.y));
if (((((((((_local4) && (!(_local4.unmovable)))) && (!(_local3.isequal(_arg2.pos))))) && ((_local4.size == _arg2.size)))) && ((_local4.type == _arg2.type)))){
return (true);
};
_local3 = new Position(_arg1.pos.x, (_arg1.pos.y + GemOptions.height(_arg1)));
_local4 = mapping.get(((_local3.x * Consts.MappingInsureMult) + _local3.y));
if (((((((((_local4) && (!(_local4.unmovable)))) && (!(_local3.isequal(_arg2.pos))))) && ((_local4.size == _arg2.size)))) && ((_local4.type == _arg2.type)))){
return (true);
};
_local3 = new Position(_arg2.pos.x, (_arg2.pos.y - GemOptions.height(_arg2)));
_local4 = mapping.get(((_local3.x * Consts.MappingInsureMult) + _local3.y));
if (((((((((_local4) && (!(_local4.unmovable)))) && (!(_local3.isequal(_arg1.pos))))) && ((_local4.size == _arg1.size)))) && ((_local4.type == _arg1.type)))){
return (true);
};
_local3 = new Position(_arg2.pos.x, (_arg2.pos.y + GemOptions.height(_arg2)));
_local4 = mapping.get(((_local3.x * Consts.MappingInsureMult) + _local3.y));
if (((((((((_local4) && (!(_local4.unmovable)))) && (!(_local3.isequal(_arg1.pos))))) && ((_local4.size == _arg1.size)))) && ((_local4.type == _arg1.type)))){
return (true);
};
} else {
if (GemOptions.direction(_arg1) == Consts.Horizontal){
_local3 = new Position((_arg1.pos.x - GemOptions.width(_arg1)), _arg1.pos.y);
_local4 = mapping.get(((_local3.x * Consts.MappingInsureMult) + _local3.y));
if (((((((((_local4) && (!(_local4.unmovable)))) && (!(_local3.isequal(_arg2.pos))))) && ((_local4.size == _arg2.size)))) && ((_local4.type == _arg2.type)))){
return (true);
};
_local3 = new Position((_arg1.pos.x + GemOptions.width(_arg1)), _arg1.pos.y);
_local4 = mapping.get(((_local3.x * Consts.MappingInsureMult) + _local3.y));
if (((((((((_local4) && (!(_local4.unmovable)))) && (!(_local3.isequal(_arg2.pos))))) && ((_local4.size == _arg2.size)))) && ((_local4.type == _arg2.type)))){
return (true);
};
_local3 = new Position((_arg2.pos.x - GemOptions.width(_arg2)), _arg2.pos.y);
_local4 = mapping.get(((_local3.x * Consts.MappingInsureMult) + _local3.y));
if (((((((((_local4) && (!(_local4.unmovable)))) && (!(_local3.isequal(_arg1.pos))))) && ((_local4.size == _arg1.size)))) && ((_local4.type == _arg1.type)))){
return (true);
};
_local3 = new Position((_arg2.pos.x + GemOptions.width(_arg2)), _arg2.pos.y);
_local4 = mapping.get(((_local3.x * Consts.MappingInsureMult) + _local3.y));
if (((((((((_local4) && (!(_local4.unmovable)))) && (!(_local3.isequal(_arg1.pos))))) && ((_local4.size == _arg1.size)))) && ((_local4.type == _arg1.type)))){
return (true);
};
};
};
return (false);
}
}
}//package fe
Section 56
//Mutex (fe.Mutex)
package fe {
public final class Mutex {
private var actions_locked:int;// = 0
public function Mutex(){
actions_locked = 0;
super();
}
public function isLocked():Boolean{
return ((actions_locked > 0));
}
public function unlock():void{
actions_locked--;
}
public function lock():void{
actions_locked++;
}
}
}//package fe
Section 57
//NumberCounter (fe.NumberCounter)
package fe {
import flash.display.*;
import flash.text.*;
public class NumberCounter extends MovieClip {
private var actualNumber:int;// = 0
private var number_font:String;// = "futura"
private var number_spacing:int;// = 16
private var numberFormat:TextFormat;// = null
private var digitCount:int;// = 0
public function NumberCounter():void{
actualNumber = 0;
digitCount = 0;
number_spacing = 16;
number_font = "futura";
numberFormat = null;
super();
}
public function init(_arg1:int, _arg2:String, _arg3:int=0):void{
var _local4:int;
var _local5:TextField;
digitCount = _arg1;
actualNumber = _arg3;
numberFormat = new TextFormat();
numberFormat.font = new CounterFont().fontName;
numberFormat.color = _arg2;
numberFormat.size = 10;
_local4 = 0;
while (_local4 < _arg1) {
_local5 = new TextField();
_local5.name = ("digit_" + _local4);
_local5.x = (_local4 * 16);
_local5.height = 16;
_local5.width = 16;
_local5.embedFonts = true;
_local5.defaultTextFormat = numberFormat;
_local5.selectable = false;
addChild(_local5);
_local4++;
};
updateNumber(actualNumber);
}
public function updateNumber(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:*;
var _local5:int;
actualNumber = _arg1;
_local2 = actualNumber;
_local3 = 0;
while (_local3 < digitCount) {
_local4 = ((digitCount - _local3) - 1);
_local5 = (_local2 / Math.pow(10, _local4));
TextField(getChildByName(("digit_" + _local3))).text = String(_local5);
_local2 = (_local2 - (_local5 * Math.pow(10, _local4)));
_local3++;
};
}
}
}//package fe
Section 58
//PlayWindow (fe.PlayWindow)
package fe {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class PlayWindow extends MovieClip {
private var gem_board:GemBoard;// = null
public var menu_button:SimpleButton;
public var levelgo:LevelGoMC;// = null
public var movesMC;
public var bonus_layer:bonusLayer;// = null
private var info_small:SubHelpMotion;// = null
public var timer:LevelTimer;// = null
public var well_done:WellDoneMC;// = null
private var first_help:FirstHelpMC;// = null
public var creditMC;
public var double_bonus_text:MovieClip;
public var sound_clip:SoundControlMC;
private var Intro_HTP:Boolean;// = false
public var scoreMC;
private var info_layer:Sprite;// = null
public var timerMC:NumberCounter;// = null
public var engine:Engine;// = null
private var info:GoalInfoMotion;// = null
private var goals:GameGoals;// = null
public var paused_motion:PausedMotion;// = null
public var hammer_cursor:Sprite;// = null
public var help_button:SimpleButton;
public function PlayWindow():void{
engine = null;
gem_board = null;
goals = null;
timer = null;
info = null;
info_small = null;
paused_motion = null;
info_layer = null;
bonus_layer = null;
hammer_cursor = null;
well_done = null;
levelgo = null;
timerMC = null;
first_help = null;
Intro_HTP = false;
super();
}
public function updateTimer(_arg1):void{
timerMC.updateNumber(_arg1);
}
public function updateInfo():void{
var _local1:int;
_local1 = engine.gem_board.basket.calcMoves();
if (_local1 > 10){
};
}
public function setTimer(_arg1:int, _arg2:Function):void{
if (timer){
timer.stopTimer();
info_layer.removeChild(timer);
};
timer = new LevelTimer(_arg1, _arg2);
timer.x = ((Consts.GameWidth - timer.width) - 100);
timer.y = ((Consts.GameHeight - timer.height) - 5);
info_layer.addChild(timer);
}
private function pauseClick(_arg1:MouseEvent):void{
engine.sound(Consts.ClickSound);
engine.pause();
}
public function goalClick(_arg1:MouseEvent):void{
if (info.currentLabel == "ride_still"){
info.gotoAndPlay("ride_out");
if (Intro_HTP){
Intro_HTP = false;
engine.mutex.unlock();
timer.startTimer();
engine.events.register();
levelgo.play();
} else {
engine.pause();
};
return;
};
engine.pause();
engine.sound(Consts.ClickSound);
info.gotoAndPlay("ride");
info.help_mc.close_button.addEventListener(MouseEvent.MOUSE_UP, closeGoalClick);
info.help_mc.continue_button.addEventListener(MouseEvent.MOUSE_UP, closeGoalClick);
}
public function createHammerCursor():void{
hammer_cursor = new HammerBonusCursorMC();
hammer_cursor.name = "hammer_cursor";
bonus_layer.addChild(hammer_cursor);
bonus_layer.hit_layer.visible = true;
}
public function closeGoalClick(_arg1:MouseEvent):void{
if (info.currentLabel == "ride_still"){
info.gotoAndPlay("ride_out");
};
if (Intro_HTP){
Intro_HTP = false;
engine.mutex.unlock();
timer.startTimer();
engine.events.register();
levelgo.play();
} else {
engine.pause();
};
}
public function closeSubHelpClick(_arg1:MouseEvent):void{
if (info_small.currentLabel == "ride_still"){
info_small.gotoAndPlay("ride_out");
if (Intro_HTP){
Intro_HTP = false;
engine.mutex.unlock();
timer.startTimer();
engine.events.register();
levelgo.play();
} else {
engine.pause();
};
return;
};
engine.pause();
engine.sound(Consts.ClickSound);
info_small.gotoAndPlay("ride");
info_small.help_mc.close_button.addEventListener(MouseEvent.MOUSE_UP, closeSubHelpClick);
info_small.help_mc.continue_button.addEventListener(MouseEvent.MOUSE_UP, closeSubHelpClick);
}
public function initialize(_arg1:Engine, _arg2:GemBoard):void{
engine = _arg1;
gem_board = _arg2;
gem_board.x = 61;
gem_board.y = 20;
addChild(gem_board);
menu_button.addEventListener(MouseEvent.MOUSE_UP, menuClick);
help_button.addEventListener(MouseEvent.MOUSE_UP, goalClick);
double_bonus_text.visible = false;
double_bonus_text.stop();
well_done = new WellDoneMC(engine);
well_done.well_done_2.visible = false;
well_done.well_done_1.visible = true;
well_done.x = 0;
well_done.y = 0;
well_done.visible = false;
addChild(well_done);
levelgo = new LevelGoMC();
levelgo.x = 250;
levelgo.y = (((Consts.GameHeight / 2) - (levelgo.height / 2)) - 150);
levelgo.visible = false;
addChild(levelgo);
timerMC = new NumberCounter();
timerMC.x = 548;
timerMC.y = 1.1;
timerMC.init(9, "0xFFFFFF");
addChild(timerMC);
scoreMC = new NumberCounter();
scoreMC.x = 112;
scoreMC.y = 1.1;
scoreMC.init(9, "0xFFFFFF");
addChild(scoreMC);
creditMC = new NumberCounter();
creditMC.x = 340;
creditMC.y = 1.1;
creditMC.init(9, "0x4C6B00");
addChild(creditMC);
bonus_layer = new bonusLayer();
bonus_layer.hit_layer.visible = false;
bonus_layer.hit_layer.addEventListener(MouseEvent.MOUSE_OVER, BonusMouseOver);
bonus_layer.hit_layer.addEventListener(MouseEvent.MOUSE_OUT, BonusMouseOut);
bonus_layer.hit_layer.addEventListener(MouseEvent.MOUSE_DOWN, BonusMouseDown);
addChild(bonus_layer);
info_layer = new Sprite();
addChild(info_layer);
info = new GoalInfoMotion();
info.y = Consts.GameHeight;
addChild(info);
info_small = new SubHelpMotion();
info_small.y = Consts.GameHeight;
addChild(info_small);
}
public function makeGoals(_arg1:GameGoals):void{
if (goals){
info_layer.removeChild(goals.bar);
};
goals = _arg1;
goals.buildBar();
goals.bar.x = 10;
goals.bar.y = 50;
info_layer.addChild(goals.bar);
}
public function menuClick(_arg1:MouseEvent):void{
engine.sound(Consts.ClickSound);
if (!engine.paused){
engine.pause();
};
engine.mainMenu();
}
public function BonusMouseDown(_arg1:MouseEvent):void{
if (bonus_layer.getChildByName("hammer_cursor")){
engine.hammer_bonus_placeholder = null;
engine.hammer_bonus = false;
removeHammerCursor();
engine.mutex.unlock();
};
}
public function updatedGoalPositions():void{
goals.updatedGoalPositions();
}
public function BonusMouseOut(_arg1:MouseEvent):void{
if (bonus_layer.getChildByName("hammer_cursor")){
HammerBonusCursorMC(bonus_layer.getChildByName("hammer_cursor")).gotoAndStop("select");
};
}
public function removeHammerCursor():void{
bonus_layer.hit_layer.visible = false;
bonus_layer.removeChild(hammer_cursor);
hammer_cursor = null;
}
public function update():void{
scoreMC.updateNumber(engine.score);
creditMC.updateNumber(engine.nmoney);
}
public function postInit():void{
if (engine.current_level_number == 3){
Intro_HTP = true;
info_small.gotoAndStop("ride_still");
info_small.help_mc.close_button.addEventListener(MouseEvent.MOUSE_UP, closeSubHelpClick);
info_small.help_mc.continue_button.addEventListener(MouseEvent.MOUSE_UP, closeSubHelpClick);
levelgo.stop();
engine.mutex.lock();
timer.stopTimer();
engine.events.unregister();
};
}
public function deinitialize():void{
timer.destroy();
goals.gcaption.removeEventListener(MouseEvent.MOUSE_UP, goalClick);
removeChild(gem_board);
removeChild(info_layer);
removeChild(bonus_layer);
removeChild(info);
removeChild(well_done);
if (hammer_cursor){
removeHammerCursor();
};
menu_button.removeEventListener(MouseEvent.MOUSE_UP, menuClick);
help_button.removeEventListener(MouseEvent.MOUSE_UP, goalClick);
gem_board = null;
info_layer = null;
bonus_layer = null;
info = null;
well_done = null;
}
public function testTrace(_arg1:String):void{
trace(("TT: " + _arg1));
}
public function BonusMouseOver(_arg1:MouseEvent):void{
if (bonus_layer.getChildByName("hammer_cursor")){
HammerBonusCursorMC(bonus_layer.getChildByName("hammer_cursor")).gotoAndStop("cancel");
};
}
private function closeFirstHelp(_arg1:MouseEvent):void{
first_help.close_button.removeEventListener(MouseEvent.MOUSE_UP, closeFirstHelp);
removeChild(first_help);
engine.mutex.unlock();
timer.startTimer();
engine.events.register();
levelgo.play();
}
}
}//package fe
Section 59
//PopupCaptionGoal (fe.PopupCaptionGoal)
package fe {
public class PopupCaptionGoal extends Goal {
private var engine:Engine;// = null
private var caption:PopupText;// = null
private var till:Boolean;// = true
private var after_goal:Goal;// = null
public function PopupCaptionGoal(_arg1:Engine, _arg2:String, _arg3):void{
after_goal = null;
caption = null;
engine = null;
till = true;
super();
engine = _arg1;
engine.mutex.lock();
after_goal = _arg3;
caption = new PopupText();
caption.caption.text = _arg2;
caption.y = ((Consts.GameHeight - caption.height) / 2);
caption.x = 0;
caption.alpha = 0;
caption.name = "pop_up_caption";
engine.globalstage.addChild(caption);
}
public function advance():void{
if (till){
caption.alpha = (caption.alpha + 0.05);
if (caption.alpha >= 1){
till = false;
if (after_goal){
engine.goalsys.add(after_goal);
};
};
} else {
caption.alpha = (caption.alpha - 0.05);
if (caption.alpha <= 0){
deactivate();
};
};
}
override public function deactivate():void{
engine.globalstage.removeChild(caption);
super.deactivate();
engine.mutex.unlock();
}
}
}//package fe
Section 60
//Position (fe.Position)
package fe {
public class Position {
public var x:int;// = 0
public var y:int;// = 0
public function Position(_arg1:int=0, _arg2:int=0):void{
x = 0;
y = 0;
super();
set(_arg1, _arg2);
}
public function copy(_arg1:Position):void{
x = _arg1.x;
y = _arg1.y;
}
public function set(_arg1:int, _arg2:int):void{
x = _arg1;
y = _arg2;
}
public function isequal(_arg1:Position):Boolean{
return ((((x == _arg1.x)) && ((y == _arg1.y))));
}
}
}//package fe
Section 61
//RotateGoal (fe.RotateGoal)
package fe {
public class RotateGoal extends Goal {
public var dode:Dodecahedron;// = null
public function RotateGoal(_arg1:Dodecahedron):void{
dode = null;
super();
dode = _arg1;
}
public function advance():void{
dode.rotate(5);
}
}
}//package fe
Section 62
//Shop (fe.Shop)
package fe {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import com.candystand.ScoreSubmit.*;
public class Shop extends MovieClip {
public var main_menu:SimpleButton;
public var buy_strip:SimpleButton;
public var sold_out_helicopter:MovieClip;
private var CasinoTotal:int;// = 0
public var sold_out_limosine:MovieClip;
private var final_victory:Boolean;// = false
public var sold_out_casino:MovieClip;
public var casino_1:MovieClip;
public var casino_2:MovieClip;
public var casino_3:MovieClip;
public var casino_4:MovieClip;
private var engine:Engine;// = null
public var creditMC;
public var buy_limosine:SimpleButton;
public var final_score:MovieClip;
public var main_menu_2:SimpleButton;
public var strip_1:MovieClip;
public var strip_2:MovieClip;
public var strip_3:MovieClip;
public var strip_4:MovieClip;
public var strip_5:MovieClip;
public var play_next:SimpleButton;
public var quit_button:SimpleButton;
private var StripTotal:int;// = 0
public var buy_helicopter:SimpleButton;
public var sold_out_strip:MovieClip;
public var scoreMC_2;
public var limosine_1:MovieClip;
public var limosine_2:MovieClip;
public var limosine_3:MovieClip;
public var limosine_4:MovieClip;
public var limosine_5:MovieClip;
public var nomoney:MovieClip;
public var scoreMC;
public var timerMC:NumberCounter;// = null
private var HelicopterTotal:int;// = 0
private var LimosineTotal:int;// = 0
public var shop_title_1:MovieClip;
public var shop_title_2:MovieClip;
public var helicopter_1:MovieClip;
public var helicopter_2:MovieClip;
public var helicopter_4:MovieClip;
public var helicopter_5:MovieClip;
public var buy_casino:SimpleButton;
public var helicopter_3:MovieClip;
public var movesMC;
public function Shop(_arg1:Engine=null):void{
engine = null;
final_victory = false;
timerMC = null;
CasinoTotal = 0;
HelicopterTotal = 0;
LimosineTotal = 0;
StripTotal = 0;
super();
addFrameScript(0, frame1, 14, frame15, 44, frame45);
engine = _arg1;
buy_casino.visible = true;
buy_helicopter.visible = true;
buy_limosine.visible = true;
buy_strip.visible = true;
buy_casino.addEventListener(MouseEvent.MOUSE_UP, clickBuyCasino);
buy_helicopter.addEventListener(MouseEvent.MOUSE_UP, clickBuyHelicopter);
buy_limosine.addEventListener(MouseEvent.MOUSE_UP, clickBuyLimosine);
buy_strip.addEventListener(MouseEvent.MOUSE_UP, clickBuyStrip);
sold_out_casino.visible = false;
sold_out_helicopter.visible = false;
sold_out_limosine.visible = false;
sold_out_strip.visible = false;
casino_1.visible = false;
casino_2.visible = false;
casino_3.visible = false;
casino_4.visible = false;
helicopter_1.visible = false;
helicopter_2.visible = false;
helicopter_3.visible = false;
helicopter_4.visible = false;
helicopter_5.visible = false;
limosine_1.visible = false;
limosine_2.visible = false;
limosine_3.visible = false;
limosine_4.visible = false;
limosine_5.visible = false;
strip_1.visible = false;
strip_2.visible = false;
strip_3.visible = false;
strip_4.visible = false;
strip_5.visible = false;
timerMC = new NumberCounter();
timerMC.x = 548;
timerMC.y = 1.1;
timerMC.init(9, "0xFFFFFF");
addChild(timerMC);
scoreMC = new NumberCounter();
scoreMC.x = 112;
scoreMC.y = 1.1;
scoreMC.init(9, "0xFFFFFF");
addChild(scoreMC);
scoreMC_2 = new NumberCounter();
scoreMC_2.x = 344;
scoreMC_2.y = 405.1;
scoreMC_2.init(9, "0xFFFFFF");
addChild(scoreMC_2);
creditMC = new NumberCounter();
creditMC.x = 340;
creditMC.y = 1.1;
creditMC.init(9, "0x4C6B00");
addChild(creditMC);
final_score.visible = false;
main_menu_2.visible = false;
quit_button.visible = false;
scoreMC_2.visible = false;
shop_title_2.visible = false;
main_menu.addEventListener(MouseEvent.MOUSE_UP, clickMainMenu);
play_next.addEventListener(MouseEvent.MOUSE_UP, clickPlayNext);
main_menu_2.addEventListener(MouseEvent.MOUSE_UP, clickMainMenu);
quit_button.addEventListener(MouseEvent.MOUSE_UP, clickQuitButton);
}
private function clickQuitButton(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.candystand.com/play.do?id=18317");
navigateToURL(_local2, "_blank");
}
function frame1(){
stop();
}
private function clickBuyHelicopter(_arg1:MouseEvent):void{
if (!calcMoney(10000)){
return;
};
if (HelicopterTotal == 4){
sold_out_helicopter.visible = true;
buy_helicopter.removeEventListener(MouseEvent.MOUSE_DOWN, clickBuyHelicopter);
buy_helicopter.visible = false;
};
HelicopterTotal++;
addHelicopter();
}
function frame15(){
}
private function clickMainMenu(_arg1:MouseEvent):void{
engine.sound(Consts.ClickSound);
engine.mainMenu();
}
private function addLimosine():void{
MovieClip(getChildByName(("limosine_" + LimosineTotal))).visible = true;
}
function frame45(){
stop();
}
public function update():void{
scoreMC.updateNumber(engine.score);
scoreMC_2.updateNumber(engine.score);
creditMC.updateNumber(engine.nmoney);
}
private function clickBuyLimosine(_arg1:MouseEvent):void{
if (!calcMoney(10000)){
return;
};
if (LimosineTotal == 4){
sold_out_limosine.visible = true;
buy_limosine.removeEventListener(MouseEvent.MOUSE_DOWN, clickBuyLimosine);
buy_limosine.visible = false;
};
LimosineTotal++;
addLimosine();
}
private function addStrip():void{
MovieClip(getChildByName(("strip_" + StripTotal))).visible = true;
}
public function levelsOver():void{
main_menu.visible = false;
play_next.visible = false;
shop_title_1.visible = false;
final_score.visible = true;
main_menu_2.visible = true;
quit_button.visible = true;
scoreMC_2.visible = true;
shop_title_2.visible = true;
}
private function addHelicopter():void{
MovieClip(getChildByName(("helicopter_" + HelicopterTotal))).visible = true;
}
private function calcMoney(_arg1:int):Boolean{
if (final_victory){
return (false);
};
engine.sound(Consts.ClickSound);
if (engine.nmoney >= _arg1){
engine.nmoney = (engine.nmoney - _arg1);
update();
} else {
nomoney.gotoAndPlay("run");
return (false);
};
return (true);
}
private function clickBuyCasino(_arg1:MouseEvent):void{
if (!calcMoney(10000)){
return;
};
if (CasinoTotal == 3){
sold_out_casino.visible = true;
buy_casino.removeEventListener(MouseEvent.MOUSE_DOWN, clickBuyCasino);
buy_casino.visible = false;
};
CasinoTotal++;
addCasino();
}
private function clickBuyStrip(_arg1:MouseEvent):void{
if (!calcMoney(10000)){
return;
};
if (StripTotal == 4){
sold_out_strip.visible = true;
buy_strip.removeEventListener(MouseEvent.MOUSE_DOWN, clickBuyStrip);
buy_strip.visible = false;
};
StripTotal++;
addStrip();
}
private function clickPlayNext(_arg1:MouseEvent):void{
engine.sound(Consts.ClickSound);
engine.clearAll();
engine.current_level_number++;
engine.nextLevel();
visible = false;
}
private function addCasino():void{
MovieClip(getChildByName(("casino_" + CasinoTotal))).visible = true;
}
}
}//package fe
Section 63
//ShuffleGoal (fe.ShuffleGoal)
package fe {
public class ShuffleGoal extends Goal {
private var goals:GoalSystem;// = null
private var engine:Engine;// = null
private var big_gems:Array;// = null
private var gen_params:Array;// = null
private var generation:Boolean;// = false
public function ShuffleGoal(_arg1:Engine, _arg2:Array):void{
var _local3:int;
engine = null;
big_gems = null;
goals = null;
gen_params = null;
generation = false;
super();
engine = _arg1;
gen_params = _arg2;
engine.mutex.lock();
goals = new GoalSystem();
big_gems = engine.gem_board.basket.getGemsGreater(2);
_local3 = 0;
_local3 = 0;
while (_local3 < big_gems.length) {
goals.add(new GemFadeGoal(big_gems[_local3]));
_local3++;
};
}
public function advance():void{
var _local1:int;
var _local2:Array;
var _local3:Gem;
var _local4:Position;
var _local5:int;
goals.tick();
if (!goals.activeCount()){
if (!generation){
_local1 = 0;
_local1 = 0;
while (_local1 < big_gems.length) {
engine.gem_board.destroyGem(big_gems[_local1]);
_local1++;
};
_local2 = engine.gem_board.basket.fillEmpty(gen_params);
_local1 = 0;
while (_local1 < _local2.length) {
if (!engine.gem_board.addGem(_local2[_local1])){
trace("replaceGems - add after fill failed!");
};
_local3 = _local2[_local1];
_local4 = _local3.graphicCenter();
_local5 = ((_local4.y - (Math.random() * 1000)) - 500);
_local3.display.y = _local5;
goals.add(new EaseGoal(_local3, _local4, 0.3));
_local1++;
};
engine.sound(Consts.DiceSound);
generation = true;
} else {
deactivate();
};
};
}
override public function deactivate():void{
engine.play_window.updateInfo();
engine.mutex.unlock();
engine.balance();
super.deactivate();
}
}
}//package fe
Section 64
//SizeReduceGoal (fe.SizeReduceGoal)
package fe {
public class SizeReduceGoal extends Goal {
private var gem:Gem;// = null
public function SizeReduceGoal(_arg1:Gem):void{
gem = null;
super();
gem = _arg1;
}
public function advance():void{
gem.display.scale((gem.display.scaleX * 0.9));
if (gem.display.scaleX <= 0.1){
deactivate();
};
}
}
}//package fe
Section 65
//SoundControlMC (fe.SoundControlMC)
package fe {
import fl.controls.*;
import flash.display.*;
import flash.media.*;
import flash.events.*;
import fl.events.*;
public class SoundControlMC extends MovieClip {
public var off_button:SimpleButton;
private var music_slider:Slider;// = null
public var off_static:MovieClip;
private var actions_slider:Slider;// = null
public var engine:Engine;// = null
public var on_button:SimpleButton;
public var on_static:MovieClip;
public function SoundControlMC():void{
engine = null;
music_slider = null;
actions_slider = null;
super();
music_slider = new Slider();
music_slider.liveDragging = true;
music_slider.setSize(100, 0);
music_slider.maximum = 100;
music_slider.minimum = 0;
music_slider.tickInterval = 5;
music_slider.addEventListener(SliderEvent.CHANGE, musicChange);
music_slider.x = 70;
music_slider.y = 0;
addChild(music_slider);
actions_slider = new Slider();
actions_slider.liveDragging = true;
actions_slider.setSize(100, 0);
actions_slider.maximum = 100;
actions_slider.minimum = 0;
actions_slider.tickInterval = 5;
actions_slider.addEventListener(SliderEvent.CHANGE, actionsChange);
actions_slider.x = 70;
actions_slider.y = 35;
addChild(actions_slider);
music_slider.value = 100;
actions_slider.value = 100;
}
private function actionsChange(_arg1:SliderEvent):void{
engine.actions_volume = (actions_slider.value / 100);
}
private function unmuteMusic(_arg1:MouseEvent):void{
engine.music_state = true;
music_slider.value = 50;
actions_slider.value = 100;
musicChange(null);
actionsChange(null);
off_button.addEventListener(MouseEvent.MOUSE_DOWN, muteMusic);
on_static.visible = true;
off_button.visible = true;
off_static.visible = false;
on_button.visible = false;
on_button.removeEventListener(MouseEvent.MOUSE_DOWN, unmuteMusic);
}
private function musicChange(_arg1:SliderEvent):void{
var _local2:SoundTransform;
engine.music_volume = (music_slider.value / 100);
if (engine.music_channel){
_local2 = engine.music_channel.soundTransform;
_local2.volume = engine.music_volume;
engine.music_channel.soundTransform = _local2;
};
}
public function setEngine(_arg1:Engine):void{
engine = _arg1;
if (engine.music_state){
off_button.addEventListener(MouseEvent.MOUSE_DOWN, muteMusic);
on_static.visible = true;
off_button.visible = true;
off_static.visible = false;
on_button.visible = false;
} else {
on_static.visible = false;
off_button.visible = false;
off_static.visible = true;
on_button.visible = true;
on_button.addEventListener(MouseEvent.MOUSE_DOWN, unmuteMusic);
};
music_slider.value = (engine.music_volume * 100);
actions_slider.value = (engine.actions_volume * 100);
}
private function muteMusic(_arg1:MouseEvent):void{
engine.music_state = false;
music_slider.value = 0;
actions_slider.value = 0;
musicChange(null);
actionsChange(null);
off_button.removeEventListener(MouseEvent.MOUSE_DOWN, muteMusic);
on_static.visible = false;
off_button.visible = false;
off_static.visible = true;
on_button.visible = true;
on_button.addEventListener(MouseEvent.MOUSE_DOWN, unmuteMusic);
}
}
}//package fe
Section 66
//TextPopupGoal (fe.TextPopupGoal)
package fe {
public final class TextPopupGoal extends Goal {
private var money:int;// = 0
private var engine:Engine;// = null
private var top_edge:int;// = 0
private var mpopup:MoneyPopupMC;// = null
public function TextPopupGoal(_arg1:Engine, _arg2:String):void{
engine = null;
money = 0;
top_edge = 0;
mpopup = null;
super();
engine = _arg1;
mpopup = new MoneyPopupMC();
mpopup.txt.text = _arg2;
mpopup.x = (Consts.GameWidth - 150);
mpopup.y = 20;
engine.globalstage.addChild(mpopup);
top_edge = (mpopup.y + 30);
}
public function advance():void{
if (mpopup.y > top_edge){
deactivate();
return;
};
mpopup.y++;
}
override public function deactivate():void{
if (mpopup){
engine.globalstage.removeChild(mpopup);
mpopup = null;
};
super.deactivate();
}
}
}//package fe
Section 67
//TimeIsUpScreenMC (fe.TimeIsUpScreenMC)
package fe {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class TimeIsUpScreenMC extends MovieClip {
public var try_again:SimpleButton;
public var main_menu:SimpleButton;
public var quit_menu:SimpleButton;
private var engine:Engine;// = null
public function TimeIsUpScreenMC(_arg1:Engine=null):void{
engine = null;
super();
if (_arg1 == null){
return;
};
engine = _arg1;
engine.globalstage.addChild(this);
try_again.addEventListener(MouseEvent.MOUSE_DOWN, clickTryAgain);
main_menu.addEventListener(MouseEvent.MOUSE_DOWN, clickMainMenu);
quit_menu.addEventListener(MouseEvent.MOUSE_DOWN, clickQuitButton);
}
private function destroy():void{
try_again.removeEventListener(MouseEvent.MOUSE_DOWN, clickTryAgain);
main_menu.removeEventListener(MouseEvent.MOUSE_DOWN, clickMainMenu);
quit_menu.removeEventListener(MouseEvent.MOUSE_DOWN, clickQuitButton);
engine.globalstage.removeChild(this);
}
public function clickTryAgain(_arg1:MouseEvent):void{
engine.resetLevelScores();
engine.clearAll();
engine.nextLevel();
}
public function clickQuitButton(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.candystand.com/play.do?id=18317");
navigateToURL(_local2, "_blank");
}
public function clickMainMenu(_arg1:MouseEvent):void{
destroy();
engine.mainMenu();
}
}
}//package fe
Section 68
//TutorialPanel (fe.TutorialPanel)
package fe {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public dynamic class TutorialPanel extends MovieClip {
private var timer:Timer;// = null
private var tutorial:Number;// = 1
public var engine:Engine;// = null
public var continue_button:SimpleButton;
public var skip_button:SimpleButton;
public function TutorialPanel(_arg1:Engine=null):void{
timer = null;
engine = null;
tutorial = 1;
super();
addFrameScript(0, frame1, 1, frame2, 39, frame40, 40, frame41, 89, frame90, 90, frame91, 113, frame114, 204, frame205, 234, frame235, 303, frame304, 304, frame305, 334, frame335, 364, frame365, 404, frame405, 440, frame441, 468, frame469, 499, frame500, 580, frame581, 620, frame621, 701, frame702, 731, frame732, 800, frame801, 801, frame802, 900, frame901, 901, frame902, 902, frame903, 971, frame972);
engine = _arg1;
skip_button.addEventListener(MouseEvent.MOUSE_UP, clickSkipButton);
}
function frame702(){
engine.gem_board.gemMouseDown(null, 248, 343);
play();
}
function frame305(){
play();
continue_button.removeEventListener(MouseEvent.MOUSE_UP, continueClick3);
}
function frame441(){
engine.pause();
}
public function continueClick(_arg1:MouseEvent):void{
play();
}
public function continueClick2(_arg1:MouseEvent):void{
gotoAndPlay("step4");
engine.pause();
}
public function continueClick3(_arg1:MouseEvent):void{
gotoAndPlay("step5");
}
public function continueClick4(_arg1:MouseEvent):void{
gotoAndPlay("step6");
}
function frame90(){
engine.gem_board.gemMouseDown(null, 123, 158);
play();
}
private function clickSkipButton(_arg1:MouseEvent):void{
trace("skip");
stop();
engine.sound(Consts.ClickSound);
engine.clearAll();
engine.nextLevel();
engine.tutorialFinish(this);
}
function frame91(){
play();
}
function frame732(){
engine.gem_board.gemMouseDown(null, 450, 250);
play();
}
function frame205(){
continue_button.removeEventListener(MouseEvent.MOUSE_UP, continueClick2);
play();
}
function frame972(){
stop();
}
function frame335(){
engine.gem_board.gemMouseDown(null, 373, 65);
play();
}
function frame1(){
continue_button.addEventListener(MouseEvent.MOUSE_UP, continueClick);
stop();
}
private function clickContinueButton(_arg1:MouseEvent):void{
}
function frame469(){
engine.pause();
}
function frame902(){
play();
}
function frame903(){
continue_button.addEventListener(MouseEvent.MOUSE_UP, clickSkipButton);
}
function frame500(){
engine.pause();
}
function frame901(){
stop();
}
function frame581(){
engine.gem_board.gemMouseDown(null, 123, 342);
play();
}
function frame621(){
engine.gem_board.gemMouseDown(null, 373, 250);
play();
}
function frame114(){
engine.pause();
continue_button.addEventListener(MouseEvent.MOUSE_UP, continueClick2);
stop();
}
function frame40(){
engine.gem_board.gemMouseDown(null, 498, 65);
play();
}
function frame802(){
play();
continue_button.removeEventListener(MouseEvent.MOUSE_UP, continueClick4);
continue_button.addEventListener(MouseEvent.MOUSE_UP, clickSkipButton);
}
function frame41(){
play();
}
function frame405(){
engine.pause();
}
function frame2(){
continue_button.removeEventListener(MouseEvent.MOUSE_UP, continueClick);
play();
}
function frame801(){
continue_button.addEventListener(MouseEvent.MOUSE_UP, continueClick4);
stop();
}
function frame365(){
engine.gem_board.gemMouseDown(null, 248, 158);
play();
}
function frame235(){
continue_button.addEventListener(MouseEvent.MOUSE_UP, continueClick3);
}
function frame304(){
stop();
}
}
}//package fe
Section 69
//WellDoneMC (fe.WellDoneMC)
package fe {
import flash.display.*;
import flash.events.*;
public class WellDoneMC extends MovieClip {
public var well_done_1:MovieClip;
private var engine:Engine;// = null
public var well_done_2:MovieClip;
public var continue_button:SimpleButton;
public function WellDoneMC(_arg1:Engine=null):void{
engine = null;
super();
addFrameScript(0, frame1);
engine = _arg1;
continue_button.addEventListener(MouseEvent.MOUSE_UP, clickContinue);
}
function frame1(){
stop();
}
private function clickContinue(_arg1:MouseEvent):void{
engine.showShop();
}
}
}//package fe
Section 70
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
import flash.utils.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 71
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 72
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 73
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 74
//Slider (fl.controls.Slider)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class Slider extends UIComponent implements IFocusManagerComponent {
protected var _direction:String;
protected var _liveDragging:Boolean;// = false
protected var _value:Number;// = 0
protected var _snapInterval:Number;// = 0
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var track:BaseButton;
protected var _tickInterval:Number;// = 0
protected var tickContainer:Sprite;
protected var thumb:BaseButton;
protected static const TICK_STYLES:Object = {upSkin:"tickSkin"};
protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"};
protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"};
protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null};
public function Slider(){
_direction = SliderDirection.HORIZONTAL;
_minimum = 0;
_maximum = 10;
_value = 0;
_tickInterval = 0;
_snapInterval = 0;
_liveDragging = false;
super();
setStyles();
}
public function get minimum():Number{
return (_minimum);
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
this.value = Math.max(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
protected function positionThumb():void{
thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? ((maximum - minimum) - value) : (value - minimum) / (maximum - minimum)) * _width);
}
protected function clearTicks():void{
if (((!(tickContainer)) || (!(tickContainer.parent)))){
return;
};
removeChild(tickContainer);
}
protected function onTrackClick(_arg1:MouseEvent):void{
calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK);
if (!liveDragging){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE));
};
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
this.value = Math.min(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get liveDragging():Boolean{
return (_liveDragging);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_width / snapInterval);
_local3 = track.mouseX;
calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:uint;
var _local3:Number;
var _local4:Boolean;
if (!enabled){
return;
};
_local2 = ((snapInterval)>0) ? snapInterval : 1;
_local4 = (direction == SliderDirection.HORIZONTAL);
if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){
_local3 = (value - _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){
_local3 = (value + _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){
_local3 = minimum;
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){
_local3 = maximum;
};
};
};
};
if (!isNaN(_local3)){
_arg1.stopPropagation();
doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode);
};
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
super.enabled = _arg1;
track.enabled = (thumb.enabled = _arg1);
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
}
public function get snapInterval():Number{
return (_snapInterval);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
public function set liveDragging(_arg1:Boolean):void{
_liveDragging = _arg1;
}
public function set value(_arg1:Number):void{
doSetValue(_arg1);
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
_direction = _arg1;
_local2 = (_direction == SliderDirection.VERTICAL);
if (isLivePreview){
if (_local2){
setScaleY(-1);
y = track.height;
} else {
setScaleY(1);
y = 0;
};
positionThumb();
return;
};
if (((_local2) && (componentInspectorSetting))){
if ((rotation % 90) == 0){
setScaleY(-1);
};
};
if (!componentInspectorSetting){
rotation = (_local2) ? 90 : 0;
};
}
public function set tickInterval(_arg1:Number):void{
_tickInterval = _arg1;
invalidate(InvalidationType.SIZE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
track.setSize(_width, track.height);
track.drawNow();
thumb.drawNow();
};
if (tickInterval > 0){
drawTicks();
} else {
clearTicks();
};
positionThumb();
super.draw();
}
override protected function configUI():void{
super.configUI();
thumb = new BaseButton();
thumb.setSize(13, 13);
thumb.autoRepeat = false;
addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
track = new BaseButton();
track.move(0, 0);
track.setSize(80, 4);
track.autoRepeat = false;
track.useHandCursor = false;
track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
addChildAt(track, 0);
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
}
public function get value():Number{
return (_value);
}
public function get direction():String{
return (_direction);
}
public function get tickInterval():Number{
return (_tickInterval);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
invalidate(InvalidationType.SIZE);
}
protected function drawTicks():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:uint;
var _local5:DisplayObject;
clearTicks();
tickContainer = new Sprite();
_local1 = ((maximum)<1) ? (tickInterval / 100) : tickInterval;
_local2 = ((maximum - minimum) / _local1);
_local3 = (_width / _local2);
_local4 = 0;
while (_local4 <= _local2) {
_local5 = getDisplayObjectInstance(getStyleValue("tickSkin"));
_local5.x = (_local3 * _local4);
_local5.y = ((track.y - _local5.height) - 2);
tickContainer.addChild(_local5);
_local4++;
};
addChild(tickContainer);
}
protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{
var _local5:Number;
_local5 = ((_arg1 / _width) * (maximum - minimum));
if (_direction == SliderDirection.VERTICAL){
_local5 = (maximum - _local5);
} else {
_local5 = (minimum + _local5);
};
doSetValue(_local5, _arg2, _arg3, _arg4);
}
protected function getPrecision(_arg1:Number):Number{
var _local2:String;
_local2 = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local5 = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local6 = Math.pow(10, getPrecision(snapInterval));
_local7 = (_snapInterval * _local6);
_local8 = Math.round((_arg1 * _local6));
_local9 = (Math.round((_local8 / _local7)) * _local7);
_arg1 = (_local9 / _local6);
_value = Math.max(minimum, Math.min(maximum, _arg1));
} else {
_value = Math.max(minimum, Math.min(maximum, Math.round(_arg1)));
};
if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4));
};
positionThumb();
}
protected function setStyles():void{
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 75
//SliderDirection (fl.controls.SliderDirection)
package fl.controls {
public class SliderDirection {
public static var HORIZONTAL:String = "horizontal";
public static var VERTICAL:String = "vertical";
}
}//package fl.controls
Section 76
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 77
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 78
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.utils.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 79
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 80
//InteractionInputType (fl.events.InteractionInputType)
package fl.events {
public class InteractionInputType {
public static const MOUSE:String = "mouse";
public static const KEYBOARD:String = "keyboard";
}
}//package fl.events
Section 81
//SliderEvent (fl.events.SliderEvent)
package fl.events {
import flash.events.*;
public class SliderEvent extends Event {
protected var _triggerEvent:String;
protected var _keyCode:Number;
protected var _value:Number;
protected var _clickTarget:String;
public static const CHANGE:String = "change";
public static const THUMB_PRESS:String = "thumbPress";
public static const THUMB_DRAG:String = "thumbDrag";
public static const THUMB_RELEASE:String = "thumbRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){
_value = _arg2;
_keyCode = _arg5;
_triggerEvent = _arg4;
_clickTarget = _arg3;
super(_arg1);
}
public function get clickTarget():String{
return (_clickTarget);
}
override public function clone():Event{
return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode));
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget"));
}
public function get triggerEvent():String{
return (_triggerEvent);
}
public function get value():Number{
return (_value);
}
public function get keyCode():Number{
return (_keyCode);
}
}
}//package fl.events
Section 82
//SliderEventClickTarget (fl.events.SliderEventClickTarget)
package fl.events {
public class SliderEventClickTarget {
public static const TRACK:String = "track";
public static const THUMB:String = "thumb";
}
}//package fl.events
Section 83
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 84
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 85
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 86
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 87
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 88
//3dcslogo_8 (gemworks_fla.3dcslogo_8)
package gemworks_fla {
import flash.display.*;
public dynamic class 3dcslogo_8 extends MovieClip {
public function 3dcslogo_8(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package gemworks_fla
Section 89
//anim_30 (gemworks_fla.anim_30)
package gemworks_fla {
import flash.display.*;
public dynamic class anim_30 extends MovieClip {
public function anim_30(){
addFrameScript(0, frame1, 13, frame14, 14, frame15, 20, frame21);
}
function frame14(){
stop();
}
function frame15(){
play();
}
function frame1(){
stop();
}
function frame21(){
parent.alpha = 0;
stop();
}
}
}//package gemworks_fla
Section 90
//anim_4 (gemworks_fla.anim_4)
package gemworks_fla {
import flash.display.*;
public dynamic class anim_4 extends MovieClip {
public var cslogo_mc:MovieClip;
}
}//package gemworks_fla
Section 91
//CSLOGO_5 (gemworks_fla.CSLOGO_5)
package gemworks_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class CSLOGO_5 extends MovieClip {
public var logo_button:SimpleButton;
public function CSLOGO_5(){
addFrameScript(40, frame41, 54, frame55);
}
function frame41(){
this.logo_button.addEventListener(MouseEvent.CLICK, onlogoReleaseHandler, false, 0, true);
}
function frame55(){
stop();
}
public function onlogoReleaseHandler(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.candystand.com/");
navigateToURL(_local2, "_blank");
}
}
}//package gemworks_fla
Section 92
//help_panel_44 (gemworks_fla.help_panel_44)
package gemworks_fla {
import flash.display.*;
public dynamic class help_panel_44 extends MovieClip {
public var close_button:SimpleButton;
public var continue_button:SimpleButton;
}
}//package gemworks_fla
Section 93
//help_short_panel_124 (gemworks_fla.help_short_panel_124)
package gemworks_fla {
import flash.display.*;
public dynamic class help_short_panel_124 extends MovieClip {
public var close_button:SimpleButton;
public var continue_button:SimpleButton;
}
}//package gemworks_fla
Section 94
//HelpPagesMotionMC_33 (gemworks_fla.HelpPagesMotionMC_33)
package gemworks_fla {
import flash.display.*;
public dynamic class HelpPagesMotionMC_33 extends MovieClip {
public function HelpPagesMotionMC_33(){
addFrameScript(0, frame1, 6, frame7, 12, frame13, 18, frame19, 24, frame25);
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame19(){
stop();
}
function frame25(){
stop();
}
function frame13(){
stop();
}
}
}//package gemworks_fla
Section 95
//playButton_14 (gemworks_fla.playButton_14)
package gemworks_fla {
import flash.display.*;
import flash.text.*;
public dynamic class playButton_14 extends MovieClip {
public var buttonText:TextField;
}
}//package gemworks_fla
Section 96
//ShopPopupText_223 (gemworks_fla.ShopPopupText_223)
package gemworks_fla {
import flash.display.*;
import flash.text.*;
public dynamic class ShopPopupText_223 extends MovieClip {
public var caption:TextField;
public function ShopPopupText_223(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gemworks_fla
Section 97
//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 98
//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 99
//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 100
//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 101
//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 102
//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 103
//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 104
//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 105
//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 106
//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 107
//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 108
//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 109
//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 110
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D)
package org.papervision3d.core.proto {
import flash.display.*;
import flash.events.*;
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 maxV:Number;
public var tiled:Boolean;// = false
public var needsFaceNormals:Boolean;// = false
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 111
//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 container:Sprite;
public var triangleCuller:ITriangleCuller;
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 112
//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 113
//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 114
//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 115
//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 116
//InteractiveScene3DEvent (org.papervision3d.events.InteractiveScene3DEvent)
package org.papervision3d.events {
import flash.display.*;
import flash.events.*;
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 117
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.proto.*;
import flash.utils.*;
import org.papervision3d.core.draw.*;
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 118
//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 119
//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 120
//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 121
//MovieMaterial (org.papervision3d.materials.MovieMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.geom.*;
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 122
//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 123
//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 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 get sceneY():Number{
return (this.world.n24);
}
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 124
//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 125
//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 126
//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 127
//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 128
//IVirtualMouseEvent (org.papervision3d.utils.virtualmouse.IVirtualMouseEvent)
package org.papervision3d.utils.virtualmouse {
public interface IVirtualMouseEvent {
}
}//package org.papervision3d.utils.virtualmouse
Section 129
//VirtualMouse (org.papervision3d.utils.virtualmouse.VirtualMouse)
package org.papervision3d.utils.virtualmouse {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
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 130
//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 131
//VirtualMouseMouseEvent (org.papervision3d.utils.virtualmouse.VirtualMouseMouseEvent)
package org.papervision3d.utils.virtualmouse {
import flash.display.*;
import flash.events.*;
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 132
//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 133
//InteractiveSceneManager (org.papervision3d.utils.InteractiveSceneManager)
package org.papervision3d.utils {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
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 134
//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 135
//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 136
//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 137
//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 138
//bonusLayer (bonusLayer)
package {
import flash.display.*;
public dynamic class bonusLayer extends MovieClip {
public var hit_layer:MovieClip;
}
}//package
Section 139
//card_119_178 (card_119_178)
package {
import flash.display.*;
public dynamic class card_119_178 extends MovieClip {
}
}//package
Section 140
//card_119_86 (card_119_86)
package {
import flash.display.*;
public dynamic class card_119_86 extends MovieClip {
}
}//package
Section 141
//card_150_108 (card_150_108)
package {
import flash.display.*;
public dynamic class card_150_108 extends MovieClip {
}
}//package
Section 142
//card_150_222 (card_150_222)
package {
import flash.display.*;
public dynamic class card_150_222 extends MovieClip {
}
}//package
Section 143
//card_151_109 (card_151_109)
package {
import flash.display.*;
public dynamic class card_151_109 extends MovieClip {
}
}//package
Section 144
//card_151_224 (card_151_224)
package {
import flash.display.*;
public dynamic class card_151_224 extends MovieClip {
}
}//package
Section 145
//card_172_124 (card_172_124)
package {
import flash.display.*;
public dynamic class card_172_124 extends MovieClip {
}
}//package
Section 146
//card_172_254 (card_172_254)
package {
import flash.display.*;
public dynamic class card_172_254 extends MovieClip {
}
}//package
Section 147
//card_202_146 (card_202_146)
package {
import flash.display.*;
public dynamic class card_202_146 extends MovieClip {
}
}//package
Section 148
//card_202_298 (card_202_298)
package {
import flash.display.*;
public dynamic class card_202_298 extends MovieClip {
}
}//package
Section 149
//card_244_178 (card_244_178)
package {
import flash.display.*;
public dynamic class card_244_178 extends MovieClip {
}
}//package
Section 150
//card_244_362 (card_244_362)
package {
import flash.display.*;
public dynamic class card_244_362 extends MovieClip {
}
}//package
Section 151
//card_308_224 (card_308_224)
package {
import flash.display.*;
public dynamic class card_308_224 extends MovieClip {
}
}//package
Section 152
//card_308_454 (card_308_454)
package {
import flash.display.*;
public dynamic class card_308_454 extends MovieClip {
}
}//package
Section 153
//card_72_108 (card_72_108)
package {
import flash.display.*;
public dynamic class card_72_108 extends MovieClip {
}
}//package
Section 154
//card_72_51 (card_72_51)
package {
import flash.display.*;
public dynamic class card_72_51 extends MovieClip {
}
}//package
Section 155
//card_83_124 (card_83_124)
package {
import flash.display.*;
public dynamic class card_83_124 extends MovieClip {
}
}//package
Section 156
//card_83_59 (card_83_59)
package {
import flash.display.*;
public dynamic class card_83_59 extends MovieClip {
}
}//package
Section 157
//card_98_146 (card_98_146)
package {
import flash.display.*;
public dynamic class card_98_146 extends MovieClip {
}
}//package
Section 158
//card_98_70 (card_98_70)
package {
import flash.display.*;
public dynamic class card_98_70 extends MovieClip {
}
}//package
Section 159
//CounterFont (CounterFont)
package {
import flash.text.*;
public dynamic class CounterFont extends Font {
}
}//package
Section 160
//CSSet1Image0 (CSSet1Image0)
package {
import flash.display.*;
public dynamic class CSSet1Image0 extends BitmapData {
public function CSSet1Image0(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 161
//CSSet1Image1 (CSSet1Image1)
package {
import flash.display.*;
public dynamic class CSSet1Image1 extends BitmapData {
public function CSSet1Image1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 162
//CSSet1Image2 (CSSet1Image2)
package {
import flash.display.*;
public dynamic class CSSet1Image2 extends BitmapData {
public function CSSet1Image2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 163
//CSSet1Image3 (CSSet1Image3)
package {
import flash.display.*;
public dynamic class CSSet1Image3 extends BitmapData {
public function CSSet1Image3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 164
//CSSet1Image4 (CSSet1Image4)
package {
import flash.display.*;
public dynamic class CSSet1Image4 extends BitmapData {
public function CSSet1Image4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 165
//CSSet1Image5 (CSSet1Image5)
package {
import flash.display.*;
public dynamic class CSSet1Image5 extends BitmapData {
public function CSSet1Image5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 166
//CSSet1Image6 (CSSet1Image6)
package {
import flash.display.*;
public dynamic class CSSet1Image6 extends BitmapData {
public function CSSet1Image6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 167
//CSSet1Image7 (CSSet1Image7)
package {
import flash.display.*;
public dynamic class CSSet1Image7 extends BitmapData {
public function CSSet1Image7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 168
//CSSet1Image8 (CSSet1Image8)
package {
import flash.display.*;
public dynamic class CSSet1Image8 extends BitmapData {
public function CSSet1Image8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 169
//CSSet1Image9 (CSSet1Image9)
package {
import flash.display.*;
public dynamic class CSSet1Image9 extends BitmapData {
public function CSSet1Image9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 170
//DoubleBonusBackMC (DoubleBonusBackMC)
package {
import flash.display.*;
public dynamic class DoubleBonusBackMC extends MovieClip {
}
}//package
Section 171
//DoubleMoneyBonusMC (DoubleMoneyBonusMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class DoubleMoneyBonusMC extends MovieClip {
public var card_number:TextField;
}
}//package
Section 172
//FirstHelpMC (FirstHelpMC)
package {
import flash.display.*;
public dynamic class FirstHelpMC extends MovieClip {
public var close_button:SimpleButton;
}
}//package
Section 173
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 174
//GameStage (GameStage)
package {
import flash.display.*;
import fe.*;
import flash.events.*;
import com.caurina.transitions.*;
import flash.utils.*;
import flash.text.*;
import com.candystand.Stinger.*;
import flash.ui.*;
import flash.system.*;
import com.candystand.ScoreSubmit.*;
public dynamic class GameStage extends MovieClip {
public var main_menu:MainMenuMC;// = null
public var stinger3D:Stinger3D;
public var _mochiads_game_id:String;
public var engine:Engine;// = null
public var playButton:MovieClip;
public var timeOutHolder;// = null
private static var GAME_NAMES:Array = ["Vector TD2", "Headcase", "Insurgo", "Jetboost", "Linegolfer", "Good Ol' Poker", "Polarity", "Pow Pool", "Streetball Jam", "Slipstream"];
private 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 GameStage():void{
var _local1:String;
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:ContextMenu;
engine = null;
main_menu = null;
timeOutHolder = null;
super();
addFrameScript(0, frame1);
this.stop();
Security.allowDomain("*");
_local1 = root.loaderInfo.loaderURL;
_local2 = (_local1.indexOf("://") + 3);
_local3 = _local1.indexOf("/", _local2);
_local4 = _local1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
if (((((!((_local4.toLocaleLowerCase() == "warspark.com"))) && (!((_local4.toLocaleLowerCase() == "flashgamelicense.com"))))) && (!((_local4.toLocaleLowerCase() == "mentart.com"))))){
};
_local7 = new ContextMenu();
_local7.hideBuiltInItems();
contextMenu = _local7;
this.playButton.visible = false;
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...";
this.stinger3D.onAddedToStage(GAME_NAMES, GAME_LINKS);
this.stinger3D.addEventListener(Event.COMPLETE, this.showButton, false, 0, true);
}
private function onReleaseHandler(_arg1:MouseEvent):void{
this.stinger3D.destroy();
this.init();
}
private function init():void{
this.gotoAndStop("main");
trace("MAIN ADDED TO STAGE");
engine = new Engine(this);
main_menu = new MainMenuMC(engine);
addChild(main_menu);
}
private function onRollOutHandler(_arg1:MouseEvent):void{
Tweener.addTween(_arg1.target, {scaleX:1.45, scaleY:1.45, time:0.5, transition:"easeOutExpo"});
}
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{
this.playButton.gotoAndStop(2);
this.playButton.buttonText.text = "PLAY GEMWORKS";
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);
}
function frame1(){
_mochiads_game_id = "fa9f6398ab75cfb9";
MochiBot.track(this, "b4e0b459");
}
private function onRollOverHandler(_arg1:MouseEvent):void{
Tweener.addTween(_arg1.target, {scaleX:1.75, scaleY:1.75, time:0.5, transition:"easeOutExpo"});
}
private function showButton(_arg1:Event=null):void{
var _local2:*;
var _local3:*;
_local2 = this.playButton.scaleX;
_local3 = this.playButton.scaleY;
this.playButton.scaleX = 0;
this.playButton.scaleY = 0;
Tweener.addTween(this.playButton, {scaleX:_local2, scaleY:_local3, time:1});
this.playButton.visible = true;
}
}
}//package
Section 175
//GemBackHMC (GemBackHMC)
package {
import flash.display.*;
public dynamic class GemBackHMC extends MovieClip {
}
}//package
Section 176
//GoalCaptionMC (GoalCaptionMC)
package {
import flash.display.*;
public dynamic class GoalCaptionMC extends MovieClip {
}
}//package
Section 177
//GoalGems (GoalGems)
package {
import flash.display.*;
import flash.text.*;
public dynamic class GoalGems extends MovieClip {
public var gem_total:TextField;
public var gem_animation:MovieClip;
public function GoalGems(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 178
//GoalInfoMC (GoalInfoMC)
package {
import flash.display.*;
public dynamic class GoalInfoMC extends MovieClip {
public var next_button:SimpleButton;
public var close_button:SimpleButton;
public var help_pages:MovieClip;
}
}//package
Section 179
//GoalInfoMotion (GoalInfoMotion)
package {
import flash.display.*;
public dynamic class GoalInfoMotion extends MovieClip {
public var help_mc:MovieClip;
public function GoalInfoMotion(){
addFrameScript(0, frame1, 10, frame11, 19, frame20);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 180
//GoalNumberMC (GoalNumberMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class GoalNumberMC extends MovieClip {
public var txt:TextField;
}
}//package
Section 181
//hammer_description (hammer_description)
package {
import flash.display.*;
public dynamic class hammer_description extends MovieClip {
}
}//package
Section 182
//HammerBonusBackMC (HammerBonusBackMC)
package {
import flash.display.*;
public dynamic class HammerBonusBackMC extends MovieClip {
}
}//package
Section 183
//HammerBonusBMC (HammerBonusBMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class HammerBonusBMC extends MovieClip {
public var card_number:TextField;
}
}//package
Section 184
//HammerBonusCursorMC (HammerBonusCursorMC)
package {
import flash.display.*;
public dynamic class HammerBonusCursorMC extends MovieClip {
public function HammerBonusCursorMC(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 185
//Imageamethyst (Imageamethyst)
package {
import flash.display.*;
public dynamic class Imageamethyst extends BitmapData {
public function Imageamethyst(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 186
//Imageblue (Imageblue)
package {
import flash.display.*;
public dynamic class Imageblue extends BitmapData {
public function Imageblue(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 187
//Imageemerald (Imageemerald)
package {
import flash.display.*;
public dynamic class Imageemerald extends BitmapData {
public function Imageemerald(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 188
//Imagegoal_back (Imagegoal_back)
package {
import flash.display.*;
public dynamic class Imagegoal_back extends BitmapData {
public function Imagegoal_back(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 189
//Imagepattern1 (Imagepattern1)
package {
import flash.display.*;
public dynamic class Imagepattern1 extends BitmapData {
public function Imagepattern1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 190
//Imagepyrite (Imagepyrite)
package {
import flash.display.*;
public dynamic class Imagepyrite extends BitmapData {
public function Imagepyrite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 191
//Imagered (Imagered)
package {
import flash.display.*;
public dynamic class Imagered extends BitmapData {
public function Imagered(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 192
//Imagetimer_line (Imagetimer_line)
package {
import flash.display.*;
public dynamic class Imagetimer_line extends BitmapData {
public function Imagetimer_line(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 193
//LevelGoMC (LevelGoMC)
package {
import flash.display.*;
public dynamic class LevelGoMC extends MovieClip {
public function LevelGoMC(){
addFrameScript(0, frame1, 38, frame39);
}
function frame1(){
stop();
}
function frame39(){
stop();
}
}
}//package
Section 194
//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 195
//money_description (money_description)
package {
import flash.display.*;
public dynamic class money_description extends MovieClip {
}
}//package
Section 196
//MoneyPopupMC (MoneyPopupMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MoneyPopupMC extends MovieClip {
public var txt:TextField;
}
}//package
Section 197
//PausedMotion (PausedMotion)
package {
import flash.display.*;
public dynamic class PausedMotion extends MovieClip {
public function PausedMotion(){
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
stop();
visible = false;
}
function frame8(){
stop();
}
}
}//package
Section 198
//PlaneLabel (PlaneLabel)
package {
import flash.display.*;
import flash.text.*;
public dynamic class PlaneLabel extends MovieClip {
public var labelText:TextField;
}
}//package
Section 199
//play_description (play_description)
package {
import flash.display.*;
public dynamic class play_description extends MovieClip {
}
}//package
Section 200
//PopupText (PopupText)
package {
import flash.display.*;
import flash.text.*;
public dynamic class PopupText extends MovieClip {
public var caption:TextField;
}
}//package
Section 201
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 202
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 203
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 204
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 205
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 206
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 207
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 208
//Sound_click (Sound_click)
package {
import flash.media.*;
public dynamic class Sound_click extends Sound {
}
}//package
Section 209
//Sound_dice (Sound_dice)
package {
import flash.media.*;
public dynamic class Sound_dice extends Sound {
}
}//package
Section 210
//Sound_game_shop (Sound_game_shop)
package {
import flash.media.*;
public dynamic class Sound_game_shop extends Sound {
}
}//package
Section 211
//Sound_gem_click (Sound_gem_click)
package {
import flash.media.*;
public dynamic class Sound_gem_click extends Sound {
}
}//package
Section 212
//Sound_gem_composed (Sound_gem_composed)
package {
import flash.media.*;
public dynamic class Sound_gem_composed extends Sound {
}
}//package
Section 213
//Sound_gem_merge (Sound_gem_merge)
package {
import flash.media.*;
public dynamic class Sound_gem_merge extends Sound {
}
}//package
Section 214
//Sound_level_music (Sound_level_music)
package {
import flash.media.*;
public dynamic class Sound_level_music extends Sound {
}
}//package
Section 215
//Sound_over (Sound_over)
package {
import flash.media.*;
public dynamic class Sound_over extends Sound {
}
}//package
Section 216
//Sound_tada (Sound_tada)
package {
import flash.media.*;
public dynamic class Sound_tada extends Sound {
}
}//package
Section 217
//SubHelpMotion (SubHelpMotion)
package {
import flash.display.*;
public dynamic class SubHelpMotion extends MovieClip {
public var help_mc:MovieClip;
public function SubHelpMotion(){
addFrameScript(0, frame1, 10, frame11, 19, frame20);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 218
//time_description (time_description)
package {
import flash.display.*;
public dynamic class time_description extends MovieClip {
}
}//package
Section 219
//TimeBonusBackMC (TimeBonusBackMC)
package {
import flash.display.*;
public dynamic class TimeBonusBackMC extends MovieClip {
}
}//package
Section 220
//TimeBonusMC (TimeBonusMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TimeBonusMC extends MovieClip {
public var card_number:TextField;
}
}//package