Section 1
//Ball (balls.Ball)
package balls {
import flash.display.*;
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import be.atomik.gamelib.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import flash.filters.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.events.*;
import org.papervision3d.scenes.*;
import flash.utils.*;
import org.papervision3d.utils.*;
public class Ball extends DisplayObject3D {
public var isSmall:Boolean;
private var BALL:Ball;
private var ratio:Number;
private var directionNumber3D:Number3D;
private var ballMaterial:BitmapAssetMaterial;
public var speed:Number;
public var sx:Number;// = 0
public var sy:Number;// = 0
private var shadowMaterial:MovieAssetMaterial;
private var i:int;
private var j:int;
private var sound_click:Sound_Click1;
private var t:Number;
private var w:Number;// = 0
private var dy:Number;// = 0
private var dx:Number;// = 0
public var inGame:Boolean;// = true
public var vx:Number;// = 0
public var vy:Number;// = 0
public var bounces:int;// = 0
public var dropShadow:Plane;
public var mass:Number;
public var ballNum:int;
private var collisionObject:Object;
private var unitNumber3D:Number3D;
private var pen:Number;
private var endRange:int;
private var steps:Number;// = 0
private var ix:Number;
private var iy:Number;
public var oldx:Number;// = 0
public var oldy:Number;// = 0
public var hits:int;// = 0
public var line3D:Line3D;
public var hasRendered:Boolean;// = false
public var ballRadius:Number;
public var glow:Plane;
private var crossNumber3D:Number3D;
private var glowMaterial:MovieAssetMaterial;
public var collided:Boolean;// = false
private var walls:Array;
private var wallt:Number;
public var distance:Number;// = 0
private var startRange:int;
public var debuglines3D:Lines3D;
public var ball:Sphere;
private static var OMEGA:Number = 0.1;
public static var camera:Camera3D;
private static var h2:Number = (Constants.TABLE_HEIGHT / 2);
public static var target:DisplayObject3D;
public static var ballArray:Array;
private static var w2:Number = (Constants.TABLE_WIDTH / 2);
public function Ball(){
sx = 0;
sy = 0;
collided = false;
ballRadius = Constants.BALL_RADIUS;
inGame = true;
vx = 0;
vy = 0;
oldx = 0;
oldy = 0;
distance = 0;
bounces = 0;
hasRendered = false;
unitNumber3D = new Number3D(0.1, 0.1, 0.1);
w = 0;
dx = 0;
dy = 0;
hits = 0;
steps = 0;
sound_click = new Sound_Click1();
walls = [];
super();
createWalls();
BALL = this;
}
public function drawLines(){
var _local1:*;
var _local2:Vector;
var _local3:Vector;
debuglines3D = new Lines3D(new LineMaterial(0xFFFFFF));
_local1 = 0;
while (_local1 < walls.length) {
_local2 = walls[_local1][0];
_local3 = walls[_local1][1];
debuglines3D.addNewLine(1, _local2.x, _local2.y, -10, _local3.x, _local3.y, -10);
_local1++;
};
debuglines3D.project(target, camera);
target.addChild(debuglines3D);
}
public function setY(_arg1:Number){
ball.y = _arg1;
}
public function checkBalls(){
i = 0;
while (i < ballArray.length) {
if (ballArray[i] != BALL){
if (ballArray[i].inGame){
if (detect(BALL, ballArray[i])){
react2(BALL, ballArray[i]);
SoundManager.getInstance().ballClick(BALL);
};
};
};
i++;
};
}
public function setX(_arg1:Number){
ball.x = _arg1;
}
public function drawVelocity(){
debuglines3D = new Lines3D(new LineMaterial(0xFFFFFF));
debuglines3D.addNewLine(1, sx, sy, -10, 100, 100, -10);
debuglines3D.project(target, camera);
target.addChild(debuglines3D);
line3D = debuglines3D.lines[0];
}
public function createWalls(){
var _local1:*;
var _local2:*;
_local1 = [{p0:new Vector(-868, 380), p1:new Vector(-868, -380)}, {p0:new Vector(-834, -434), p1:new Vector(-40, -434)}, {p0:new Vector(57, -434), p1:new Vector(840, -434)}, {p0:new Vector(866, 380), p1:new Vector(866, -364)}, {p0:new Vector(818, 429), p1:new Vector(40, 429)}, {p0:new Vector(-60, 429), p1:new Vector(-833, 429)}, {p0:new Vector(-868, -380), p1:new Vector(-924, -451)}, {p0:new Vector(-938, 476), p1:new Vector(-868, 380)}, {p0:new Vector(-904, -491), p1:new Vector(-834, -434)}, {p0:new Vector(-40, -434), p1:new Vector(-15, -509)}, {p0:new Vector(11, -504), p1:new Vector(57, -434)}, {p0:new Vector(840, -434), p1:new Vector(917, -491)}, {p0:new Vector(929, -434), p1:new Vector(866, -364)}, {p0:new Vector(866, 380), p1:new Vector(935, 429)}, {p0:new Vector(40, 429), p1:new Vector(10, 502)}, {p0:new Vector(901, 493), p1:new Vector(818, 429)}, {p0:new Vector(-833, 429), p1:new Vector(-903, 489)}, {p0:new Vector(-18, 504), p1:new Vector(-60, 429)}, {p0:new Vector(-924, -451), p1:new Vector(-904, -491)}, {p0:new Vector(11, -504), p1:new Vector(-15, -509)}, {p0:new Vector(929, -452), p1:new Vector(917, -491)}, {p0:new Vector(901, 493), p1:new Vector(935, 458)}, {p0:new Vector(-18, 504), p1:new Vector(10, 502)}, {p0:new Vector(-938, 476), p1:new Vector(-903, 489)}];
_local2 = 0;
while (_local2 < _local1.length) {
walls.push([_local1[_local2].p0, _local1[_local2].p1]);
_local2++;
};
startRange = 0;
endRange = walls.length;
}
private function checkWallCollision(_arg1:Object, _arg2:Ball):Boolean{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
_local3 = _arg2.vx;
_local4 = _arg2.vy;
_local5 = (_arg1[1].x - _arg1[0].x);
_local6 = (_arg1[1].y - _arg1[0].y);
_local7 = ((-(_local5) * _local4) + (_local3 * _local6));
_local10 = (_arg2.sx - _arg1[0].x);
_local11 = (_arg2.sy - _arg1[0].y);
_local8 = (((-(_local4) * _local10) + (_local3 * _local11)) / _local7);
wallt = (((_local5 * _local11) - (_local6 * _local10)) / _local7);
if ((((((((_local8 >= 0)) && ((_local8 <= 1)))) && ((wallt >= 0)))) && ((wallt <= 1)))){
ix = (_arg2.sx + (wallt * _local3));
iy = (_arg2.sy + (wallt * _local4));
ratio = (1 - wallt);
return (true);
};
return (false);
}
public function react2(_arg1:Ball, _arg2:Ball):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:Ball;
var _local12:Ball;
var _local13:Boolean;
var _local14:Boolean;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
_local3 = (_arg2.sx - _arg1.sx);
_local4 = (_arg2.sy - _arg1.sy);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local6 = (ballRadius * 2);
_local7 = (_local3 / _local5);
_local8 = (_local4 / _local5);
_local9 = (_local7 * (_local6 - _local5));
_local10 = (_local8 * (_local6 - _local5));
_local11 = new Ball();
_local12 = new Ball();
_local11.sx = _arg1.sx;
_local11.sy = _arg1.sy;
_local11.vx = -(_local9);
_local11.vy = -(_local10);
_local12.sx = _arg2.sx;
_local12.sy = _arg2.sy;
_local12.vx = _local9;
_local12.vy = _local10;
_local13 = checkWalls(_local11);
_local14 = checkWalls(_local12);
if (((!(_local13)) && (_local14))){
_arg1.sx = (_arg1.sx - (2 * _local9));
_arg1.sy = (_arg1.sy - (2 * _local10));
} else {
if (((_local13) && (!(_local14)))){
_arg2.sx = (_arg2.sx + (2 * _local9));
_arg2.sy = (_arg2.sy + (2 * _local10));
} else {
_arg1.sx = (_arg1.sx - _local9);
_arg1.sy = (_arg1.sy - _local10);
_arg2.sx = (_arg2.sx + _local9);
_arg2.sy = (_arg2.sy + _local10);
};
};
_local15 = (_arg2.vx - _arg1.vx);
_local16 = (_arg2.vy - _arg1.vy);
_local17 = (-((1 + Constants.BALL_COEFFICIENTRESTITUTION)) * ((_local15 * _local7) + (_local16 * _local8)));
_local18 = ((1 / _arg1.mass) + (1 / _arg2.mass));
_local19 = (_local17 / _local18);
_local11.sx = _arg1.sx;
_local11.sy = _arg1.sy;
_local11.vx = (_arg1.vx - ((_local19 / _arg1.mass) * _local7));
_local11.vy = (_arg1.vy - ((_local19 / _arg1.mass) * _local8));
_local12.sx = _arg2.sx;
_local12.sy = _arg2.sy;
_local12.vx = (_arg2.vx + ((_local19 / _arg2.mass) * _local7));
_local12.vy = (_arg2.vy + ((_local19 / _arg2.mass) * _local8));
_local13 = checkWalls(_local11);
_local14 = checkWalls(_local12);
_arg1.vx = _local11.vx;
_arg1.vy = _local11.vy;
_arg2.vx = _local12.vx;
_arg2.vy = _local12.vy;
_arg1.hits++;
_arg2.hits++;
if (_arg2.ballNum < _arg1.ballNum){
_arg2.render();
};
}
public function detect(_arg1:Ball, _arg2:Ball):Boolean{
var _local3:*;
var _local4:*;
var _local5:Vector;
var _local6:Number;
var _local7:*;
var _local8:*;
var _local9:Vector;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local3 = new Vector(_arg1.sx, _arg1.sy);
_local4 = new Vector(_arg2.sx, _arg2.sy);
_local5 = _local4.minus(_local3);
_local6 = (_local4.minus(_local3).dot(_local5) - ((_arg1.ballRadius + _arg2.ballRadius) * (_arg1.ballRadius + _arg2.ballRadius)));
if (_local6 < 0){
t = 0;
return (true);
};
_local7 = new Vector(_arg1.vx, _arg1.vy);
_local8 = new Vector(_arg2.vx, _arg2.vy);
_local9 = _local8.minus(_local7);
_local10 = _local8.minus(_local7).dot(_local9);
if (_local10 < OMEGA){
return (false);
};
_local11 = _local9.dot(_local5);
if (_local11 >= 0){
return (false);
};
_local12 = ((_local11 * _local11) - (_local10 * _local6));
if (_local12 < 0){
return (false);
};
t = ((-(_local11) - Math.sqrt(_local12)) / _local10);
return ((t <= 1));
}
public function init(_arg1:String, _arg2:Boolean, _arg3:Number, _arg4:int):void{
var _local5:MovieMaterial;
createWalls();
ballNum = _arg4;
mass = _arg3;
glowMaterial = new MovieAssetMaterial("glow", true);
shadowMaterial = new MovieAssetMaterial("shadow", true);
if (ballNum == 0){
_local5 = new MovieMaterial(new white());
_local5.interactive = true;
_local5.movie.addEventListener(MouseEvent.MOUSE_DOWN, handleWhiteBallMouseDown);
ball = new Sphere(_local5, Constants.BALL_RADIUS, Constants.BALL_SEGMENTS, Constants.BALL_SEGMENTS);
} else {
ballMaterial = new BitmapAssetMaterial(_arg1);
ball = new Sphere(ballMaterial, Constants.BALL_RADIUS, Constants.BALL_SEGMENTS, Constants.BALL_SEGMENTS);
};
ball.z = Constants.BALL_HEIGHT;
glow = new Plane(glowMaterial, Constants.BALL_GLOW_SIZE, Constants.BALL_GLOW_SIZE, 1, 1);
glow.z = Constants.BALL_GLOW_HEIGHT;
dropShadow = new Plane(shadowMaterial, Constants.BALL_SHADOW_SIZE, Constants.BALL_SHADOW_SIZE, 1, 1);
dropShadow.z = Constants.BALL_SHADOW_HEIGHT;
addChild(ball);
ball.rotationY = (Math.random() * 360);
ball.rotationZ = (Math.random() * 360);
ball.rotationX = (Math.random() * 360);
}
public function draw(){
w = (Math.sqrt(((((vx * vx) * Constants.ITERATIONS) * Constants.ITERATIONS) + (((vy * vy) * Constants.ITERATIONS) * Constants.ITERATIONS))) / ballRadius);
if (((!((vx == 0))) || (!((vy == 0))))){
directionNumber3D = new Number3D(vx, vy, 0);
crossNumber3D = Number3D.cross(unitNumber3D, directionNumber3D);
ball.rotateArbitrary(w, new Number3D(crossNumber3D.x, crossNumber3D.y, 0));
};
setX(sx);
setY(sy);
}
public function checkJump(){
if ((((((((sx < -1000)) || ((sx > 1000)))) || ((sy < -500)))) || ((sy > 500)))){
return (true);
};
return (false);
}
public function render(){
vx = (vx * Constants.TABLE_FRICTION);
vy = (vy * Constants.TABLE_FRICTION);
if ((vx * vx) < (Constants.BALL_FRICTION * Constants.BALL_FRICTION)){
vx = 0;
};
if ((vy * vy) < (Constants.BALL_FRICTION * Constants.BALL_FRICTION)){
vy = 0;
};
sx = (sx + vx);
sy = (sy + vy);
speed = ((vx * vx) + (vy * vy));
}
public function checkWalls(_arg1:Ball){
var _local2:*;
var _local3:*;
_local2 = false;
_local3 = startRange;
while (_local3 < endRange) {
if (checkWallCollision(walls[_local3], _arg1)){
_local2 = true;
bounces++;
reactWall(walls[_local3], _arg1);
return (true);
};
_local3++;
};
return (false);
}
public function displayLine(){
line3D.v0.x = sx;
line3D.v0.y = sy;
line3D.v1.x = (sx + (5 * vx));
line3D.v1.y = (sy + (5 * vy));
}
public function reactWall(_arg1:Object, _arg2:Ball){
var _local3:Vector;
var _local4:Vector;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
_local3 = new Vector((_arg1[0].x - _arg1[1].x), (_arg1[0].y - _arg1[1].y)).getNormalized();
_local4 = _local3.normal;
_local5 = _local3.dot(new Vector(_arg2.vx, _arg2.vy));
_local6 = _local4.dot(new Vector(_arg2.vx, _arg2.vy));
_local7 = _local3.cross(_local5);
_local8 = _local4.cross(-(_local6));
_arg2.vx = (new Vector(1, 0).dot(_local8) + new Vector(1, 0).dot(_local7));
_arg2.vy = (new Vector(0, 1).dot(_local8) + new Vector(0, 1).dot(_local7));
_arg2.sx = (_arg2.ix + (ratio * _arg2.vx));
_arg2.sy = (_arg2.iy + (ratio * _arg2.vy));
_arg2.vx = (_arg2.vx * Constants.TABLE_BOUNCE);
_arg2.vy = (_arg2.vy * Constants.TABLE_BOUNCE);
}
public static function handleWhiteBallMouseDown(_arg1:MouseEvent){
Core.getInstance().handleWhiteBallMouseDown();
}
}
}//package balls
Section 2
//BallManager (balls.BallManager)
package balls {
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.events.*;
import org.papervision3d.scenes.*;
import org.papervision3d.utils.*;
public class BallManager {
public var ball0:Ball;
public var ball1:Ball;
public var ball2:Ball;
public var ball3:Ball;
public var ball4:Ball;
public var ball5:Ball;
public var ball6:Ball;
public var ball7:Ball;
public var ball8:Ball;
public var ball9:Ball;
private var target:DisplayObject3D;
public var ballArray:Array;
private var camera:Camera3D;
public var shots:int;// = 0
public var ballsMoving:Boolean;// = false
public var ballBonusArray:Array;
public var ball10:Ball;
public var ball11:Ball;
public var ball12:Ball;
public var ball13:Ball;
public var ball14:Ball;
public var ball15:Ball;
private var i:int;// = 0
private var j:int;// = 0
private var k:int;
private var l:int;
private var t:Number;
public function BallManager(_arg1:DisplayObject3D, _arg2:Camera3D){
ballArray = [];
ballBonusArray = [];
shots = 0;
ballsMoving = false;
i = 0;
j = 0;
super();
target = _arg1;
camera = _arg2;
Ball.target = target;
Ball.camera = camera;
createBalls();
}
public function checkHoles(_arg1:Ball){
var _local2:Number;
var _local3:Number;
var _local4:*;
k = 0;
while (k < Constants.TABLE_HOLES) {
_local2 = (_arg1.sx - (Constants.TABLE_HOLE_POSITIONS[k].x - (Constants.TABLE_WIDTH / 2)));
_local3 = (_arg1.sy - (Constants.TABLE_HOLE_POSITIONS[k].y - (Constants.TABLE_HEIGHT / 2)));
if (((_local2 * _local2) + (_local3 * _local3)) < (Constants.TABLE_HOLE_RADIUS * Constants.TABLE_HOLE_RADIUS)){
_arg1.inGame = false;
_arg1.visible = false;
_arg1.vx = 0;
_arg1.vy = 0;
_local4 = (k == Core.getInstance().bonusHole);
if (_local4){
Core.getInstance().setBonusHole();
};
if (_arg1.ballNum == 0){
Core.getInstance().gameOver(false);
} else {
if ((((_arg1.ballNum == 8)) && ((ballBonusArray.length == 1)))){
Core.getInstance().gameOver(true);
} else {
if ((((_arg1.ballNum == 8)) && ((ballBonusArray.length > 1)))){
Core.getInstance().gameOver(false);
} else {
if (_arg1 == ballBonusArray[0]){
ballBonusArray.shift();
StateManager.getInstance().potted(_arg1, true, _local4);
} else {
removePottedBall(_arg1);
StateManager.getInstance().potted(_arg1, false, _local4);
};
};
};
};
shots = 0;
Core.getInstance().soundManager.hole();
return (true);
};
k++;
};
return (false);
}
public function render(){
var _local1:*;
_local1 = 0;
while (_local1 < Constants.ITERATIONS) {
checkCollisions();
i = 0;
while (i < ballArray.length) {
if (ballArray[i].inGame){
ballArray[i].checkBalls();
ballArray[i].checkWalls(ballArray[i]);
ballArray[i].render();
};
i++;
};
ballsMoving = (ballArray[0].speed > 0);
_local1++;
};
i = 0;
while (i < ballArray.length) {
if (ballArray[i].inGame){
ballArray[i].draw();
};
i++;
};
}
public function showFx(){
var _local1:*;
_local1 = 0;
while (_local1 < ballArray.length) {
ballArray[_local1].glow.visible = true;
ballArray[_local1].dropShadow.visible = true;
_local1++;
};
}
public function showBallBonusArray(){
var _local1:*;
_local1 = 0;
while (_local1 < ballBonusArray.length) {
_local1++;
};
}
public function createBalls(){
var _local1:*;
ball0 = new Ball();
ball0.init("bitmapBall0", false, Constants.BALL_MASS_CUE, 0);
target.addChild(ball0);
ballArray.push(ball0);
ball1 = new Ball();
ball1.init("bitmapBall1", false, Constants.BALL_MASS_NUMBERED, 1);
ball2 = new Ball();
ball2.init("bitmapBall2", false, Constants.BALL_MASS_NUMBERED, 2);
ball3 = new Ball();
ball3.init("bitmapBall3", false, Constants.BALL_MASS_NUMBERED, 3);
ball4 = new Ball();
ball4.init("bitmapBall4", false, Constants.BALL_MASS_NUMBERED, 4);
ball5 = new Ball();
ball5.init("bitmapBall5", false, Constants.BALL_MASS_NUMBERED, 5);
ball6 = new Ball();
ball6.init("bitmapBall6", false, Constants.BALL_MASS_NUMBERED, 6);
ball7 = new Ball();
ball7.init("bitmapBall7", false, Constants.BALL_MASS_NUMBERED, 7);
ball8 = new Ball();
ball8.init("bitmapBall8", false, Constants.BALL_MASS_NUMBERED, 8);
ball9 = new Ball();
ball9.init("bitmapBall9", true, Constants.BALL_MASS_NUMBERED, 9);
ball10 = new Ball();
ball10.init("bitmapBall10", true, Constants.BALL_MASS_NUMBERED, 10);
ball11 = new Ball();
ball11.init("bitmapBall11", true, Constants.BALL_MASS_NUMBERED, 11);
ball12 = new Ball();
ball12.init("bitmapBall12", true, Constants.BALL_MASS_NUMBERED, 12);
ball13 = new Ball();
ball13.init("bitmapBall13", true, Constants.BALL_MASS_NUMBERED, 13);
ball14 = new Ball();
ball14.init("bitmapBall14", true, Constants.BALL_MASS_NUMBERED, 14);
ball15 = new Ball();
ball15.init("bitmapBall15", true, Constants.BALL_MASS_NUMBERED, 15);
target.addChild(ball1);
target.addChild(ball2);
target.addChild(ball3);
target.addChild(ball4);
target.addChild(ball5);
target.addChild(ball6);
target.addChild(ball7);
target.addChild(ball8);
target.addChild(ball9);
target.addChild(ball10);
target.addChild(ball11);
target.addChild(ball12);
target.addChild(ball13);
target.addChild(ball14);
target.addChild(ball15);
ballArray.push(ball1);
ballArray.push(ball2);
ballArray.push(ball3);
ballArray.push(ball4);
ballArray.push(ball5);
ballArray.push(ball6);
ballArray.push(ball7);
ballArray.push(ball9);
ballArray.push(ball10);
ballArray.push(ball11);
ballArray.push(ball12);
ballArray.push(ball13);
ballArray.push(ball14);
ballArray.push(ball15);
ballArray.push(ball8);
_local1 = 0;
while (_local1 < ballArray.length) {
ballArray[_local1].meshSort = Constants.MESH_SORT;
_local1++;
};
ballBonusArray = ballArray.slice(1, (ballArray.length - 1));
ballBonusArray.push(ball8);
Ball.ballArray = ballArray;
rackBalls(400, 0);
}
public function rackBalls(_arg1, _arg2){
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:Ball;
_local3 = ((Math.random() * 30) - 15);
_local4 = ((Math.random() * 30) - 15);
ball0.sx = (-400 + _local3);
ball0.sy = _local4;
_local5 = [[ball9], [ball7, ball12], [ball15, ball8, ball1], [ball6, ball10, ball3, ball14], [ball11, ball2, ball13, ball4, ball5]];
_local6 = ((Constants.BALL_RADIUS * 2) + 1);
_local7 = (((Constants.BALL_RADIUS * 2) * Math.cos((Math.PI / 6))) + 1);
k = 0;
while (k < 5) {
l = 0;
while (l < _local5[k].length) {
_local8 = _local5[k][l];
_local8.sx = ((_arg1 + (k * _local7)) - _local4);
_local8.sy = (((_arg2 + (l * _local6)) - (Constants.BALL_RADIUS * k)) + _local3);
l++;
};
k++;
};
}
public function hideFx(){
var _local1:*;
_local1 = 0;
while (_local1 < ballArray.length) {
ballArray[_local1].glow.visible = false;
ballArray[_local1].dropShadow.visible = false;
_local1++;
};
}
public function resetBalls(){
var _local1:*;
_local1 = 0;
while (_local1 < ballArray.length) {
ballArray[_local1].oldx = ballArray[_local1].sx;
ballArray[_local1].oldy = ballArray[_local1].sy;
ballArray[_local1].distance = 0;
ballArray[_local1].bounces = 0;
ballArray[_local1].hits = 0;
ballArray[_local1].collided = false;
_local1++;
};
}
public function checkCollisions(){
i = 0;
while (i < ballArray.length) {
if (ballArray[i].inGame){
checkHoles(ballArray[i]);
};
i++;
};
}
private function removePottedBall(_arg1:Ball){
var _local2:*;
_local2 = ballBonusArray.length;
while (_local2--) {
if (_arg1 == ballBonusArray[_local2]){
ballBonusArray.splice(_local2, 1);
};
};
}
}
}//package balls
Section 3
//Cue (balls.Cue)
package balls {
import flash.display.*;
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import caurina.transitions.*;
import flash.filters.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.events.*;
import org.papervision3d.scenes.*;
import org.papervision3d.utils.*;
public class Cue extends DisplayObject3D {
private var camera:Camera3D;
public var cue:Cylinder;
public var line3D:Line3D;
public var cueAngle:Number;
public var cueX:Number;
private var target:DisplayObject3D;
private var oldCueY:Number;
public var cueY:Number;
public var cuePower:Number;
private var oldCueX:Number;
public var lines3D:Lines3D;
public var whiteBall:Ball;
private var STAGE:Stage;
private var shotAngle:Number;
public function Cue(_arg1:DisplayObject3D, _arg2:Stage, _arg3:Camera3D){
STAGE = _arg2;
camera = _arg3;
target = _arg1;
shotAngle = Core.getInstance().shotAngle;
whiteBall = Core.getInstance().whiteBall;
cue = new Cylinder(new MovieMaterial(new cueTexture(), false), 8, Constants.CUE_LENGTH, 4, 10);
cue.z = Constants.CUE_HEIGHT;
cue.meshSort = Constants.MESH_SORT;
target.addChild(cue);
lines3D = new Lines3D(new LineMaterial(0xDDDDDD, 10));
lines3D.addNewLine(1, whiteBall.x, whiteBall.y, Constants.CUE_LINE_HEIGHT, 100, 100, Constants.CUE_LINE_HEIGHT);
lines3D.project(target, camera);
lines3D.meshSort = DisplayObject3D.MESH_SORT_CLOSE;
target.addChild(lines3D);
line3D = lines3D.lines[0];
}
public function shoot(){
oldCueX = cue.x;
oldCueY = cue.y;
cueX = (whiteBall.sx + (Math.sin(cueAngle) * (Constants.CUE_LENGTH / 2)));
cueY = (whiteBall.sy - (Math.cos(cueAngle) * (Constants.CUE_LENGTH / 2)));
Tweener.addTween(cue, {x:cueX, y:cueY, time:Constants.CUE_SHOT_TIME, transition:"easeInQuint", onComplete:fire});
}
public function hide(){
cue.visible = false;
lines3D.visible = false;
}
public function fire(){
var _local1:*;
_local1 = ((Math.random() * 0.04) - 0.02);
cueAngle = (cueAngle + _local1);
Core.getInstance().ballManager.ball0.vx = (Math.sin(-(cueAngle)) * cuePower);
Core.getInstance().ballManager.ball0.vy = (Math.cos(-(cueAngle)) * cuePower);
Core.getInstance().gameState = "shot";
Tweener.addTween(cue, {x:oldCueX, y:oldCueY, delay:0.5, time:2, transition:"easeInQuint"});
}
public function viewAim(_arg1:Number){
cue.visible = true;
cueAngle = -(_arg1);
lines3D.visible = true;
line3D.v0.x = (whiteBall.sx - (350 * Math.sin(-(cueAngle))));
line3D.v0.y = (whiteBall.sy - (350 * Math.cos(-(cueAngle))));
line3D.v1.x = (whiteBall.sx + (Constants.CUE_LINE_LENGTH * Math.sin(-(cueAngle))));
line3D.v1.y = (whiteBall.sy + (Constants.CUE_LINE_LENGTH * Math.cos(-(cueAngle))));
cue.rotationZ = (cueAngle * Constants.RAD_TO_DEG);
cue.rotationX = Constants.CUE_AIM_PITCH;
cue.x = (whiteBall.sx + (Math.sin(cueAngle) * ((Constants.CUE_LENGTH / 2) + Constants.CUE_OFFSET)));
cue.y = (whiteBall.sy - (Math.cos(cueAngle) * ((Constants.CUE_LENGTH / 2) + Constants.CUE_OFFSET)));
cue.z = Constants.CUE_AIM_HEIGHT;
}
public function viewPower(_arg1:Number){
var _local2:*;
var _local3:*;
cueAngle = -(_arg1);
lines3D.visible = false;
cueX = (whiteBall.sx + (Math.sin(cueAngle) * ((Constants.CUE_LENGTH / 2) + Constants.CUE_SHOT_OFFSET)));
cueY = (whiteBall.sy - (Math.cos(cueAngle) * ((Constants.CUE_LENGTH / 2) + Constants.CUE_SHOT_OFFSET)));
_local2 = (STAGE.mouseY - (whiteBall.ball.screen.y + (Constants.STAGE_HEIGHT / 2)));
if (_local2 < 0){
_local2 = 0;
};
_local2 = (_local2 / (Constants.STAGE_HEIGHT - (whiteBall.ball.screen.y + (Constants.STAGE_HEIGHT / 2))));
cuePower = (_local2 * Constants.CUE_MAX_POWER);
if (cuePower < Constants.CUE_MIN_POWER){
cuePower = Constants.CUE_MIN_POWER;
};
if (cuePower > Constants.CUE_MAX_POWER){
cuePower = Constants.CUE_MAX_POWER;
};
cue.x = (cueX + ((Math.sin(cueAngle) * cuePower) * Constants.CUE_POWER_SCALE));
cue.y = (cueY - ((Math.cos(cueAngle) * cuePower) * Constants.CUE_POWER_SCALE));
_local3 = (((cuePower / Constants.CUE_MAX_POWER) * 100) >> 0);
Core.getInstance().headsUpDisplay.setPower(_local3);
}
public function show(){
cue.visible = true;
}
}
}//package balls
Section 4
//Vector (be.atomik.gamelib.geom.Vector)
package be.atomik.gamelib.geom {
import flash.display.*;
public class Vector {
private var __x:Number;
private var __y:Number;
private var __normal:Vector;
private var bInvalidLen:Boolean;
private var __len:Number;
private var bInvalidNormal:Boolean;
public function Vector(_arg1:Number, _arg2:Number){
__x = _arg1;
__y = _arg2;
bInvalidLen = true;
bInvalidNormal = true;
}
public function setVector(_arg1:Number, _arg2:Number){
__x = _arg1;
__y = _arg2;
bInvalidLen = true;
bInvalidNormal = true;
}
public function get y(){
return (__y);
}
public function dot(_arg1:Vector){
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function set y(_arg1:Number){
__y = _arg1;
bInvalidLen = true;
bInvalidNormal = true;
}
private function updateLen(){
__len = Math.sqrt(((__x * __x) + (__y * __y)));
bInvalidLen = false;
}
public function normalize():void{
if (len == 0){
__x = 0;
__y = 0;
} else {
__x = (__x / len);
__y = (__y / len);
};
bInvalidLen = true;
}
public function cross(_arg1:Number){
return (new Vector((x * _arg1), (y * _arg1)));
}
public function get x(){
return (__x);
}
public function get len(){
if (bInvalidLen){
updateLen();
};
return (__len);
}
public function drawAt(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
}
public function plus(_arg1:Vector){
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function invert(){
__x = (__x * -1);
__y = (__y * -1);
bInvalidNormal = true;
}
public function get normal(){
if (bInvalidNormal){
updateNormal();
};
return (__normal);
}
private function updateNormal(){
__normal = new Vector((-(__y) / len), (__x / len));
bInvalidNormal = false;
}
public function getInverted(){
return (new Vector(-(x), -(y)));
}
public function toString():String{
return ((((("Vector(" + __x) + ", ") + __y) + ")"));
}
public function getNormalized(){
if (len == 0){
return (null);
};
return (new Vector((__x / len), (__y / len)));
}
public function minus(_arg1:Vector){
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function getProduct(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
public function set x(_arg1:Number){
__x = _arg1;
bInvalidLen = true;
bInvalidNormal = true;
}
}
}//package be.atomik.gamelib.geom
Section 5
//AuxFunctions (caurina.transitions.AuxFunctions)
package caurina.transitions {
public class AuxFunctions {
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 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 numberToG(_arg1:Number):Number{
return (((_arg1 & 0xFF00) >> 8));
}
public static function numberToB(_arg1:Number):Number{
return ((_arg1 & 0xFF));
}
public static function numberToR(_arg1:Number):Number{
return (((_arg1 & 0xFF0000) >> 16));
}
}
}//package caurina.transitions
Section 6
//Equations (caurina.transitions.Equations)
package caurina.transitions {
public class Equations {
public static function easeOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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:Number=NaN, _arg6:Number=NaN):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) * 0.5) + _arg3) + _arg2));
}
public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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):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:Number=NaN):Number{
if (!_arg5){
_arg5 = 1.70158;
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) - _arg5))) + _arg2));
};
_arg1 = (_arg1 - 2);
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 2)) + _arg2));
}
public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4));
};
return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=NaN):Number{
if (!_arg5){
_arg5 = 1.70158;
};
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 1)) + _arg2));
}
public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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:Number=NaN):Number{
if (!_arg5){
_arg5 = 1.70158;
};
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_arg5 + 1) * _arg1) - _arg5)) + _arg2));
}
public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4));
};
return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4));
}
public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4));
};
return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4));
}
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):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:Number=NaN):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):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):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4));
};
return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4));
}
public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=NaN, _arg6:Number=NaN):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5, _arg6));
};
return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5, _arg6));
}
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=NaN, _arg6:Number=NaN):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
}
public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4));
};
return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4));
}
public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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):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):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):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4));
};
return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4));
}
public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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:Number=NaN, _arg6:Number=NaN):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) + _arg3) + _arg2));
}
public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4));
};
return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4));
}
public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4));
};
return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4));
}
}
}//package caurina.transitions
Section 7
//PropertyInfoObj (caurina.transitions.PropertyInfoObj)
package caurina.transitions {
public class PropertyInfoObj {
public var modifierParameters:Array;
public var valueComplete:Number;
public var modifierFunction:Function;
public var hasModifier:Boolean;
public var valueStart:Number;
public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Function, _arg4:Array){
valueStart = _arg1;
valueComplete = _arg2;
hasModifier = Boolean(_arg3);
modifierFunction = _arg3;
modifierParameters = _arg4;
}
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 + ("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, modifierFunction, modifierParameters);
return (_local1);
}
}
}//package caurina.transitions
Section 8
//SpecialPropertiesDefault (caurina.transitions.SpecialPropertiesDefault)
package caurina.transitions {
import flash.geom.*;
import flash.filters.*;
import flash.media.*;
public class SpecialPropertiesDefault {
public static function _sound_volume_get(_arg1:Object):Number{
return (_arg1.soundTransform.volume);
}
public static function _color_splitter(_arg1):Array{
var _local2:Array;
_local2 = new Array();
if (_arg1 == null){
_local2.push({name:"_color_ra", value:1});
_local2.push({name:"_color_rb", value:0});
_local2.push({name:"_color_ga", value:1});
_local2.push({name:"_color_gb", value:0});
_local2.push({name:"_color_ba", value:1});
_local2.push({name:"_color_bb", value:0});
} else {
_local2.push({name:"_color_ra", value:0});
_local2.push({name:"_color_rb", value:AuxFunctions.numberToR(_arg1)});
_local2.push({name:"_color_ga", value:0});
_local2.push({name:"_color_gb", value:AuxFunctions.numberToG(_arg1)});
_local2.push({name:"_color_ba", value:0});
_local2.push({name:"_color_bb", value:AuxFunctions.numberToB(_arg1)});
};
return (_local2);
}
public static function frame_get(_arg1:Object):Number{
return (_arg1.currentFrame);
}
public static function _sound_pan_get(_arg1:Object):Number{
return (_arg1.soundTransform.pan);
}
public static function _color_property_get(_arg1:Object, _arg2:Array):Number{
return (_arg1.transform.colorTransform[_arg2[0]]);
}
public static function _sound_volume_set(_arg1:Object, _arg2:Number):void{
var _local3:SoundTransform;
_local3 = _arg1.soundTransform;
_local3.volume = _arg2;
_arg1.soundTransform = _local3;
}
public static function _autoAlpha_get(_arg1:Object):Number{
return (_arg1.alpha);
}
public static function _filter_splitter(_arg1:BitmapFilter):Array{
var _local2:Array;
_local2 = new Array();
if ((_arg1 is BlurFilter)){
_local2.push({name:"_blur_blurX", value:BlurFilter(_arg1).blurX});
_local2.push({name:"_blur_blurY", value:BlurFilter(_arg1).blurY});
_local2.push({name:"_blur_quality", value:BlurFilter(_arg1).quality});
//unresolved jump
};
return (_local2);
}
public static function init():void{
Tweener.registerSpecialProperty("_frame", frame_get, frame_set);
Tweener.registerSpecialProperty("_sound_volume", _sound_volume_get, _sound_volume_set);
Tweener.registerSpecialProperty("_sound_pan", _sound_pan_get, _sound_pan_set);
Tweener.registerSpecialProperty("_color_ra", _color_property_get, _color_property_set, ["redMultiplier"]);
Tweener.registerSpecialProperty("_color_rb", _color_property_get, _color_property_set, ["redOffset"]);
Tweener.registerSpecialProperty("_color_ga", _color_property_get, _color_property_set, ["greenMultiplier"]);
Tweener.registerSpecialProperty("_color_gb", _color_property_get, _color_property_set, ["greenOffset"]);
Tweener.registerSpecialProperty("_color_ba", _color_property_get, _color_property_set, ["blueMultiplier"]);
Tweener.registerSpecialProperty("_color_bb", _color_property_get, _color_property_set, ["blueOffset"]);
Tweener.registerSpecialProperty("_color_aa", _color_property_get, _color_property_set, ["alphaMultiplier"]);
Tweener.registerSpecialProperty("_color_ab", _color_property_get, _color_property_set, ["alphaOffset"]);
Tweener.registerSpecialProperty("_autoAlpha", _autoAlpha_get, _autoAlpha_set);
Tweener.registerSpecialPropertySplitter("_color", _color_splitter);
Tweener.registerSpecialPropertySplitter("_colorTransform", _colorTransform_splitter);
Tweener.registerSpecialPropertySplitter("_scale", _scale_splitter);
Tweener.registerSpecialProperty("_blur_blurX", _filter_property_get, _filter_property_set, [BlurFilter, "blurX"]);
Tweener.registerSpecialProperty("_blur_blurY", _filter_property_get, _filter_property_set, [BlurFilter, "blurY"]);
Tweener.registerSpecialProperty("_blur_quality", _filter_property_get, _filter_property_set, [BlurFilter, "quality"]);
Tweener.registerSpecialPropertySplitter("_filter", _filter_splitter);
Tweener.registerSpecialPropertyModifier("_bezier", _bezier_modifier, _bezier_get);
}
public static function _sound_pan_set(_arg1:Object, _arg2:Number):void{
var _local3:SoundTransform;
_local3 = _arg1.soundTransform;
_local3.pan = _arg2;
_arg1.soundTransform = _local3;
}
public static function _color_property_set(_arg1:Object, _arg2:Number, _arg3:Array):void{
var _local4:ColorTransform;
_local4 = _arg1.transform.colorTransform;
_local4[_arg3[0]] = _arg2;
_arg1.transform.colorTransform = _local4;
}
public static function _filter_property_get(_arg1:Object, _arg2:Array):Number{
var _local3:Array;
var _local4:uint;
var _local5:Object;
var _local6:String;
var _local7:Object;
_local3 = _arg1.filters;
_local5 = _arg2[0];
_local6 = _arg2[1];
_local4 = 0;
while (_local4 < _local3.length) {
if ((((_local3[_local4] is BlurFilter)) && ((_local5 == BlurFilter)))){
return (_local3[_local4][_local6]);
};
_local4++;
};
switch (_local5){
case BlurFilter:
_local7 = {blurX:0, blurY:0, quality:NaN};
break;
};
return (_local7[_local6]);
}
public static function _bezier_get(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Array):Number{
var _local5:uint;
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg4.length == 1){
return ((_arg1 + (_arg3 * (((2 * (1 - _arg3)) * (_arg4[0] - _arg1)) + (_arg3 * (_arg2 - _arg1))))));
};
_local5 = Math.floor((_arg3 * _arg4.length));
_local6 = ((_arg3 - (_local5 * (1 / _arg4.length))) * _arg4.length);
if (_local5 == 0){
_local7 = _arg1;
_local8 = ((_arg4[0] + _arg4[1]) / 2);
} else {
if (_local5 == (_arg4.length - 1)){
_local7 = ((_arg4[(_local5 - 1)] + _arg4[_local5]) / 2);
_local8 = _arg2;
} else {
_local7 = ((_arg4[(_local5 - 1)] + _arg4[_local5]) / 2);
_local8 = ((_arg4[_local5] + _arg4[(_local5 + 1)]) / 2);
};
};
return ((_local7 + (_local6 * (((2 * (1 - _local6)) * (_arg4[_local5] - _local7)) + (_local6 * (_local8 - _local7))))));
}
public static function frame_set(_arg1:Object, _arg2:Number):void{
_arg1.gotoAndStop(Math.round(_arg2));
}
public static function _filter_property_set(_arg1:Object, _arg2:Number, _arg3:Array):void{
var _local4:Array;
var _local5:uint;
var _local6:Object;
var _local7:String;
var _local8:BitmapFilter;
_local4 = _arg1.filters;
_local6 = _arg3[0];
_local7 = _arg3[1];
_local5 = 0;
while (_local5 < _local4.length) {
if ((((_local4[_local5] is BlurFilter)) && ((_local6 == BlurFilter)))){
_local4[_local5][_local7] = _arg2;
_arg1.filters = _local4;
return;
};
_local5++;
};
if (_local4 == null){
_local4 = new Array();
};
switch (_local6){
case BlurFilter:
_local8 = new BlurFilter(0, 0);
break;
};
_local8[_local7] = _arg2;
_local4.push(_local8);
_arg1.filters = _local4;
}
public static function _autoAlpha_set(_arg1:Object, _arg2:Number):void{
_arg1.alpha = _arg2;
_arg1.visible = (_arg2 > 0);
}
public static function _scale_splitter(_arg1:Number):Array{
var _local2:Array;
_local2 = new Array();
_local2.push({name:"scaleX", value:_arg1});
_local2.push({name:"scaleY", value:_arg1});
return (_local2);
}
public static function _colorTransform_splitter(_arg1):Array{
var _local2:Array;
_local2 = new Array();
if (_arg1 == null){
_local2.push({name:"_color_ra", value:1});
_local2.push({name:"_color_rb", value:0});
_local2.push({name:"_color_ga", value:1});
_local2.push({name:"_color_gb", value:0});
_local2.push({name:"_color_ba", value:1});
_local2.push({name:"_color_bb", value:0});
} else {
if (_arg1.ra != undefined){
_local2.push({name:"_color_ra", value:_arg1.ra});
};
if (_arg1.rb != undefined){
_local2.push({name:"_color_rb", value:_arg1.rb});
};
if (_arg1.ga != undefined){
_local2.push({name:"_color_ba", value:_arg1.ba});
};
if (_arg1.gb != undefined){
_local2.push({name:"_color_bb", value:_arg1.bb});
};
if (_arg1.ba != undefined){
_local2.push({name:"_color_ga", value:_arg1.ga});
};
if (_arg1.bb != undefined){
_local2.push({name:"_color_gb", value:_arg1.gb});
};
if (_arg1.aa != undefined){
_local2.push({name:"_color_aa", value:_arg1.aa});
};
if (_arg1.ab != undefined){
_local2.push({name:"_color_ab", value:_arg1.ab});
};
};
return (_local2);
}
public static function _bezier_modifier(_arg1):Array{
var _local2:Array;
var _local3:Array;
var _local4:uint;
var _local5:String;
var _local6:Object;
_local2 = [];
if ((_arg1 is Array)){
_local3 = _arg1;
} else {
_local3 = [_arg1];
};
_local6 = {};
_local4 = 0;
while (_local4 < _local3.length) {
for (_local5 in _local3[_local4]) {
if (_local6[_local5] == undefined){
_local6[_local5] = [];
};
_local6[_local5].push(_local3[_local4][_local5]);
};
_local4++;
};
for (_local5 in _local6) {
_local2.push({name:_local5, parameters:_local6[_local5]});
};
return (_local2);
}
}
}//package caurina.transitions
Section 9
//SpecialProperty (caurina.transitions.SpecialProperty)
package caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var getValue:Function;
public var setValue:Function;
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null){
getValue = _arg1;
setValue = _arg2;
parameters = _arg3;
}
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 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 10
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier)
package 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 caurina.transitions
Section 11
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter)
package caurina.transitions {
public class SpecialPropertySplitter {
public var splitValues:Function;
public function SpecialPropertySplitter(_arg1:Function){
splitValues = _arg1;
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + "[SpecialPropertySplitter ");
_local1 = (_local1 + ("splitValues:" + String(splitValues)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 12
//Tweener (caurina.transitions.Tweener)
package caurina.transitions {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Tweener {
private static var _timeScale:Number = 1;
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 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):void{
var _local5:SpecialProperty;
if (!_inited){
init();
};
_local5 = new SpecialProperty(_arg2, _arg3, _arg4);
_specialPropertyList[_arg1] = _local5;
}
public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Object;
var _local8:Number;
var _local9:Number;
var _local10:Function;
var _local11:TweenListObj;
var _local12:Number;
var _local13:String;
if ((((arguments.length < 2)) || ((arguments[0] == undefined)))){
return (false);
};
_local4 = new Array();
if ((arguments[0] is Array)){
_local5 = 0;
while (_local5 < arguments[0].length) {
_local4.push(arguments[0][_local5]);
_local5++;
};
} else {
_local5 = 0;
while (_local5 < (arguments.length - 1)) {
_local4.push(arguments[_local5]);
_local5++;
};
};
_local7 = arguments[(arguments.length - 1)];
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
_local8 = (isNaN(_local7.time)) ? 0 : _local7.time;
_local9 = (isNaN(_local7.delay)) ? 0 : _local7.delay;
if (typeof(_local7.transition) == "string"){
_local13 = _local7.transition.toLowerCase();
_local10 = _transitionList[_local13];
} else {
_local10 = _local7.transition;
};
if (!Boolean(_local10)){
_local10 = _transitionList["easeoutexpo"];
};
_local5 = 0;
while (_local5 < _local4.length) {
_local11 = new TweenListObj(_local4[_local5], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), (_local7.useFrames == true), _local10);
_local11.properties = null;
_local11.onStart = _local7.onStart;
_local11.onUpdate = _local7.onUpdate;
_local11.onComplete = _local7.onComplete;
_local11.onOverwrite = _local7.onOverwrite;
_local11.onStartParams = _local7.onStartParams;
_local11.onUpdateParams = _local7.onUpdateParams;
_local11.onCompleteParams = _local7.onCompleteParams;
_local11.onOverwriteParams = _local7.onOverwriteParams;
_local11.isCaller = true;
_local11.count = _local7.count;
_local11.waitFrames = _local7.waitFrames;
_tweenList.push(_local11);
if ((((_local8 == 0)) && ((_local9 == 0)))){
_local12 = (_tweenList.length - 1);
updateTweenByIndex(_local12);
removeTweenByIndex(_local12);
};
_local5++;
};
return (true);
}
public static function init(_arg1=null):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
SpecialPropertiesDefault.init();
}
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 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 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 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 resumeTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj;
_local2 = _tweenList[_arg1];
if ((((_local2 == null)) || (!(_local2.isPaused)))){
return (false);
};
_local2.timeStart = (_local2.timeStart + (_currentTime - _local2.timePaused));
_local2.timeComplete = (_local2.timeComplete + (_currentTime - _local2.timePaused));
_local2.timePaused = undefined;
_local2.isPaused = false;
return (true);
}
public static function debug_getList():String{
var _local1:String;
var _local2:uint;
var _local3:uint;
_local1 = "";
_local2 = 0;
while (_local2 < _tweenList.length) {
_local1 = (_local1 + (("[" + _local2) + "] ::\n"));
_local3 = 0;
while (_local3 < _tweenList[_local2].properties.length) {
_local1 = (_local1 + ((((" " + _tweenList[_local2].properties[_local3].name) + " -> ") + _tweenList[_local2].properties[_local3].valueComplete) + "\n"));
_local3++;
};
_local2++;
};
return (_local1);
}
public static function getVersion():String{
return ("AS3 1.25.57");
}
public static function onEnterFrame(_arg1:Event):void{
var _local2:Boolean;
updateTime();
_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 tScope:Object;
var tProperty:Object;
var pv:Number;
var i = _arg1;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
isOver = false;
if (_currentTime >= 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 (!(_currentTime >= nv));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (_currentTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
try {
tTweening.onStart.apply(tScope, tTweening.onStartParams);
} catch(e:Error) {
};
};
for (pName in tTweening.properties) {
pv = getPropertyValue(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 = (_currentTime - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, 0, 1, d);
nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters);
} else {
t = (_currentTime - tTweening.timeStart);
b = tProperty.valueStart;
c = (tProperty.valueComplete - tProperty.valueStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
};
};
if (tTweening.rounded){
nv = Math.round(nv);
};
setPropertyValue(tScope, pName, nv);
};
tTweening.updatesSkipped = 0;
if (Boolean(tTweening.onUpdate)){
try {
tTweening.onUpdate.apply(tScope, tTweening.onUpdateParams);
} catch(e:Error) {
};
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
try {
tTweening.onComplete.apply(tScope, tTweening.onCompleteParams);
} catch(e:Error) {
};
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(_arg1:Number):void{
var _local2:Number;
if (isNaN(_arg1)){
_arg1 = 1;
};
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
if (_arg1 != _timeScale){
_local2 = 0;
while (_local2 < _tweenList.length) {
_tweenList[_local2].timeStart = (_currentTime - (((_currentTime - _tweenList[_local2].timeStart) * _timeScale) / _arg1));
_tweenList[_local2].timeComplete = (_currentTime - (((_currentTime - _tweenList[_local2].timeComplete) * _timeScale) / _arg1));
if (_tweenList[_local2].timePaused != undefined){
_tweenList[_local2].timePaused = (_currentTime - (((_currentTime - _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 startEngine():void{
_engineExists = true;
_tweenList = new Array();
__tweener_controller__ = new MovieClip();
__tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
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 _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:String;
var _local8:String;
var _local9:Object;
var _local10:Number;
var _local11:Number;
var _local12:Array;
var _local13:Object;
var _local14:Object;
var _local15:Function;
var _local16:Object;
var _local17:TweenListObj;
var _local18:Number;
var _local19:Array;
var _local20:Array;
var _local21:String;
if ((((arguments.length < 2)) || ((arguments[0] == undefined)))){
return (false);
};
_local4 = new Array();
if ((arguments[0] is Array)){
_local5 = 0;
while (_local5 < arguments[0].length) {
_local4.push(arguments[0][_local5]);
_local5++;
};
} else {
_local5 = 0;
while (_local5 < (arguments.length - 1)) {
_local4.push(arguments[_local5]);
_local5++;
};
};
_local9 = arguments[(arguments.length - 1)];
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
_local10 = (isNaN(_local9.time)) ? 0 : _local9.time;
_local11 = (isNaN(_local9.delay)) ? 0 : _local9.delay;
_local12 = new Array();
_local13 = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true};
_local14 = new Object();
for (_local7 in _local9) {
if (!_local13[_local7]){
if (_specialPropertySplitterList[_local7]){
_local19 = _specialPropertySplitterList[_local7].splitValues(_local9[_local7]);
_local5 = 0;
while (_local5 < _local19.length) {
_local12[_local19[_local5].name] = {valueStart:undefined, valueComplete:_local19[_local5].value};
_local5++;
};
} else {
if (_specialPropertyModifierList[_local7] != undefined){
_local20 = _specialPropertyModifierList[_local7].modifyValues(_local9[_local7]);
_local5 = 0;
while (_local5 < _local20.length) {
_local14[_local20[_local5].name] = {modifierParameters:_local20[_local5].parameters, modifierFunction:_specialPropertyModifierList[_local7].getValue};
_local5++;
};
} else {
_local12[_local7] = {valueStart:undefined, valueComplete:_local9[_local7]};
};
};
};
};
for (_local7 in _local14) {
if (_local12[_local7] != undefined){
_local12[_local7].modifierParameters = _local14[_local7].modifierParameters;
_local12[_local7].modifierFunction = _local14[_local7].modifierFunction;
};
};
if (typeof(_local9.transition) == "string"){
_local21 = _local9.transition.toLowerCase();
_local15 = _transitionList[_local21];
} else {
_local15 = _local9.transition;
};
if (!Boolean(_local15)){
_local15 = _transitionList["easeoutexpo"];
};
_local5 = 0;
while (_local5 < _local4.length) {
_local16 = new Object();
for (_local7 in _local12) {
_local16[_local7] = new PropertyInfoObj(_local12[_local7].valueStart, _local12[_local7].valueComplete, _local12[_local7].modifierFunction, _local12[_local7].modifierParameters);
};
_local17 = new TweenListObj(_local4[_local5], (_currentTime + ((_local11 * 1000) / _timeScale)), (_currentTime + (((_local11 * 1000) + (_local10 * 1000)) / _timeScale)), (_local9.useFrames == true), _local15);
_local17.properties = _local16;
_local17.onStart = _local9.onStart;
_local17.onUpdate = _local9.onUpdate;
_local17.onComplete = _local9.onComplete;
_local17.onOverwrite = _local9.onOverwrite;
_local17.onStartParams = _local9.onStartParams;
_local17.onUpdateParams = _local9.onUpdateParams;
_local17.onCompleteParams = _local9.onCompleteParams;
_local17.onOverwriteParams = _local9.onOverwriteParams;
_local17.rounded = _local9.rounded;
_local17.skipUpdates = _local9.skipUpdates;
removeTweensByTime(_local17.scope, _local17.properties, _local17.timeStart, _local17.timeComplete);
_tweenList.push(_local17);
if ((((_local10 == 0)) && ((_local11 == 0)))){
_local18 = (_tweenList.length - 1);
updateTweenByIndex(_local18);
removeTweenByIndex(_local18);
};
_local5++;
};
return (true);
}
public static function registerTransition(_arg1:String, _arg2:Function):void{
if (!_inited){
init();
};
_transitionList[_arg1] = _arg2;
}
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 (_tweenList[_local2].scope == _arg1){
for (_local3 in _tweenList[_local2].properties) {
_local4.push(_local3);
};
};
_local2++;
};
return (_local4);
}
private static function setPropertyValue(_arg1:Object, _arg2:String, _arg3:Number):void{
if (_specialPropertyList[_arg2] != undefined){
if (Boolean(_specialPropertyList[_arg2].parameters)){
_specialPropertyList[_arg2].setValue(_arg1, _arg3, _specialPropertyList[_arg2].parameters);
} else {
_specialPropertyList[_arg2].setValue(_arg1, _arg3);
};
} else {
_arg1[_arg2] = _arg3;
};
}
private static function getPropertyValue(_arg1:Object, _arg2:String):Number{
if (_specialPropertyList[_arg2] != undefined){
if (Boolean(_specialPropertyList[_arg2].parameters)){
return (_specialPropertyList[_arg2].getValue(_arg1, _specialPropertyList[_arg2].parameters));
};
return (_specialPropertyList[_arg2].getValue(_arg1));
} else {
};
return (!NULL!);
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local2 = 0;
while (_local2 < _tweenList.length) {
if (_tweenList[_local2].scope == _arg1){
return (true);
};
_local2++;
};
return (false);
}
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 (_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;
__tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
__tweener_controller__ = null;
}
public static function pauseTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj;
_local2 = _tweenList[_arg1];
if ((((_local2 == null)) || (_local2.isPaused))){
return (false);
};
_local2.timePaused = _currentTime;
_local2.isPaused = true;
return (true);
}
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 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)){
try {
_tweenList[i].onOverwrite.apply(_tweenList[i].scope, _tweenList[i].onOverwriteParams);
} catch(e:Error) {
};
};
_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):void{
var _local3:SpecialPropertySplitter;
if (!_inited){
init();
};
_local3 = new SpecialPropertySplitter(_arg2);
_specialPropertySplitterList[_arg1] = _local3;
}
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 caurina.transitions
Section 13
//TweenListObj (caurina.transitions.TweenListObj)
package 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 auxProperties:Object;
public var timeComplete:Number;
public var onStartParams:Array;
public var rounded:Boolean;
public var updatesSkipped:Number;
public var onUpdateParams:Array;
public var onComplete:Function;
public var properties:Object;
public var onStart:Function;
public var skipUpdates:Number;
public var scope:Object;
public var isCaller:Boolean;
public var timePaused:Number;
public var transition:Function;
public var onCompleteParams:Array;
public var timesCalled:Number;
public var onOverwrite:Function;
public var isPaused:Boolean;
public var waitFrames:Boolean;
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function){
scope = _arg1;
timeStart = _arg2;
timeComplete = _arg3;
useFrames = _arg4;
transition = _arg5;
auxProperties = new Object();
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);
_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.onStartParams = onStartParams;
_local2.onUpdateParams = onUpdateParams;
_local2.onCompleteParams = onCompleteParams;
_local2.onOverwriteParams = onOverwriteParams;
};
_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:uint;
_local1 = "\n[TweenListObj ";
_local1 = (_local1 + ("scope:" + String(scope)));
_local1 = (_local1 + ", properties:");
_local2 = 0;
while (_local2 < properties.length) {
if (_local2 > 0){
_local1 = (_local1 + ",");
};
_local1 = (_local1 + ("[name:" + properties[_local2].name));
_local1 = (_local1 + (",valueStart:" + properties[_local2].valueStart));
_local1 = (_local1 + (",valueComplete:" + properties[_local2].valueComplete));
_local1 = (_local1 + "]");
_local2++;
};
_local1 = (_local1 + (", timeStart:" + String(timeStart)));
_local1 = (_local1 + (", timeComplete:" + String(timeComplete)));
_local1 = (_local1 + (", useFrames:" + String(useFrames)));
_local1 = (_local1 + (", transition:" + String(transition)));
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 (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 (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);
}
}
}//package caurina.transitions
Section 14
//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 15
//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 16
//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 17
//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 18
//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 19
//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 20
//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 21
//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 22
//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 23
//Fx (com.markfennell.display.Fx)
package com.markfennell.display {
import flash.display.*;
import caurina.transitions.*;
import flash.filters.*;
import flash.utils.*;
public class Fx extends Sprite {
public function zoomIn(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:String, _arg10:Function){
var _initTime:Number;
var _interval:Number;
var angle:Number;
var blurX:*;
var blurY:*;
var mc:DisplayObject;
var wait:*;
var blurFilter:BlurFilter;
var _animate:Function;
var onMotionStopped:Function;
var _mc = _arg1;
var delay = _arg2;
var duration = _arg3;
var startX = _arg4;
var startY = _arg5;
var finishX = _arg6;
var finishY = _arg7;
var blur = _arg8;
var transition = _arg9;
var callBack = _arg10;
_animate = function (){
mc.filters = [blurFilter];
Tweener.addTween(mc, {x:finishX, y:finishY, time:duration, transition:transition, onComplete:onMotionStopped});
};
onMotionStopped = function (){
this.filters = [];
callBack();
};
_initTime = getTimer();
angle = Math.atan2((finishY - startY), (finishX - startX));
blurX = Math.abs(Math.floor((Math.cos(angle) * blur)));
blurY = Math.abs(Math.floor((Math.sin(angle) * blur)));
mc = _mc;
wait = (1000 * delay);
mc.x = startX;
mc.y = startY;
blurFilter = new BlurFilter(blurX, blurY, 1);
_interval = setTimeout(_animate, wait);
}
public function padScore(_arg1:int, _arg2:int){
var _local3:*;
var _local4:*;
_local3 = "000000000000000000000";
_local4 = _arg1.toString();
if (_local4.length < _arg2){
_local4 = (_local3.substring(0, (_arg2 - _local4.length)) + _local4);
};
return (_local4);
}
}
}//package com.markfennell.display
Section 24
//TimeKeeper (com.markfennell.display.TimeKeeper)
package com.markfennell.display {
import flash.utils.*;
public class TimeKeeper {
private var oldTime:Number;// = 0
private var countdownTime:Number;// = 0
private var isCountdown:Boolean;// = false
private var totalTime:Number;// = 0
private var pause:Boolean;// = false
public function TimeKeeper(_arg1:Number){
oldTime = 0;
pause = false;
totalTime = 0;
isCountdown = false;
countdownTime = 0;
super();
if (_arg1 != 0){
isCountdown = true;
countdownTime = _arg1;
};
this.reset();
}
public function stop(){
if (!this.pause){
this.pause = true;
this.totalTime = (this.totalTime + (getTimer() - this.oldTime));
};
}
public function getTime(_arg1){
if (isCountdown){
return ((countdownTime - _arg1));
};
return (_arg1);
}
public function displayHour(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
_local1 = this.getMili();
_local2 = Math.floor((_local1 / 1000));
_local3 = Math.floor((_local2 / 60));
_local4 = Math.floor((_local3 / 60));
return (_local4);
}
private function two(_arg1){
return ((((_arg1)>9) ? "" : "0" + _arg1));
}
public function reset(){
this.oldTime = 0;
this.pause = true;
this.totalTime = 0;
}
public function getMins(){
var _local1:*;
_local1 = (this.totalTime / 1000);
if (!this.pause){
_local1 = (_local1 + (((getTimer() - this.oldTime) / 1000) / 60));
};
return (Math.round(getTime(_local1)));
}
public function addMili(_arg1){
countdownTime = Math.max(0, (countdownTime - _arg1));
}
private function three(_arg1){
return (((((_arg1)>99) ? "" : "0" + ((_arg1)>9) ? "" : "0") + _arg1));
}
public function getMili(){
var _local1:*;
_local1 = this.totalTime;
if (!this.pause){
_local1 = (_local1 + (getTimer() - this.oldTime));
};
return (getTime(_local1));
}
public function start(){
if (this.pause){
this.pause = false;
this.oldTime = getTimer();
};
}
public function displayTime(){
var _local1:*;
var _local2:*;
_local1 = three(displayMili());
_local1 = _local1.substring(0, 2);
_local2 = ((((displayMin() + ":") + two(displaySec())) + ":") + _local1);
return (_local2);
}
public function displayMin(){
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = this.getMili();
_local2 = Math.floor((_local1 / 1000));
_local3 = Math.floor((_local2 / 60));
_local3 = (_local3 % 60);
return (_local3);
}
public function displaySec(){
var _local1:*;
var _local2:*;
_local1 = this.getMili();
_local2 = Math.floor((_local1 / 1000));
_local2 = (_local2 % 60);
return (_local2);
}
public function getSecs(){
var _local1:*;
_local1 = (this.totalTime / 1000);
if (!this.pause){
_local1 = (_local1 + ((getTimer() - this.oldTime) / 1000));
};
return (Math.round(getTime(_local1)));
}
public function subMili(_arg1){
countdownTime = (countdownTime + _arg1);
}
public function displayMili(){
var _local1:*;
_local1 = this.getMili();
_local1 = (_local1 % 1000);
return (_local1);
}
}
}//package com.markfennell.display
Section 25
//RC4 (com.meychi.ascrypt3.RC4)
package com.meychi.ascrypt3 {
public class RC4 {
private static var mykey:Array = new Array(0xFF);
private static var sbox:Array = new Array(0xFF);
public function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
_local3 = strToChars(_arg1);
_local4 = strToChars(_arg2);
_local5 = calculate(_local3, _local4);
return (charsToHex(_local5));
}
public function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
_local3 = hexToChars(_arg1);
_local4 = strToChars(_arg2);
_local5 = calculate(_local3, _local4);
return (charsToStr(_local5));
}
private static function initialize(_arg1:Array):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = 0;
_local4 = _arg1.length;
_local5 = 0;
_local5 = 0;
while (_local5 <= 0xFF) {
mykey[_local5] = _arg1[(_local5 % _local4)];
sbox[_local5] = _local5;
_local5++;
};
_local5 = 0;
while (_local5 <= 0xFF) {
_local2 = (((_local2 + sbox[_local5]) + mykey[_local5]) % 0x0100);
_local3 = sbox[_local5];
sbox[_local5] = sbox[_local2];
sbox[_local2] = _local3;
_local5++;
};
}
private static function strToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
private static function charsToStr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = new String("");
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
private static function charsToHex(_arg1:Array):String{
var _local2:String;
var _local3:Array;
var _local4:Number;
_local2 = new String("");
_local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
_local4 = 0;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
private static function calculate(_arg1:Array, _arg2:Array):Array{
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
initialize(_arg2);
_local3 = 0;
_local4 = 0;
_local5 = new Array();
_local9 = 0;
while (_local9 < _arg1.length) {
_local3 = ((_local3 + 1) % 0x0100);
_local4 = ((_local4 + sbox[_local3]) % 0x0100);
_local7 = sbox[_local3];
sbox[_local3] = sbox[_local4];
sbox[_local4] = _local7;
_local10 = ((sbox[_local3] + sbox[_local4]) % 0x0100);
_local6 = sbox[_local10];
_local8 = (_arg1[_local9] ^ _local6);
_local5.push(_local8);
_local9++;
};
return (_local5);
}
private static function hexToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
}
}//package com.meychi.ascrypt3
Section 26
//MusicControls (controls.MusicControls)
package controls {
import flash.display.*;
import flash.events.*;
public class MusicControls extends MovieClip {
public var btnOn:SimpleButton;
public var btnOff:SimpleButton;
public function MusicControls(){
var myThis:*;
var soundOn:Function;
var soundOff:Function;
super();
soundOn = function (){
myThis.btnOn.visible = false;
myThis.btnOff.visible = true;
SoundManager.getInstance().startMusic();
};
soundOff = function (){
myThis.btnOff.visible = false;
myThis.btnOn.visible = true;
SoundManager.getInstance().stopMusic();
};
myThis = this;
if (SoundManager.getInstance().musicEnabled){
myThis.btnOff.visible = true;
myThis.btnOn.visible = false;
} else {
myThis.btnOff.visible = false;
myThis.btnOn.visible = true;
};
myThis.btnOn.addEventListener(MouseEvent.CLICK, soundOn);
myThis.btnOff.addEventListener(MouseEvent.CLICK, soundOff);
}
}
}//package controls
Section 27
//SoundControls (controls.SoundControls)
package controls {
import flash.display.*;
import flash.events.*;
public class SoundControls extends MovieClip {
public var btnOn:SimpleButton;
public var btnOff:SimpleButton;
public function SoundControls(){
var myThis:*;
var soundOn:Function;
var soundOff:Function;
super();
soundOn = function (){
myThis.btnOn.visible = false;
myThis.btnOff.visible = true;
SoundManager.getInstance().soundsEnabled = true;
};
soundOff = function (){
myThis.btnOff.visible = false;
myThis.btnOn.visible = true;
SoundManager.getInstance().soundsEnabled = false;
};
myThis = this;
if (SoundManager.getInstance().soundsEnabled){
myThis.btnOff.visible = true;
myThis.btnOn.visible = false;
} else {
myThis.btnOff.visible = false;
myThis.btnOn.visible = true;
};
myThis.btnOn.addEventListener(MouseEvent.CLICK, soundOn);
myThis.btnOff.addEventListener(MouseEvent.CLICK, soundOff);
}
}
}//package controls
Section 28
//Explosion (effects.Explosion)
package effects {
import flash.display.*;
import org.papervision3d.objects.*;
public class Explosion {
public var y:Number;
private var container:Sprite;
public var remove:Boolean;// = false
private var i:int;
private var particleCount:int;
private var particle:Particle;
private var particleNumber:int;
private var particleArray:Array;
private var world:DisplayObject3D;
public var x:Number;
public function Explosion(_arg1:Number, _arg2:Number, _arg3:DisplayObject3D, _arg4:Sprite, _arg5:Boolean){
remove = false;
particleNumber = Constants.PARTICLE_NUMBER;
particleArray = [];
super();
container = _arg4;
world = _arg3;
x = _arg1;
y = _arg2;
if (_arg5){
particleNumber = (particleNumber * 2);
};
i = 0;
while (i < particleNumber) {
particle = new Particle(x, y, world, container, _arg5);
particleArray.push(particle);
i++;
};
}
public function render():void{
particleCount = particleArray.length;
while (particleCount--) {
particle = particleArray[particleCount];
particle.render();
if (particle.killMe){
particle.remove();
delete particleArray[particleCount];
particleArray.splice(particleCount, 1);
};
};
if (particleArray.length == 0){
remove = true;
};
}
}
}//package effects
Section 29
//Explosion2D (effects.Explosion2D)
package effects {
import flash.display.*;
public class Explosion2D {
public var y:Number;
private var container:Sprite;
public var remove:Boolean;// = false
private var i:int;
private var particleCount:int;
private var particle:Particle2D;
private var particleNumber:int;// = 150
private var particleArray:Array;
public var x:Number;
public function Explosion2D(_arg1:Number, _arg2:Number, _arg3:Sprite){
remove = false;
particleNumber = 150;
particleArray = [];
super();
container = _arg3;
x = _arg1;
y = _arg2;
i = 0;
while (i < particleNumber) {
particle = new Particle2D(x, y, container);
particleArray.push(particle);
i++;
};
}
public function render():void{
particleCount = particleArray.length;
while (particleCount--) {
particle = particleArray[particleCount];
particle.render();
if (particle.killMe){
particle.remove();
delete particleArray[particleCount];
particleArray.splice(particleCount, 1);
};
};
if (particleArray.length == 0){
remove = true;
};
}
}
}//package effects
Section 30
//ExplosionManager (effects.ExplosionManager)
package effects {
import flash.display.*;
import org.papervision3d.objects.*;
public class ExplosionManager {
private var container:Sprite;
private var explosionArray:Array;
private var i:int;
private var explosion2D:Explosion2D;
private var explosionArrayLength:int;// = 0
private var explosion:Explosion;
private var explosion2DArrayLength:int;// = 0
private var explosion2DArray:Array;
private var world:DisplayObject3D;
public function ExplosionManager(_arg1:DisplayObject3D, _arg2:Sprite){
explosionArray = new Array();
explosionArrayLength = 0;
explosion2DArray = new Array();
explosion2DArrayLength = 0;
super();
container = _arg2;
world = _arg1;
}
public function createExplosion(_arg1:Number, _arg2:Number, _arg3:Boolean){
explosion = new Explosion(_arg1, _arg2, world, container, _arg3);
explosionArray.push(explosion);
}
public function createExplosion2D(_arg1:Number, _arg2:Number){
explosion2D = new Explosion2D(_arg1, _arg2, container);
explosion2DArray.push(explosion2D);
}
public function render(){
explosionArrayLength = explosionArray.length;
while (explosionArrayLength--) {
explosion = explosionArray[explosionArrayLength];
if (explosion.remove){
explosionArray.splice(explosionArrayLength, 1);
} else {
explosion.render();
};
};
explosion2DArrayLength = explosion2DArray.length;
while (explosion2DArrayLength--) {
explosion2D = explosion2DArray[explosion2DArrayLength];
if (explosion2D.remove){
explosion2DArray.splice(explosion2DArrayLength, 1);
} else {
explosion2D.render();
};
};
}
}
}//package effects
Section 31
//Particle (effects.Particle)
package effects {
import flash.display.*;
import org.papervision3d.objects.*;
public class Particle {
public var vx:Number;
public var vy:Number;
public var vz:Number;
public var step:Number;// = 0
private var particle:DisplayObject3D;
private var container:Sprite;
private var world:DisplayObject3D;
public var gravity:Number;
public var killMe:Boolean;// = false
public var steps:Number;
private var particleImage:Sprite;
public function Particle(_arg1:Number, _arg2:Number, _arg3:DisplayObject3D, _arg4:Sprite, _arg5:Boolean){
var _local6:*;
step = 0;
killMe = false;
super();
world = _arg3;
container = _arg4;
steps = ((Math.random() * 40) + 150);
particle = new DisplayObject3D();
particle.x = _arg1;
particle.y = _arg2;
particle.z = Constants.PARTICLE_MIN_HEIGHT;
world.addChild(particle);
gravity = -4;
vx = (Math.random() * 40);
if (Math.random() > 0.5){
vx = (vx * -1);
};
vy = (Math.random() * 40);
if (Math.random() > 0.5){
vy = (vy * -1);
};
vz = ((Math.random() * 30) + 30);
vz = (vz * -1);
if (_arg5){
vx = (vx * 2);
vy = (vy * 2);
};
particleImage = new particleSprite();
particleImage.x = particle.screen.x;
particleImage.y = particle.screen.y;
particleImage.rotation = (Math.random() * 360);
_local6 = ((Math.random() * 0.35) + 0.5);
particleImage.scaleX = _local6;
particleImage.scaleY = _local6;
container.addChild(particleImage);
}
public function render():void{
particle.x = (particle.x + vx);
particle.y = (particle.y + vy);
particle.z = (particle.z + vz);
particleImage.x = particle.screen.x;
particleImage.y = particle.screen.y;
vz = (vz - gravity);
if (particle.z > Constants.PARTICLE_MIN_HEIGHT){
particle.z = Constants.PARTICLE_MIN_HEIGHT;
killMe = true;
};
}
public function remove(){
container.removeChild(particleImage);
world.removeChild(particle);
}
}
}//package effects
Section 32
//Particle2D (effects.Particle2D)
package effects {
import flash.display.*;
public class Particle2D {
public var vx:Number;
public var vy:Number;
private var container:Sprite;
public var step:Number;// = 0
private var particle:Sprite;
public var gravity:Number;
public var killMe:Boolean;// = false
public var rot:Number;
public var steps:Number;
public var decay:Number;// = 0.999
private var counter:int;// = 0
public function Particle2D(_arg1:Number, _arg2:Number, _arg3:Sprite){
var _local4:*;
step = 0;
decay = 0.999;
killMe = false;
counter = 0;
super();
container = _arg3;
steps = 50;
particle = new particleSprite2D();
particle.x = _arg1;
particle.y = _arg2;
particle.alpha = 0;
container.addChild(particle);
gravity = ((Math.random() * -2) - 1);
vx = (Math.random() * 20);
if (Math.random() > 0.5){
vx = (vx * -1);
};
vy = ((Math.random() * -15) - 5);
_local4 = ((Math.random() * 1.3) + 0.1);
particle.scaleX = _local4;
particle.scaleY = _local4;
rot = ((Math.random() * 10) + 10);
if (Math.random() > 0.5){
rot = (rot * -1);
};
container.addChild(particle);
}
public function remove(){
container.removeChild(particle);
}
public function render():void{
counter++;
if (counter == 2){
particle.alpha = 100;
};
particle.x = (particle.x + vx);
particle.y = (particle.y + vy);
vx = (vx * decay);
particle.rotation = (particle.rotation + rot);
vy = (vy - gravity);
step++;
if (step > steps){
killMe = true;
};
}
}
}//package effects
Section 33
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import fl.events.*;
public class BaseScrollPane extends UIComponent {
protected var defaultLineScrollSize:Number;// = 4
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var vScrollBar:Boolean;
protected var disabledOverlay:Shape;
protected var hScrollBar:Boolean;
protected var availableWidth:Number;
protected var _verticalPageScrollSize:Number;// = 0
protected var vOffset:Number;// = 0
protected var _verticalScrollBar:ScrollBar;
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var background:DisplayObject;
protected var _useBitmpScrolling:Boolean;// = false
protected var contentPadding:Number;// = 0
protected var availableHeight:Number;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
protected static const SCROLL_BAR_STYLES:Object = {upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {repeatDelay:500, repeatInterval:35, skin:"ScrollPane_upSkin", contentPadding:0, disabledAlpha:0.5};
public function BaseScrollPane(){
contentWidth = 0;
contentHeight = 0;
contentPadding = 0;
vOffset = 0;
_maxHorizontalScrollPosition = 0;
_horizontalPageScrollSize = 0;
_verticalPageScrollSize = 0;
defaultLineScrollSize = 4;
useFixedHorizontalScrolling = false;
_useBitmpScrolling = false;
super();
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((((!(enabled)) || (!(_verticalScrollBar.visible)))) || ((contentHeight <= availableHeight)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * verticalLineScrollSize));
setVerticalScrollPosition(_verticalScrollBar.scrollPosition);
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _arg1.delta, horizontalScrollPosition));
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
protected function drawDisabledOverlay():void{
if (enabled){
if (contains(disabledOverlay)){
removeChild(disabledOverlay);
};
} else {
disabledOverlay.x = (disabledOverlay.y = contentPadding);
disabledOverlay.width = availableWidth;
disabledOverlay.height = availableHeight;
disabledOverlay.alpha = (getStyleValue("disabledAlpha") as Number);
addChild(disabledOverlay);
};
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ScrollBar.WIDTH;
_local2 = (contentPadding = Number(getStyleValue("contentPadding")));
_local3 = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
_local4 = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
_local5 = (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - _local4);
hScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_local5 > 0)))));
if (hScrollBar){
_local3 = (_local3 - _local1);
};
if (((((((hScrollBar) && (!(vScrollBar)))) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((contentHeight > _local3)))){
vScrollBar = true;
_local4 = (_local4 - _local1);
};
availableHeight = (_local3 + vOffset);
availableWidth = _local4;
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STATE)){
drawLayout();
};
updateChildren();
super.draw();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
var _local1:Graphics;
super.configUI();
contentScrollRect = new Rectangle(0, 0, 85, 85);
_verticalScrollBar = new ScrollBar();
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_verticalScrollBar.visible = false;
_verticalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_verticalScrollBar);
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar = new ScrollBar();
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_horizontalScrollBar.visible = false;
_horizontalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_horizontalScrollBar);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
disabledOverlay = new Shape();
_local1 = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function calculateContentWidth():void{
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
protected function drawLayout():void{
calculateAvailableSize();
calculateContentWidth();
background.width = width;
background.height = height;
if (vScrollBar){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = ((width - ScrollBar.WIDTH) - contentPadding);
_verticalScrollBar.y = contentPadding;
_verticalScrollBar.height = availableHeight;
} else {
_verticalScrollBar.visible = false;
};
_verticalScrollBar.setScrollProperties(availableHeight, 0, (contentHeight - availableHeight), verticalPageScrollSize);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
if (hScrollBar){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.x = contentPadding;
_horizontalScrollBar.y = ((height - ScrollBar.WIDTH) - contentPadding);
_horizontalScrollBar.width = availableWidth;
} else {
_horizontalScrollBar.visible = false;
};
_horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), horizontalPageScrollSize);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
drawDisabledOverlay();
}
protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 34
//CellRenderer (fl.controls.listClasses.CellRenderer)
package fl.controls.listClasses {
import fl.controls.*;
import flash.events.*;
public class CellRenderer extends LabelButton implements ICellRenderer {
protected var _data:Object;
protected var _listData:ListData;
private static var defaultStyles:Object = {upSkin:"CellRenderer_upSkin", downSkin:"CellRenderer_downSkin", overSkin:"CellRenderer_overSkin", disabledSkin:"CellRenderer_disabledSkin", selectedDisabledSkin:"CellRenderer_selectedDisabledSkin", selectedUpSkin:"CellRenderer_selectedUpSkin", selectedDownSkin:"CellRenderer_selectedDownSkin", selectedOverSkin:"CellRenderer_selectedOverSkin", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public function CellRenderer():void{
toggle = true;
focusEnabled = false;
}
override protected function toggleSelected(_arg1:MouseEvent):void{
}
override public function get selected():Boolean{
return (super.selected);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
label = _listData.label;
setStyle("icon", _listData.icon);
}
override public function set selected(_arg1:Boolean):void{
super.selected = _arg1;
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get listData():ListData{
return (_listData);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = 0;
if (icon != null){
icon.x = _local1;
icon.y = Math.round(((height - icon.height) >> 1));
_local2 = (icon.width + _local1);
};
if (label.length > 0){
textField.visible = true;
_local3 = Math.max(0, ((width - _local2) - (_local1 * 2)));
textField.width = _local3;
textField.height = (textField.textHeight + 4);
textField.x = (_local2 + _local1);
textField.y = Math.round(((height - textField.height) >> 1));
} else {
textField.visible = false;
};
background.width = width;
background.height = height;
}
public function get data():Object{
return (_data);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.listClasses
Section 35
//ICellRenderer (fl.controls.listClasses.ICellRenderer)
package fl.controls.listClasses {
public interface ICellRenderer {
function setSize(_arg1:Number, _arg2:Number):void;
function get listData():ListData;
function get data():Object;
function setMouseState(_arg1:String):void;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function set data(_arg1:Object):void;
function set selected(_arg1:Boolean):void;
function set listData(_arg1:ListData):void;
function get selected():Boolean;
}
}//package fl.controls.listClasses
Section 36
//ListData (fl.controls.listClasses.ListData)
package fl.controls.listClasses {
import fl.core.*;
public class ListData {
protected var _index:uint;
protected var _owner:UIComponent;
protected var _label:String;
protected var _icon:Object;// = null
protected var _row:uint;
protected var _column:uint;
public function ListData(_arg1:String, _arg2:Object, _arg3:UIComponent, _arg4:uint, _arg5:uint, _arg6:uint=0){
_icon = null;
super();
_label = _arg1;
_icon = _arg2;
_owner = _arg3;
_index = _arg4;
_row = _arg5;
_column = _arg6;
}
public function get owner():UIComponent{
return (_owner);
}
public function get label():String{
return (_label);
}
public function get row():uint{
return (_row);
}
public function get index():uint{
return (_index);
}
public function get icon():Object{
return (_icon);
}
public function get column():uint{
return (_column);
}
}
}//package fl.controls.listClasses
Section 37
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 38
//Button (fl.controls.Button)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 39
//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 40
//ComboBox (fl.controls.ComboBox)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class ComboBox extends UIComponent implements IFocusManagerComponent {
protected var _dropdownWidth:Number;
protected var highlightedCell:int;// = -1
protected var _prompt:String;
protected var isOpen:Boolean;// = false
protected var list:List;
protected var _rowCount:uint;// = 5
protected var currentIndex:int;
protected var isKeyDown:Boolean;// = false
protected var _labels:Array;
protected var background:BaseButton;
protected var inputField:TextInput;
protected var listOverIndex:uint;
protected var editableValue:String;
protected var _editable:Boolean;// = false
private var collectionItemImport:SimpleCollectionItem;
protected static const BACKGROUND_STYLES:Object = {overSkin:"overSkin", downSkin:"downSkin", upSkin:"upSkin", disabledSkin:"disabledSkin", repeatInterval:"repeatInterval"};
protected static const LIST_STYLES:Object = {upSkin:"comboListUpSkin", overSkin:"comboListOverSkin", downSkin:"comobListDownSkin", disabledSkin:"comboListDisabledSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval", textFormat:"textFormat", disabledAlpha:"disabledAlpha", skin:"listSkin"};
private static var defaultStyles:Object = {upSkin:"ComboBox_upSkin", downSkin:"ComboBox_downSkin", overSkin:"ComboBox_overSkin", disabledSkin:"ComboBox_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:3, buttonWidth:24, disabledAlpha:null, listSkin:null};
public static var createAccessibilityImplementation:Function;
public function ComboBox(){
_rowCount = 5;
_editable = false;
isOpen = false;
highlightedCell = -1;
isKeyDown = false;
super();
}
protected function drawList():void{
list.rowCount = Math.max(0, Math.min(_rowCount, list.dataProvider.length));
}
public function set imeMode(_arg1:String):void{
inputField.imeMode = _arg1;
}
public function get dropdown():List{
return (list);
}
public function get dropdownWidth():Number{
return (list.width);
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (list.sortItemsOn(_arg1, _arg2));
}
protected function onEnter(_arg1:ComponentEvent):void{
_arg1.stopPropagation();
}
public function removeItemAt(_arg1:uint):void{
list.removeItemAt(_arg1);
invalidate(InvalidationType.DATA);
}
public function open():void{
currentIndex = selectedIndex;
if (((isOpen) || ((length == 0)))){
return;
};
dispatchEvent(new Event(Event.OPEN));
isOpen = true;
addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true);
positionList();
list.scrollToSelected();
stage.addChild(list);
}
public function get selectedItem():Object{
return (list.selectedItem);
}
public function set text(_arg1:String):void{
if (!editable){
return;
};
inputField.text = _arg1;
}
public function get labelField():String{
return (list.labelField);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:uint;
var _local4:Number;
var _local5:int;
isKeyDown = true;
if (_arg1.ctrlKey){
switch (_arg1.keyCode){
case Keyboard.UP:
if (highlightedCell > -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
break;
case Keyboard.DOWN:
open();
break;
};
return;
};
_arg1.stopPropagation();
_local2 = Math.max(((calculateAvailableHeight() / list.rowHeight) << 0), 1);
_local3 = selectedIndex;
_local4 = ((highlightedCell)==-1) ? selectedIndex : highlightedCell;
_local5 = -1;
switch (_arg1.keyCode){
case Keyboard.SPACE:
if (isOpen){
close();
} else {
open();
};
return;
case Keyboard.ESCAPE:
if (isOpen){
if (highlightedCell > -1){
selectedIndex = selectedIndex;
};
close();
};
return;
case Keyboard.UP:
_local5 = Math.max(0, (_local4 - 1));
break;
case Keyboard.DOWN:
_local5 = Math.min((length - 1), (_local4 + 1));
break;
case Keyboard.PAGE_UP:
_local5 = Math.max((_local4 - _local2), 0);
break;
case Keyboard.PAGE_DOWN:
_local5 = Math.min((_local4 + _local2), (length - 1));
break;
case Keyboard.HOME:
_local5 = 0;
break;
case Keyboard.END:
_local5 = (length - 1);
break;
case Keyboard.ENTER:
if (((_editable) && ((highlightedCell == -1)))){
editableValue = inputField.text;
selectedIndex = -1;
} else {
if (((isOpen) && ((highlightedCell > -1)))){
editableValue = null;
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
};
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER));
close();
return;
default:
if (editable){
break;
};
_local5 = list.getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), _local4);
break;
};
if (_local5 > -1){
if (isOpen){
highlightCell(_local5);
inputField.text = list.itemToLabel(getItemAt(_local5));
} else {
highlightCell();
selectedIndex = _local5;
dispatchEvent(new Event(Event.CHANGE));
};
};
}
public function set dropdownWidth(_arg1:Number):void{
_dropdownWidth = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
super.focusInHandler(_arg1);
if (editable){
stage.focus = inputField.textField;
};
}
protected function onStageClick(_arg1:MouseEvent):void{
if (!isOpen){
return;
};
if (((!(contains((_arg1.target as DisplayObject)))) && (!(list.contains((_arg1.target as DisplayObject)))))){
if (highlightedCell != -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
invalidate(InvalidationType.DATA);
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
isKeyDown = false;
}
protected function onListItemUp(_arg1:MouseEvent):void{
var _local2:*;
stage.removeEventListener(MouseEvent.MOUSE_UP, onListItemUp);
if (((!((_arg1.target is ICellRenderer))) || (!(list.contains((_arg1.target as DisplayObject)))))){
return;
};
editableValue = null;
_local2 = selectedIndex;
selectedIndex = _arg1.target.listData.index;
if (_local2 != selectedIndex){
dispatchEvent(new Event(Event.CHANGE));
};
close();
}
public function removeAll():void{
list.removeAll();
inputField.text = "";
invalidate(InvalidationType.DATA);
}
public function set selectedItem(_arg1:Object):void{
list.selectedItem = _arg1;
invalidate(InvalidationType.SELECTED);
}
protected function highlightCell(_arg1:int=-1):void{
var _local2:ICellRenderer;
if (highlightedCell > -1){
_local2 = list.itemToCellRenderer(getItemAt(highlightedCell));
if (_local2 != null){
_local2.setMouseState("up");
};
};
if (_arg1 == -1){
return;
};
list.scrollToIndex(_arg1);
list.drawNow();
_local2 = list.itemToCellRenderer(getItemAt(_arg1));
if (_local2 != null){
_local2.setMouseState("over");
highlightedCell = _arg1;
};
}
public function itemToLabel(_arg1:Object):String{
if (_arg1 == null){
return ("");
};
return (list.itemToLabel(_arg1));
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
list.addItemAt(_arg1, _arg2);
invalidate(InvalidationType.DATA);
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (list.replaceItemAt(_arg1, _arg2));
}
protected function showPrompt():void{
inputField.text = _prompt;
}
public function set rowCount(_arg1:uint):void{
_rowCount = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get restrict():String{
return (inputField.restrict);
}
protected function setEmbedFonts():void{
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
inputField.textField.embedFonts = _local1;
};
}
public function sortItems(... _args){
return (list.sortItems.apply(list, _args));
}
public function set labelField(_arg1:String):void{
list.labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
drawTextField();
}
public function set prompt(_arg1:String):void{
if (_arg1 == ""){
_prompt = null;
} else {
_prompt = _arg1;
};
invalidate(InvalidationType.STATE);
}
public function get length():int{
return (list.length);
}
protected function drawTextField():void{
inputField.setStyle("upSkin", "");
inputField.setStyle("disabledSkin", "");
inputField.enabled = enabled;
inputField.editable = _editable;
inputField.textField.selectable = ((enabled) && (_editable));
inputField.mouseEnabled = (inputField.mouseChildren = ((enabled) && (_editable)));
inputField.focusEnabled = false;
if (_editable){
inputField.addEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus, false, 0, true);
inputField.addEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut, false, 0, true);
} else {
inputField.removeEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus);
inputField.removeEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut);
};
}
protected function onInputFieldFocusOut(_arg1:FocusEvent):void{
inputField.removeEventListener(ComponentEvent.ENTER, onEnter);
selectedIndex = selectedIndex;
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
public function get imeMode():String{
return (inputField.imeMode);
}
public function get labelFunction():Function{
return (list.labelFunction);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return ((list.height - (_local1 * 2)));
}
public function get selectedIndex():int{
return (list.selectedIndex);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
isKeyDown = false;
if (isOpen){
if (((!(_arg1.relatedObject)) || (!(list.contains(_arg1.relatedObject))))){
if (((!((highlightedCell == -1))) && (!((highlightedCell == selectedIndex))))){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
};
super.focusOutHandler(_arg1);
}
public function get selectedLabel():String{
if (editableValue != null){
return (editableValue);
};
if (selectedIndex == -1){
return (null);
};
return (itemToLabel(selectedItem));
}
public function get text():String{
return (inputField.text);
}
protected function onListChange(_arg1:Event):void{
editableValue = null;
dispatchEvent(_arg1);
invalidate(InvalidationType.SELECTED);
if (isKeyDown){
return;
};
close();
}
protected function onToggleListVisibility(_arg1:MouseEvent):void{
_arg1.stopPropagation();
dispatchEvent(_arg1);
if (isOpen){
close();
} else {
open();
stage.addEventListener(MouseEvent.MOUSE_UP, onListItemUp, false, 0, true);
};
}
override protected function draw():void{
var _local1:*;
_local1 = selectedIndex;
if ((((_local1 == -1)) && (((((!((prompt == null))) || (editable))) || ((length == 0)))))){
_local1 = Math.max(-1, Math.min(_local1, (length - 1)));
} else {
editableValue = null;
_local1 = Math.max(0, Math.min(_local1, (length - 1)));
};
if (list.selectedIndex != _local1){
list.selectedIndex = _local1;
invalidate(InvalidationType.SELECTED, false);
};
if (isInvalid(InvalidationType.STYLES)){
setStyles();
setEmbedFonts();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.STATE)){
drawTextFormat();
drawLayout();
invalidate(InvalidationType.DATA);
};
if (isInvalid(InvalidationType.DATA)){
drawList();
invalidate(InvalidationType.SELECTED, true);
};
if (isInvalid(InvalidationType.SELECTED)){
if ((((_local1 == -1)) && (!((editableValue == null))))){
inputField.text = editableValue;
} else {
if (_local1 > -1){
if (length > 0){
inputField.horizontalScrollPosition = 0;
inputField.text = itemToLabel(list.selectedItem);
};
} else {
if ((((_local1 == -1)) && (!((_prompt == null))))){
showPrompt();
} else {
inputField.text = "";
};
};
};
if (((((editable) && ((selectedIndex > -1)))) && ((stage.focus == inputField.textField)))){
inputField.setSelection(0, inputField.length);
};
};
drawTextField();
super.draw();
}
public function addItem(_arg1:Object):void{
list.addItem(_arg1);
invalidate(InvalidationType.DATA);
}
public function get rowCount():uint{
return (_rowCount);
}
override protected function configUI():void{
super.configUI();
background = new BaseButton();
background.focusEnabled = false;
copyStylesToChild(background, BACKGROUND_STYLES);
background.addEventListener(MouseEvent.MOUSE_DOWN, onToggleListVisibility, false, 0, true);
addChild(background);
inputField = new TextInput();
inputField.focusTarget = (this as IFocusManagerComponent);
inputField.focusEnabled = false;
inputField.addEventListener(Event.CHANGE, onTextInput, false, 0, true);
addChild(inputField);
list = new List();
list.focusEnabled = false;
copyStylesToChild(list, LIST_STYLES);
list.addEventListener(Event.CHANGE, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_CLICK, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OUT, passEvent, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OVER, passEvent, false, 0, true);
list.verticalScrollBar.addEventListener(Event.SCROLL, passEvent, false, 0, true);
}
protected function positionList():void{
var _local1:Point;
_local1 = localToGlobal(new Point(0, 0));
list.x = _local1.x;
if (((_local1.y + height) + list.height) > stage.stageHeight){
list.y = (_local1.y - list.height);
} else {
list.y = (_local1.y + height);
};
}
public function get value():String{
var _local1:Object;
if (editableValue != null){
return (editableValue);
};
_local1 = selectedItem;
if (((!(_editable)) && (!((_local1.data == null))))){
return (_local1.data);
};
return (itemToLabel(_local1));
}
public function get prompt():String{
return (_prompt);
}
public function set dataProvider(_arg1:DataProvider):void{
_arg1.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
list.dataProvider = _arg1;
invalidate(InvalidationType.DATA);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
if (!_editable){
return;
};
inputField.restrict = _arg1;
}
protected function onTextInput(_arg1:Event):void{
_arg1.stopPropagation();
if (!_editable){
return;
};
editableValue = inputField.text;
selectedIndex = -1;
dispatchEvent(new Event(Event.CHANGE));
}
protected function onInputFieldFocus(_arg1:FocusEvent):void{
inputField.addEventListener(ComponentEvent.ENTER, onEnter, false, 0, true);
close();
}
public function getItemAt(_arg1:uint):Object{
return (list.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (ComboBox.createAccessibilityImplementation != null){
ComboBox.createAccessibilityImplementation(this);
};
}
protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
_local1 = (getStyleValue("buttonWidth") as Number);
_local2 = (getStyleValue("textPadding") as Number);
background.setSize(width, height);
inputField.x = (inputField.y = _local2);
inputField.setSize(((width - _local1) - _local2), (height - _local2));
list.width = (isNaN(_dropdownWidth)) ? width : _dropdownWidth;
background.enabled = enabled;
background.drawNow();
}
public function removeItem(_arg1:Object):Object{
return (list.removeItem(_arg1));
}
private function addCloseListener(_arg1:Event){
removeEventListener(Event.ENTER_FRAME, addCloseListener);
if (!isOpen){
return;
};
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false, 0, true);
}
public function get dataProvider():DataProvider{
return (list.dataProvider);
}
public function get textField():TextInput{
return (inputField);
}
protected function setStyles():void{
copyStylesToChild(background, BACKGROUND_STYLES);
copyStylesToChild(list, LIST_STYLES);
}
public function set labelFunction(_arg1:Function):void{
list.labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
protected function drawTextFormat():void{
var _local1:TextFormat;
_local1 = (getStyleValue((_enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local1 == null){
_local1 = new TextFormat();
};
inputField.textField.defaultTextFormat = _local1;
inputField.textField.setTextFormat(_local1);
setEmbedFonts();
}
public function set selectedIndex(_arg1:int):void{
list.selectedIndex = _arg1;
highlightCell();
invalidate(InvalidationType.SELECTED);
}
public function close():void{
highlightCell();
highlightedCell = -1;
if (!isOpen){
return;
};
dispatchEvent(new Event(Event.CLOSE));
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onStageClick);
isOpen = false;
stage.removeChild(list);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, List.getStyleDefinition()));
}
}
}//package fl.controls
Section 41
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 42
//List (fl.controls.List)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import fl.managers.*;
import flash.utils.*;
import flash.ui.*;
public class List extends SelectableList implements IFocusManagerComponent {
protected var _labelField:String;// = "label"
protected var _rowHeight:Number;// = 20
protected var _cellRenderer:Object;
protected var _iconField:String;// = "icon"
protected var _labelFunction:Function;
protected var _iconFunction:Function;
private static var defaultStyles:Object = {focusRectSkin:null, focusRectPadding:null};
public static var createAccessibilityImplementation:Function;
public function List(){
_rowHeight = 20;
_labelField = "label";
_iconField = "icon";
super();
}
public function get iconField():String{
return (_iconField);
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
_local4 = false;
if (_arg2){
_local6 = [];
_local7 = lastCaretIndex;
_local8 = _arg1;
if (_local7 == -1){
_local7 = ((caretIndex)!=-1) ? caretIndex : _arg1;
};
if (_local7 > _local8){
_local8 = _local7;
_local7 = _arg1;
};
_local5 = _local7;
while (_local5 <= _local8) {
_local6.push(_local5);
_local5++;
};
selectedIndices = _local6;
caretIndex = _arg1;
_local4 = true;
} else {
selectedIndex = _arg1;
caretIndex = (lastCaretIndex = _arg1);
_local4 = true;
};
if (_local4){
dispatchEvent(new Event(Event.CHANGE));
};
invalidate(InvalidationType.DATA);
}
override protected function drawList():void{
var _local1:Rectangle;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:ICellRenderer;
var _local7:Dictionary;
var _local8:Dictionary;
var _local9:Boolean;
var _local10:String;
var _local11:Object;
var _local12:Sprite;
var _local13:String;
listHolder.x = (listHolder.y = contentPadding);
_local1 = listHolder.scrollRect;
_local1.x = _horizontalScrollPosition;
_local1.y = (Math.floor(_verticalScrollPosition) % rowHeight);
listHolder.scrollRect = _local1;
listHolder.cacheAsBitmap = useBitmapScrolling;
_local2 = Math.floor((_verticalScrollPosition / rowHeight));
_local3 = Math.min(length, ((_local2 + rowCount) + 1));
_local7 = (renderedItems = new Dictionary(true));
_local4 = _local2;
while (_local4 < _local3) {
_local7[_dataProvider.getItemAt(_local4)] = true;
_local4++;
};
_local8 = new Dictionary(true);
while (activeCellRenderers.length > 0) {
_local6 = (activeCellRenderers.pop() as ICellRenderer);
_local5 = _local6.data;
if ((((_local7[_local5] == null)) || ((invalidItems[_local5] == true)))){
availableCellRenderers.push(_local6);
} else {
_local8[_local5] = _local6;
invalidItems[_local5] = true;
};
list.removeChild((_local6 as DisplayObject));
};
invalidItems = new Dictionary(true);
_local4 = _local2;
while (_local4 < _local3) {
_local9 = false;
_local5 = _dataProvider.getItemAt(_local4);
if (_local8[_local5] != null){
_local9 = true;
_local6 = _local8[_local5];
delete _local8[_local5];
} else {
if (availableCellRenderers.length > 0){
_local6 = (availableCellRenderers.pop() as ICellRenderer);
} else {
_local6 = (getDisplayObjectInstance(getStyleValue("cellRenderer")) as ICellRenderer);
_local12 = (_local6 as Sprite);
if (_local12 != null){
_local12.addEventListener(MouseEvent.CLICK, handleCellRendererClick, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OVER, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OUT, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(Event.CHANGE, handleCellRendererChange, false, 0, true);
_local12.doubleClickEnabled = true;
_local12.addEventListener(MouseEvent.DOUBLE_CLICK, handleCellRendererDoubleClick, false, 0, true);
if (_local12["setStyle"] != null){
for (_local13 in rendererStyles) {
var _local16 = _local12;
_local16["setStyle"](_local13, rendererStyles[_local13]);
};
};
};
};
};
list.addChild((_local6 as Sprite));
activeCellRenderers.push(_local6);
_local6.y = (rowHeight * (_local4 - _local2));
_local6.setSize((availableWidth + _maxHorizontalScrollPosition), rowHeight);
_local10 = itemToLabel(_local5);
_local11 = null;
if (_iconFunction != null){
_local11 = _iconFunction(_local5);
} else {
if (_iconField != null){
_local11 = _local5[_iconField];
};
};
if (!_local9){
_local6.data = _local5;
};
_local6.listData = new ListData(_local10, _local11, this, _local4, _local4, 0);
_local6.selected = !((_selectedIndices.indexOf(_local4) == -1));
if ((_local6 is UIComponent)){
(_local6 as UIComponent).drawNow();
};
_local4++;
};
}
public function get iconFunction():Function{
return (_iconFunction);
}
public function set iconField(_arg1:String):void{
if (_arg1 == _iconField){
return;
};
_iconField = _arg1;
invalidate(InvalidationType.DATA);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.SPACE:
if (caretIndex == -1){
caretIndex = 0;
};
doKeySelection(caretIndex, _arg1.shiftKey, _arg1.ctrlKey);
scrollToSelected();
break;
default:
_local2 = getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), selectedIndex);
if (_local2 > -1){
selectedIndex = _local2;
scrollToSelected();
};
break;
};
_arg1.stopPropagation();
}
override public function itemToLabel(_arg1:Object):String{
if (_labelFunction != null){
return (String(_labelFunction(_arg1)));
};
return (((_arg1[_labelField])!=null) ? String(_arg1[_labelField]) : "");
}
public function get labelField():String{
return (_labelField);
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int;
var _local5:int;
var _local6:int;
_local4 = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
_local5 = -1;
_local6 = 0;
switch (_arg1){
case Keyboard.UP:
if (caretIndex > 0){
_local5 = (caretIndex - 1);
};
break;
case Keyboard.DOWN:
if (caretIndex < (length - 1)){
_local5 = (caretIndex + 1);
};
break;
case Keyboard.PAGE_UP:
if (caretIndex > 0){
_local5 = Math.max((caretIndex - _local4), 0);
};
break;
case Keyboard.PAGE_DOWN:
if (caretIndex < (length - 1)){
_local5 = Math.min((caretIndex + _local4), (length - 1));
};
break;
case Keyboard.HOME:
if (caretIndex > 0){
_local5 = 0;
};
break;
case Keyboard.END:
if (caretIndex < (length - 1)){
_local5 = (length - 1);
};
break;
};
if (_local5 >= 0){
doKeySelection(_local5, _arg2, _arg3);
scrollToSelected();
};
}
public function set labelField(_arg1:String):void{
if (_arg1 == _labelField){
return;
};
_labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowCount(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
height = (((rowHeight * _arg1) + (2 * _local2)) + _local3);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
list.x = -(_arg1);
super.setHorizontalScrollPosition(_arg1, true);
}
public function set iconFunction(_arg1:Function):void{
if (_iconFunction == _arg1){
return;
};
_iconFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function get labelFunction():Function{
return (_labelFunction);
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
override protected function draw():void{
var _local1:Boolean;
_local1 = !((contentHeight == (rowHeight * length)));
contentHeight = (rowHeight * length);
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
if (_cellRenderer != getStyleValue("cellRenderer")){
_invalidateList();
_cellRenderer = getStyleValue("cellRenderer");
};
};
if (((isInvalid(InvalidationType.SIZE, InvalidationType.STATE)) || (_local1))){
drawLayout();
};
if (isInvalid(InvalidationType.RENDERER_STYLES)){
updateRendererStyles();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.SCROLL, InvalidationType.SELECTED)){
drawList();
};
updateChildren();
validate();
}
override protected function configUI():void{
useFixedHorizontalScrolling = true;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
super.configUI();
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
override protected function initializeAccessibility():void{
if (List.createAccessibilityImplementation != null){
List.createAccessibilityImplementation(this);
};
}
override public function scrollToIndex(_arg1:int):void{
var _local2:uint;
var _local3:uint;
drawNow();
_local2 = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
_local3 = Math.ceil((_verticalScrollPosition / rowHeight));
if (_arg1 < _local3){
verticalScrollPosition = (_arg1 * rowHeight);
} else {
if (_arg1 > _local2){
verticalScrollPosition = (((_arg1 + 1) * rowHeight) - availableHeight);
};
};
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = _arg1;
invalidate(InvalidationType.SIZE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition()));
}
}
}//package fl.controls
Section 43
//RadioButton (fl.controls.RadioButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.ui.*;
public class RadioButton extends LabelButton implements IFocusManagerGroup {
protected var _value:Object;
protected var defaultGroupName:String;// = "RadioButtonGroup"
protected var _group:RadioButtonGroup;
private static var defaultStyles:Object = {icon:null, upIcon:"RadioButton_upIcon", downIcon:"RadioButton_downIcon", overIcon:"RadioButton_overIcon", disabledIcon:"RadioButton_disabledIcon", selectedDisabledIcon:"RadioButton_selectedDisabledIcon", selectedUpIcon:"RadioButton_selectedUpIcon", selectedDownIcon:"RadioButton_selectedDownIcon", selectedOverIcon:"RadioButton_selectedOverIcon", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public static var createAccessibilityImplementation:Function;
public function RadioButton(){
defaultGroupName = "RadioButtonGroup";
super();
mode = "border";
groupName = defaultGroupName;
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = (background.x - _local2);
uiFocusRect.y = (background.y - _local2);
uiFocusRect.width = (background.width + (_local2 * 2));
uiFocusRect.height = (background.height + (_local2 * 2));
};
}
private function setThis():void{
var _local1:RadioButtonGroup;
_local1 = _group;
if (_local1 != null){
if (_local1.selection != this){
_local1.selection = this;
};
} else {
super.selected = true;
};
}
override public function get autoRepeat():Boolean{
return (false);
}
override public function set autoRepeat(_arg1:Boolean):void{
}
protected function handleClick(_arg1:MouseEvent):void{
if (_group == null){
return;
};
_group.dispatchEvent(new MouseEvent(MouseEvent.CLICK, true));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.DOWN:
setNext(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.UP:
setPrev(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
setPrev(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.RIGHT:
setNext(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.SPACE:
setThis();
_toggle = false;
default:
super.keyDownHandler(_arg1);
break;
};
}
private function setNext(_arg1:Boolean=true):void{
var _local2:RadioButtonGroup;
var _local3:IFocusManager;
var _local4:int;
var _local5:Number;
var _local6:int;
var _local7:*;
_local2 = _group;
if (_local2 == null){
return;
};
_local3 = focusManager;
if (_local3){
_local3.showFocusIndicator = true;
};
_local4 = _local2.getRadioButtonIndex(this);
_local5 = _local2.numRadioButtons;
_local6 = _local4;
if (_local4 != -1){
do {
_local6++;
_local6 = ((_local6)>(_local2.numRadioButtons - 1)) ? 0 : _local6;
_local7 = _local2.getRadioButtonAt(_local6);
if (((_local7) && (_local7.enabled))){
if (_arg1){
_local2.selection = _local7;
};
_local7.setFocus();
return;
};
if (((_arg1) && (!((_local2.getRadioButtonAt(_local6) == _local2.selection))))){
_local2.selection = this;
};
this.drawFocus(true);
} while (_local6 != _local4);
};
}
public function get group():RadioButtonGroup{
return (_group);
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
super.keyUpHandler(_arg1);
if ((((_arg1.keyCode == Keyboard.SPACE)) && (!(_toggle)))){
_toggle = true;
};
}
override public function get selected():Boolean{
return (super.selected);
}
override public function set toggle(_arg1:Boolean):void{
throw (new Error("Warning: You cannot change a RadioButtons toggle."));
}
public function set value(_arg1:Object):void{
_value = _arg1;
}
public function set group(_arg1:RadioButtonGroup):void{
groupName = _arg1.name;
}
override public function set selected(_arg1:Boolean):void{
if ((((_arg1 == false)) || (selected))){
return;
};
if (_group != null){
_group.selection = this;
} else {
super.selected = _arg1;
};
}
override protected function draw():void{
super.draw();
}
override public function get toggle():Boolean{
return (true);
}
override protected function configUI():void{
var _local1:Shape;
var _local2:Graphics;
super.configUI();
super.toggle = true;
_local1 = new Shape();
_local2 = _local1.graphics;
_local2.beginFill(0, 0);
_local2.drawRect(0, 0, 100, 100);
_local2.endFill();
background = (_local1 as DisplayObject);
addChildAt(background, 0);
addEventListener(MouseEvent.CLICK, handleClick, false, 0, true);
}
public function set groupName(_arg1:String):void{
if (_group != null){
_group.removeRadioButton(this);
_group.removeEventListener(Event.CHANGE, handleChange);
};
_group = ((_arg1)==null) ? null : RadioButtonGroup.getGroup(_arg1);
if (_group != null){
_group.addRadioButton(this);
_group.addEventListener(Event.CHANGE, handleChange, false, 0, true);
};
}
public function get value():Object{
return (_value);
}
override protected function drawLayout():void{
var _local1:Number;
super.drawLayout();
_local1 = Number(getStyleValue("textPadding"));
switch (_labelPlacement){
case ButtonLabelPlacement.RIGHT:
icon.x = _local1;
textField.x = (icon.x + (icon.width + _local1));
background.width = ((textField.x + textField.width) + _local1);
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.LEFT:
icon.x = ((width - icon.width) - _local1);
textField.x = (((width - icon.width) - (_local1 * 2)) - textField.width);
background.width = ((textField.width + icon.width) + (_local1 * 3));
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.TOP:
case ButtonLabelPlacement.BOTTOM:
background.width = (Math.max(textField.width, icon.width) + (_local1 * 2));
background.height = ((textField.height + icon.height) + (_local1 * 3));
break;
};
background.x = Math.min((icon.x - _local1), (textField.x - _local1));
background.y = Math.min((icon.y - _local1), (textField.y - _local1));
}
override protected function drawBackground():void{
}
override protected function initializeAccessibility():void{
if (RadioButton.createAccessibilityImplementation != null){
RadioButton.createAccessibilityImplementation(this);
};
}
public function get groupName():String{
return (((_group)==null) ? null : _group.name);
}
private function setPrev(_arg1:Boolean=true):void{
var _local2:RadioButtonGroup;
var _local3:IFocusManager;
var _local4:int;
var _local5:int;
var _local6:*;
_local2 = _group;
if (_local2 == null){
return;
};
_local3 = focusManager;
if (_local3){
_local3.showFocusIndicator = true;
};
_local4 = _local2.getRadioButtonIndex(this);
_local5 = _local4;
if (_local4 != -1){
do {
--_local5;
_local5 = ((_local5)==-1) ? (_local2.numRadioButtons - 1) : _local5;
_local6 = _local2.getRadioButtonAt(_local5);
if (((_local6) && (_local6.enabled))){
if (_arg1){
_local2.selection = _local6;
};
_local6.setFocus();
return;
};
if (((_arg1) && (!((_local2.getRadioButtonAt(_local5) == _local2.selection))))){
_local2.selection = this;
};
this.drawFocus(true);
} while (_local5 != _local4);
};
}
protected function handleChange(_arg1:Event):void{
super.selected = (_group.selection == this);
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 44
//RadioButtonGroup (fl.controls.RadioButtonGroup)
package fl.controls {
import flash.events.*;
public class RadioButtonGroup extends EventDispatcher {
protected var _selection:RadioButton;
protected var radioButtons:Array;
protected var _name:String;
private static var groups:Object;
private static var groupCount:uint = 0;
public function RadioButtonGroup(_arg1:String){
_name = _arg1;
radioButtons = [];
registerGroup(this);
}
public function getRadioButtonIndex(_arg1:RadioButton):int{
var _local2:int;
var _local3:RadioButton;
_local2 = 0;
while (_local2 < radioButtons.length) {
_local3 = (radioButtons[_local2] as RadioButton);
if (_local3 == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function get numRadioButtons():int{
return (radioButtons.length);
}
public function get name():String{
return (_name);
}
public function get selection():RadioButton{
return (_selection);
}
public function set selection(_arg1:RadioButton):void{
if ((((((_selection == _arg1)) || ((_arg1 == null)))) || ((getRadioButtonIndex(_arg1) == -1)))){
return;
};
_selection = _arg1;
dispatchEvent(new Event(Event.CHANGE, true));
}
public function set selectedData(_arg1:Object):void{
var _local2:int;
var _local3:RadioButton;
_local2 = 0;
while (_local2 < radioButtons.length) {
_local3 = (radioButtons[_local2] as RadioButton);
if (_local3.value == _arg1){
selection = _local3;
return;
};
_local2++;
};
}
public function removeRadioButton(_arg1:RadioButton):void{
var _local2:int;
_local2 = getRadioButtonIndex(_arg1);
if (_local2 != -1){
radioButtons.splice(_local2, 1);
};
if (_selection == _arg1){
_selection = null;
};
}
public function addRadioButton(_arg1:RadioButton):void{
if (_arg1.groupName != name){
_arg1.groupName = name;
return;
};
radioButtons.push(_arg1);
if (_arg1.selected){
selection = _arg1;
};
}
public function getRadioButtonAt(_arg1:int):RadioButton{
return (RadioButton(radioButtons[_arg1]));
}
public function get selectedData():Object{
var _local1:RadioButton;
_local1 = _selection;
return (((_local1)==null) ? null : _local1.value);
}
public static function getGroup(_arg1:String):RadioButtonGroup{
var _local2:RadioButtonGroup;
if (groups == null){
groups = {};
};
_local2 = (groups[_arg1] as RadioButtonGroup);
if (_local2 == null){
_local2 = new RadioButtonGroup(_arg1);
if ((++groupCount % 20) == 0){
cleanUpGroups();
};
};
return (_local2);
}
private static function registerGroup(_arg1:RadioButtonGroup):void{
if (groups == null){
groups = {};
};
groups[_arg1.name] = _arg1;
}
private static function cleanUpGroups():void{
var _local1:String;
var _local2:RadioButtonGroup;
for (_local1 in groups) {
_local2 = (groups[_local1] as RadioButtonGroup);
if (_local2.radioButtons.length == 0){
delete groups[_local1];
};
};
}
}
}//package fl.controls
Section 45
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 46
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 47
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 48
//SelectableList (fl.controls.SelectableList)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.utils.*;
import fl.containers.*;
import flash.ui.*;
public class SelectableList extends BaseScrollPane implements IFocusManagerComponent {
protected var invalidItems:Dictionary;
protected var renderedItems:Dictionary;
protected var listHolder:Sprite;
protected var _allowMultipleSelection:Boolean;// = false
protected var lastCaretIndex:int;// = -1
protected var _selectedIndices:Array;
protected var availableCellRenderers:Array;
protected var list:Sprite;
protected var caretIndex:int;// = -1
protected var updatedRendererStyles:Object;
protected var preChangeItems:Array;
protected var activeCellRenderers:Array;
protected var rendererStyles:Object;
protected var _verticalScrollPosition:Number;
protected var _dataProvider:DataProvider;
protected var _horizontalScrollPosition:Number;
private var collectionItemImport:SimpleCollectionItem;
protected var _selectable:Boolean;// = true
private static var defaultStyles:Object = {skin:"List_skin", cellRenderer:CellRenderer, contentPadding:null, disabledAlpha:null};
public static var createAccessibilityImplementation:Function;
public function SelectableList(){
_allowMultipleSelection = false;
_selectable = true;
caretIndex = -1;
lastCaretIndex = -1;
super();
activeCellRenderers = [];
availableCellRenderers = [];
invalidItems = new Dictionary(true);
renderedItems = new Dictionary(true);
_selectedIndices = [];
if (dataProvider == null){
dataProvider = new DataProvider();
};
verticalScrollPolicy = ScrollPolicy.AUTO;
rendererStyles = {};
updatedRendererStyles = {};
}
protected function drawList():void{
}
public function set allowMultipleSelection(_arg1:Boolean):void{
if (_arg1 == _allowMultipleSelection){
return;
};
_allowMultipleSelection = _arg1;
if (((!(_arg1)) && ((_selectedIndices.length > 1)))){
_selectedIndices = [_selectedIndices.pop()];
invalidate(InvalidationType.DATA);
};
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (_dataProvider.sortOn(_arg1, _arg2));
}
public function removeItemAt(_arg1:uint):Object{
return (_dataProvider.removeItemAt(_arg1));
}
public function get selectedItem():Object{
return (((_selectedIndices.length)==0) ? null : _dataProvider.getItemAt(selectedIndex));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
};
}
public function get selectable():Boolean{
return (_selectable);
}
public function itemToCellRenderer(_arg1:Object):ICellRenderer{
var _local2:*;
var _local3:ICellRenderer;
if (_arg1 != null){
for (_local2 in activeCellRenderers) {
_local3 = (activeCellRenderers[_local2] as ICellRenderer);
if (_local3.data == _arg1){
return (_local3);
};
};
};
return (null);
}
public function getNextIndexAtLetter(_arg1:String, _arg2:int=-1):int{
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Object;
var _local7:String;
if (length == 0){
return (-1);
};
_arg1 = _arg1.toUpperCase();
_local3 = (length - 1);
_local4 = 0;
while (_local4 < _local3) {
_local5 = ((_arg2 + 1) + _local4);
if (_local5 > (length - 1)){
_local5 = (_local5 - length);
};
_local6 = getItemAt(_local5);
if (_local6 == null){
break;
};
_local7 = itemToLabel(_local6);
if (_local7 == null){
} else {
if (_local7.charAt(0).toUpperCase() == _arg1){
return (_local5);
};
};
_local4++;
};
return (-1);
}
public function invalidateList():void{
_invalidateList();
invalidate(InvalidationType.DATA);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
list.mouseChildren = _enabled;
}
public function get selectedIndices():Array{
return (_selectedIndices.concat());
}
public function set selectable(_arg1:Boolean):void{
if (_arg1 == _selectable){
return;
};
if (!_arg1){
selectedIndices = [];
};
_selectable = _arg1;
}
public function itemToLabel(_arg1:Object):String{
return (_arg1["label"]);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
_dataProvider.addItemAt(_arg1, _arg2);
invalidateList();
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (_dataProvider.replaceItemAt(_arg1, _arg2));
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:uint;
_local2 = _arg1.startIndex;
_local3 = _arg1.endIndex;
_local4 = _arg1.changeType;
if (_local4 == DataChangeType.INVALIDATE_ALL){
clearSelection();
invalidateList();
} else {
if (_local4 == DataChangeType.INVALIDATE){
_local5 = 0;
while (_local5 < _arg1.items.length) {
invalidateItem(_arg1.items[_local5]);
_local5++;
};
} else {
if (_local4 == DataChangeType.ADD){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
_selectedIndices[_local5] = (_selectedIndices[_local5] + (_local2 - _local3));
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
if (_selectedIndices[_local5] <= _local3){
delete _selectedIndices[_local5];
} else {
_selectedIndices[_local5] = (_selectedIndices[_local5] - ((_local2 - _local3) + 1));
};
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE_ALL){
clearSelection();
} else {
if (_local4 == DataChangeType.REPLACE){
} else {
selectedItems = preChangeItems;
preChangeItems = null;
};
};
};
};
};
};
invalidate(InvalidationType.DATA);
}
protected function _invalidateList():void{
availableCellRenderers = [];
while (activeCellRenderers.length > 0) {
list.removeChild((activeCellRenderers.pop() as DisplayObject));
};
}
protected function updateRendererStyles():void{
var _local1:Array;
var _local2:uint;
var _local3:uint;
var _local4:String;
_local1 = availableCellRenderers.concat(activeCellRenderers);
_local2 = _local1.length;
_local3 = 0;
while (_local3 < _local2) {
if (_local1[_local3].setStyle == null){
} else {
for (_local4 in updatedRendererStyles) {
_local1[_local3].setStyle(_local4, updatedRendererStyles[_local4]);
};
_local1[_local3].drawNow();
};
_local3++;
};
updatedRendererStyles = {};
}
public function set selectedItem(_arg1:Object):void{
var _local2:int;
_local2 = _dataProvider.getItemIndex(_arg1);
selectedIndex = _local2;
}
public function sortItems(... _args){
return (_dataProvider.sort.apply(_dataProvider, _args));
}
public function removeAll():void{
_dataProvider.removeAll();
}
protected function handleCellRendererChange(_arg1:Event):void{
var _local2:ICellRenderer;
var _local3:uint;
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
_dataProvider.invalidateItemAt(_local3);
}
protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _horizontalScrollPosition){
return;
};
_local3 = (_arg1 - _horizontalScrollPosition);
_horizontalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.HORIZONTAL, _local3, _arg1));
};
}
public function scrollToSelected():void{
scrollToIndex(selectedIndex);
}
public function invalidateItem(_arg1:Object):void{
if (renderedItems[_arg1] == null){
return;
};
invalidItems[_arg1] = true;
invalidate(InvalidationType.DATA);
}
protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
var _local4:int;
var _local5:int;
var _local6:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
if (((!(dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data)))) || (!(_selectable)))){
return;
};
_local4 = selectedIndices.indexOf(_local3);
if (!_allowMultipleSelection){
if (_local4 != -1){
return;
};
_local2.selected = true;
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
} else {
if (_arg1.shiftKey){
_local6 = ((_selectedIndices.length)>0) ? _selectedIndices[0] : _local3;
_selectedIndices = [];
if (_local6 > _local3){
_local5 = _local6;
while (_local5 >= _local3) {
_selectedIndices.push(_local5);
_local5--;
};
} else {
_local5 = _local6;
while (_local5 <= _local3) {
_selectedIndices.push(_local5);
_local5++;
};
};
caretIndex = _local3;
} else {
if (_arg1.ctrlKey){
if (_local4 != -1){
_local2.selected = false;
_selectedIndices.splice(_local4, 1);
} else {
_local2.selected = true;
_selectedIndices.push(_local3);
};
caretIndex = _local3;
} else {
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
};
};
};
dispatchEvent(new Event(Event.CHANGE));
invalidate(InvalidationType.DATA);
}
public function get length():uint{
return (_dataProvider.length);
}
public function get allowMultipleSelection():Boolean{
return (_allowMultipleSelection);
}
protected function onPreChange(_arg1:DataChangeEvent):void{
switch (_arg1.changeType){
case DataChangeType.REMOVE:
case DataChangeType.ADD:
case DataChangeType.INVALIDATE:
case DataChangeType.REMOVE_ALL:
case DataChangeType.REPLACE:
case DataChangeType.INVALIDATE_ALL:
break;
default:
preChangeItems = selectedItems;
break;
};
}
public function getRendererStyle(_arg1:String, _arg2:int=-1):Object{
return (rendererStyles[_arg1]);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _verticalScrollPosition){
return;
};
_local3 = (_arg1 - _verticalScrollPosition);
_verticalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _local3, _arg1));
};
}
protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
public function set selectedIndices(_arg1:Array):void{
if (!_selectable){
return;
};
_selectedIndices = ((_arg1)==null) ? [] : _arg1.concat();
invalidate(InvalidationType.SELECTED);
}
public function get selectedIndex():int{
return (((_selectedIndices.length)==0) ? -1 : _selectedIndices[(_selectedIndices.length - 1)]);
}
override protected function draw():void{
super.draw();
}
override protected function configUI():void{
super.configUI();
listHolder = new Sprite();
addChild(listHolder);
listHolder.scrollRect = contentScrollRect;
list = new Sprite();
listHolder.addChild(list);
}
public function addItem(_arg1:Object):void{
_dataProvider.addItem(_arg1);
invalidateList();
}
protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:String;
_local2 = (_arg1.target as ICellRenderer);
_local3 = ((_arg1.type)==MouseEvent.ROLL_OVER) ? ListEvent.ITEM_ROLL_OVER : ListEvent.ITEM_ROLL_OUT;
dispatchEvent(new ListEvent(_local3, false, false, _local2.listData.column, _local2.listData.row, _local2.listData.index, _local2.data));
}
public function clearRendererStyle(_arg1:String, _arg2:int=-1):void{
delete rendererStyles[_arg1];
updatedRendererStyles[_arg1] = null;
invalidate(InvalidationType.RENDERER_STYLES);
}
protected function handleCellRendererDoubleClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
dispatchEvent(new ListEvent(ListEvent.ITEM_DOUBLE_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data));
}
public function get rowCount():uint{
return (0);
}
public function isItemSelected(_arg1:Object):Boolean{
return ((selectedItems.indexOf(_arg1) > -1));
}
public function set dataProvider(_arg1:DataProvider):void{
if (_dataProvider != null){
_dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange);
_dataProvider.removeEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange);
};
_dataProvider = _arg1;
_dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
_dataProvider.addEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange, false, 0, true);
clearSelection();
invalidateList();
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
listHolder.scrollRect = contentScrollRect;
}
public function getItemAt(_arg1:uint):Object{
return (_dataProvider.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (SelectableList.createAccessibilityImplementation != null){
SelectableList.createAccessibilityImplementation(this);
};
}
public function scrollToIndex(_arg1:int):void{
}
public function removeItem(_arg1:Object):Object{
return (_dataProvider.removeItem(_arg1));
}
public function get dataProvider():DataProvider{
return (_dataProvider);
}
public function set maxHorizontalScrollPosition(_arg1:Number):void{
_maxHorizontalScrollPosition = _arg1;
invalidate(InvalidationType.SIZE);
}
public function setRendererStyle(_arg1:String, _arg2:Object, _arg3:uint=0):void{
if (rendererStyles[_arg1] == _arg2){
return;
};
updatedRendererStyles[_arg1] = _arg2;
rendererStyles[_arg1] = _arg2;
invalidate(InvalidationType.RENDERER_STYLES);
}
public function invalidateItemAt(_arg1:uint):void{
var _local2:Object;
_local2 = _dataProvider.getItemAt(_arg1);
if (_local2 != null){
invalidateItem(_local2);
};
}
public function set selectedItems(_arg1:Array):void{
var _local2:Array;
var _local3:uint;
var _local4:int;
if (_arg1 == null){
selectedIndices = null;
return;
};
_local2 = [];
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _dataProvider.getItemIndex(_arg1[_local3]);
if (_local4 != -1){
_local2.push(_local4);
};
_local3++;
};
selectedIndices = _local2;
}
public function clearSelection():void{
selectedIndex = -1;
}
override public function get maxHorizontalScrollPosition():Number{
return (_maxHorizontalScrollPosition);
}
public function get selectedItems():Array{
var _local1:Array;
var _local2:uint;
_local1 = [];
_local2 = 0;
while (_local2 < _selectedIndices.length) {
_local1.push(_dataProvider.getItemAt(_selectedIndices[_local2]));
_local2++;
};
return (_local1);
}
public function set selectedIndex(_arg1:int):void{
selectedIndices = ((_arg1)==-1) ? null : [_arg1];
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.controls
Section 49
//Slider (fl.controls.Slider)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 50
//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 51
//TextInput (fl.controls.TextInput)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 52
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 53
//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 54
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.utils.*;
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 55
//DataProvider (fl.data.DataProvider)
package fl.data {
import flash.events.*;
import fl.events.*;
public class DataProvider extends EventDispatcher {
protected var data:Array;
public function DataProvider(_arg1:Object=null){
if (_arg1 == null){
data = [];
} else {
data = getDataFromObject(_arg1);
};
}
protected function dispatchPreChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.PRE_DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
public function invalidateItemAt(_arg1:int):void{
checkIndex(_arg1, (data.length - 1));
dispatchChangeEvent(DataChangeType.INVALIDATE, [data[_arg1]], _arg1, _arg1);
}
public function getItemIndex(_arg1:Object):int{
return (data.indexOf(_arg1));
}
protected function getDataFromObject(_arg1:Object):Array{
var _local2:Array;
var _local3:Array;
var _local4:uint;
var _local5:Object;
var _local6:XML;
var _local7:XMLList;
var _local8:XML;
var _local9:XMLList;
var _local10:XML;
var _local11:XMLList;
var _local12:XML;
if ((_arg1 is Array)){
_local3 = (_arg1 as Array);
if (_local3.length > 0){
if ((((_local3[0] is String)) || ((_local3[0] is Number)))){
_local2 = [];
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = {label:String(_local3[_local4]), data:_local3[_local4]};
_local2.push(_local5);
_local4++;
};
return (_local2);
};
};
return (_arg1.concat());
//unresolved jump
};
if ((_arg1 is DataProvider)){
return (_arg1.toArray());
};
if ((_arg1 is XML)){
_local6 = (_arg1 as XML);
_local2 = [];
_local7 = _local6.*;
for each (_local8 in _local7) {
_arg1 = {};
_local9 = _local8.attributes();
for each (_local10 in _local9) {
_arg1[_local10.localName()] = _local10.toString();
};
_local11 = _local8.*;
for each (_local12 in _local11) {
if (_local12.hasSimpleContent()){
_arg1[_local12.localName()] = _local12.toString();
};
};
_local2.push(_arg1);
};
return (_local2);
//unresolved jump
};
throw (new TypeError((("Error: Type Coercion failed: cannot convert " + _arg1) + " to Array or DataProvider.")));
}
public function removeItemAt(_arg1:uint):Object{
var _local2:Array;
checkIndex(_arg1, (data.length - 1));
dispatchPreChangeEvent(DataChangeType.REMOVE, data.slice(_arg1, (_arg1 + 1)), _arg1, _arg1);
_local2 = data.splice(_arg1, 1);
dispatchChangeEvent(DataChangeType.REMOVE, _local2, _arg1, _arg1);
return (_local2[0]);
}
public function addItem(_arg1:Object):void{
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
data.push(_arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
}
public function sortOn(_arg1:Object, _arg2:Object=null){
var _local3:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local3 = data.sortOn(_arg1, _arg2);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local3);
}
public function sort(... _args){
var _local2:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local2 = data.sort.apply(data, _args);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local2);
}
public function addItems(_arg1:Object):void{
addItemsAt(_arg1, data.length);
}
public function concat(_arg1:Object):void{
addItems(_arg1);
}
public function clone():DataProvider{
return (new DataProvider(data));
}
public function toArray():Array{
return (data.concat());
}
public function get length():uint{
return (data.length);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
checkIndex(_arg2, data.length);
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
data.splice(_arg2, 0, _arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
}
public function getItemAt(_arg1:uint):Object{
checkIndex(_arg1, (data.length - 1));
return (data[_arg1]);
}
override public function toString():String{
return ((("DataProvider [" + data.join(" , ")) + "]"));
}
public function invalidateItem(_arg1:Object):void{
var _local2:uint;
_local2 = getItemIndex(_arg1);
if (_local2 == -1){
return;
};
invalidateItemAt(_local2);
}
protected function dispatchChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
protected function checkIndex(_arg1:int, _arg2:int):void{
if ((((_arg1 > _arg2)) || ((_arg1 < 0)))){
throw (new RangeError((((("DataProvider index (" + _arg1) + ") is not in acceptable range (0 - ") + _arg2) + ")")));
};
}
public function addItemsAt(_arg1:Object, _arg2:uint):void{
var _local3:Array;
checkIndex(_arg2, data.length);
_local3 = getDataFromObject(_arg1);
dispatchPreChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
data.splice.apply(data, [_arg2, 0].concat(_local3));
dispatchChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
}
public function replaceItem(_arg1:Object, _arg2:Object):Object{
var _local3:int;
_local3 = getItemIndex(_arg2);
if (_local3 != -1){
return (replaceItemAt(_arg1, _local3));
};
return (null);
}
public function removeItem(_arg1:Object):Object{
var _local2:int;
_local2 = getItemIndex(_arg1);
if (_local2 != -1){
return (removeItemAt(_local2));
};
return (null);
}
public function merge(_arg1:Object):void{
var _local2:Array;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Object;
_local2 = getDataFromObject(_arg1);
_local3 = _local2.length;
_local4 = data.length;
dispatchPreChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
_local5 = 0;
while (_local5 < _local3) {
_local6 = _local2[_local5];
if (getItemIndex(_local6) == -1){
data.push(_local6);
};
_local5++;
};
if (data.length > _local4){
dispatchChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
} else {
dispatchChangeEvent(DataChangeType.ADD, [], -1, -1);
};
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
var _local3:Array;
checkIndex(_arg2, (data.length - 1));
_local3 = [data[_arg2]];
dispatchPreChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
data[_arg2] = _arg1;
dispatchChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
return (_local3[0]);
}
public function invalidate():void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, DataChangeType.INVALIDATE_ALL, data.concat(), 0, data.length));
}
public function removeAll():void{
var _local1:Array;
_local1 = data.concat();
dispatchPreChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
data = [];
dispatchChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
}
}
}//package fl.data
Section 56
//SimpleCollectionItem (fl.data.SimpleCollectionItem)
package fl.data {
public dynamic class SimpleCollectionItem {
public var label:String;
public var data:String;
public function toString():String{
return ((((("[SimpleCollectionItem: " + label) + ",") + data) + "]"));
}
}
}//package fl.data
Section 57
//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 58
//DataChangeEvent (fl.events.DataChangeEvent)
package fl.events {
import flash.events.*;
public class DataChangeEvent extends Event {
protected var _items:Array;
protected var _endIndex:uint;
protected var _changeType:String;
protected var _startIndex:uint;
public static const PRE_DATA_CHANGE:String = "preDataChange";
public static const DATA_CHANGE:String = "dataChange";
public function DataChangeEvent(_arg1:String, _arg2:String, _arg3:Array, _arg4:int=-1, _arg5:int=-1):void{
super(_arg1);
_changeType = _arg2;
_startIndex = _arg4;
_items = _arg3;
_endIndex = ((_arg5)==-1) ? _startIndex : _arg5;
}
public function get changeType():String{
return (_changeType);
}
public function get startIndex():uint{
return (_startIndex);
}
public function get items():Array{
return (_items);
}
override public function clone():Event{
return (new DataChangeEvent(type, _changeType, _items, _startIndex, _endIndex));
}
override public function toString():String{
return (formatToString("DataChangeEvent", "type", "changeType", "startIndex", "endIndex", "bubbles", "cancelable"));
}
public function get endIndex():uint{
return (_endIndex);
}
}
}//package fl.events
Section 59
//DataChangeType (fl.events.DataChangeType)
package fl.events {
public class DataChangeType {
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const REMOVE_ALL:String = "removeAll";
public static const CHANGE:String = "change";
public static const REPLACE:String = "replace";
public static const INVALIDATE:String = "invalidate";
public static const INVALIDATE_ALL:String = "invalidateAll";
public static const SORT:String = "sort";
}
}//package fl.events
Section 60
//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 61
//ListEvent (fl.events.ListEvent)
package fl.events {
import flash.events.*;
public class ListEvent extends Event {
protected var _index:int;
protected var _item:Object;
protected var _columnIndex:int;
protected var _rowIndex:int;
public static const ITEM_DOUBLE_CLICK:String = "itemDoubleClick";
public static const ITEM_ROLL_OUT:String = "itemRollOut";
public static const ITEM_ROLL_OVER:String = "itemRollOver";
public static const ITEM_CLICK:String = "itemClick";
public function ListEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:int=-1, _arg7:Object=null){
super(_arg1, _arg2, _arg3);
_rowIndex = _arg5;
_columnIndex = _arg4;
_index = _arg6;
_item = _arg7;
}
public function get rowIndex():Object{
return (_rowIndex);
}
public function get index():int{
return (_index);
}
public function get item():Object{
return (_item);
}
public function get columnIndex():int{
return (_columnIndex);
}
override public function clone():Event{
return (new ListEvent(type, bubbles, cancelable, _columnIndex, _rowIndex));
}
override public function toString():String{
return (formatToString("ListEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "index", "item"));
}
}
}//package fl.events
Section 62
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 63
//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 64
//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 65
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
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 66
//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 67
//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 68
//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 69
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.text.*;
import flash.utils.*;
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 70
//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 71
//DefaultParticleCuller (org.papervision3d.core.culling.DefaultParticleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public class DefaultParticleCuller implements IParticleCuller {
public function testParticle(_arg1:Particle):Boolean{
if (_arg1.material.invisible == false){
if (_arg1.vertex3D.vertex3DInstance.visible == true){
return (true);
};
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 72
//DefaultTriangleCuller (org.papervision3d.core.culling.DefaultTriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
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:Triangle3D, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
var _local5:MaterialObject3D;
if (((((_arg2.visible) && (_arg3.visible))) && (_arg4.visible))){
_local5 = (_arg1.material) ? _arg1.material : _arg1.instance.material;
if (_local5.invisible){
return (false);
};
x0 = _arg2.x;
y0 = _arg2.y;
x1 = _arg3.x;
y1 = _arg3.y;
x2 = _arg4.x;
y2 = _arg4.y;
if (_local5.oneSide){
if (_local5.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 73
//IParticleCuller (org.papervision3d.core.culling.IParticleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public interface IParticleCuller {
function testParticle(_arg1:Particle):Boolean;
}
}//package org.papervision3d.core.culling
Section 74
//ITriangleCuller (org.papervision3d.core.culling.ITriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public interface ITriangleCuller {
function testFace(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean;
}
}//package org.papervision3d.core.culling
Section 75
//IRenderable (org.papervision3d.core.geom.renderables.IRenderable)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
public interface IRenderable {
function getRenderListItem():IRenderListItem;
}
}//package org.papervision3d.core.geom.renderables
Section 76
//Line3D (org.papervision3d.core.geom.renderables.Line3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.materials.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.geom.*;
public class Line3D implements IRenderable {
public var size:Number;
public var renderCommand:RenderLine;
public var v0:Vertex3D;
public var v1:Vertex3D;
public var instance:Lines3D;
public var material:LineMaterial;
public function Line3D(_arg1:Lines3D, _arg2:LineMaterial, _arg3:Number, _arg4:Vertex3D, _arg5:Vertex3D){
this.size = _arg3;
this.material = _arg2;
this.v0 = _arg4;
this.v1 = _arg5;
this.instance = _arg1;
this.renderCommand = new RenderLine(this);
}
public function getRenderListItem():IRenderListItem{
return (this.renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 77
//Particle (org.papervision3d.core.geom.renderables.Particle)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.materials.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.geom.*;
public class Particle implements IRenderable {
public var size:int;
public var renderCommand:RenderParticle;
public var renderScale:Number;
public var instance:Particles;
public var material:ParticleMaterial;
public var vertex3D:Vertex3D;
public function Particle(_arg1:ParticleMaterial, _arg2:int=1, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
this.material = _arg1;
this.size = _arg2;
this.renderCommand = new RenderParticle(this);
vertex3D = new Vertex3D(_arg3, _arg4, _arg5);
}
public function get y():Number{
return (vertex3D.y);
}
public function set x(_arg1:Number):void{
vertex3D.x = _arg1;
}
public function set y(_arg1:Number):void{
vertex3D.y = _arg1;
}
public function get x():Number{
return (vertex3D.x);
}
public function get z():Number{
return (vertex3D.z);
}
public function set z(_arg1:Number):void{
vertex3D.z = _arg1;
}
public function getRenderListItem():IRenderListItem{
return (renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 78
//Triangle3D (org.papervision3d.core.geom.renderables.Triangle3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
import org.papervision3d.core.render.command.*;
public class Triangle3D implements IRenderable {
public var vertices:Array;
public var face3DInstance:Triangle3DInstance;
public var instance:DisplayObject3D;
public var id:Number;
public var uv:Array;
public var material:MaterialObject3D;
public var faceNormal:Number3D;
public var renderCommand:RenderTriangle;
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 Triangle3D(_arg1:DisplayObject3D, _arg2:Array, _arg3:MaterialObject3D=null, _arg4:Array=null){
this.instance = _arg1;
this.renderCommand = new RenderTriangle(this);
face3DInstance = new Triangle3DInstance(this, _arg1);
this.vertices = _arg2;
v0 = _arg2[0];
v1 = _arg2[1];
v2 = _arg2[2];
this.material = _arg3;
this.uv = _arg4;
this.id = _totalFaces++;
createNormal();
}
public function getRenderListItem():IRenderListItem{
return (renderCommand);
}
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();
}
}
}//package org.papervision3d.core.geom.renderables
Section 79
//Triangle3DInstance (org.papervision3d.core.geom.renderables.Triangle3DInstance)
package org.papervision3d.core.geom.renderables {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
public class Triangle3DInstance {
public var container:Sprite;
public var faceNormal:Number3D;
public var screenZ:Number;
public var visible:Boolean;// = false
public var instance:DisplayObject3D;
public function Triangle3DInstance(_arg1:Triangle3D, _arg2:DisplayObject3D){
visible = false;
super();
this.instance = _arg2;
faceNormal = new Number3D();
}
}
}//package org.papervision3d.core.geom.renderables
Section 80
//Vertex3D (org.papervision3d.core.geom.renderables.Vertex3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.*;
import org.papervision3d.core.render.command.*;
import flash.utils.*;
public class Vertex3D implements IRenderable {
public var vertex3DInstance:Vertex3DInstance;
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.vertex3DInstance = new Vertex3DInstance();
this.normal = new Number3D();
this.connectedFaces = new Dictionary();
}
public function getRenderListItem():IRenderListItem{
return (null);
}
public function calculateNormal():void{
var _local1:Triangle3D;
var _local2:Number;
normal = new Number3D();
_local2 = 0;
for each (_local1 in connectedFaces) {
_local2++;
normal = Number3D.add(_local1.faceNormal, normal);
};
normal.x = (normal.x / _local2);
normal.y = (normal.y / _local2);
normal.z = (normal.z / _local2);
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.vertex3DInstance = vertex3DInstance.clone();
_local1.normal = normal.clone();
return (_local1);
}
}
}//package org.papervision3d.core.geom.renderables
Section 81
//Vertex3DInstance (org.papervision3d.core.geom.renderables.Vertex3DInstance)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.*;
public class Vertex3DInstance {
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 Vertex3DInstance(_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():Vertex3DInstance{
var _local1:Vertex3DInstance;
_local1 = new Vertex3DInstance(x, y, z);
_local1.visible = visible;
_local1.extra = extra;
return (_local1);
}
public static function cross(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Number{
return (((_arg1.x * _arg2.y) - (_arg2.x * _arg1.y)));
}
public static function dot(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function sub(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Vertex3DInstance{
return (new Vertex3DInstance((_arg2.x - _arg1.x), (_arg2.y - _arg1.y)));
}
}
}//package org.papervision3d.core.geom.renderables
Section 82
//Lines3D (org.papervision3d.core.geom.Lines3D)
package org.papervision3d.core.geom {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.render.draw.*;
public class Lines3D extends Vertices3D {
public var lines:Array;
private var _material:ILineDrawer;
public function Lines3D(_arg1:LineMaterial, _arg2:String=null){
super(null, _arg2);
this.material = _arg1;
init();
}
private function init():void{
this.lines = new Array();
}
override public function project(_arg1:DisplayObject3D, _arg2:CameraObject3D, _arg3:Array=null):Number{
var _local4:Line3D;
var _local5:Number;
super.project(_arg1, _arg2, _arg3);
if (!_arg3){
_arg3 = this._sorted;
};
for each (_local4 in lines) {
if (((_local4.v0.vertex3DInstance.visible) && (_local4.v1.vertex3DInstance.visible))){
_local4.renderCommand.renderer = _local4.material;
_local5 = (_local5 + (_local4.renderCommand.screenDepth = ((_local4.v0.vertex3DInstance.z + _local4.v1.vertex3DInstance.z) / 2)));
scene.renderer.addToRenderList(_local4.renderCommand);
};
};
return ((_local5 / (lines.length + 1)));
}
public function addNewSegmentedLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):void{
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Line3D;
var _local13:Vertex3D;
var _local14:Vertex3D;
var _local15:Number;
_local9 = ((_arg6 - _arg3) / _arg2);
_local10 = ((_arg7 - _arg4) / _arg2);
_local11 = ((_arg8 - _arg5) / _arg2);
_local13 = new Vertex3D(_arg3, _arg4, _arg5);
_local15 = 0;
while (_local15 <= _arg2) {
_local14 = new Vertex3D((_arg3 + (_local9 * _local15)), (_arg4 + (_local10 * _local15)), (_arg5 + (_local11 * _local15)));
_local12 = new Line3D(this, (material as LineMaterial), _arg1, _local13, _local14);
addLine(_local12);
_local13 = _local14;
_local15++;
};
}
public function addLine(_arg1:Line3D):void{
lines.push(_arg1);
_arg1.instance = this;
if (geometry.vertices.indexOf(_arg1.v0) == -1){
geometry.vertices.push(_arg1.v0);
};
if (geometry.vertices.indexOf(_arg1.v1) == -1){
geometry.vertices.push(_arg1.v1);
};
}
public function removeLine(_arg1:Line3D):void{
lines.splice(lines.indexOf(_arg1), 1);
}
public function addNewLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):void{
var _local8:Line3D;
_local8 = new Line3D(this, (material as LineMaterial), _arg1, new Vertex3D(_arg2, _arg3, _arg4), new Vertex3D(_arg5, _arg6, _arg7));
addLine(_local8);
}
}
}//package org.papervision3d.core.geom
Section 83
//Particles (org.papervision3d.core.geom.Particles)
package org.papervision3d.core.geom {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
public class Particles extends Vertices3D {
private var particles:Array;
private var vertices:Array;
public function Particles(_arg1:String="VertexParticles"){
this.vertices = new Array();
this.particles = new Array();
super(vertices, _arg1);
}
override public function project(_arg1:DisplayObject3D, _arg2:CameraObject3D, _arg3:Array=null):Number{
var _local4:Particle;
var _local5:Number;
super.project(_arg1, _arg2, _arg3);
_local5 = (_arg2.focus * _arg2.zoom);
for each (_local4 in particles) {
if (scene.particleCuller.testParticle(_local4)){
_local4.renderScale = (_local5 / (_arg2.focus + _local4.vertex3D.vertex3DInstance.z));
_local4.renderCommand.screenDepth = _local4.vertex3D.vertex3DInstance.z;
scene.renderer.addToRenderList(_local4.renderCommand);
};
};
return (1);
}
public function removeParticle(_arg1:Particle):void{
_arg1.instance = null;
particles.splice(particles.indexOf(_arg1, 0));
vertices.splice(vertices.indexOf(_arg1.vertex3D, 0));
}
public function addParticle(_arg1:Particle):void{
_arg1.instance = this;
particles.push(_arg1);
vertices.push(_arg1.vertex3D);
}
public function removeAllParticles():void{
particles = new Array();
vertices = new Array();
geometry.vertices = vertices;
}
}
}//package org.papervision3d.core.geom
Section 84
//TriangleMesh3D (org.papervision3d.core.geom.TriangleMesh3D)
package org.papervision3d.core.geom {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.culling.*;
public class TriangleMesh3D extends Vertices3D {
public function TriangleMesh3D(_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:Vertex3DInstance;
var _local9:Vertex3DInstance;
var _local10:Vertex3DInstance;
var _local11:Triangle3DInstance;
var _local12:Triangle3D;
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;
_local8 = _local12.v0.vertex3DInstance;
_local9 = _local12.v1.vertex3DInstance;
_local10 = _local12.v2.vertex3DInstance;
if ((_local11.visible = _local7.testFace(_local12, _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.vertex3DInstance.normal);
Matrix3D.multiplyVector3x3(this.world, _local8.normal);
_local12.v1.normal.copyTo(_local12.v1.vertex3DInstance.normal);
Matrix3D.multiplyVector3x3(this.world, _local9.normal);
_local12.v2.normal.copyTo(_local12.v2.vertex3DInstance.normal);
Matrix3D.multiplyVector3x3(this.world, _local10.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++;
_local12.renderCommand.renderer = (_local13 as ITriangleDrawer);
_local12.renderCommand.screenDepth = _local11.screenZ;
scene.renderer.addToRenderList(_local12.renderCommand);
} else {
scene.stats.culledTriangles++;
};
};
return ((this.screenZ = (_local5 / _local6)));
}
public function mergeVertices():void{
var _local1:Dictionary;
var _local2:Array;
var _local3:Vertex3D;
var _local4:Triangle3D;
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:Triangle3D;
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 85
//Vertices3D (org.papervision3d.core.geom.Vertices3D)
package org.papervision3d.core.geom {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
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:Vertex3DInstance;
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.vertex3DInstance;
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 86
//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 87
//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 88
//GeometryObject3D (org.papervision3d.core.proto.GeometryObject3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.*;
import flash.utils.*;
public class GeometryObject3D extends EventDispatcher {
protected var _boundingSphere2:Number;
protected var _boundingSphereDirty:Boolean;// = true
public var dirty:Boolean;
protected var _material:MaterialObject3D;
public var _ready:Boolean;// = false
public var faces:Array;
public var vertices:Array;
public function GeometryObject3D(_arg1:Object=null):void{
_ready = false;
_boundingSphereDirty = true;
super();
this.dirty = true;
}
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:Triangle3D;
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();
this.dirty = false;
};
_ready = _arg1;
}
public function get ready():Boolean{
return (_ready);
}
}
}//package org.papervision3d.core.proto
Section 89
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D)
package org.papervision3d.core.proto {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.render.draw.*;
public class MaterialObject3D extends EventDispatcher implements ITriangleDrawer {
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 interactive:Boolean;// = false
public var maxU:Number;
public var needsFaceNormals:Boolean;// = false
public var tiled:Boolean;// = false
public var maxV:Number;
public static var DEFAULT_COLOR:int = 0;
public static var DEBUG_COLOR:int = 0xFF00FF;
private static var _totalMaterialObjects:Number = 0;
public function MaterialObject3D(){
smooth = false;
tiled = false;
lineColor = DEFAULT_COLOR;
lineAlpha = 0;
lineThickness = 1;
fillColor = DEFAULT_COLOR;
fillAlpha = 0;
oneSide = true;
invisible = false;
opposite = false;
needsFaceNormals = false;
needsVertexNormals = false;
widthOffset = 0;
heightOffset = 0;
interactive = false;
super();
this.id = _totalMaterialObjects++;
}
public function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData):void{
}
public function get doubleSided():Boolean{
return (!(this.oneSide));
}
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 90
//SceneObject3D (org.papervision3d.core.proto.SceneObject3D)
package org.papervision3d.core.proto {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.stat.*;
import flash.utils.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.*;
import org.papervision3d.utils.*;
public class SceneObject3D extends DisplayObjectContainer3D {
public var interactiveSceneManager:InteractiveSceneManager;// = null
public var container:Sprite;
public var objects:Array;
private var geometries:Dictionary;
public var stats:RenderStatistics;
public var materials:MaterialsList;
public var renderer:IRenderEngine;
public var particleCuller:IParticleCuller;
public var triangleCuller:ITriangleCuller;
public var interactive:Boolean;// = false
public function SceneObject3D(_arg1:Sprite){
triangleCuller = new DefaultTriangleCuller();
particleCuller = new DefaultParticleCuller();
interactive = false;
interactiveSceneManager = null;
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.root = this;
}
protected function renderObjects(_arg1:CameraObject3D):void{
}
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);
}
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);
}
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);
}
}
}//package org.papervision3d.core.proto
Section 91
//AbstractRenderListItem (org.papervision3d.core.render.command.AbstractRenderListItem)
package org.papervision3d.core.render.command {
import org.papervision3d.core.render.data.*;
public class AbstractRenderListItem implements IRenderListItem {
public var screenDepth:Number;
public function render(_arg1:RenderSessionData):void{
}
}
}//package org.papervision3d.core.render.command
Section 92
//IRenderListItem (org.papervision3d.core.render.command.IRenderListItem)
package org.papervision3d.core.render.command {
import org.papervision3d.core.render.data.*;
public interface IRenderListItem {
function render(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.render.command
Section 93
//RenderableListItem (org.papervision3d.core.render.command.RenderableListItem)
package org.papervision3d.core.render.command {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.hit.*;
import flash.geom.*;
public class RenderableListItem extends AbstractRenderListItem {
public var renderableInstance:IRenderable;
public var renderable:Class;
public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
return (_arg2);
}
}
}//package org.papervision3d.core.render.command
Section 94
//RenderLine (org.papervision3d.core.render.command.RenderLine)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.materials.*;
public class RenderLine extends RenderableListItem implements IRenderListItem {
public var renderer:LineMaterial;
public var line:Line3D;
public var container:Sprite;
public function RenderLine(_arg1:Line3D){
this.renderable = Line3D;
this.renderableInstance = _arg1;
this.line = _arg1;
}
override public function render(_arg1:RenderSessionData):void{
container = line.instance.container;
if (!container){
container = _arg1.container;
};
renderer.drawLine(line, container.graphics, _arg1);
}
}
}//package org.papervision3d.core.render.command
Section 95
//RenderParticle (org.papervision3d.core.render.command.RenderParticle)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.materials.*;
public class RenderParticle extends RenderableListItem implements IRenderListItem {
public var renderer:ParticleMaterial;
public var particle:Particle;
private static var container:Sprite;
public function RenderParticle(_arg1:Particle){
this.particle = _arg1;
}
override public function render(_arg1:RenderSessionData):void{
container = particle.instance.container;
if (!container){
container = _arg1.container;
};
particle.material.drawParticle(particle, container.graphics, _arg1);
}
}
}//package org.papervision3d.core.render.command
Section 96
//RenderTriangle (org.papervision3d.core.render.command.RenderTriangle)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import org.papervision3d.core.render.hit.*;
import flash.geom.*;
import org.papervision3d.core.render.draw.*;
public class RenderTriangle extends RenderableListItem implements IRenderListItem {
public var renderer:ITriangleDrawer;
public var triangle:Triangle3D;
private var position:Number3D;
public var renderMat:MaterialObject3D;
public var container:Sprite;
public function RenderTriangle(_arg1:Triangle3D):void{
position = new Number3D();
super();
this.triangle = _arg1;
renderableInstance = _arg1;
renderable = Triangle3D;
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
var _local3:Vertex3DInstance;
var _local4:Vertex3DInstance;
var _local5:Vertex3DInstance;
var _local6:Vertex3DInstance;
renderMat = triangle.material;
if (!renderMat){
renderMat = triangle.instance.material;
};
if (renderMat.interactive){
_local3 = new Vertex3DInstance(_arg1.x, _arg1.y);
_local4 = triangle.v0.vertex3DInstance;
_local5 = triangle.v1.vertex3DInstance;
_local6 = triangle.v2.vertex3DInstance;
if (sameSide(_local3, _local4, _local5, _local6)){
if (sameSide(_local3, _local5, _local4, _local6)){
if (sameSide(_local3, _local6, _local4, _local5)){
return (deepHitTest(triangle, _local3, _arg2));
};
};
};
};
return (_arg2);
}
public function sameSide(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
var _local5:Number;
_local5 = (Vertex3DInstance.cross(Vertex3DInstance.sub(_arg4, _arg3), Vertex3DInstance.sub(_arg1, _arg3)) * Vertex3DInstance.cross(Vertex3DInstance.sub(_arg4, _arg3), Vertex3DInstance.sub(_arg2, _arg3)));
return ((_local5 > 0));
}
private function deepHitTest(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:RenderHitData):RenderHitData{
var _local4:Vertex3DInstance;
var _local5:Vertex3DInstance;
var _local6:Vertex3DInstance;
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;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Array;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:BitmapData;
var _local40:Number;
var _local41:Number;
_local4 = _arg1.v0.vertex3DInstance;
_local5 = _arg1.v1.vertex3DInstance;
_local6 = _arg1.v2.vertex3DInstance;
_local7 = (_local6.x - _local4.x);
_local8 = (_local6.y - _local4.y);
_local9 = (_local5.x - _local4.x);
_local10 = (_local5.y - _local4.y);
_local11 = (_arg2.x - _local4.x);
_local12 = (_arg2.y - _local4.y);
_local13 = ((_local7 * _local7) + (_local8 * _local8));
_local14 = ((_local7 * _local9) + (_local8 * _local10));
_local15 = ((_local7 * _local11) + (_local8 * _local12));
_local16 = ((_local9 * _local9) + (_local10 * _local10));
_local17 = ((_local9 * _local11) + (_local10 * _local12));
_local18 = (1 / ((_local13 * _local16) - (_local14 * _local14)));
_local19 = (((_local16 * _local15) - (_local14 * _local17)) * _local18);
_local20 = (((_local13 * _local17) - (_local14 * _local15)) * _local18);
_local21 = (_arg1.v2.x - _arg1.v0.x);
_local22 = (_arg1.v2.y - _arg1.v0.y);
_local23 = (_arg1.v2.z - _arg1.v0.z);
_local24 = (_arg1.v1.x - _arg1.v0.x);
_local25 = (_arg1.v1.y - _arg1.v0.y);
_local26 = (_arg1.v1.z - _arg1.v0.z);
_local27 = ((_arg1.v0.x + (_local21 * _local19)) + (_local24 * _local20));
_local28 = ((_arg1.v0.y + (_local22 * _local19)) + (_local25 * _local20));
_local29 = ((_arg1.v0.z + (_local23 * _local19)) + (_local26 * _local20));
_local30 = _arg1.uv;
_local31 = _local30[0].u;
_local32 = _local30[1].u;
_local33 = _local30[2].u;
_local34 = _local30[0].v;
_local35 = _local30[1].v;
_local36 = _local30[2].v;
_local37 = ((((_local32 - _local31) * _local20) + ((_local33 - _local31) * _local19)) + _local31);
_local38 = ((((_local35 - _local34) * _local20) + ((_local36 - _local34) * _local19)) + _local34);
if (triangle.material){
renderMat = _arg1.material;
} else {
renderMat = _arg1.instance.material;
};
_local39 = renderMat.bitmap;
_local40 = 1;
_local41 = 1;
if (_local39){
_local40 = (BitmapMaterial.AUTO_MIP_MAPPING) ? renderMat.widthOffset : _local39.width;
_local41 = (BitmapMaterial.AUTO_MIP_MAPPING) ? renderMat.heightOffset : _local39.height;
};
_arg3.displayObject3D = _arg1.instance;
_arg3.material = renderMat;
_arg3.renderable = _arg1;
_arg3.hasHit = true;
position.x = _local27;
position.y = _local28;
position.z = _local29;
Matrix3D.multiplyVector(_arg1.instance.world, position);
_arg3.x = position.x;
_arg3.y = position.y;
_arg3.z = position.z;
_arg3.u = (_local37 * _local40);
_arg3.v = (_local41 - (_local38 * _local41));
return (_arg3);
}
override public function render(_arg1:RenderSessionData):void{
container = triangle.instance.container;
if (!container){
container = _arg1.container;
};
renderer.drawTriangle(triangle, container.graphics, _arg1);
}
}
}//package org.papervision3d.core.render.command
Section 97
//RenderSessionData (org.papervision3d.core.render.data.RenderSessionData)
package org.papervision3d.core.render.data {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.stat.*;
import org.papervision3d.core.render.*;
public class RenderSessionData {
public var container:Sprite;
public var renderer:IRenderEngine;
public var camera:CameraObject3D;
public var scene:SceneObject3D;
public var renderStatistics:RenderStatistics;
public function RenderSessionData():void{
}
}
}//package org.papervision3d.core.render.data
Section 98
//ILineDrawer (org.papervision3d.core.render.draw.ILineDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
public interface ILineDrawer {
function drawLine(_arg1:Line3D, _arg2:Graphics, _arg3:RenderSessionData):void;
}
}//package org.papervision3d.core.render.draw
Section 99
//IParticleDrawer (org.papervision3d.core.render.draw.IParticleDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
public interface IParticleDrawer {
function drawParticle(_arg1:Particle, _arg2:Graphics, _arg3:RenderSessionData):void;
}
}//package org.papervision3d.core.render.draw
Section 100
//ITriangleDrawer (org.papervision3d.core.render.draw.ITriangleDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
public interface ITriangleDrawer {
function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData):void;
}
}//package org.papervision3d.core.render.draw
Section 101
//BasicRenderFilter (org.papervision3d.core.render.filter.BasicRenderFilter)
package org.papervision3d.core.render.filter {
public class BasicRenderFilter implements IRenderFilter {
public function filter(_arg1:Array):int{
return (0);
}
}
}//package org.papervision3d.core.render.filter
Section 102
//IRenderFilter (org.papervision3d.core.render.filter.IRenderFilter)
package org.papervision3d.core.render.filter {
public interface IRenderFilter {
function filter(_arg1:Array):int;
}
}//package org.papervision3d.core.render.filter
Section 103
//RenderHitData (org.papervision3d.core.render.hit.RenderHitData)
package org.papervision3d.core.render.hit {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
public class RenderHitData {
public var y:Number;
public var displayObject3D:DisplayObject3D;
public var renderable:IRenderable;
public var u:Number;
public var material:MaterialObject3D;
public var x:Number;
public var hasHit:Boolean;// = false
public var z:Number;
public var v:Number;
public function RenderHitData(){
hasHit = false;
super();
}
public function toString():String{
return (((displayObject3D + " ") + renderable));
}
}
}//package org.papervision3d.core.render.hit
Section 104
//BasicRenderSorter (org.papervision3d.core.render.sort.BasicRenderSorter)
package org.papervision3d.core.render.sort {
public class BasicRenderSorter implements IRenderSorter {
public function sort(_arg1:Array):void{
_arg1.sortOn("screenDepth", Array.NUMERIC);
}
}
}//package org.papervision3d.core.render.sort
Section 105
//IRenderSorter (org.papervision3d.core.render.sort.IRenderSorter)
package org.papervision3d.core.render.sort {
public interface IRenderSorter {
function sort(_arg1:Array):void;
}
}//package org.papervision3d.core.render.sort
Section 106
//BasicRenderEngine (org.papervision3d.core.render.BasicRenderEngine)
package org.papervision3d.core.render {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.stat.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.render.hit.*;
import flash.geom.*;
import com.blitzagency.xray.logger.*;
import org.papervision3d.events.*;
import org.papervision3d.core.render.sort.*;
import org.papervision3d.core.render.filter.*;
public class BasicRenderEngine extends EventDispatcher implements IRenderEngine {
private var log:XrayLog;
private var lastRenderList:Array;
public var sorter:IRenderSorter;
private var renderList:Array;
private var renderStatistics:RenderStatistics;
private var cleanRHD:RenderHitData;
private var renderSessionData:RenderSessionData;
public var filter:IRenderFilter;
public function BasicRenderEngine():void{
cleanRHD = new RenderHitData();
log = new XrayLog();
super();
init();
}
public function removeFromRenderList(_arg1:IRenderListItem):int{
return (renderList.splice(renderList.indexOf(_arg1), 1));
}
protected function init():void{
renderStatistics = new RenderStatistics();
sorter = new BasicRenderSorter();
filter = new BasicRenderFilter();
renderList = new Array();
lastRenderList = new Array();
renderSessionData = new RenderSessionData();
}
public function render(_arg1:SceneObject3D, _arg2:Sprite, _arg3:CameraObject3D):RenderStatistics{
var _local4:IRenderListItem;
filter.filter(renderList);
sorter.sort(renderList);
lastRenderList.length = 0;
renderSessionData.container = _arg2;
renderSessionData.camera = _arg3;
renderSessionData.scene = _arg1;
renderSessionData.renderer = this;
renderSessionData.renderStatistics = new RenderStatistics();
while ((_local4 = renderList.pop())) {
_local4.render(renderSessionData);
lastRenderList.push(_local4);
};
dispatchEvent(new RendererEvent(RendererEvent.RENDER_DONE, renderSessionData));
return (renderStatistics);
}
public function hitTestPoint2D(_arg1:Point):RenderHitData{
var _local2:RenderableListItem;
var _local3:RenderHitData;
var _local4:IRenderListItem;
var _local5:uint;
_local3 = new RenderHitData();
_local5 = lastRenderList.length;
while ((_local4 = lastRenderList[--_local5])) {
if ((_local4 is RenderableListItem)){
_local2 = (_local4 as RenderableListItem);
_local3 = _local2.hitTestPoint2D(_arg1, _local3);
if (_local3.hasHit){
return (_local3);
};
};
};
return (cleanRHD);
}
public function addToRenderList(_arg1:IRenderListItem):int{
return (renderList.push(_arg1));
}
}
}//package org.papervision3d.core.render
Section 107
//InteractiveRendererEngine (org.papervision3d.core.render.InteractiveRendererEngine)
package org.papervision3d.core.render {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.stat.*;
import org.papervision3d.scenes.*;
import org.papervision3d.utils.*;
public class InteractiveRendererEngine extends BasicRenderEngine {
public var interactiveSceneManager:InteractiveSceneManager;// = null
public function InteractiveRendererEngine(_arg1:Scene3D){
interactiveSceneManager = null;
super();
interactiveSceneManager = new InteractiveSceneManager(_arg1, _arg1.container);
}
override protected function init():void{
super.init();
}
override public function render(_arg1:SceneObject3D, _arg2:Sprite, _arg3:CameraObject3D):RenderStatistics{
if (!interactiveSceneManager.camera){
interactiveSceneManager.camera = _arg3;
};
return (super.render(_arg1, _arg2, _arg3));
}
}
}//package org.papervision3d.core.render
Section 108
//IRenderEngine (org.papervision3d.core.render.IRenderEngine)
package org.papervision3d.core.render {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.stat.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.render.hit.*;
import flash.geom.*;
public interface IRenderEngine {
function addToRenderList(_arg1:IRenderListItem):int;
function removeFromRenderList(_arg1:IRenderListItem):int;
function render(_arg1:SceneObject3D, _arg2:Sprite, _arg3:CameraObject3D):RenderStatistics;
function hitTestPoint2D(_arg1:Point):RenderHitData;
}
}//package org.papervision3d.core.render
Section 109
//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 particles:Number;
public var performance:int;// = 0
public var rendered:int;// = 0
public var culledTriangles:int;// = 0
public var lines:Number;
public function RenderStatistics(){
performance = 0;
points = 0;
polys = 0;
rendered = 0;
triangles = 0;
culledTriangles = 0;
super();
}
public function toString():String{
return (new String(((((((((("Performance:" + performance) + ", Points:") + points) + " Polys:") + polys) + " Rendered:") + rendered) + " Culled:") + culledTriangles)));
}
public function clear():void{
performance = 0;
points = 0;
polys = 0;
rendered = 0;
triangles = 0;
particles = 0;
culledTriangles = 0;
lines = 0;
}
}
}//package org.papervision3d.core.stat
Section 110
//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 111
//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 112
//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 113
//InteractiveScene3DEvent (org.papervision3d.events.InteractiveScene3DEvent)
package org.papervision3d.events {
import flash.display.*;
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
public class InteractiveScene3DEvent extends Event {
public var sprite:Sprite;// = null
public var displayObject3D:DisplayObject3D;// = null
public var face3d:Triangle3D;// = null
public var x:Number;// = 0
public var y:Number;// = 0
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:Triangle3D=null, _arg5:Number=0, _arg6:Number=0, _arg7:Boolean=false, _arg8:Boolean=false){
displayObject3D = null;
sprite = null;
face3d = null;
x = 0;
y = 0;
super(_arg1, _arg7, _arg8);
this.displayObject3D = _arg2;
this.sprite = _arg3;
this.face3d = _arg4;
this.x = _arg5;
this.y = _arg6;
}
}
}//package org.papervision3d.events
Section 114
//RendererEvent (org.papervision3d.events.RendererEvent)
package org.papervision3d.events {
import flash.events.*;
import org.papervision3d.core.render.data.*;
public class RendererEvent extends Event {
public var renderSessionData:RenderSessionData;
public static var RENDER_DONE:String = "onRenderDone";
public function RendererEvent(_arg1:String, _arg2:RenderSessionData){
super(_arg1);
this.renderSessionData = _arg2;
}
}
}//package org.papervision3d.events
Section 115
//BitmapAssetMaterial (org.papervision3d.materials.BitmapAssetMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
public class BitmapAssetMaterial extends BitmapMaterial implements ITriangleDrawer {
private static var _library:Object = new Object();
private static var _count:Object = new Object();
public function BitmapAssetMaterial(_arg1:String){
texture = _arg1;
}
override public function get texture():Object{
return (this._texture);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is String) == false){
Papervision3D.log("Error: BitmapMaterial.texture requires a BitmapData object for the texture");
return;
};
bitmap = createBitmapFromLinkageID(String(_arg1));
_texture = _arg1;
}
protected function createBitmapFromLinkageID(_arg1:String):BitmapData{
var _local2:BitmapData;
var _local3:BitmapData;
var _local4:BitmapData;
var _local5:Class;
var _local6:XML;
if (this._texture != _arg1){
var _local7 = _count;
var _local8 = this._texture;
var _local9 = (_local7[_local8] - 1);
_local7[_local8] = _local9;
_local4 = _library[this._texture];
if (((_local4) && ((_count[this._texture] == 0)))){
_local4.dispose();
};
};
_local3 = _library[_arg1];
if (!_local3){
_local5 = (getDefinitionByName(_arg1) as Class);
_local6 = describeType(_local5);
if (_local6..constructor.length() == 0){
_local3 = (new (_local5) as BitmapData);
} else {
_local3 = (new _local5(0, 0) as BitmapData);
};
_local2 = createBitmap(_local3);
_library[_arg1] = _local2;
_count[_arg1] = 0;
} else {
_local2 = _local3;
maxU = (maxV = 1);
_local7 = _count;
_local8 = _arg1;
_local9 = (_local7[_local8] + 1);
_local7[_local8] = _local9;
};
return (_local2);
}
}
}//package org.papervision3d.materials
Section 116
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import flash.geom.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
public class BitmapMaterial extends TriangleMaterial implements ITriangleDrawer {
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 toString():String{
return (((((("Texture:" + this.texture) + " lineColor:") + this.lineColor) + " lineAlpha:") + this.lineAlpha));
}
public function resetMapping():void{
uvMatrices = new Dictionary();
}
public function transformUV(_arg1:Triangle3D):Matrix{
var _local2:Array;
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:Matrix;
var _local16:Matrix;
if (!_arg1.uv){
Papervision3D.log("MaterialObject3D: transformUV() uv not found!");
} else {
if (bitmap){
_local2 = _arg1.uv;
_local3 = (bitmap.width * maxU);
_local4 = (bitmap.height * maxV);
_local5 = (_local3 * _local2[0].u);
_local6 = (_local4 * (1 - _local2[0].v));
_local7 = (_local3 * _local2[1].u);
_local8 = (_local4 * (1 - _local2[1].v));
_local9 = (_local3 * _local2[2].u);
_local10 = (_local4 * (1 - _local2[2].v));
if ((((((_local5 == _local7)) && ((_local6 == _local8)))) || ((((_local5 == _local9)) && ((_local6 == _local10)))))){
_local5 = (_local5 - ((_local5)>0.05) ? 0.05 : -0.05);
_local6 = (_local6 - ((_local6)>0.07) ? 0.07 : -0.07);
};
if ((((_local9 == _local7)) && ((_local10 == _local8)))){
_local9 = (_local9 - ((_local9)>0.05) ? 0.04 : -0.04);
_local10 = (_local10 - ((_local10)>0.06) ? 0.06 : -0.06);
};
_local11 = (_local7 - _local5);
_local12 = (_local8 - _local6);
_local13 = (_local9 - _local5);
_local14 = (_local10 - _local6);
_local15 = new Matrix(_local11, _local12, _local13, _local14, _local5, _local6);
_local15.invert();
_local16 = ((uvMatrices[_arg1]) || ((uvMatrices[_arg1] = _local15.clone())));
_local16.a = _local15.a;
_local16.b = _local15.b;
_local16.c = _local15.c;
_local16.d = _local15.d;
_local16.tx = _local15.tx;
_local16.ty = _local15.ty;
} else {
Papervision3D.log("MaterialObject3D: transformUV() material.bitmap not found!");
};
};
return (_local16);
}
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 copy(_arg1:MaterialObject3D):void{
super.copy(_arg1);
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
override public function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData):void{
var _local4:Matrix;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
if (lineAlpha){
_arg2.lineStyle(0, lineColor, lineAlpha);
};
if (bitmap){
_local4 = ((uvMatrices[_arg1]) || (transformUV(_arg1)));
_local5 = _arg1.v0.vertex3DInstance.x;
_local6 = _arg1.v0.vertex3DInstance.y;
_local7 = _arg1.v1.vertex3DInstance.x;
_local8 = _arg1.v1.vertex3DInstance.y;
_local9 = _arg1.v2.vertex3DInstance.x;
_local10 = _arg1.v2.vertex3DInstance.y;
_triMatrix.a = (_local7 - _local5);
_triMatrix.b = (_local8 - _local6);
_triMatrix.c = (_local9 - _local5);
_triMatrix.d = (_local10 - _local6);
_triMatrix.tx = _local5;
_triMatrix.ty = _local6;
_localMatrix.a = _local4.a;
_localMatrix.b = _local4.b;
_localMatrix.c = _local4.c;
_localMatrix.d = _local4.d;
_localMatrix.tx = _local4.tx;
_localMatrix.ty = _local4.ty;
_localMatrix.concat(_triMatrix);
_arg2.beginBitmapFill(bitmap, _localMatrix, tiled, smooth);
};
_arg2.moveTo(_local5, _local6);
_arg2.lineTo(_local7, _local8);
_arg2.lineTo(_local9, _local10);
_arg2.lineTo(_local5, _local6);
if (bitmap){
_arg2.endFill();
};
if (lineAlpha){
_arg2.lineStyle();
};
_arg3.renderStatistics.triangles++;
}
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 117
//LineMaterial (org.papervision3d.materials.LineMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.draw.*;
public class LineMaterial extends MaterialObject3D implements ILineDrawer {
public function LineMaterial(_arg1:Number=0xFF0000, _arg2:Number=100){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
}
public function drawLine(_arg1:Line3D, _arg2:Graphics, _arg3:RenderSessionData):void{
_arg2.lineStyle(_arg1.size, lineColor, lineAlpha);
_arg2.moveTo(_arg1.v0.vertex3DInstance.x, _arg1.v0.vertex3DInstance.y);
_arg2.lineTo(_arg1.v1.vertex3DInstance.x, _arg1.v1.vertex3DInstance.y);
_arg2.moveTo(0, 0);
_arg2.lineStyle();
}
}
}//package org.papervision3d.materials
Section 118
//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 119
//MovieAssetMaterial (org.papervision3d.materials.MovieAssetMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
public class MovieAssetMaterial extends MovieMaterial implements ITriangleDrawer {
public var createUnique:Boolean;// = false
private static var _library:Object = new Object();
private static var _count:Object = new Object();
public function MovieAssetMaterial(_arg1:String="", _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Boolean=false){
createUnique = false;
super();
movieTransparent = _arg2;
this.animated = _arg3;
this.createUnique = _arg4;
if (_arg1.length > 0){
texture = _arg1;
};
}
protected function createMovie(_arg1):MovieClip{
var _local2:MovieClip;
var _local3:Class;
var _local4:MovieClip;
if (this._texture != _arg1){
var _local5 = _count;
var _local6 = this._texture;
var _local7 = (_local5[_local6] - 1);
_local5[_local6] = _local7;
_local4 = _library[this._texture];
if (((_local4) && ((_count[this._texture] == 0)))){
_library[this._texture] = null;
};
};
_local2 = _library[_arg1];
if (!_local2){
_local3 = (getDefinitionByName(_arg1) as Class);
_local2 = new (_local3);
_library[_arg1] = _local2;
_count[_arg1] = 0;
} else {
if (createUnique){
_local3 = (getDefinitionByName(_arg1) as Class);
_local2 = new (_local3);
} else {
_local5 = _count;
_local6 = _arg1;
_local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
};
};
return (_local2);
}
override public function get texture():Object{
return (this._texture);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is String) == false){
Papervision3D.log("Error: MovieAssetMaterial.texture requires a String to be passed to create the MovieClip reference from the library");
return;
};
movie = Sprite(createMovie(String(_arg1)));
bitmap = createBitmapFromSprite(movie);
_texture = _arg1;
}
}
}//package org.papervision3d.materials
Section 120
//MovieMaterial (org.papervision3d.materials.MovieMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.*;
public class MovieMaterial extends BitmapMaterial implements ITriangleDrawer {
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;
};
}
override public function get texture():Object{
return (this._texture);
}
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);
}
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 121
//ParticleMaterial (org.papervision3d.materials.ParticleMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.draw.*;
public class ParticleMaterial extends MaterialObject3D implements IParticleDrawer {
public function ParticleMaterial(_arg1:Number, _arg2:Number){
this.fillAlpha = _arg2;
this.fillColor = _arg1;
}
public function drawParticle(_arg1:Particle, _arg2:Graphics, _arg3:RenderSessionData):void{
_arg2.beginFill(fillColor, fillAlpha);
if (_arg1.size == 0){
_arg2.drawRect(_arg1.vertex3D.vertex3DInstance.x, _arg1.vertex3D.vertex3DInstance.y, 1, 1);
} else {
_arg2.drawRect(_arg1.vertex3D.vertex3DInstance.x, _arg1.vertex3D.vertex3DInstance.y, _arg1.renderScale, _arg1.renderScale);
};
_arg2.endFill();
}
}
}//package org.papervision3d.materials
Section 122
//TriangleMaterial (org.papervision3d.materials.TriangleMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.draw.*;
public class TriangleMaterial extends MaterialObject3D implements ITriangleDrawer {
override public function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData):void{
}
}
}//package org.papervision3d.materials
Section 123
//WireframeMaterial (org.papervision3d.materials.WireframeMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.draw.*;
public class WireframeMaterial extends TriangleMaterial implements ITriangleDrawer {
public function WireframeMaterial(_arg1:Number=0xFF00FF, _arg2:Number=100){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
this.doubleSided = false;
}
override public function toString():String{
return (((("WireframeMaterial - color:" + this.lineColor) + " alpha:") + this.lineAlpha));
}
override public function drawTriangle(_arg1:Triangle3D, _arg2:Graphics, _arg3:RenderSessionData):void{
var _local4:Number;
var _local5:Number;
_local4 = _arg1.v0.vertex3DInstance.x;
_local5 = _arg1.v0.vertex3DInstance.y;
if (lineAlpha){
_arg2.lineStyle(0, lineColor, lineAlpha);
_arg2.moveTo(_local4, _local5);
_arg2.lineTo(_arg1.v1.vertex3DInstance.x, _arg1.v1.vertex3DInstance.y);
_arg2.lineTo(_arg1.v2.vertex3DInstance.x, _arg1.v2.vertex3DInstance.y);
_arg2.lineTo(_local4, _local5);
_arg2.lineStyle();
_arg3.renderStatistics.triangles++;
};
}
}
}//package org.papervision3d.materials
Section 124
//Cylinder (org.papervision3d.objects.Cylinder)
package org.papervision3d.objects {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
import org.papervision3d.core.geom.*;
public class Cylinder extends TriangleMesh3D {
public var segmentsH:Number;
public var segmentsW:Number;
public static var DEFAULT_HEIGHT:Number = 100;
public static var DEFAULT_SEGMENTSH:Number = 6;
public static var DEFAULT_SCALE:Number = 1;
public static var DEFAULT_RADIUS:Number = 100;
public static var MIN_SEGMENTSH:Number = 2;
public static var MIN_SEGMENTSW:Number = 3;
public static var DEFAULT_SEGMENTSW:Number = 8;
public function Cylinder(_arg1:MaterialObject3D=null, _arg2:Number=100, _arg3:Number=100, _arg4:int=8, _arg5:int=6, _arg6:Number=-1, _arg7:Object=null){
var _local8:Number;
super(_arg1, new Array(), new Array(), null, _arg7);
this.segmentsW = Math.max(MIN_SEGMENTSW, ((_arg4) || (DEFAULT_SEGMENTSW)));
this.segmentsH = Math.max(MIN_SEGMENTSH, ((_arg5) || (DEFAULT_SEGMENTSH)));
if (_arg2 == 0){
_arg2 = DEFAULT_RADIUS;
};
if (_arg3 == 0){
_arg3 = DEFAULT_HEIGHT;
};
if (_arg6 == -1){
_arg6 = _arg2;
};
_local8 = DEFAULT_SCALE;
buildCylinder(_arg2, _arg3, _arg6);
}
private function buildCylinder(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:MaterialObject3D;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Array;
var _local11:Array;
var _local12:Array;
var _local13:int;
var _local14:NumberUV;
var _local15:NumberUV;
var _local16:NumberUV;
var _local17:NumberUV;
var _local18:Vertex3D;
var _local19:Vertex3D;
var _local20:Vertex3D;
var _local21:Vertex3D;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Array;
var _local26:Vertex3D;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:int;
var _local31:Boolean;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:int;
var _local37:Boolean;
_local4 = material;
_local8 = Math.max(3, this.segmentsW);
_local9 = Math.max(2, this.segmentsH);
_local10 = this.geometry.vertices;
_local11 = this.geometry.faces;
_local12 = new Array();
_local6 = 0;
while (_local6 < (_local9 + 1)) {
_local22 = Number((_local6 / _local9));
_local23 = ((_arg2 * (_local6 / (_local9 + 0))) - (_arg2 / 2));
_local24 = (_arg3 + ((_arg1 - _arg3) * (1 - (_local6 / _local9))));
_local25 = new Array();
_local5 = 0;
while (_local5 < _local8) {
_local27 = Number(((2 * _local5) / _local8));
_local28 = (_local24 * Math.sin((_local27 * Math.PI)));
_local29 = (_local24 * Math.cos((_local27 * Math.PI)));
_local26 = new Vertex3D(_local29, _local23, _local28);
_local10.push(_local26);
_local25.push(_local26);
_local5++;
};
_local12.push(_local25);
_local6++;
};
_local13 = _local12.length;
_local6 = 0;
while (_local6 < _local13) {
_local30 = _local12[_local6].length;
_local5 = 0;
while (_local5 < _local30) {
if ((((_local6 > 0)) && ((_local5 >= 0)))){
_local31 = (_local5 == (_local30 - 0));
_local18 = _local12[_local6][(_local31) ? 0 : _local5];
_local19 = _local12[_local6][(((_local5 == 0)) ? _local30 : _local5 - 1)];
_local20 = _local12[(_local6 - 1)][(((_local5 == 0)) ? _local30 : _local5 - 1)];
_local21 = _local12[(_local6 - 1)][(_local31) ? 0 : _local5];
_local32 = (_local6 / _local13);
_local33 = ((_local6 - 1) / _local13);
_local34 = ((_local5 + 1) / _local30);
_local35 = (_local5 / _local30);
_local14 = new NumberUV(_local34, _local33);
_local15 = new NumberUV(_local34, _local32);
_local16 = new NumberUV(_local35, _local32);
_local17 = new NumberUV(_local35, _local33);
_local11.push(new Triangle3D(this, [_local18, _local19, _local20], _local4, [_local15, _local16, _local17]));
_local11.push(new Triangle3D(this, [_local18, _local20, _local21], _local4, [_local15, _local17, _local14]));
};
_local5++;
};
if ((((_local6 == 0)) || ((_local6 == (_local13 - 1))))){
_local5 = 0;
while (_local5 < (_local30 - 2)) {
_local36 = Math.floor((_local5 / 2));
_local18 = _local12[_local6][_local36];
_local19 = (((_local5 % 2))==0) ? _local12[_local6][((_local30 - 2) - _local36)] : _local12[_local6][(_local36 + 1)];
_local20 = (((_local5 % 2))==0) ? _local12[_local6][((_local30 - 1) - _local36)] : _local12[_local6][((_local30 - 2) - _local36)];
_local37 = (_local6 == 0);
_local15 = new NumberUV(((_local37) ? 1 : 0 + ((_local37) ? -1 : 1 * (((_local18.x / _arg1) / 2) + 0.5))), (((_local18.z / _arg1) / 2) + 0.5));
_local16 = new NumberUV(((_local37) ? 1 : 0 + ((_local37) ? -1 : 1 * (((_local19.x / _arg1) / 2) + 0.5))), (((_local19.z / _arg1) / 2) + 0.5));
_local17 = new NumberUV(((_local37) ? 1 : 0 + ((_local37) ? -1 : 1 * (((_local20.x / _arg1) / 2) + 0.5))), (((_local20.z / _arg1) / 2) + 0.5));
if (_local6 == 0){
_local11.push(new Triangle3D(this, [_local18, _local20, _local19], _local4, [_local15, _local17, _local16]));
} else {
_local11.push(new Triangle3D(this, [_local18, _local19, _local20], _local4, [_local15, _local16, _local17]));
};
_local5++;
};
};
_local6++;
};
this.geometry.ready = true;
}
}
}//package org.papervision3d.objects
Section 125
//DisplayObject3D (org.papervision3d.objects.DisplayObject3D)
package org.papervision3d.objects {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import com.blitzagency.xray.logger.*;
import org.papervision3d.*;
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 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;
public static var staticSorted:Array = new Array();
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;
};
};
}
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){
staticSorted.length = 0;
_arg3 = staticSorted;
this._sorted = _arg3;
};
for each (_local6 in this._childrenByName) {
if (_local6.visible){
_local4 = (_local4 + _local6.project(this, _arg2, _arg3));
_local5++;
};
};
return ((this.screenZ = (_local4 / _local5)));
}
private function calculateScreenCoords(_arg1:CameraObject3D):void{
var _local2:Number;
_local2 = ((_arg1.focus * _arg1.zoom) / (_arg1.focus + view.n34));
screen.x = (view.n14 * _local2);
screen.y = (view.n24 * _local2);
screen.z = view.n34;
}
public function lookAt(_arg1:DisplayObject3D, _arg2:Number3D=null):void{
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
var _local6:Number3D;
var _local7:Number3D;
var _local8:Matrix3D;
var _local9:XrayLog;
_local3 = new Number3D(this.x, this.y, this.z);
_local4 = new Number3D(_arg1.x, _arg1.y, _arg1.z);
_local5 = Number3D.sub(_local4, _local3);
_local5.normalize();
if (_local5.modulo > 0.1){
_local6 = Number3D.cross(_local5, ((_arg2) || (UP)));
_local6.normalize();
_local7 = Number3D.cross(_local5, _local6);
_local7.normalize();
_local8 = this.transform;
_local8.n11 = (_local6.x * _scaleX);
_local8.n21 = (_local6.y * _scaleX);
_local8.n31 = (_local6.z * _scaleX);
_local8.n12 = (-(_local7.x) * _scaleY);
_local8.n22 = (-(_local7.y) * _scaleY);
_local8.n32 = (-(_local7.z) * _scaleY);
_local8.n13 = (_local5.x * _scaleZ);
_local8.n23 = (_local5.y * _scaleZ);
_local8.n33 = (_local5.z * _scaleZ);
this._transformDirty = false;
this._rotationDirty = true;
} else {
_local9 = new XrayLog();
_local9.debug("lookAt Error");
};
}
public function set rotationX(_arg1:Number):void{
this._rotationX = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
public function set rotationY(_arg1:Number):void{
this._rotationY = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
public function set rotationZ(_arg1:Number):void{
this._rotationZ = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this._transformDirty = true;
}
public function addGeometry(_arg1:GeometryObject3D=null):void{
if (_arg1){
this.geometry = _arg1;
};
}
public function get sceneX():Number{
return (this.world.n14);
}
public function get scaleX():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
}
public function get scaleY():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleY * 100));
};
return (this._scaleY);
}
public function get scaleZ():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleZ * 100));
};
return (this._scaleZ);
}
public function moveUp(_arg1:Number):void{
translate(_arg1, UP);
}
public function get sceneZ():Number{
return (this.world.n34);
}
public function distanceTo(_arg1:DisplayObject3D):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (this.x - _arg1.x);
_local3 = (this.y - _arg1.y);
_local4 = (this.z - _arg1.z);
return (Math.sqrt((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4))));
}
public function get sceneY():Number{
return (this.world.n24);
}
public function get scale():Number{
if ((((this._scaleX == this._scaleY)) && ((this._scaleX == this._scaleZ)))){
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
//unresolved jump
};
return (NaN);
}
public function hitTestObject(_arg1:DisplayObject3D, _arg2:Number=1):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = (this.x - _arg1.x);
_local4 = (this.y - _arg1.y);
_local5 = (this.z - _arg1.z);
_local6 = (((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5));
_local7 = (this.geometry) ? this.geometry.boundingSphere2 : 0;
_local8 = (_arg1.geometry) ? _arg1.geometry.boundingSphere2 : 0;
_local7 = (_local7 * _arg2);
return (((_local7 + _local8) > _local6));
}
public function translate(_arg1:Number, _arg2:Number3D):void{
var _local3:Number3D;
_local3 = _arg2.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local3);
this.x = (this.x + (_arg1 * _local3.x));
this.y = (this.y + (_arg1 * _local3.y));
this.z = (this.z + (_arg1 * _local3.z));
}
private function updateRotation():void{
var _local1:Number3D;
_local1 = Matrix3D.matrix2euler(this.transform);
this._rotationX = (_local1.x * toRADIANS);
this._rotationY = (_local1.y * toRADIANS);
this._rotationZ = (_local1.z * toRADIANS);
this._rotationDirty = false;
}
public function pitch(_arg1:Number):void{
var _local2:Number3D;
var _local3:Matrix3D;
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
_local2 = RIGHT.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local2);
_local3 = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this._rotationDirty = true;
}
public function yaw(_arg1:Number):void{
var _local2:Number3D;
var _local3:Matrix3D;
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
_local2 = UP.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local2);
_local3 = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this._rotationDirty = true;
}
public function copyTransform(_arg1):void{
var _local2:Matrix3D;
var _local3:Matrix3D;
_local2 = this.transform;
_local3 = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n11 = _local3.n11;
_local2.n12 = _local3.n12;
_local2.n13 = _local3.n13;
_local2.n14 = _local3.n14;
_local2.n21 = _local3.n21;
_local2.n22 = _local3.n22;
_local2.n23 = _local3.n23;
_local2.n24 = _local3.n24;
_local2.n31 = _local3.n31;
_local2.n32 = _local3.n32;
_local2.n33 = _local3.n33;
_local2.n34 = _local3.n34;
this._transformDirty = false;
this._rotationDirty = true;
}
public function moveLeft(_arg1:Number):void{
translate(_arg1, LEFT);
}
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 get x():Number{
return (this.transform.n14);
}
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 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 rotateArbitrary(_arg1:Number, _arg2:Number3D=null, _arg3:DisplayObject3D=null):void{
var _local4:Number3D;
var _local5:Number3D;
var _local6:Number;
var _local7:Number;
var _local8:Matrix3D;
var _local9:Matrix3D;
var _local10:Matrix3D;
var _local11:Matrix3D;
var _local12:Matrix3D;
var _local13:Matrix3D;
var _local14:Matrix3D;
var _local15:Matrix3D;
if (!_arg3){
_arg3 = this;
};
if (!_arg2){
_arg2 = new Number3D(1, 0, 0);
};
_local4 = _arg2;
_local5 = new Number3D(_arg3.x, _arg3.y, _arg3.z);
_local6 = Math.sqrt(((_local4.x * _local4.x) + (_local4.y * _local4.y)));
_local7 = Math.sqrt(((_local6 * _local6) + (_local4.z * _local4.z)));
_local8 = new Matrix3D([1, 0, 0, -(_local5.x), 0, 1, 0, -(_local5.y), 0, 0, 1, -(_local5.z), 0, 0, 0, 1]);
_local9 = Matrix3D.inverse(_local8);
if (_local6 != 0){
_local10 = new Matrix3D([(_local4.x / _local6), (_local4.y / _local6), 0, 0, (-(_local4.y) / _local6), (_local4.x / _local6), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
} else {
_local10 = Matrix3D.IDENTITY;
};
_local11 = Matrix3D.inverse(_local10);
_local12 = new Matrix3D([(_local4.z / _local7), 0, (-(_local6) / _local7), 0, 0, 1, 0, 0, (_local6 / _local7), 0, (_local4.z / _local7), 0, 0, 0, 0, 1]);
_local13 = Matrix3D.inverse(_local12);
_local14 = new Matrix3D([Math.cos(_arg1), -(Math.sin(_arg1)), 0, 0, Math.sin(_arg1), Math.cos(_arg1), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
_local15 = Matrix3D.multiply(Matrix3D.multiply(Matrix3D.multiply(Matrix3D.multiply(Matrix3D.multiply(Matrix3D.multiply(_local9, _local11), _local13), _local14), _local12), _local10), _local8);
this.transform.calculateMultiply(_local15, transform);
if (this._transformDirty){
updateTransform();
};
}
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 126
//Plane (org.papervision3d.objects.Plane)
package org.papervision3d.objects {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
import org.papervision3d.core.geom.*;
public class Plane extends TriangleMesh3D {
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 Triangle3D(this, [_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 Triangle3D(this, [_local20, _local22, _local21], null, [_local14, _local16, _local15]));
_local17++;
};
_local13++;
};
this.geometry.ready = true;
}
}
}//package org.papervision3d.objects
Section 127
//Sphere (org.papervision3d.objects.Sphere)
package org.papervision3d.objects {
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.*;
import org.papervision3d.core.geom.*;
public class Sphere extends TriangleMesh3D {
public var segmentsH:Number;
public var segmentsW:Number;
public static var MIN_SEGMENTSW:Number = 3;
public static var DEFAULT_SCALE:Number = 1;
public static var DEFAULT_RADIUS:Number = 100;
public static var DEFAULT_SEGMENTSH:Number = 6;
public static var MIN_SEGMENTSH:Number = 2;
public static var DEFAULT_SEGMENTSW:Number = 8;
public function Sphere(_arg1:MaterialObject3D=null, _arg2:Number=100, _arg3:int=8, _arg4:int=6, _arg5:Object=null){
var _local6:Number;
super(_arg1, new Array(), new Array(), null, _arg5);
this.segmentsW = Math.max(MIN_SEGMENTSW, ((_arg3) || (DEFAULT_SEGMENTSW)));
this.segmentsH = Math.max(MIN_SEGMENTSH, ((_arg4) || (DEFAULT_SEGMENTSH)));
if (_arg2 == 0){
_arg2 = DEFAULT_RADIUS;
};
_local6 = DEFAULT_SCALE;
buildSphere(_arg2);
}
private function buildSphere(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Array;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Array;
var _local15:Vertex3D;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:Boolean;
var _local21:Vertex3D;
var _local22:Vertex3D;
var _local23:Vertex3D;
var _local24:Vertex3D;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:NumberUV;
var _local30:NumberUV;
var _local31:NumberUV;
var _local32:NumberUV;
_local5 = Math.max(3, this.segmentsW);
_local6 = Math.max(2, this.segmentsH);
_local7 = this.geometry.vertices;
_local8 = this.geometry.faces;
_local9 = new Array();
_local3 = 0;
while (_local3 < (_local6 + 1)) {
_local11 = Number((_local3 / _local6));
_local12 = (-(_arg1) * Math.cos((_local11 * Math.PI)));
_local13 = (_arg1 * Math.sin((_local11 * Math.PI)));
_local14 = new Array();
_local2 = 0;
while (_local2 < _local5) {
_local16 = Number(((2 * _local2) / _local5));
_local17 = (_local13 * Math.sin((_local16 * Math.PI)));
_local18 = (_local13 * Math.cos((_local16 * Math.PI)));
if (!(((((_local3 == 0)) || ((_local3 == _local6)))) && ((_local2 > 0)))){
_local15 = new Vertex3D(_local18, _local12, _local17);
_local7.push(_local15);
};
_local14.push(_local15);
_local2++;
};
_local9.push(_local14);
_local3++;
};
_local10 = _local9.length;
_local3 = 0;
while (_local3 < _local10) {
_local19 = _local9[_local3].length;
if (_local3 > 0){
_local2 = 0;
while (_local2 < _local19) {
_local20 = (_local2 == (_local19 - 0));
_local21 = _local9[_local3][(_local20) ? 0 : _local2];
_local22 = _local9[_local3][(((_local2 == 0)) ? _local19 : _local2 - 1)];
_local23 = _local9[(_local3 - 1)][(((_local2 == 0)) ? _local19 : _local2 - 1)];
_local24 = _local9[(_local3 - 1)][(_local20) ? 0 : _local2];
_local25 = (_local3 / (_local10 - 1));
_local26 = ((_local3 - 1) / (_local10 - 1));
_local27 = ((_local2 + 1) / _local19);
_local28 = (_local2 / _local19);
_local29 = new NumberUV(_local27, _local26);
_local30 = new NumberUV(_local27, _local25);
_local31 = new NumberUV(_local28, _local25);
_local32 = new NumberUV(_local28, _local26);
if (_local3 < (_local9.length - 1)){
_local8.push(new Triangle3D(this, new Array(_local21, _local22, _local23), null, new Array(_local30, _local31, _local32)));
};
if (_local3 > 1){
_local8.push(new Triangle3D(this, new Array(_local21, _local23, _local24), null, new Array(_local30, _local32, _local29)));
};
_local2++;
};
};
_local3++;
};
this.geometry.ready = true;
}
}
}//package org.papervision3d.objects
Section 128
//Scene3D (org.papervision3d.scenes.Scene3D)
package org.papervision3d.scenes {
import flash.display.*;
import org.papervision3d.core.proto.*;
import flash.utils.*;
import org.papervision3d.core.render.*;
public class Scene3D extends SceneObject3D {
public function Scene3D(_arg1:Sprite, _arg2:Boolean=false){
super(_arg1);
this.interactive = _arg2;
if (_arg2){
renderer = new InteractiveRendererEngine(this);
interactiveSceneManager = InteractiveRendererEngine(renderer).interactiveSceneManager;
interactiveSceneManager.initListeners();
} else {
renderer = new BasicRenderEngine();
};
}
override protected function renderObjects(_arg1:CameraObject3D):void{
container.graphics.clear();
this.stats = renderer.render(this, container, _arg1);
stats.performance = (getTimer() - stats.performance);
}
}
}//package org.papervision3d.scenes
Section 129
//IVirtualMouseEvent (org.papervision3d.utils.virtualmouse.IVirtualMouseEvent)
package org.papervision3d.utils.virtualmouse {
public interface IVirtualMouseEvent {
}
}//package org.papervision3d.utils.virtualmouse
Section 130
//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;
};
_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 131
//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 132
//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 133
//InteractiveSceneManager (org.papervision3d.utils.InteractiveSceneManager)
package org.papervision3d.utils {
import flash.display.*;
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.render.hit.*;
import flash.geom.*;
import com.blitzagency.xray.logger.*;
import org.papervision3d.events.*;
import org.papervision3d.core.render.*;
import org.papervision3d.utils.virtualmouse.*;
public class InteractiveSceneManager extends EventDispatcher {
public var container:Sprite;
public var scene:SceneObject3D;
public var currentDisplayObject3D:DisplayObject3D;
protected var point:Point;
public var camera:CameraObject3D;
protected var log:XrayLog;
public var currentMaterial:MaterialObject3D;
public var debug:Boolean;// = false
public var mouse3D:Mouse3D;
public var enableOverOut:Boolean;// = true
public var virtualMouse:VirtualMouse;
public var renderHitData:RenderHitData;
public var currentMouseDO3D:DisplayObject3D;// = null
public static var MOUSE_IS_DOWN:Boolean = false;
public function InteractiveSceneManager(_arg1:SceneObject3D, _arg2:Sprite, _arg3:CameraObject3D=null){
virtualMouse = new VirtualMouse();
mouse3D = new Mouse3D();
enableOverOut = true;
currentMouseDO3D = null;
debug = false;
point = new Point();
log = new XrayLog();
super();
this.scene = _arg1;
this.container = _arg2;
this.camera = _arg3;
init();
}
protected function initVirtualMouse():void{
virtualMouse.stage = container.stage;
virtualMouse.container = container;
}
public function init():void{
if (container){
if (container.stage){
initVirtualMouse();
} else {
container.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
};
};
}
public function initListeners():void{
if (scene.interactive){
container.addEventListener(MouseEvent.MOUSE_DOWN, handleMousePress);
container.addEventListener(MouseEvent.MOUSE_UP, handleMouseRelease);
container.addEventListener(MouseEvent.CLICK, handleMouseClick);
container.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
if ((scene.renderer is InteractiveRendererEngine)){
InteractiveRendererEngine(scene.renderer).addEventListener(RendererEvent.RENDER_DONE, handleRenderDone);
};
};
}
protected function handleRenderDone(_arg1:RendererEvent):void{
resolveRenderHitData();
if (renderHitData.hasHit){
currentDisplayObject3D = renderHitData.displayObject3D;
currentMaterial = renderHitData.material;
manageOverOut();
};
}
protected function handleMouseClick(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (renderHitData){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_CLICK, currentDisplayObject3D);
};
}
protected function handleMouseOut(_arg1:DisplayObject3D):void{
var _local2:BitmapData;
var _local3:Rectangle;
var _local4:Boolean;
if (((VirtualMouse) && (renderHitData))){
_local2 = currentMaterial.bitmap;
_local3 = new Rectangle(0, 0, _local2.width, _local2.height);
_local4 = _local3.contains(renderHitData.u, renderHitData.v);
if (!_local4){
virtualMouse.exitContainer();
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OUT, _arg1);
};
}
protected function manageOverOut():void{
if (((!(renderHitData.hasHit)) || (!(enableOverOut)))){
return;
};
if (((!(currentMouseDO3D)) && (currentDisplayObject3D))){
handleMouseOver(currentDisplayObject3D);
};
if (currentDisplayObject3D != currentMouseDO3D){
handleMouseOut(currentMouseDO3D);
handleMouseOver(currentDisplayObject3D);
currentMouseDO3D = currentDisplayObject3D;
};
}
protected function dispatchObjectEvent(_arg1:String, _arg2:DisplayObject3D):void{
var _local3:Number;
var _local4:Number;
var _local5:InteractiveScene3DEvent;
if (!renderHitData.hasHit){
return;
};
if (debug){
log.debug(_arg1, _arg2.name);
};
_local3 = (renderHitData.u) ? renderHitData.u : 0;
_local4 = (renderHitData.v) ? renderHitData.v : 0;
_local5 = new InteractiveScene3DEvent(_arg1, _arg2, container, (renderHitData.renderable as Triangle3D), _local3, _local4);
dispatchEvent(_local5);
currentDisplayObject3D.dispatchEvent(_local5);
}
protected function handleMouseMove(_arg1:MouseEvent):void{
var _local2:MovieMaterial;
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((VirtualMouse) && (renderHitData))){
_local2 = (currentMaterial as MovieMaterial);
if (_local2){
virtualMouse.container = (_local2.movie as Sprite);
if (virtualMouse.container){
virtualMouse.setLocation(renderHitData.u, renderHitData.v);
};
};
if (((Mouse3D.enabled) && (renderHitData.hasHit))){
mouse3D.updatePosition(renderHitData);
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, currentDisplayObject3D);
} else {
if (renderHitData.hasHit){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, currentDisplayObject3D);
};
};
}
protected function handleMouseOver(_arg1:DisplayObject3D):void{
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OVER, _arg1);
}
protected function resolveRenderHitData():void{
point.x = container.mouseX;
point.y = container.mouseY;
renderHitData = (InteractiveRendererEngine(scene.renderer).hitTestPoint2D(point) as RenderHitData);
}
protected function handleMousePress(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
MOUSE_IS_DOWN = true;
if (virtualMouse){
virtualMouse.press();
};
if (renderHitData){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_PRESS, currentDisplayObject3D);
};
}
protected function handleMouseRelease(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
MOUSE_IS_DOWN = false;
if (virtualMouse){
virtualMouse.release();
};
if (renderHitData){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_RELEASE, currentDisplayObject3D);
};
}
protected function handleAddedToStage(_arg1:Event):void{
initVirtualMouse();
initListeners();
}
}
}//package org.papervision3d.utils
Section 134
//Mouse3D (org.papervision3d.utils.Mouse3D)
package org.papervision3d.utils {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.*;
import org.papervision3d.core.render.hit.*;
public class Mouse3D extends DisplayObject3D {
public static var enabled:Boolean = false;
private static var UP:Number3D = new Number3D(0, 1, 0);
public function Mouse3D(_arg1:Object=null):void{
}
public function updatePosition(_arg1:RenderHitData):void{
var _local2:Triangle3D;
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
var _local6:Matrix3D;
var _local7:Number3D;
var _local8:Number3D;
var _local9:Matrix3D;
_local2 = (_arg1.renderable as Triangle3D);
_local3 = new Number3D(0, 0, 0);
_local4 = new Number3D(_local2.faceNormal.x, _local2.faceNormal.y, _local2.faceNormal.z);
_local5 = Number3D.sub(_local4, _local3);
_local5.normalize();
if (_local5.modulo > 0.1){
_local7 = Number3D.cross(_local5, UP);
_local7.normalize();
_local8 = Number3D.cross(_local5, _local7);
_local8.normalize();
_local9 = this.transform;
_local9.n11 = _local7.x;
_local9.n21 = _local7.y;
_local9.n31 = _local7.z;
_local9.n12 = -(_local8.x);
_local9.n22 = -(_local8.y);
_local9.n32 = -(_local8.z);
_local9.n13 = _local5.x;
_local9.n23 = _local5.y;
_local9.n33 = _local5.z;
};
_local6 = Matrix3D.IDENTITY;
this.transform = Matrix3D.multiply(_local2.instance.world, _local9);
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
}
}
}//package org.papervision3d.utils
Section 135
//Papervision3D (org.papervision3d.Papervision3D)
package org.papervision3d {
public class Papervision3D {
public static var useDEGREES:Boolean = true;
public static var VERBOSE:Boolean = false;
public static var AUTHOR:String = "(c) 2006-2007 Copyright by Carlos Ulloa | papervision3d.org | carlos@papervision3d.org";
public static var DATE:String = "20.09.07";
public static var NAME:String = "Papervision3D";
public static var VERSION:String = "Beta 1.9 - PHUNKY";
public static var usePERCENT:Boolean = false;
public static function log(_arg1:String):void{
if (Papervision3D.VERBOSE){
};
}
}
}//package org.papervision3d
Section 136
//bonus_11 (pool_fla.bonus_11)
package pool_fla {
import flash.display.*;
import flash.text.*;
public dynamic class bonus_11 extends MovieClip {
public var bonusText:TextField;
public var detailsText:TextField;
}
}//package pool_fla
Section 137
//hud_29 (pool_fla.hud_29)
package pool_fla {
import flash.display.*;
public dynamic class hud_29 extends MovieClip {
public var ball:MovieClip;
}
}//package pool_fla
Section 138
//hud_30 (pool_fla.hud_30)
package pool_fla {
import flash.display.*;
public dynamic class hud_30 extends MovieClip {
public function hud_30(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16);
}
function frame10(){
stop();
}
function frame14(){
stop();
}
function frame12(){
stop();
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame9(){
stop();
}
function frame16(){
stop();
}
function frame8(){
stop();
}
function frame2(){
stop();
}
function frame15(){
stop();
}
function frame11(){
stop();
}
}
}//package pool_fla
Section 139
//hud_42 (pool_fla.hud_42)
package pool_fla {
import flash.display.*;
import flash.text.*;
public dynamic class hud_42 extends MovieClip {
public var timeText:TextField;
}
}//package pool_fla
Section 140
//hud_43 (pool_fla.hud_43)
package pool_fla {
import flash.display.*;
import flash.text.*;
public dynamic class hud_43 extends MovieClip {
public var scoreText:TextField;
}
}//package pool_fla
Section 141
//logo_67 (pool_fla.logo_67)
package pool_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
import flash.text.*;
import flash.utils.*;
import flash.media.*;
import preloader.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class logo_67 extends MovieClip {
public var link:MovieClip;
public var guide:MovieClip;
public var explosion;
public var mc_bomb:MovieClip;
public function logo_67(){
addFrameScript(0, frame1, 65, frame66);
}
function frame1(){
this.x = 300;
this.y = 250;
}
function frame66(){
explosion = new Explosion(stage.stageWidth, stage.stageHeight, stage);
explosion.createExplosion((this.x - 200), (this.y - 30));
stop();
}
}
}//package pool_fla
Section 142
//mc_bomb_68 (pool_fla.mc_bomb_68)
package pool_fla {
import flash.display.*;
public dynamic class mc_bomb_68 extends MovieClip {
public var guide:MovieClip;
public function mc_bomb_68(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package pool_fla
Section 143
//power_39 (pool_fla.power_39)
package pool_fla {
import flash.display.*;
import flash.text.*;
public dynamic class power_39 extends MovieClip {
public var percentage:TextField;
}
}//package pool_fla
Section 144
//preloader_2 (pool_fla.preloader_2)
package pool_fla {
import flash.display.*;
import flash.text.*;
public dynamic class preloader_2 extends MovieClip {
public var percentage:TextField;
public var preloaderBar:MovieClip;
public var game:MovieClip;
}
}//package pool_fla
Section 145
//preloader_3 (pool_fla.preloader_3)
package pool_fla {
import flash.display.*;
public dynamic class preloader_3 extends MovieClip {
public var bar:MovieClip;
}
}//package pool_fla
Section 146
//preloader_8 (pool_fla.preloader_8)
package pool_fla {
import flash.display.*;
import flash.text.*;
public dynamic class preloader_8 extends MovieClip {
public var title:TextField;
}
}//package pool_fla
Section 147
//score_135 (pool_fla.score_135)
package pool_fla {
import flash.display.*;
public dynamic class score_135 extends MovieClip {
public var bg:MovieClip;
}
}//package pool_fla
Section 148
//score_90 (pool_fla.score_90)
package pool_fla {
import flash.display.*;
public dynamic class score_90 extends MovieClip {
public var scores:scoreboard;
public var bg:MovieClip;
}
}//package pool_fla
Section 149
//scoreboard_93 (pool_fla.scoreboard_93)
package pool_fla {
import flash.display.*;
public dynamic class scoreboard_93 extends MovieClip {
public var bar:MovieClip;
}
}//package pool_fla
Section 150
//Explosion (preloader.Explosion)
package preloader {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
public class Explosion {
private var particle:Particle;
private var particleRectangle:Rectangle;
private var STAGE:Stage;
private var x:Number;
private var stageRectangle:Rectangle;
private var stageBitmapData:BitmapData;
private var particleCycle:Number;// = 0
private var particleBitmapDataArray:Array;
private var blurAmount:Number;// = 10
private var particleBitmapData:BitmapData;
private var particleCount:int;
private var origin:Point;
private var particleExplosion:Boolean;// = false
private var whiteBitmap:Bitmap;
private var blurFilter:BlurFilter;
private var matrix:Array;
private var fireColors:Array;
private var stageBitmap:Bitmap;
private var particleHeight:Number;// = 80
private var bufferBitmapData:BitmapData;
private var particleWidth:Number;// = 80
private var i:int;// = 0
private var particlePerCycle:Number;// = 20
private var particleCycles:Number;// = 5
private var particleBitmapMatrix:Matrix;
private var y:Number;
private var particleArray:Array;
private var fade:Number;// = 0.93
private var filter:BitmapFilter;
public function Explosion(_arg1:Number, _arg2:Number, _arg3:Stage){
particleArray = new Array();
i = 0;
origin = new Point(0, 0);
fade = 0.93;
blurAmount = 10;
particleBitmapDataArray = [];
particleWidth = 80;
particleHeight = 80;
particlePerCycle = 20;
particleCycle = 0;
particleCycles = 5;
particleExplosion = false;
super();
STAGE = _arg3;
stageBitmapData = new BitmapData(_arg1, _arg2, true, 4281545523);
bufferBitmapData = new BitmapData(_arg1, _arg2, false, 0);
stageRectangle = new Rectangle(0, 0, _arg1, _arg2);
stageBitmap = new Bitmap(stageBitmapData);
STAGE.addChild(stageBitmap);
matrix = new Array();
matrix = matrix.concat([1, 0, 0, 0, 0]);
matrix = matrix.concat([0, 1, 0, 0, 0]);
matrix = matrix.concat([0, 0, 1, 0, 0]);
matrix = matrix.concat([0, 0, 0, fade, 0]);
filter = new ColorMatrixFilter(matrix);
blurFilter = new BlurFilter(blurAmount, blurAmount, 1);
fireColors = Gradient.getArray([0x333333, 0x333333, 0x333333, 0xFF4400, 0xFFFF00, 0xFFFFFF], [0x333333, 0x333333, 1, 1, 1, 1], [0, 34, 68, 85, 136, 0xFF]);
particleBitmapMatrix = new Matrix();
particleBitmapMatrix.tx = (particleWidth / 2);
particleBitmapMatrix.ty = (particleHeight / 2);
particleBitmapData = new BitmapData(particleWidth, particleHeight, true, 0);
particleBitmapData.draw(new starMC(), particleBitmapMatrix);
STAGE.addEventListener(Event.ENTER_FRAME, render);
}
public function render(_arg1:Event){
if (particleExplosion){
i = 0;
while (i < particlePerCycle) {
particle = new Particle(x, y);
particleArray.push(particle);
i++;
};
particleCycle++;
if (particleCycle > particleCycles){
particleExplosion = false;
particleCycle = 0;
};
};
particleCount = particleArray.length;
if (particleCount == 0){
STAGE.removeChild(stageBitmap);
STAGE.removeEventListener(Event.ENTER_FRAME, render);
Root.credits();
};
while (particleCount--) {
particle = particleArray[particleCount];
particle.render();
if (particle.killMe){
delete particleArray[particleCount];
particleArray.splice(particleCount, 1);
} else {
bufferBitmapData.copyPixels(particleBitmapData, new Rectangle(0, 0, particleWidth, particleHeight), new Point(particle.x, particle.y));
};
};
stageBitmapData.copyPixels(bufferBitmapData, stageRectangle, origin);
bufferBitmapData.applyFilter(bufferBitmapData, stageRectangle, origin, filter);
bufferBitmapData.applyFilter(bufferBitmapData, stageRectangle, origin, blurFilter);
stageBitmapData.paletteMap(stageBitmapData, stageRectangle, origin, fireColors, [], [], []);
}
public function createExplosion(_arg1:Number, _arg2:Number){
x = _arg1;
y = _arg2;
particleExplosion = true;
}
}
}//package preloader
Section 151
//Gradient (preloader.Gradient)
package preloader {
import flash.display.*;
import flash.geom.*;
public class Gradient {
private static const IDENTITY:Matrix = new Matrix();
public static function getArray(_arg1:Array, _arg2:Array, _arg3:Array):Array{
var _local4:Array;
var _local5:Shape;
var _local6:Matrix;
var _local7:BitmapData;
var _local8:Graphics;
var _local9:uint;
var _local10:int;
_local4 = new Array();
_local5 = new Shape();
_local6 = new Matrix();
_local7 = new BitmapData(0x0100, 1, true, 0);
_local8 = _local5.graphics;
_local6.createGradientBox(0x0100, 0x0100, 0, 0, 0);
_local8.clear();
_local8.beginGradientFill("linear", _arg1, _arg2, _arg3, _local6);
_local8.drawRect(0, 0, 0x0100, 0x0100);
_local8.endFill();
_local7.draw(_local5, IDENTITY);
_local10 = 0;
while (_local10 < 0x0100) {
_local9 = _local7.getPixel32(_local10, 0);
_local4.push(_local9);
_local10++;
};
return (_local4);
}
}
}//package preloader
Section 152
//Particle (preloader.Particle)
package preloader {
public class Particle {
public var vx:Number;
public var vy:Number;
public var spin:Number;// = 0
public var step:Number;// = 0
public var spinRate:int;
public var gravity:Number;
public var killMe:Boolean;// = false
public var spinMax:int;// = 360
public var steps:Number;
public var x:Number;
public var y:Number;
public function Particle(_arg1:Number, _arg2:Number){
step = 0;
spin = 0;
spinMax = 360;
killMe = false;
super();
steps = ((Math.random() * 40) + 20);
x = _arg1;
y = _arg2;
spin = int((Math.random() * spinMax));
spinRate = 0;
gravity = (0.45 + (Math.random() * 2));
vx = (Math.random() * 30);
if (Math.random() > 0.5){
vx = (vx * -1);
};
vy = ((Math.random() * -40) + 10);
}
public function render():void{
vy = (vy + gravity);
vx = (vx * 0.98);
x = (x + vx);
y = (y + vy);
spin = (spin + spinRate);
if (spin < 0){
spin = (spin + spinMax);
} else {
if (spin > spinMax){
spin = (spin - spinMax);
};
};
step++;
if (step > steps){
killMe = true;
};
}
}
}//package preloader
Section 153
//FPS (utilities.FPS)
package utilities {
import flash.events.*;
import flash.text.*;
import flash.utils.*;
public class FPS extends TextField {
private var ms:int;
private var fs:int;
public function FPS(_arg1){
var _local2:TextFormat;
super();
_local2 = new TextFormat();
_local2.color = 0xFFFFFF;
_local2.size = 10;
_local2.bold = true;
_local2.font = "Verdana";
textColor = 0xCECECE;
autoSize = "left";
defaultTextFormat = _local2;
ms = getTimer();
fs = 0;
_arg1.addEventListener(Event.ENTER_FRAME, loop);
}
private function loop(_arg1:Event):void{
if ((getTimer() - 1000) > ms){
ms = getTimer();
text = fs.toString();
fs = 0;
} else {
fs++;
};
}
}
}//package utilities
Section 154
//GameOverDisplay (view.GameOverDisplay)
package view {
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.text.*;
import com.markfennell.display.*;
import flash.ui.*;
public class GameOverDisplay extends MovieClip {
public var bonusText:TextField;
public var textGameOver:MovieClip;
public var btnReplay:SimpleButton;
private var core:Core;
public var btnSubmit:SimpleButton;
public var textWellDone:MovieClip;
private var fx:Fx;
public var scoreText:TextField;
public function GameOverDisplay(){
fx = new Fx();
super();
textGameOver.visible = false;
textWellDone.visible = false;
}
function init(_arg1:Boolean, _arg2:int){
if (_arg1){
textWellDone.visible = true;
bonusText.text = "BONUS 20000";
} else {
textGameOver.visible = true;
};
scoreText.text = ("SCORE " + fx.padScore((Core.getInstance().headsUpDisplay.score + _arg2), Constants.SCORE_DISPLAY_LENGTH));
if (Core.getInstance().headsUpDisplay.score == 0){
btnSubmit.visible = false;
};
btnSubmit.addEventListener(MouseEvent.CLICK, submitScore);
btnReplay.addEventListener(MouseEvent.CLICK, playGame);
}
function submitScore(_arg1:MouseEvent){
GameManager.getInstance().setState("Submit");
}
function playGame(_arg1:MouseEvent){
GameManager.getInstance().setState("Credits");
}
}
}//package view
Section 155
//HeadsUpDisplay (view.HeadsUpDisplay)
package view {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import fl.events.*;
import com.markfennell.display.*;
import utilities.*;
import flash.ui.*;
public class HeadsUpDisplay extends Sprite {
private var viewAimZoomMax:Number;
private var offsetY:Number;// = 80
private var scoreLength:int;
private var timeKeeper:TimeKeeper;
private var sliderMaxRange:Number;// = 300
private var gameOverClip:MovieClip;
private var viewAimZoom:Number;
private var toggleFullScreen:MovieClip;
private var s:Slider;
private var dx:Number;
private var dy:Number;
private var sliderMarginLeft:Number;// = 20
public var score:int;
private var container:Sprite;
private var centerDisplay:MovieClip;
private var leftDisplay:MovieClip;
private var sliderTop:MovieClip;
private var marginTop:Number;// = 60
private var fx:Fx;
private var STAGE:Stage;
private var fps:FPS;
private var displayTarget:MovieClip;
private var sliderBounds:MovieClip;
private var hud:MovieClip;
private var viewAimZoomDiff:Number;
private var viewAimZoomMin:Number;
private var power:MovieClip;
private var rightDisplay:MovieClip;
private var marginRight:Number;// = 20
private var sliderValue:Number;// = 0
private var viewAimZMax:Number;
private var viewAimZDiff:Number;
private var aim:MovieClip;
private var viewManager:ViewManager;
private var sliderBase:MovieClip;
private var sliderMarginRight:Number;// = 40
private var glow:GlowFilter;
private var bonusDisplay:MovieClip;
private var logo:MovieClip;
private var viewAimZMin:Number;
private var viewAimZ:Number;
public function HeadsUpDisplay(_arg1:Sprite, _arg2:Stage){
offsetY = 80;
scoreLength = Constants.SCORE_DISPLAY_LENGTH;
sliderMarginRight = 40;
marginRight = 20;
marginTop = 60;
sliderMarginLeft = 20;
sliderMaxRange = 300;
sliderValue = 0;
viewAimZMin = Constants.CAMERA_AIM_HEIGHT;
viewAimZMax = Constants.CAMERA_AIM_MAX_HEIGHT;
viewAimZDiff = (viewAimZMax - viewAimZMin);
viewAimZ = viewAimZMin;
viewAimZoomMin = Constants.CAMERA_AIM_ZOOM_MIN;
viewAimZoomMax = Constants.CAMERA_AIM_ZOOM_MAX;
viewAimZoomDiff = (viewAimZoomMax - viewAimZoomMin);
viewAimZoom = viewAimZoomMin;
fx = new Fx();
super();
STAGE = _arg2;
container = _arg1;
glow = new GlowFilter(0xFFFFFF, 1, 5, 5, 2, 1, false, false);
fps = new FPS(STAGE);
fps.x = (-(STAGE.stageWidth) / 2);
fps.y = (-(STAGE.stageHeight) / 2);
hud = new HeadsUp();
container.addChild(hud);
STAGE.addEventListener(Event.RESIZE, resizeHandler);
score = 0;
s = new Slider();
s.direction = SliderDirection.VERTICAL;
s.liveDragging = true;
s.setSize(0, sliderMaxRange);
s.maximum = sliderMaxRange;
s.minimum = 0;
s.tickInterval = 10;
s.addEventListener(SliderEvent.CHANGE, sliderChange);
container.addChild(s);
rightDisplay = hud.rightDisplay;
centerDisplay = hud.centerDisplay;
leftDisplay = hud.leftDisplay;
displayTarget = leftDisplay.ball;
bonusDisplay = hud.bonusDisplay;
logo = hud.logo;
power = hud.power;
power.visible = false;
aim = hud.aim;
aim.visible = false;
leftDisplay.visible = false;
viewManager = Core.getInstance().viewManager;
sliderBase = hud.sliderBase;
sliderTop = hud.sliderTop;
sliderBounds = hud.sliderBounds;
toggleFullScreen = hud.toggleFullScreen;
resizeHud();
toggleFullScreen.addEventListener(MouseEvent.CLICK, fullScreenToggle);
sliderBase.addEventListener(MouseEvent.CLICK, viewBase);
sliderTop.addEventListener(MouseEvent.CLICK, viewTop);
toggleFullScreen.addEventListener(MouseEvent.ROLL_OVER, buttonRollOver);
toggleFullScreen.addEventListener(MouseEvent.ROLL_OUT, buttonRollOut);
sliderBase.addEventListener(MouseEvent.ROLL_OVER, buttonRollOver);
sliderBase.addEventListener(MouseEvent.ROLL_OUT, buttonRollOut);
sliderTop.addEventListener(MouseEvent.ROLL_OVER, buttonRollOver);
sliderTop.addEventListener(MouseEvent.ROLL_OUT, buttonRollOut);
sliderBounds.addEventListener(MouseEvent.ROLL_OVER, sliderRollOver);
sliderBounds.addEventListener(MouseEvent.ROLL_OUT, sliderRollOut);
sliderSet((((viewAimZoom - viewAimZoomMin) / viewAimZoomDiff) * sliderMaxRange));
timeKeeper = new TimeKeeper(Constants.GAME_TIME);
timeKeeper.start();
displayTargetBall(Core.getInstance().ballManager.ballBonusArray[0].ballNum);
}
public function showPower(){
power.x = (((STAGE.stageWidth / 2) + Core.getInstance().ballManager.ball0.ball.screen.x) + 20);
power.y = ((STAGE.stageHeight / 2) + Core.getInstance().ballManager.ball0.ball.screen.y);
power.visible = true;
}
private function buttonRollOver(_arg1:MouseEvent):void{
_arg1.target.filters = [glow];
}
public function viewTop(_arg1:MouseEvent){
viewAimZoom = viewAimZoomMax;
viewAimZ = viewAimZMax;
viewManager.viewAimZoom = viewAimZoom;
viewManager.viewAimZ = viewAimZ;
sliderSet(sliderMaxRange);
}
public function hideAim(){
aim.visible = false;
}
public function hidePower(){
power.visible = false;
}
public function displayMessage(_arg1:String, _arg2:String, _arg3:Boolean){
if (_arg3){
Core.getInstance().explosionManager.createExplosion2D(0, (-(offsetY) + 30));
};
bonusDisplay.alpha = 0;
bonusDisplay.bonusText.text = _arg1;
bonusDisplay.detailsText.text = _arg2;
dx = (Constants.STAGE_WIDTH / 2);
dy = ((Constants.STAGE_HEIGHT / 2) - offsetY);
fx.zoomIn(bonusDisplay, 0, 0.25, dx, 2000, dx, dy, 20, "easeOut", removeMessage);
bonusDisplay.alpha = 100;
}
private function removeMessage(){
fx.zoomIn(bonusDisplay, 1.5, 0.25, dx, dy, dx, 2000, 20, "easeOut", null);
}
private function sliderRollOver(_arg1:MouseEvent):void{
Core.getInstance().isOverSlider = true;
}
public function showAim(){
aim.x = (STAGE.stageWidth / 2);
aim.y = 80;
aim.visible = true;
aim.alpha = 70;
}
public function addTime(){
timeKeeper.subMili(Constants.BONUS_TIME);
}
private function fullScreenToggle(_arg1:MouseEvent):void{
switch (STAGE.displayState){
case "normal":
STAGE.displayState = "fullScreen";
break;
case "fullScreen":
default:
STAGE.displayState = "normal";
break;
};
}
public function subTime(){
timeKeeper.addMili(Constants.PENALTY_TIME);
}
public function viewBase(_arg1:MouseEvent){
viewAimZoom = viewAimZoomMin;
viewAimZ = viewAimZMin;
viewManager.viewAimZoom = viewAimZoom;
viewManager.viewAimZ = viewAimZ;
sliderSet(0);
}
public function updateScore(_arg1:int){
score = (score + _arg1);
rightDisplay.scoreText.text = fx.padScore(score, scoreLength);
}
public function reset(){
score = 0;
}
private function sliderRollOut(_arg1:MouseEvent):void{
Core.getInstance().isOverSlider = false;
}
public function displayTargetBall(_arg1:int){
leftDisplay.visible = true;
leftDisplay.ball.gotoAndPlay(_arg1);
}
public function render(){
centerDisplay.timeText.text = timeKeeper.displayTime();
if (timeKeeper.getMili() <= 0){
centerDisplay.timeText.text = "0:00:00";
timeKeeper.stop();
Core.getInstance().gameOver(false);
};
}
private function resizeHud(){
hud.x = (-(STAGE.stageWidth) / 2);
hud.y = (-(STAGE.stageHeight) / 2);
s.move(((STAGE.stageWidth / 2) - sliderMarginRight), (100 - (STAGE.stageHeight / 2)));
rightDisplay.x = (STAGE.stageWidth - marginRight);
leftDisplay.x = sliderMarginLeft;
centerDisplay.x = (STAGE.stageWidth / 2);
sliderBase.x = (STAGE.stageWidth - marginRight);
sliderBase.y = ((marginTop + sliderMaxRange) + 70);
sliderTop.x = (STAGE.stageWidth - marginRight);
sliderTop.y = marginTop;
sliderBounds.x = (STAGE.stageWidth - marginRight);
sliderBounds.y = marginTop;
logo.x = 60;
logo.y = (STAGE.stageHeight - 70);
toggleFullScreen.x = (STAGE.stageWidth - marginRight);
toggleFullScreen.y = (STAGE.stageHeight - marginTop);
Constants.STAGE_WIDTH = STAGE.stageWidth;
Constants.STAGE_HEIGHT = STAGE.stageHeight;
Core.getInstance().container.x = (Constants.STAGE_WIDTH / 2);
Core.getInstance().container.y = (Constants.STAGE_HEIGHT / 2);
hud.controls.x = 5;
hud.controls.y = (Constants.STAGE_HEIGHT - 10);
}
public function sliderSet(_arg1:Number){
s.value = _arg1;
}
public function setPower(_arg1:Number){
power.percentage.text = (_arg1 + "%");
}
public function gameOver(_arg1:Boolean, _arg2:Number){
gameOverClip = new src_gameover();
gameOverClip.init(_arg1, _arg2);
gameOverClip.x = 0;
container.addChild(gameOverClip);
fx.zoomIn(gameOverClip, 0, 0.25, gameOverClip.x, 3000, gameOverClip.x, -50, 20, "easeOut", null);
}
private function sliderChange(_arg1:SliderEvent):void{
sliderValue = (_arg1.target.value / sliderMaxRange);
viewAimZoom = (viewAimZoomMin + (sliderValue * viewAimZoomDiff));
viewAimZ = (viewAimZMin + (sliderValue * viewAimZDiff));
viewManager.viewAimZoom = viewAimZoom;
viewManager.viewAimZ = viewAimZ;
}
private function resizeHandler(_arg1:Event):void{
resizeHud();
Constants.STAGE_WIDTH = STAGE.stageWidth;
Constants.STAGE_HEIGHT = STAGE.stageHeight;
}
private function buttonRollOut(_arg1:MouseEvent):void{
_arg1.target.filters = [];
}
}
}//package view
Section 156
//ViewManager (view.ViewManager)
package view {
import flash.display.*;
import flash.events.*;
import balls.*;
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import caurina.transitions.*;
import flash.filters.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.events.*;
import org.papervision3d.scenes.*;
import org.papervision3d.utils.*;
import flash.ui.*;
public class ViewManager extends Sprite {
private var viewAimZoomMin:Number;
private var viewAimZoomDiff:Number;
private var viewAimZMax:Number;
private var viewAimZoomMax:Number;
public var camera:Camera3D;
private var viewAimZDiff:Number;
public var cue:Cue;
private var i:int;// = 0
public var viewAimZoom:Number;
public var line3D:Lines3D;
public var world:DisplayObject3D;
public var ballManager:BallManager;
public var whiteBall:Ball;
public var gameState:String;
private var STAGE:Stage;
public var shotAngle:Number;// = 1.5707963267949
public var viewAimZ:Number;
private var viewAimZMin:Number;
public static var _instance:ViewManager;
public function ViewManager(_arg1:Stage){
shotAngle = (Math.PI / 2);
i = 0;
viewAimZMin = Constants.CAMERA_AIM_HEIGHT;
viewAimZMax = Constants.CAMERA_AIM_MAX_HEIGHT;
viewAimZDiff = (viewAimZMax - viewAimZMin);
viewAimZ = viewAimZMin;
viewAimZoomMin = Constants.CAMERA_AIM_ZOOM_MIN;
viewAimZoomMax = Constants.CAMERA_AIM_ZOOM_MAX;
viewAimZoomDiff = (viewAimZoomMax - viewAimZoomMin);
viewAimZoom = viewAimZoomMin;
super();
_instance = this;
STAGE = _arg1;
world = Core.getInstance().world;
camera = Core.getInstance().camera;
gameState = Core.getInstance().gameState;
whiteBall = Core.getInstance().whiteBall;
cue = Core.getInstance().cue;
}
public function viewAim(){
if (!Core.getInstance().isOverSlider){
shotAngle = (shotAngle + (Core.getInstance().xDel * Constants.TURN_SCALE));
};
if (shotAngle > Constants.PI2){
shotAngle = (shotAngle - Constants.PI2);
};
if (shotAngle < 0){
shotAngle = (shotAngle + Constants.PI2);
};
world.rotationZ = (shotAngle * Constants.RAD_TO_DEG);
world.x = ((-(whiteBall.sx) * Math.cos(shotAngle)) + (whiteBall.sy * Math.sin(shotAngle)));
world.y = ((-(whiteBall.sy) * Math.cos(shotAngle)) - (whiteBall.sx * Math.sin(shotAngle)));
world.y = (world.y - Constants.TABLE_OFFSET);
camera.z = viewAimZ;
camera.zoom = viewAimZoom;
camera.y = Constants.CAMERA_AIM_SETBACK;
}
public function viewTop(){
Tweener.addTween(camera, {zoom:viewAimZoomMax, z:viewAimZMax, time:0.5, transition:"easeInOutSine"});
Tweener.addTween(world, {x:0, y:-(Constants.TABLE_OFFSET), time:0.5, transition:"linear"});
viewAimZ = viewAimZMax;
viewAimZoom = viewAimZoomMax;
Core.getInstance().headsUpDisplay.sliderSet(300);
}
public function viewFree(){
if (!Core.getInstance().isOverSlider){
shotAngle = (shotAngle + (Core.getInstance().xDel * Constants.TURN_SCALE));
};
if (shotAngle > Constants.PI2){
shotAngle = (shotAngle - Constants.PI2);
};
if (shotAngle < 0){
shotAngle = (shotAngle + Constants.PI2);
};
world.rotationZ = (shotAngle * Constants.RAD_TO_DEG);
camera.z = viewAimZ;
camera.zoom = viewAimZoom;
camera.y = Constants.CAMERA_AIM_SETBACK;
}
}
}//package view
Section 157
//bitmapBall0 (bitmapBall0)
package {
import flash.display.*;
public dynamic class bitmapBall0 extends BitmapData {
public function bitmapBall0(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 158
//bitmapBall1 (bitmapBall1)
package {
import flash.display.*;
public dynamic class bitmapBall1 extends BitmapData {
public function bitmapBall1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 159
//bitmapBall10 (bitmapBall10)
package {
import flash.display.*;
public dynamic class bitmapBall10 extends BitmapData {
public function bitmapBall10(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 160
//bitmapBall11 (bitmapBall11)
package {
import flash.display.*;
public dynamic class bitmapBall11 extends BitmapData {
public function bitmapBall11(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 161
//bitmapBall12 (bitmapBall12)
package {
import flash.display.*;
public dynamic class bitmapBall12 extends BitmapData {
public function bitmapBall12(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 162
//bitmapBall13 (bitmapBall13)
package {
import flash.display.*;
public dynamic class bitmapBall13 extends BitmapData {
public function bitmapBall13(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 163
//bitmapBall14 (bitmapBall14)
package {
import flash.display.*;
public dynamic class bitmapBall14 extends BitmapData {
public function bitmapBall14(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 164
//bitmapBall15 (bitmapBall15)
package {
import flash.display.*;
public dynamic class bitmapBall15 extends BitmapData {
public function bitmapBall15(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 165
//bitmapBall2 (bitmapBall2)
package {
import flash.display.*;
public dynamic class bitmapBall2 extends BitmapData {
public function bitmapBall2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 166
//bitmapBall3 (bitmapBall3)
package {
import flash.display.*;
public dynamic class bitmapBall3 extends BitmapData {
public function bitmapBall3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 167
//bitmapBall4 (bitmapBall4)
package {
import flash.display.*;
public dynamic class bitmapBall4 extends BitmapData {
public function bitmapBall4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 168
//bitmapBall5 (bitmapBall5)
package {
import flash.display.*;
public dynamic class bitmapBall5 extends BitmapData {
public function bitmapBall5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 169
//bitmapBall6 (bitmapBall6)
package {
import flash.display.*;
public dynamic class bitmapBall6 extends BitmapData {
public function bitmapBall6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 170
//bitmapBall7 (bitmapBall7)
package {
import flash.display.*;
public dynamic class bitmapBall7 extends BitmapData {
public function bitmapBall7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 171
//bitmapBall8 (bitmapBall8)
package {
import flash.display.*;
public dynamic class bitmapBall8 extends BitmapData {
public function bitmapBall8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 172
//bitmapBall9 (bitmapBall9)
package {
import flash.display.*;
public dynamic class bitmapBall9 extends BitmapData {
public function bitmapBall9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 173
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
}
}//package
Section 174
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
}
}//package
Section 175
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
}
}//package
Section 176
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 177
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 178
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 179
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 180
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
}
}//package
Section 181
//ComboBox_disabledSkin (ComboBox_disabledSkin)
package {
import flash.display.*;
public dynamic class ComboBox_disabledSkin extends MovieClip {
}
}//package
Section 182
//ComboBox_downSkin (ComboBox_downSkin)
package {
import flash.display.*;
public dynamic class ComboBox_downSkin extends MovieClip {
}
}//package
Section 183
//ComboBox_overSkin (ComboBox_overSkin)
package {
import flash.display.*;
public dynamic class ComboBox_overSkin extends MovieClip {
}
}//package
Section 184
//ComboBox_upSkin (ComboBox_upSkin)
package {
import flash.display.*;
public dynamic class ComboBox_upSkin extends MovieClip {
}
}//package
Section 185
//Constants (Constants)
package {
import org.papervision3d.objects.*;
import be.atomik.gamelib.geom.*;
public class Constants {
public static var GAME_TIME:int = 180000;
public static var MUSIC:String = "music.mp3";
public static var TABLE_MARGIN_BOTTOM:Number = (TABLE_HEIGHT - 119);
public static var STAGE_WIDTH:Number = 600;
public static var BONUS_TIME:Number = 30000;
public static var LEVEL_MESSAGE:Array = ["", "", "", ""];
public static var CUE_MAX_POWER:Number = CUE_BREAK_POWER;
public static var TABLE_MARGIN_RIGHT:Number = (TABLE_WIDTH - 126);
public static var TABLE_HEIGHT:Number = 1124;
public static var BONUS_TIME_TEXT:String = "20 secs";
public static var URL_MORE_GAMES = "http://www.blastone.com/games/pool";
public static var SCORE_BALL_DISTANCE:Number = 2;
public static var PARTICLE_NUMBER:Number = 100;
public static var CUE_POWER_SCALE:Number = (3 * ITERATIONS);
public static var CAMERA_FREE_ZOOM:Number = 20;
public static var CUE_AIM_HEIGHT:Number = -150;
public static var DEBUG:Boolean = false;
public static var PARTICLE_MIN_HEIGHT:Number = -3;
public static var ITERATIONS:int = 4;
public static var CUE_NORMAL_POWER:Number = (120 / ITERATIONS);
public static var BALL_GLOW_SIZE:Number = 15;
public static var TABLE_HOLE_POSITIONS:Array = [new Vector(87, 92), new Vector(1924, 92), new Vector(87, 1035), new Vector(1924, 1035), new Vector(1003, 69), new Vector(1003, 1058)];
public static var CAMERA_AIM_MAX_HEIGHT:Number = -4000;
public static var CUE_OFFSET:Number = 50;
public static var CAMERA_FREE_HEIGHT:Number = -10000;
public static var BALL_FRICTION:Number = 0.3;
public static var TABLE_OFFSET:Number = 550;
public static var BALL_GLOW_OFFSET:Number = 0;
public static var IS_VANILLA:Boolean = true;
public static var CUE_SHOT_OFFSET:Number = 60;
public static var MOUSE_ZOOM = 10;
public static var TABLE_BOUNCE:Number = 0.6;
public static var BALL_SHADOW_OFFSET:Number = 10;
public static var BALL_MASS_NUMBERED:Number = 1.56;
public static var BALL_COEFFICIENTRESTITUTION:Number = 0.96;
public static var PI2:Number = 6.28318530717959;
public static var TABLE_MARGIN_TOP:Number = 104;
public static var CAMERA_SHOT_ZOOM:Number = 9;
public static var CUE_AIM_PITCH:Number = -10;
public static var CUE_LINE_LENGTH:Number = 800;
public static var BALL_HEIGHT:Number = -20;
public static var CUE_BREAK_POWER:Number = (120 / ITERATIONS);
public static var TABLE_FRICTION:Number = 0.99;
public static var CAMERA_TOP_ZOOM:Number = 155;
public static var CAMERA_AIM_ZOOM_MIN:Number = 12;
public static var CUE_MIN_POWER:Number = 2;
public static var SENSITIVITY:Number = 100;
public static var URL_SUBMIT_SCORE = "http://www.blastone.com/games/pool/submit.php";
public static var URL_HIGH_SCORE = "http://www.blastone.com/games/pool/showscores.php";
public static var BALL_SHADOW_SIZE:Number = 70;
public static var BALL_MASS_CUE:Number = 1.7;
public static var SCORE_BALL_POCKET:Number = 3000;
public static var SCORE_DISPLAY_LENGTH:int = 8;
public static var CUE_LENGTH:Number = 1350;
public static var CAMERA_AIM_ZOOM_MAX:Number = 13;
public static var CAMERA_TOP_FOCUS:Number = 100;
public static var STAGE_HEIGHT:Number = 600;
public static var DEG_TO_RAD:Number = 0.0174532925199433;
public static var SCORE_SHOT_BONUS2:Number = 500;
public static var RAD_TO_DEG:Number = 57.2957795130823;
public static var MESH_SORT = DisplayObject3D.MESH_SORT_FAR;
public static var SCORE_SHOT_BONUS1:Number = 2000;
public static var CUE_LINE_HEIGHT:Number = -2;
public static var CAMERA_SHOT_SETBACK:Number = -1000;
public static var TABLE_HOLES:int = 6;
public static var CAMERA_TOP_HEIGHT:Number = -53000;
public static var CUE_SHOT_TIME:Number = 0.1;
public static var BALL_RADIUS:Number = 28.57;
public static var CUE_HEIGHT:Number = -150;
public static var TABLE_WIDTH:Number = 2015;
public static var BALL_GLOW_HEIGHT:Number = -47;
public static var SCORE_BALL_NORMAL:Number = 500;
public static var CAMERA_AIM_HEIGHT:Number = -600;
public static var QUALITY:String = "MEDIUM";
public static var TABLE_CUSHION_VECTORS:Array = [];
public static var URL_GAME = "http://www.blastone.com/games/pool/";
public static var PENALTY_TIME:Number = 5000;
public static var BALL_SHADOW_HEIGHT:Number = 5;
public static var BALL_SEGMENTS:Number = 9;
public static var TURN_SCALE:Number = 2;
public static var TABLE_RACKANGLE:Number = 1.0471975511966;
public static var IS_FULLSCREEN:Boolean = false;
public static var CAMERA_SHOT_HEIGHT:Number = -300;
public static var CAMERA_AIM_SETBACK:Number = -1500;
public static var TABLE_MARGIN_LEFT:Number = 123;
public static var TABLE_HOLE_RADIUS:Number = 65;
public static var SCORE_TIME_BONUS:Number = 2000;
}
}//package
Section 186
//Controls (Controls)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public class Controls extends MovieClip {
public var btnPause:SimpleButton;
public var btnSound:SimpleButton;
public var btnMusic:SimpleButton;
private var soundToggle:Boolean;
public var textPause:TextField;
private var musicToggle:Boolean;
public var textSound:TextField;
public var btnBlastone:SimpleButton;
private var pauseToggle:Boolean;// = false
public var textMusic:TextField;
public function Controls(){
var myThis:*;
var url:Function;
var soundDisplay:Function;
var musicDisplay:Function;
var toggleSound:Function;
var toggleMusic:Function;
var togglePause:Function;
pauseToggle = false;
super();
url = function (){
var _local1:URLRequest;
_local1 = new URLRequest("http://www.blastone.com");
navigateToURL(_local1, "_blank");
};
soundDisplay = function (){
if (!soundToggle){
textSound.text = "SOUND OFF";
} else {
textSound.text = "SOUND ON";
};
};
musicDisplay = function (){
if (!musicToggle){
textMusic.text = "MUSIC OFF";
} else {
textMusic.text = "MUSIC ON";
};
};
toggleSound = function (){
soundToggle = !(soundToggle);
if (!soundToggle){
SoundManager.getInstance().soundsEnabled = false;
} else {
SoundManager.getInstance().soundsEnabled = true;
};
soundDisplay();
};
toggleMusic = function (){
musicToggle = !(musicToggle);
if (!musicToggle){
SoundManager.getInstance().stopMusic();
} else {
SoundManager.getInstance().startMusic();
};
musicDisplay();
};
togglePause = function (){
if (!pauseToggle){
pauseToggle = true;
textPause.text = "RESUME";
Core.getInstance().pause = true;
} else {
pauseToggle = false;
textPause.text = "PAUSE";
Core.getInstance().pause = false;
};
};
myThis = this;
musicToggle = SoundManager.getInstance().musicEnabled;
soundToggle = SoundManager.getInstance().soundsEnabled;
soundDisplay();
musicDisplay();
myThis.btnMusic.addEventListener(MouseEvent.CLICK, toggleMusic);
myThis.btnSound.addEventListener(MouseEvent.CLICK, toggleSound);
myThis.btnPause.addEventListener(MouseEvent.CLICK, togglePause);
myThis.btnBlastone.addEventListener(MouseEvent.CLICK, url);
}
}
}//package
Section 187
//Core (Core)
package {
import flash.display.*;
import flash.events.*;
import balls.*;
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import view.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import flash.filters.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.events.*;
import org.papervision3d.scenes.*;
import effects.*;
import org.papervision3d.utils.*;
import flash.ui.*;
public class Core extends Sprite {
private var isBreak:Boolean;// = true
public var camera:Camera3D;
public var bonus:Plane;
public var cue:Cue;
public var viewManager:ViewManager;
public var headsUpDisplay:HeadsUpDisplay;
private var i:int;// = 0
private var mouseOldx:Number;
private var mouseOldy:Number;
public var bonusHole:int;
public var xDel:Number;// = 0
private var mouseIsPressed:Boolean;
public var levelManager:LevelManager;
public var container:Sprite;
public var isOverSlider:Boolean;// = false
public var world:DisplayObject3D;
public var scene:Scene3D;
public var soundManager:SoundManager;
public var ballManager:BallManager;
public var whiteBall:Ball;
public var gameState:String;// = "aim"
public var table:Plane;
private var STAGE:Stage;
private var stateManager:StateManager;
public var shotAngle:Number;// = 0
public var explosionManager:ExplosionManager;
public var pause:Boolean;// = false
public static var _instance:Core;
public function Core(){
gameState = "aim";
shotAngle = 0;
pause = false;
xDel = 0;
isOverSlider = false;
i = 0;
isBreak = true;
super();
_instance = this;
}
public function gameOver(_arg1:Boolean){
var _local2:int;
STAGE.removeEventListener(Event.ENTER_FRAME, render);
_local2 = 0;
if (_arg1){
_local2 = 20000;
};
GameManager.getInstance().gameScore = (Core.getInstance().headsUpDisplay.score + _local2);
headsUpDisplay.gameOver(_arg1, _local2);
}
public function init(_arg1:Stage){
STAGE = _arg1;
STAGE.quality = Constants.QUALITY;
STAGE.scaleMode = "noScale";
STAGE.align = "TL";
cleanup();
init3D();
levelManager = new LevelManager();
viewManager = new ViewManager(STAGE);
headsUpDisplay = new HeadsUpDisplay(container, STAGE);
stateManager = new StateManager(headsUpDisplay);
soundManager = SoundManager.getInstance();
SoundManager.getInstance().reset();
STAGE.addEventListener(Event.ENTER_FRAME, render);
headsUpDisplay.showAim();
}
public function handleMouseUp(_arg1:MouseEvent):void{
mouseIsPressed = false;
if (gameState == "power"){
gameState = "cue";
};
}
public function getScore(){
return (1000);
}
public function setBonusHole(){
bonusHole = ((Math.random() * Constants.TABLE_HOLES) >> 0);
bonus.x = (Constants.TABLE_HOLE_POSITIONS[bonusHole].x - (Constants.TABLE_WIDTH / 2));
bonus.y = (Constants.TABLE_HOLE_POSITIONS[bonusHole].y - (Constants.TABLE_HEIGHT / 2));
}
public function handleWhiteBallMouseDown():void{
if (gameState == "aim"){
headsUpDisplay.showPower();
gameState = "power";
};
}
public function render(_arg1:Event):void{
if (!pause){
switch (gameState){
case "aim":
cue.show();
viewManager.viewAim();
cue.viewAim(viewManager.shotAngle);
break;
case "power":
cue.viewPower(viewManager.shotAngle);
break;
case "cue":
cue.shoot();
soundManager.cueShot(1);
ballManager.shots++;
gameState = "waiting";
Constants.CUE_MAX_POWER = Constants.CUE_NORMAL_POWER;
break;
case "shot":
headsUpDisplay.hidePower();
stateManager.motionStarted();
gameState = "moving";
break;
case "moving":
viewManager.viewFree();
cue.hide();
if (!ballManager.ballsMoving){
checkMisses();
stateManager.motionFinished();
ballManager.resetBalls();
gameState = "aim";
headsUpDisplay.showAim();
if (isBreak){
isBreak = false;
soundManager.breakShot = false;
};
};
break;
};
ballManager.render();
explosionManager.render();
scene.renderCamera(camera);
headsUpDisplay.render();
xDel = 0;
bonus.rotationZ = (bonus.rotationZ + 10);
};
}
public function handleMouseDown(_arg1:MouseEvent):void{
mouseOldx = _arg1.stageX;
mouseOldy = _arg1.stageY;
mouseIsPressed = true;
headsUpDisplay.hideAim();
}
public function cleanup(){
STAGE.removeEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
STAGE.removeEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
STAGE.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
if (container != null){
removeChild(container);
};
}
public function init3D():void{
var _local1:MovieMaterial;
var _local2:MovieMaterial;
container = new Sprite();
addChild(container);
container.name = "mainCont";
container.x = (Constants.STAGE_WIDTH / 2);
container.y = (Constants.STAGE_HEIGHT / 2);
scene = new Scene3D(container, true);
world = new DisplayObject3D();
scene.addChild(world);
camera = new Camera3D();
_local1 = new MovieMaterial(new felt(), false);
_local1.interactive = false;
_local1.doubleSided = false;
table = new Plane(_local1, Constants.TABLE_WIDTH, Constants.TABLE_HEIGHT, 7, 10);
table.meshSort = Constants.MESH_SORT;
table.z = 20;
world.addChild(table);
_local2 = new MovieMaterial(new holeBonus(), true);
_local2.interactive = false;
_local2.doubleSided = false;
bonus = new Plane(_local2, 110, 110, 5, 5);
bonus.meshSort = Constants.MESH_SORT;
bonus.z = -40;
setBonusHole();
world.addChild(bonus);
STAGE.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
STAGE.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
STAGE.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
ballManager = new BallManager(world, camera);
whiteBall = ballManager.ball0;
if (Constants.DEBUG){
ballManager.ball0.drawLines();
};
cue = new Cue(world, STAGE, camera);
explosionManager = new ExplosionManager(world, container);
}
public function handleMouseDoubleUp(_arg1:MouseEvent){
if (gameState == "aim"){
gameState = "power";
};
}
public function checkMisses(){
if (ballManager.ball0.hits == 0){
headsUpDisplay.displayMessage("Missed", "", false);
headsUpDisplay.subTime();
};
}
public function handleMouseMove(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (mouseIsPressed){
_local2 = mouseOldx;
_local3 = mouseOldy;
_local4 = _arg1.stageX;
_local5 = _arg1.stageY;
_local6 = Math.atan2(((Constants.STAGE_HEIGHT / 2) - _local3), ((Constants.STAGE_WIDTH / 2) - _local2));
_local7 = Math.atan2(((Constants.STAGE_HEIGHT / 2) - _local5), ((Constants.STAGE_WIDTH / 2) - _local4));
xDel = (-((_local4 - _local2)) / Constants.SENSITIVITY);
mouseOldx = _local4;
mouseOldy = _local5;
};
}
public static function getInstance(){
return (_instance);
}
}
}//package
Section 188
//Credits (Credits)
package {
import flash.display.*;
import flash.events.*;
import balls.*;
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import view.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.*;
import flash.geom.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.events.*;
import org.papervision3d.scenes.*;
import flash.text.*;
import flash.utils.*;
import com.markfennell.display.*;
import org.papervision3d.utils.*;
import flash.net.*;
public class Credits extends MovieClip {
public var camera:Camera3D;
public var viewManager:ViewManager;
private var gameManager:GameManager;
public var container:Sprite;
public var world:DisplayObject3D;
public var soundManager:SoundManager;
public var ballManager:BallManager;
public var scene:Scene3D;
public var table:Plane;
private var fx;
private var STAGE:Stage;
public function Credits(){
fx = new Fx();
super();
soundManager = SoundManager.getInstance();
}
public function init(_arg1){
var titleClip:*;
var helpClip:*;
var btnPlay:*;
var btnScores:*;
var playGame:Function;
var hiscores:Function;
var miniGo:Function;
var moregames:Function;
var _stage = _arg1;
playGame = function (_arg1:MouseEvent){
cleanup();
GameManager.getInstance().setState("Game");
};
hiscores = function (){
var _local1:URLRequest;
_local1 = new URLRequest(Constants.URL_HIGH_SCORE);
navigateToURL(_local1, "_blank");
};
miniGo = function (){
var _local1:URLRequest;
_local1 = new URLRequest("http://www.minijuegos.com");
navigateToURL(_local1, "_blank");
};
moregames = function (){
var _local1:URLRequest;
_local1 = new URLRequest(Constants.URL_MORE_GAMES);
navigateToURL(_local1, "_blank");
};
STAGE = _stage;
STAGE.quality = Constants.QUALITY;
STAGE.scaleMode = "noScale";
STAGE.align = "TL";
init3D();
titleClip = new credits_title();
addChild(titleClip);
fx.zoomIn(titleClip, 0.2, 0.25, (STAGE.stageWidth / 2), 2000, (STAGE.stageWidth / 2), 50, 20, "easeOut", null);
helpClip = new credits_help();
addChild(helpClip);
fx.zoomIn(helpClip, 0.4, 0.25, Math.floor((STAGE.stageWidth / 2)), 2000, Math.floor((STAGE.stageWidth / 2)), 180, 20, "easeOut", null);
btnPlay = new playBtn();
addChild(btnPlay);
fx.zoomIn(btnPlay, 0.6, 0.25, ((STAGE.stageWidth / 2) + 200), 1000, ((STAGE.stageWidth / 2) + 200), 550, 20, "easeOut", null);
btnPlay.addEventListener(MouseEvent.CLICK, playGame);
btnScores = new scoresBtn();
addChild(btnScores);
fx.zoomIn(btnScores, 0.8, 0.25, ((STAGE.stageWidth / 2) - 210), 1000, ((STAGE.stageWidth / 2) - 210), 560, 20, "easeOut", null);
btnScores.addEventListener(MouseEvent.CLICK, hiscores);
if (!Constants.IS_VANILLA){
};
addEventListener(Event.ENTER_FRAME, render);
}
private function render(_arg1:Event){
world.rotationZ = (world.rotationZ + 3);
ballManager.render();
scene.renderCamera(camera);
}
public function init3D():void{
var _local1:MovieMaterial;
container = new Sprite();
addChild(container);
container.name = "mainCont";
container.x = (STAGE.stageWidth / 2);
container.y = (Constants.STAGE_HEIGHT / 2);
scene = new Scene3D(container, true);
world = new DisplayObject3D();
scene.addChild(world);
camera = new Camera3D();
camera.z = -2000;
camera.zoom = 14;
camera.y = Constants.CAMERA_AIM_SETBACK;
_local1 = new MovieMaterial(new felt(), false);
_local1.interactive = false;
_local1.doubleSided = false;
table = new Plane(_local1, Constants.TABLE_WIDTH, Constants.TABLE_HEIGHT, 10, 15);
table.meshSort = Constants.MESH_SORT;
table.z = 20;
world.addChild(table);
ballManager = new BallManager(world, camera);
}
public function cleanup(){
removeEventListener(Event.ENTER_FRAME, render);
if (container != null){
removeChild(container);
};
}
}
}//package
Section 189
//credits_help (credits_help)
package {
import flash.display.*;
public dynamic class credits_help extends MovieClip {
public var sliderBase:MovieClip;
public var toggleFullScreen:MovieClip;
public var sliderTop:MovieClip;
public var ball:MovieClip;
}
}//package
Section 190
//credits_musicControls (credits_musicControls)
package {
import controls.*;
public dynamic class credits_musicControls extends MusicControls {
}
}//package
Section 191
//credits_soundControls (credits_soundControls)
package {
import controls.*;
public dynamic class credits_soundControls extends SoundControls {
}
}//package
Section 192
//credits_title (credits_title)
package {
import flash.display.*;
public dynamic class credits_title extends MovieClip {
}
}//package
Section 193
//cueTexture (cueTexture)
package {
import flash.display.*;
public dynamic class cueTexture extends MovieClip {
public var movie:MovieClip;
}
}//package
Section 194
//felt (felt)
package {
import flash.display.*;
public dynamic class felt extends MovieClip {
}
}//package
Section 195
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 196
//GameManager (GameManager)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import com.markfennell.display.*;
public class GameManager extends Sprite {
public var stageWidth:Number;
private var currentClass;
public var state:String;// = "Credits"
public var stageHeight:Number;
public var gameScore:int;
private var fx;
public var STAGE:Stage;
public static var _instance:GameManager = null;
public function GameManager(_arg1){
state = "Credits";
currentClass = undefined;
fx = new Fx();
super();
_instance = this;
STAGE = _arg1;
setState(state);
}
public function setState(_arg1){
switch (_arg1){
case "Credits":
if (currentClass != undefined){
currentClass.cleanup();
removeChild(currentClass);
};
currentClass = new Credits();
currentClass.init(STAGE);
addChild(currentClass);
break;
case "Game":
gameScore = 0;
if (currentClass != undefined){
removeChild(currentClass);
};
currentClass = new Core();
currentClass.init(STAGE);
addChild(currentClass);
break;
case "Help":
if (currentClass != undefined){
removeChild(currentClass);
};
currentClass = new Help();
currentClass.init(STAGE);
addChild(currentClass);
break;
case "GameOver":
if (currentClass != null){
removeChild(currentClass);
currentClass = null;
};
currentClass = new GameOver();
currentClass.init(STAGE);
addChild(currentClass);
break;
case "Submit":
if (currentClass != undefined){
removeChild(currentClass);
};
Root.submit();
break;
};
}
public static function getInstance(){
return (_instance);
}
}
}//package
Section 197
//GameOver (GameOver)
package {
import flash.display.*;
import com.markfennell.display.*;
public class GameOver extends Sprite {
private var gameManager:GameManager;
private var i:int;// = 0
private var fx;
public function GameOver(){
fx = new Fx();
i = 0;
super();
}
public function init(_arg1){
}
}
}//package
Section 198
//glow (glow)
package {
import flash.display.*;
public dynamic class glow extends MovieClip {
}
}//package
Section 199
//HeadsUp (HeadsUp)
package {
import flash.display.*;
public dynamic class HeadsUp extends MovieClip {
public var power:MovieClip;
public var rightDisplay:MovieClip;
public var aim:MovieClip;
public var sliderBase:MovieClip;
public var toggleFullScreen:MovieClip;
public var logo:MovieClip;
public var leftDisplay:MovieClip;
public var controls:Controls;
public var sliderTop:MovieClip;
public var centerDisplay:MovieClip;
public var bonusDisplay:MovieClip;
public var sliderBounds:MovieClip;
}
}//package
Section 200
//Help (Help)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import com.markfennell.display.*;
public class Help extends Sprite {
private var gameBitmapData:BitmapData;
private var stageRectangle:Rectangle;
private var gameManager:GameManager;
private var gameBitmap:Bitmap;
private var fx;
public function Help(){
fx = new Fx();
super();
}
public function init(_arg1){
}
private function render(_arg1:Event){
}
}
}//package
Section 201
//holeBonus (holeBonus)
package {
import flash.display.*;
public dynamic class holeBonus extends MovieClip {
}
}//package
Section 202
//inputField (inputField)
package {
import flash.display.*;
import flash.text.*;
public dynamic class inputField extends MovieClip {
public var hover:MovieClip;
public var textInput:TextField;
}
}//package
Section 203
//LevelManager (LevelManager)
package {
import flash.display.*;
public class LevelManager extends Sprite {
private var level0;
private var levelArray:Array;
private var levelTimer:int;// = 0
private var i:int;// = 0
public var levelCurrent:int;// = 0
private var levelArrayLength:int;
private var levelSpawnArrayLength:int;
public static var _instance:LevelManager;
public function LevelManager(){
levelCurrent = 0;
levelTimer = 0;
level0 = [["bonus", 50]];
levelArray = [level0];
levelArrayLength = levelArray.length;
i = 0;
super();
_instance = this;
levelSpawnArrayLength = levelArray[levelCurrent].length;
}
public function spawn(_arg1){
switch (_arg1){
};
}
public function nextLevel(){
levelTimer = 0;
levelCurrent++;
levelSpawnArrayLength = levelArray[levelCurrent].length;
}
public function render(){
levelTimer++;
i = 0;
while (i < levelSpawnArrayLength) {
if (levelTimer == levelArray[levelCurrent][i][1]){
spawn(levelArray[levelCurrent][i][0]);
};
i++;
};
}
public static function getInstance(){
return (_instance);
}
}
}//package
Section 204
//List_skin (List_skin)
package {
import flash.display.*;
public dynamic class List_skin extends MovieClip {
}
}//package
Section 205
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.1");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
_arg1.removeChild(_arg1._mochiad);
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
mc.removeEventListener(Event.ENTER_FRAME, f);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 206
//musicTrack (musicTrack)
package {
import flash.media.*;
public dynamic class musicTrack extends Sound {
}
}//package
Section 207
//particleSprite (particleSprite)
package {
import flash.display.*;
public dynamic class particleSprite extends MovieClip {
}
}//package
Section 208
//particleSprite2D (particleSprite2D)
package {
import flash.display.*;
public dynamic class particleSprite2D extends MovieClip {
}
}//package
Section 209
//playBtn (playBtn)
package {
import flash.display.*;
public dynamic class playBtn extends SimpleButton {
}
}//package
Section 210
//RadioButton_disabledIcon (RadioButton_disabledIcon)
package {
import flash.display.*;
public dynamic class RadioButton_disabledIcon extends MovieClip {
}
}//package
Section 211
//RadioButton_downIcon (RadioButton_downIcon)
package {
import flash.display.*;
public dynamic class RadioButton_downIcon extends MovieClip {
}
}//package
Section 212
//RadioButton_overIcon (RadioButton_overIcon)
package {
import flash.display.*;
public dynamic class RadioButton_overIcon extends MovieClip {
}
}//package
Section 213
//RadioButton_selectedDisabledIcon (RadioButton_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedDisabledIcon extends MovieClip {
}
}//package
Section 214
//RadioButton_selectedDownIcon (RadioButton_selectedDownIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedDownIcon extends MovieClip {
}
}//package
Section 215
//RadioButton_selectedOverIcon (RadioButton_selectedOverIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedOverIcon extends MovieClip {
}
}//package
Section 216
//RadioButton_selectedUpIcon (RadioButton_selectedUpIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedUpIcon extends MovieClip {
}
}//package
Section 217
//RadioButton_upIcon (RadioButton_upIcon)
package {
import flash.display.*;
public dynamic class RadioButton_upIcon extends MovieClip {
}
}//package
Section 218
//Root (Root)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
public class Root extends MovieClip {
public var btnBad:SimpleButton;
public var background:MovieClip;
private var ltl:int;
private var percent:int;
public var btn:SimpleButton;
public var preloader:MovieClip;
public var VALID_URL:Array;
private var lb:int;
private var maskWidth:Number;
public var detailsText:TextField;
public var scoreboard:MovieClip;
public var GAME_TITLE:String;// = "SPEEDPOOL"
public var game;
public static var _root:MovieClip;
public function Root(){
var myContextMenu:ContextMenu;
var item:ContextMenuItem;
var isValid:*;
var url:*;
var i:*;
var onRootLoaderProgress:Function;
var onRootLoaderComplete:Function;
var advert:*;
VALID_URL = ["http://www.blastone.com", "http://blastone.com", "http://127.0.0.1", "addictinggames", "http://markfennell.com"];
GAME_TITLE = "SPEEDPOOL";
super();
addFrameScript(0, frame1, 7, frame8, 14, frame15, 21, frame22, 29, frame30, 36, frame37);
_root = this;
myContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
item = new ContextMenuItem("A Blastone.com game");
myContextMenu.customItems.push(item);
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, this.menuItemSelectHandler);
this.contextMenu = myContextMenu;
isValid = false;
url = _root.loaderInfo.url;
i = 0;
while (i < VALID_URL.length) {
if (url.indexOf(VALID_URL[i]) != -1){
isValid = true;
break;
};
i = (i + 1);
};
if (isValid){
onRootLoaderProgress = function (_arg1:ProgressEvent):void{
lb = _arg1.bytesLoaded;
ltl = _arg1.bytesTotal;
percent = ((lb / ltl) * 100);
_root.preloader.percentage.text = (String(percent) + "%");
_root.preloader.preloaderBar.bar.width = ((maskWidth * lb) / ltl);
};
onRootLoaderComplete = function (_arg1:Event):void{
_root.preloader.percentage.text = "100%";
_root.preloader.preloaderBar.bar.width = maskWidth;
if (percent >= 100){
intro();
};
};
_root.preloader.game.title.text = GAME_TITLE;
maskWidth = _root.preloader.preloaderBar.bar.width;
_root.preloader.preloaderBar.bar.width = 0;
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onRootLoaderProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onRootLoaderComplete);
} else {
_root.preloader.visible = false;
advert = new MovieClip();
_root.addChild(advert);
stop();
MochiAd.showPreGameAd({clip:advert, id:"a3e25437fe2de6ad", res:"600x600", background:0, color:0xFFC400, outline:0, no_bg:true, ad_finished:intro});
};
}
function frame15(){
btn.addEventListener(MouseEvent.CLICK, moregames);
stop();
}
function frame22(){
game = new GameManager(stage);
addChild(game);
stop();
}
public function playGame(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest(Constants.URL_MORE_GAMES);
navigateToURL(_local2, "_blank");
}
function frame1(){
stop();
}
function frame30(){
btnBad.addEventListener(MouseEvent.CLICK, playGame);
stop();
}
function frame37(){
scoreboard.x = (stage.stageWidth / 2);
scoreboard.y = (stage.stageHeight / 2);
scoreboard.scores.setScore(GameManager.getInstance().gameScore);
stop();
}
function frame8(){
stop();
gotoAndPlay("intro");
}
public function moregames(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest(Constants.URL_MORE_GAMES);
navigateToURL(_local2, "_blank");
}
private function menuItemSelectHandler(_arg1:ContextMenuEvent):void{
var url:String;
var request:URLRequest;
var event = _arg1;
url = "http://www.blastone.com";
request = new URLRequest(url);
try {
navigateToURL(request);
} catch(e:Error) {
};
}
public static function submit(){
_root.gotoAndPlay("submit");
}
public static function credits(){
_root.gotoAndPlay("game");
}
public static function intro(){
_root.gotoAndPlay("intro");
}
public static function restart(){
_root.gotoAndPlay("game");
}
}
}//package
Section 219
//scoreboard (scoreboard)
package {
import fl.controls.*;
import fl.data.*;
public dynamic class scoreboard extends Scoreboard {
public var j1;
public var collObj1:DataProvider;
public var collProp1:Object;
public var __id3_:ComboBox;
public var itemObj1:SimpleCollectionItem;
public var collProps1:Array;
public var i1:int;
public function scoreboard(){
__setProp___id3__score_1();
}
function __setProp___id3__score_1(){
try {
__id3_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
collObj1 = new DataProvider();
collProps1 = [];
i1 = 0;
while (i1 < collProps1.length) {
itemObj1 = new SimpleCollectionItem();
collProp1 = collProps1[i1];
for (j1 in collProp1) {
itemObj1[j1] = collProp1[j1];
};
collObj1.addItem(itemObj1);
i1++;
};
__id3_.dataProvider = collObj1;
__id3_.editable = false;
__id3_.enabled = true;
__id3_.prompt = "";
__id3_.restrict = "";
__id3_.rowCount = 5;
__id3_.visible = true;
try {
__id3_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 220
//Scoreboard (Scoreboard)
package {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.text.*;
import com.meychi.ascrypt3.*;
import com.markfennell.display.*;
import flash.net.*;
public class Scoreboard extends MovieClip {
private var inputEmail:MovieClip;
private var inputCountries:ComboBox;
private var offsetX:Number;// = 10
private var spacer:Number;// = 30
private var offsetY:Number;// = -40
private var loader:URLLoader;
private var KEY:String;// = "bLaStONe"
public var btnBack:SimpleButton;
private var countryArray;
private var inputName:MovieClip;
private var inputSubmit:MovieClip;
private var score;
private var textOptional:String;// = "(Optional)"
private var glow:GlowFilter;
private var centerY:Number;
private var centerX:Number;
public var preloaderBar:MovieClip;
private var fx:Fx;
private var score2:String;// = "null"
public var scoreText:TextField;
private var PADDING:int;// = 7
public function Scoreboard(){
var _local1:TextFormat;
var _local2:*;
PADDING = 7;
KEY = "bLaStONe";
offsetX = 10;
offsetY = -40;
centerX = (stage.stageWidth / 2);
centerY = (stage.stageHeight / 2);
spacer = 30;
textOptional = "(Optional)";
glow = new GlowFilter(0xFF0000, 6, 6, 2);
score2 = "null";
fx = new Fx();
countryArray = [[null, "Select Your Country"], ["AF", "Afghanistan"], ["AL", "Albania"], ["DZ", "Algeria"], ["AS", "American Samoa"], ["AG", "Antigua Barbuda"], ["AR", "Argentina"], ["AU", "Australia"], ["AT", "Austria"], ["AZ", "Azerbaijan"], ["BH", "Bahrain"], ["BD", "Bangladesh"], ["BB", "Barbados"], ["BY", "Belarus"], ["BE", "Belgium"], ["BZ", "Belize"], ["BJ", "Benin"], ["BM", "Bermuda"], ["BT", "Bhutan"], ["BO", "Bolivia"], ["BA", "Bosnia Herzegovina"], ["BW", "Botswana"], ["BR", "Brazil"], ["BN", "Brunei"], ["BG", "Bulgaria"], ["BF", "Burkina Faso"], ["BI", "Burundi"], ["KH", "Cambodia"], ["CM", "Cameroon"], ["CA", "Canada"], ["CV", "Cape Verde"], ["KY", "Cayman Islands"], ["CF", "Cent African Rep"], ["TD", "Chad"], ["JI", "Channel Islands"], ["CL", "Chile"], ["CN", "China"], ["CO", "Columbia"], ["KM", "Comoros"], ["CG", "Congo"], ["CK", "Cook Islands"], ["CR", "Costa Rica"], ["HR", "Croatia"], ["CU", "Cuba"], ["CY", "Cyprus"], ["CZ", "Czech Republic"], ["DK", "Denmark"], ["DM", "Dominica"], ["DO", "Dominican Republic"], ["TL", "East Timor"], ["EC", "Ecuador"], ["EG", "Egypt"], ["SV", "El Salvador"], ["GQ", "Equatorial Guinea"], ["ER", "Eritrea"], ["EE", "Estonia"], ["ET", "Ethiopia"], ["FJ", "Fiji"], ["FI", "Finland"], ["FR", "France"], ["GF", "French Guiana"], ["PF", "French Polynesia"], ["GM", "Gambia"], ["GE", "Georgia"], ["DE", "Germany"], ["GH", "Ghana"], ["GI", "Gibraltar"], ["GR", "Greece"], ["GL", "Greenland"], ["GD", "Grenada"], ["GP", "Guadeloupe"], ["GU", "Guam"], ["GT", "Guatemala"], ["GW", "Guinea Bissau"], ["GY", "Guyana"], ["HT", "Haiti"], ["HW", "Hawaii"], ["HN", "Honduras"], ["HK", "Hong Kong"], ["HU", "Hungary"], ["IS", "Iceland"], ["IN", "India"], ["ID", "Indonesia"], ["IR", "Iran"], ["IQ", "Iraq"], ["IE", "Ireland"], ["IM", "Isle of Man"], ["IL", "Israel"], ["IT", "Italy"], ["CI", "Ivory Coast"], ["JM", "Jamaica"], ["JP", "Japan"], ["JO", "Jordan"], ["KZ", "Kazakhstan"], ["KE", "Kenya"], ["KS", "Korea South"], ["KW", "Kuwait"], ["KG", "Kyrgyzstan"], ["LA", "Laos"], ["LV", "Latvia"], ["LB", "Lebanon"], ["LS", "Lesotho"], ["LR", "Liberia"], ["LY", "Libya"], ["LI", "Liechtenstein"], ["LT", "Lithuania"], ["LU", "Luxembourg"], ["MO", "Macau"], ["MK", "Macedonia"], ["MG", "Madagascar"], ["MW", "Malawi"], ["MY", "Malaysia"], ["MV", "Maldives"], ["ML", "Mali"], ["MT", "Malta"], ["MQ", "Martinique"], ["MU", "Mauritius"], ["YT", "Mayotte"], ["MX", "Mexico"], ["MD", "Moldova"], ["MC", "Monaco"], ["MN", "Mongolia"], ["MS", "Montserrat"], ["MA", "Morocco"], ["MZ", "Mozambique"], ["MM", "Myanmar"], ["NA", "Namibia"], ["NR", "Nauru"], ["NP", "Nepal"], ["NL", "Netherlands"], ["NC", "New Caledonia"], ["NZ", "New Zealand"], ["NI", "Nicaragua"], ["NE", "Niger"], ["NG", "Nigeria"], ["NO", "Norway"], ["OM", "Oman"], ["PK", "Pakistan"], ["PA", "Panama"], ["PG", "Papua New Guinea"], ["PY", "Paraguay"], ["PE", "Peru"], ["PH", "Philippines"], ["PN", "Pitcairn Island"], ["PL", "Poland"], ["PT", "Portugal"], ["PR", "Puerto Rico"], ["QA", "Qatar"], ["RE", "Reunion"], ["RO", "Romania"], ["RU", "Russia"], ["RW", "Rwanda"], ["SM", "San Marino"], ["ST", "Sao Tome Principe"], ["SA", "Saudi Arabia"], ["SN", "Senegal"], ["CS", "Serbia Montenegro"], ["SL", "Sierra Leone"], ["SG", "Singapore"], ["SK", "Slovakia"], ["SI", "Slovenia"], ["SB", "Solomon Islands"], ["SO", "Somalia"], ["ZA", "South Africa"], ["ES", "Spain"], ["LK", "Sri Lanka"], ["SH", "St Helena"], ["KN", "St Kitts-Nevis"], ["LC", "St Lucia"], ["MB", "St Maarten"], ["PM", "St Pierre Miquelon"], ["VC", "St Vincent Grenadines"], ["SD", "Sudan"], ["SR", "Suriname"], ["SZ", "Swaziland"], ["SE", "Sweden"], ["CH", "Switzerland"], ["SY", "Syria"], ["TA", "Tahiti"], ["TW", "Taiwan"], ["TJ", "Tajikistan"], ["TZ", "Tanzania"], ["TH", "Thailand"], ["TG", "Togo"], ["TT", "Trinidad Tobago"], ["TN", "Tunisia"], ["TR", "Turkey"], ["TM", "Turkmenistan"], ["UA", "Ukraine"], ["AE", "UAE"], ["GB", "United Kingdom"], ["US", "USA"], ["UY", "Uruguay"], ["UZ", "Uzbekistan"], ["VU", "Vanuatu"], ["VE", "Venezuela"], ["VN", "Vietnam"], ["VI", "Virgin Islands"], ["EH", "Western Sahara"], ["ZM", "Zambia"], ["ZW", "Zimbabwe"]];
super();
this.y = 1000;
fx.zoomIn(this, 0.5, 0.25, this.x, this.y, this.x, 0, 10, "linear", null);
inputName = new inputField();
inputName.x = offsetX;
inputName.y = offsetY;
setInput(inputName);
inputEmail = new inputField();
inputEmail.x = offsetX;
inputEmail.y = (offsetY + spacer);
inputEmail.textInput.text = textOptional;
setInput(inputEmail);
inputCountries = new ComboBox();
inputCountries.setSize(160, 22);
inputCountries.setStyle("color", 0xFF0000);
_local1 = new TextFormat();
_local1.size = 11;
_local1.color = 0xDDDDDD;
inputCountries.textField.setStyle("textFormat", _local1);
inputCountries.dropdown.setRendererStyle("textFormat", _local1);
_local2 = 0;
while (_local2 < countryArray.length) {
inputCountries.addItem({label:countryArray[_local2][1], data:countryArray[_local2][0]});
_local2++;
};
inputCountries.move(offsetX, (offsetY + (2 * spacer)));
inputCountries.addEventListener(MouseEvent.CLICK, inputClear);
inputSubmit = new submitButton();
inputSubmit.x = offsetX;
inputSubmit.y = (offsetY + (4 * spacer));
inputSubmit.stop();
inputSubmit.addEventListener(MouseEvent.ROLL_OVER, inputSubmitHover);
inputSubmit.addEventListener(MouseEvent.ROLL_OUT, inputSubmitRevert);
inputSubmit.addEventListener(MouseEvent.CLICK, validate);
addChild(inputName);
addChild(inputEmail);
addChild(inputCountries);
addChild(inputSubmit);
btnBack.addEventListener(MouseEvent.CLICK, mainMenu);
}
public function inputSubmitRevert(_arg1:MouseEvent){
_arg1.target.gotoAndStop(1);
}
private function validateEmail(_arg1:String):Boolean{
var _local2:RegExp;
var _local3:Object;
_local2 = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
_local3 = _local2.exec(_arg1);
if (_local3 == null){
return (false);
};
return (true);
}
function validate(_arg1:MouseEvent){
inputSubmit.gotoAndPlay(3);
inputSubmit.alpha = 50;
if (inputName.textInput.text.length > 1){
if ((((((inputEmail.textInput.text.length == 1)) || (validateEmail(inputEmail.textInput.text)))) || ((inputEmail.textInput.text == textOptional)))){
if (inputCountries.selectedIndex > 0){
fx.zoomIn(this, 0, 0.25, this.x, this.y, this.x, (this.y - 610), 10, "linear", submitData);
} else {
inputCountries.filters = [glow];
inputSubmit.alpha = 100;
return (false);
};
} else {
inputEmail.filters = [glow];
inputSubmit.alpha = 100;
return (false);
};
} else {
inputName.filters = [glow];
inputSubmit.alpha = 100;
return (false);
};
}
private function submitData(){
var user:String;
var email:String;
var img:String;
var rc4_text:String;
var rc4:*;
var rc4_hash:*;
var url:String;
var variables:URLVariables;
var request:URLRequest;
user = inputName.textInput.text;
user.replace("|", "");
user.replace(",", "");
email = inputEmail.textInput.text;
if (email == textOptional){
email = "";
};
img = inputCountries.selectedItem.data;
rc4_text = (email + "|");
rc4_text = (rc4_text + (user + "|"));
rc4_text = (rc4_text + (((score + "|") + checksum(score.toString())) + "|"));
rc4_text = (rc4_text + (((score2 + "|") + checksum(score2.toString())) + "|"));
rc4_text = (rc4_text + (((img + "|") + checksum(img.toString())) + "|"));
rc4_text = (rc4_text + checksum(email));
rc4 = new RC4();
rc4_hash = rc4.encrypt(rc4_text, KEY);
url = Constants.URL_SUBMIT_SCORE;
variables = new URLVariables();
variables.xj25 = rc4_hash;
request = new URLRequest(url);
request.data = variables;
request.method = URLRequestMethod.POST;
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, thanks);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, thanks);
loader.addEventListener(IOErrorEvent.IO_ERROR, thanks);
try {
loader.load(request);
} catch(e:Error) {
};
}
private function checksum(_arg1:String){
var _local2:Number;
var _local3:*;
_local2 = 0;
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + _arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
public function setScore(_arg1){
score = _arg1;
if ((score is Number)){
scoreText.text = fx.padScore(score, PADDING);
} else {
scoreText.text = _arg1;
};
}
public function inputRevert(_arg1:MouseEvent){
_arg1.target.hover.visible = false;
}
private function is_null(_arg1:String){
if ((((_arg1 == null)) || ((_arg1 == "")))){
return ("null");
};
return (_arg1);
}
public function setInput(_arg1:MovieClip){
_arg1.hover.visible = false;
_arg1.addEventListener(MouseEvent.ROLL_OVER, inputHover);
_arg1.addEventListener(MouseEvent.ROLL_OUT, inputRevert);
_arg1.addEventListener(MouseEvent.CLICK, inputClick);
}
public function inputHover(_arg1:MouseEvent){
_arg1.target.hover.visible = true;
}
public function inputClear(_arg1:MouseEvent){
_arg1.target.filters = [];
_arg1.target.parent.filters = [];
}
private function thanks(_arg1:Event){
fx.zoomIn(this, 0.5, 0.25, this.x, this.y, this.x, (this.y - 480), 10, "linear", null);
fx.zoomIn(btnBack, 0.5, 0.25, btnBack.x, 2000, btnBack.x, 1124, 10, "linear", null);
}
public function mainMenu(_arg1:MouseEvent){
Root.restart();
}
public function inputSubmitHover(_arg1:MouseEvent){
_arg1.target.gotoAndStop(2);
}
public function inputClick(_arg1:MouseEvent){
_arg1.target.filters = [];
_arg1.target.parent.filters = [];
if (_arg1.target.text == textOptional){
_arg1.target.text = "";
};
}
}
}//package
Section 221
//scoresBtn (scoresBtn)
package {
import flash.display.*;
public dynamic class scoresBtn extends SimpleButton {
}
}//package
Section 222
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 223
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 224
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 225
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 226
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 227
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 228
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 229
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 230
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 231
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 232
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 233
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 234
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 235
//shadow (shadow)
package {
import flash.display.*;
public dynamic class shadow extends MovieClip {
}
}//package
Section 236
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 237
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 238
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 239
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 240
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 241
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 242
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 243
//Sound_Bonus (Sound_Bonus)
package {
import flash.media.*;
public dynamic class Sound_Bonus extends Sound {
}
}//package
Section 244
//Sound_Break (Sound_Break)
package {
import flash.media.*;
public dynamic class Sound_Break extends Sound {
}
}//package
Section 245
//Sound_Click1 (Sound_Click1)
package {
import flash.media.*;
public dynamic class Sound_Click1 extends Sound {
}
}//package
Section 246
//Sound_Click2 (Sound_Click2)
package {
import flash.media.*;
public dynamic class Sound_Click2 extends Sound {
}
}//package
Section 247
//Sound_Click3 (Sound_Click3)
package {
import flash.media.*;
public dynamic class Sound_Click3 extends Sound {
}
}//package
Section 248
//Sound_Click4 (Sound_Click4)
package {
import flash.media.*;
public dynamic class Sound_Click4 extends Sound {
}
}//package
Section 249
//Sound_Cue (Sound_Cue)
package {
import flash.media.*;
public dynamic class Sound_Cue extends Sound {
}
}//package
Section 250
//Sound_Cushion (Sound_Cushion)
package {
import flash.media.*;
public dynamic class Sound_Cushion extends Sound {
}
}//package
Section 251
//Sound_Hole (Sound_Hole)
package {
import flash.media.*;
public dynamic class Sound_Hole extends Sound {
}
}//package
Section 252
//SoundManager (SoundManager)
package {
import flash.events.*;
import balls.*;
import flash.media.*;
public class SoundManager {
private var sound_cue:Sound_Cue;
private var music_position:Number;// = 0
private var sound_transform_click0:SoundTransform;
private var sound_transform_click1:SoundTransform;
private var sound_transform_click2:SoundTransform;
private var sound_transform_click3:SoundTransform;
private var sound_transform_click5:SoundTransform;
private var sound_transform_click6:SoundTransform;
private var sound_transform_click7:SoundTransform;
private var sound_transform_click8:SoundTransform;
private var sound_transform_click9:SoundTransform;
private var sound_transform_click4:SoundTransform;
private var music:SoundChannel;
private var breakPlaying:Boolean;// = false
private var sound_cushion:Sound_Cushion;
private var sound_channel_click10:SoundChannel;
private var sound_channel_click11:SoundChannel;
private var clickCounter:int;// = 0
public var musicEnabled:Boolean;// = false
public var soundsEnabled:Boolean;// = true
private var sound_click10:Sound_Click3;
private var sound_click11:Sound_Click4;
private var soundArray:Array;
private var sound_channel_break:SoundChannel;
private var sound_channel_click0:SoundChannel;
private var sound_channel_click1:SoundChannel;
private var sound_channel_click2:SoundChannel;
private var sound_channel_click3:SoundChannel;
private var sound_channel_click4:SoundChannel;
public var breakShot:Boolean;// = true
private var sound_channel_click6:SoundChannel;
private var sound_channel_click7:SoundChannel;
private var sound_channel_click8:SoundChannel;
private var sound_channel_click9:SoundChannel;
private var sound_channel_click5:SoundChannel;
private var sound_transform_click10:SoundTransform;
private var sound_transform_click11:SoundTransform;
private var sound_channel_hole:SoundChannel;
private var music_track:Sound;
private var sound_cue_channel:SoundChannel;
private var sound_break:Sound_Break;
private var sound_click0:Sound_Click1;
private var sound_click1:Sound_Click2;
private var sound_click2:Sound_Click3;
private var sound_click3:Sound_Click4;
private var sound_click4:Sound_Click1;
private var sound_click5:Sound_Click2;
private var sound_click6:Sound_Click3;
private var sound_click7:Sound_Click4;
private var sound_click8:Sound_Click1;
private var sound_click9:Sound_Click2;
private var sound_bonus:Sound_Bonus;
private var sound_hole:Sound_Hole;
private static var _instance:SoundManager = null;
public function SoundManager(){
soundsEnabled = true;
musicEnabled = false;
breakShot = true;
breakPlaying = false;
sound_click0 = new Sound_Click1();
sound_click1 = new Sound_Click2();
sound_click2 = new Sound_Click3();
sound_click3 = new Sound_Click4();
sound_click4 = new Sound_Click1();
sound_click5 = new Sound_Click2();
sound_click6 = new Sound_Click3();
sound_click7 = new Sound_Click4();
sound_click8 = new Sound_Click1();
sound_click9 = new Sound_Click2();
sound_click10 = new Sound_Click3();
sound_click11 = new Sound_Click4();
sound_bonus = new Sound_Bonus();
sound_cue = new Sound_Cue();
sound_break = new Sound_Break();
sound_hole = new Sound_Hole();
sound_cushion = new Sound_Cushion();
clickCounter = 0;
soundArray = [];
music_track = new Sound();
music_position = 0;
super();
_instance = this;
if (!musicEnabled){
music_track = new musicTrack();
startMusic();
};
}
public function bonus(){
if (soundsEnabled){
sound_bonus.play(0, 1);
};
}
public function musicRestart(_arg1:Event){
music.stop();
music = music_track.play(0, 9999);
}
public function stopMusic(){
music_position = music.position;
musicEnabled = false;
music.stop();
}
public function reset(){
breakShot = true;
breakPlaying = false;
}
public function playSound(_arg1:String){
if (soundsEnabled){
};
}
public function ballClick(_arg1:Ball){
var _local2:*;
var _local3:SoundTransform;
_local2 = (((_arg1.vx + _arg1.vy) / Constants.CUE_NORMAL_POWER) * 2);
if (_local2 < 0){
_local2 = (_local2 * -1);
};
if (_local2 > 1){
_local2 = 1;
};
if (soundsEnabled){
if (breakShot){
if (!breakPlaying){
_local3 = new SoundTransform();
breakPlaying = true;
sound_channel_break = sound_break.play(0, 1);
_local3 = sound_channel_break.soundTransform;
_local3.volume = _local2;
sound_channel_break.soundTransform = _local3;
};
} else {
if (clickCounter == 0){
sound_click0.play(0, 1);
clickCounter++;
} else {
if (clickCounter == 1){
sound_click1.play(0, 1);
clickCounter++;
} else {
if (clickCounter == 2){
sound_click2.play(0, 1);
clickCounter++;
} else {
if (clickCounter == 3){
sound_click3.play(0, 1);
clickCounter++;
} else {
if (clickCounter == 4){
sound_click4.play(0, 1);
clickCounter = 0;
} else {
if (clickCounter == 5){
sound_click5.play(0, 1);
clickCounter++;
} else {
if (clickCounter == 6){
sound_click6.play(0, 1);
clickCounter++;
} else {
if (clickCounter == 7){
sound_click7.play(0, 1);
clickCounter++;
} else {
if (clickCounter == 8){
sound_click8.play(0, 1);
clickCounter = 0;
};
};
};
};
};
};
};
};
};
};
};
}
public function cueShot(_arg1:Number){
}
public function hole(){
if (soundsEnabled){
sound_channel_hole = sound_hole.play(0, 1);
};
}
public function startMusic(){
var _local1:SoundTransform;
if (!musicEnabled){
music = music_track.play(0, 999, null);
musicEnabled = true;
_local1 = music.soundTransform;
_local1.volume = 0.2;
music.soundTransform = _local1;
};
}
public function stopSounds(){
SoundMixer.stopAll();
}
public static function getInstance():SoundManager{
if (_instance == null){
_instance = new (SoundManager);
};
return (_instance);
}
}
}//package
Section 253
//src_gameover (src_gameover)
package {
import view.*;
public dynamic class src_gameover extends GameOverDisplay {
}
}//package
Section 254
//starMC (starMC)
package {
import flash.display.*;
public dynamic class starMC extends MovieClip {
}
}//package
Section 255
//StateManager (StateManager)
package {
import balls.*;
import view.*;
import flash.utils.*;
public class StateManager {
private var headsUpDisplay:HeadsUpDisplay;
public var currentState:String;
public static var _instance:StateManager;
public function StateManager(_arg1:HeadsUpDisplay){
_instance = this;
headsUpDisplay = _arg1;
setTimeout(motionBreak, 500);
}
public function motionFinished(){
currentState = "motionStopped";
}
public function motionBreak(){
var _local1:*;
currentState = "motionBreak";
_local1 = (LevelManager.getInstance().levelCurrent + 1);
headsUpDisplay.displayMessage("Break", Constants.LEVEL_MESSAGE[(_local1 - 1)], true);
}
public function motionStarted(){
currentState = "motionStarted";
}
public function potted(_arg1:Ball, _arg2:Boolean, _arg3:Boolean){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
_local4 = (_arg1.sx - _arg1.oldx);
_local5 = (_arg1.sy - _arg1.oldy);
_local6 = int((Math.sqrt(((_local4 * _local4) + (_local5 * _local5))) * Constants.SCORE_BALL_DISTANCE));
_local7 = Core.getInstance().ballManager.shots;
if (_local7 == 1){
_local6 = (_local6 + Constants.SCORE_SHOT_BONUS1);
};
if (_local7 == 2){
_local6 = (_local6 + Constants.SCORE_SHOT_BONUS2);
};
if (_arg3){
_local6 = (_local6 + Constants.SCORE_BALL_POCKET);
};
if (!_arg2){
if (_arg3){
headsUpDisplay.displayMessage("Bonus!", ("+" + _local6.toString()), false);
headsUpDisplay.updateScore(_local6);
Core.getInstance().explosionManager.createExplosion(_arg1.sx, _arg1.sy, true);
Core.getInstance().soundManager.bonus();
} else {
headsUpDisplay.displayMessage("Nice Shot", ("+" + _local6.toString()), false);
_local6 = (_local6 + Constants.SCORE_BALL_NORMAL);
headsUpDisplay.updateScore(_local6);
Core.getInstance().explosionManager.createExplosion(_arg1.sx, _arg1.sy, false);
};
} else {
headsUpDisplay.displayMessage("Bonus Time", ("+" + _local6.toString()), true);
_local6 = (_local6 + Constants.SCORE_TIME_BONUS);
headsUpDisplay.updateScore(_local6);
headsUpDisplay.addTime();
headsUpDisplay.displayTargetBall(Core.getInstance().ballManager.ballBonusArray[0].ballNum);
};
}
public static function getInstance(){
return (_instance);
}
}
}//package
Section 256
//submitButton (submitButton)
package {
import flash.display.*;
public dynamic class submitButton extends MovieClip {
public function submitButton(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 257
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 258
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package
Section 259
//white (white)
package {
import flash.display.*;
public dynamic class white extends MovieClip {
}
}//package