Frame 1
function preload1(num) {
var loadedK = this.getBytesLoaded();
var totalK = this.getBytesTotal();
var percent = Math.floor((loadedk / totalk) * num);
var newFrame = (frame + percent);
this.preloadMov.gotoAndStop(newFrame);
}
stop();
allowPreload1 = false;
currentSwf = 1;
SwfWaiting = -1;
Loaded = false;
this.onEnterFrame = function () {
if (allowPreload1) {
this.preload1(8);
}
};
Frame 2
function AreVectorsEqual(v1, v2) {
if ((v1.x == v2.x) && (v1.y == v2.y)) {
return(true);
}
return(false);
}
function InitLookups(accuracy) {
if (accuracy) {
MATHACCURACY = accuracy;
}
sinLookUp = new Array();
var i = 0;
while (i <= (360 * MATHACCURACY)) {
sinLookUp[i] = Math.sin(DegreesToRadians(i / MATHACCURACY));
i++;
}
cosLookUp = new Array();
var i = 0;
while (i <= (360 * MATHACCURACY)) {
cosLookUp[i] = Math.cos(DegreesToRadians(i / MATHACCURACY));
i++;
}
tanLookUp = new Array();
var i = 0;
while (i <= (360 * MATHACCURACY)) {
tanLookUp[i] = Math.tan(DegreesToRadians(i / MATHACCURACY));
i++;
}
}
function Vector(x, y) {
this.x = x;
this.y = y;
}
function vCopy(u, w) {
w.x = u.x;
w.y = u.y;
}
function vMagnitude(v) {
return(Math.sqrt((v.x * v.x) + (v.y * v.y)));
}
function vNormalise(v, w) {
if (!w) {
w = v;
}
var m = vMagnitude(v);
if (m <= tol) {
m = 1;
}
w.x = v.x / m;
w.y = v.y / m;
if (Math.abs(w.x) < tol) {
w.x = 0;
}
if (Math.abs(w.y) < tol) {
w.y = 0;
}
}
function vReverse(v, w) {
if (!w) {
w = v;
}
w.x = -v.x;
w.y = -v.y;
}
function vAdd(u, v, w) {
if (!w) {
w = u;
}
w.x = u.x + v.x;
w.y = u.y + v.y;
}
function vSubtract(u, v, w) {
if (!w) {
w = u;
}
w.x = u.x - v.x;
w.y = u.y - v.y;
}
function vMultiply(u, v, w) {
if (!w) {
w = u;
}
w.x = u.x * v.x;
w.y = u.y * v.y;
}
function vMultiplyWithScalar(v, s, w) {
if (!w) {
w = v;
}
w.x = v.x * s;
w.y = v.y * s;
}
function vDivide(u, v, w) {
if (!w) {
w = u;
}
w.x = u.x / v.x;
w.y = u.y / v.y;
}
function vDivideByScalar(v, s, w) {
if (!w) {
w = v;
}
w.x = v.x / s;
w.y = v.y / s;
}
function vCross(u, v) {
return((u.x * v.y) - (u.y * v.x));
}
function v3dCross(u, v, w) {
w.x = (u.y * v.z) - (u.z * v.y);
w.y = ((-u.x) * v.z) + (u.z * v.x);
w.z = (u.x * v.y) - (u.y * v.x);
}
function vDot(p, q) {
var result = ((p.x * q.x) + (p.y * q.y));
return(result);
}
function vProj(u, v, w) {
if (!w) {
w = u;
}
var s = (vDot(u, v) / vDot(v, v));
vMultiplyWithScalar(v, s, w);
}
function vAngle(u) {
var returncode = atan(u.y / u.x);
if (u.x < 0) {
returncode = returncode + 180;
}
return(returncode);
}
function vAngleBetween(u, v) {
var returncode = ((vAngle(v) - vAngle(u)) % 360);
if (returncode > 180) {
returncode = returncode - 360;
} else if (returncode < -180) {
returncode = returncode + 360;
}
return(returncode);
}
function DegreesToRadians(deg) {
return((deg * Math.PI) / 180);
}
function RadiansToDegrees(rad) {
return((rad * 180) / Math.PI);
}
function VRotate2D(angle, u, w) {
if (!w) {
w = u;
}
angle = normaliseAngle(angle);
var tmp = new Vector(0, 0);
tmp.x = (u.x * cos(-angle)) + (u.y * sin(-angle));
tmp.y = ((-u.x) * sin(-angle)) + (u.y * cos(-angle));
w.x = tmp.x;
w.y = tmp.y;
delete tmp;
}
function VRotate2DAroundPoint(angle, u, v, w) {
if (!w) {
w = u;
}
var tmp = new Vector(0, 0);
var tmp2 = new Vector(0, 0);
vSubtract(u, v, tmp2);
tmp.x = (tmp2.x * cos(-angle)) + (tmp2.y * sin(-angle));
tmp.y = ((-tmp2.x) * sin(-angle)) + (tmp2.y * cos(-angle));
vAdd(tmp, v);
w.x = tmp.x;
w.y = tmp.y;
delete tmp;
delete tmp2;
}
function cos(a) {
var index = Math.round(a * MATHACCURACY);
index = index % (360 * MATHACCURACY);
if (index < 0) {
index = index + (360 * MATHACCURACY);
}
return(cosLookup[index]);
}
function sin(a) {
var index = Math.round(a * MATHACCURACY);
index = index % (360 * MATHACCURACY);
if (index < 0) {
index = index + (360 * MATHACCURACY);
}
return(sinLookup[index]);
}
function tan(a) {
return(Math.tan(DegreesToRadians(a)));
}
function atan(s) {
return(RadiansToDegrees(Math.atan(s)));
}
function acos(s) {
return(RadiansToDegrees(Math.acos(s)));
}
function normaliseAngle(angle) {
angle = angle % 360;
if (angle < 0) {
angle = angle + 360;
}
return(angle);
}
function InitConstants() {
FRAMERATE = 0.0416666666666667;
GRAVITY = 40;
DRAG = 0.97;
RDRAG = 0.95;
LEFT = 0;
RIGHT = 600;
BOTTOM = 400;
GROUND = 360;
BOUNDCLIPSVISIBLE = false;
VERTEXVISIBLE = false;
CENTRESVISIBLE = false;
JOINTSVISIBLE = false;
VELOCITYVISIBLE = false;
DEFAULTINERTIA = 100;
DEFAULTMASS = 200;
REBOUND = 0.5;
ANGULARREBOUND = 0.3;
REBOUNDSVISIBLE = false;
SHADOWANGLE = 135;
MOUSESMOOTHING = 4;
HIGHLIGHTING = true;
SHOWCOLLISIONEDGES = false;
SHOWOPTIMISE = false;
BONERIGIDITY = 0.7;
FIXED = 1;
JOINT = 2;
MOUSEDRAG = 3;
GLOBAL = 1;
LOCAL = 2;
DISABLED = 0;
ACTIVE = 1;
ATREST = 2;
BONED = 3;
ATTACHED = 4;
IGNORE = 5;
FORWARDS = 0;
BACKWARDS = 1;
UNCHANGED = 0;
CHANGED = 1;
}
function InitVars() {
bodyObjects = new Array();
particleObjects = new Array();
sparkObjects = new Array();
pivotObjects = new Array();
skeletonObjects = new Array();
stringObjects = new Array();
timeOuts = new Array();
Dragging = false;
LastMouseVelocity = new Vector(0, 0);
MouseVelocity = new Vector(0, 0);
MouseSmoothVelocity = new Vector(0, 0);
MouseVelocities = new Array();
MouseVector = new Vector(0, 0);
PreviousTimer = getTimer();
FrameRates = new Array();
FrameRateTotals = 0;
FirstTime = true;
objMovie = null;
_root.createEmptyMovieClip("sparksound", 3009);
SparkClick = new Sound(_root.sparksound);
SparkClick.attachSound("SparkClick");
_root.createEmptyMovieClip("sparkbuzz", 3010);
SparkBuzz = new Sound(_root.sparkbuzz);
SparkBuzz.attachSound("SparkBuzz");
}
function FrameMasterFunction() {
var timer = getTimer();
if (FrameRates.length > 11) {
FrameRates.push(timer - PreviousTimer);
FrameRateTotals = FrameRateTotals - FrameRates.shift();
FrameRateTotals = FrameRateTotals + (timer - PreviousTimer);
} else {
FrameRates.push(timer - PreviousTimer);
FrameRateTotals = FrameRateTotals + (timer - PreviousTimer);
}
_root.FrameDisplay = Math.round(1000 / (FrameRateTotals / FrameRates.length));
PreviousTimer = timer;
CalculateMouseVelocity();
var i = 0;
while (i < timeOuts.length) {
var timeout = timeOuts[i];
timeout.Timer--;
if (timeout.Timer == 0) {
timeout.Func();
timeOuts.splice(i, 1);
i--;
}
i++;
}
preFrameFunction();
UpdateBones();
UpdateBodies();
UpdateParticles();
UpdateSparks();
UpdateStrings();
frameFunction();
FirstTime = false;
}
function CalculateMouseVelocity() {
MouseVector.x = objMovie._xmouse;
MouseVector.y = objMovie._ymouse;
if (MouseVelocities.length > (MOUSESMOOTHING - 1)) {
MouseVelocities.push(MouseVelocities[0]);
MouseVelocities.shift();
} else {
MouseVelocities.push(new Vector(0, 0));
}
vSubtract(MouseVector, LastMouseVelocity, MouseVelocity);
VCopy(MouseVelocity, MouseVelocities[MouseVelocities.length - 1]);
ResetSmoothMouseVelocity();
vCopy(MouseVector, LastMouseVelocity);
}
function UpdateMouseSmoothVelocity() {
if (!MouseSmoothVelocityUpdated) {
MouseSmoothVelocity.x = 0;
MouseSmoothVelocity.y = 0;
var i = 0;
while (i < MouseVelocities.length) {
vAdd(MouseSmoothVelocity, MouseVelocities[i]);
i++;
}
vDivideByScalar(MouseSmoothVelocity, MouseVelocities.length);
MouseSmoothVelocityUpdated = true;
}
}
function ResetSmoothMouseVelocity() {
MouseSmoothVelocityUpdated = false;
}
function UpdateBodies() {
var x = 0;
var i = 0;
while (i < bodyObjects.length) {
var obj = bodyObjects[i];
if (obj.State == ACTIVE) {
UpdateVelAndPos(obj);
setBodyPosition(obj);
if (VELOCITYVISIBLE) {
drawLine(obj.Position, obj.Velocity, _root["arrow" + i]);
}
if (BOUNDCLIPSVISIBLE) {
setPosition(obj.BoundClip, obj.BoundingCirclePosition);
}
} else if (obj.State == BONED) {
if (obj.Bone.Changed) {
obj.Rotation = obj.Bone.Angle - obj.Bone.ObjAngle;
vRotate2D(obj.Rotation, obj.Bone.ObjStartPoint, obj.Position);
vSubtract(obj.Bone.Point1, obj.Position, obj.Position);
setBodyPosition(obj);
obj.Bone.Changed = false;
}
}
if (FirstTime) {
HighlightObject(obj);
Update3DObject(obj);
}
if (obj.State != DISABLED) {
Render3DObject(obj);
}
i++;
}
UpdateAttachedObjects();
}
function UpdateVelAndPos(obj) {
vMultiplyWithScalar(obj.Velocity, DRAG);
obj.Velocity.y = obj.Velocity.y + GRAVITY;
if (IsMouseDragging(obj) || (!obj.SelfRighting)) {
obj.Spin = obj.Spin * RDRAG;
} else {
myrotation = obj.Rotation;
if (myrotation > 180) {
myrotation = myrotation - 360;
}
obj.Spin = (myrotation * -0.05) * (1 - ((obj.Ground - obj.Position.y) / 400));
}
var tmpvelocity = new Vector(0, 0);
vMultiplyWithScalar(obj.Velocity, FRAMERATE, tmpvelocity);
vAdd(obj.Position, tmpvelocity, obj.NewPosition);
obj.NewRotation = obj.Rotation + radiansToDegrees(obj.Spin * FRAMERATE);
CheckPivots(obj);
CheckCollisions(obj);
vCopy(obj.NewPosition, obj.Position);
obj.Rotation = NormaliseAngle(obj.NewRotation);
vRotate2D(-obj.Rotation, obj.Velocity, obj.VelocityLocal);
}
function CheckCollisions(obj) {
if (obj.State == DISABLED) {
return(false);
}
vRotate2D(obj.NewRotation, obj.BoundingCircleOffset, obj.BoundingCirclePosition);
vAdd(obj.BoundingCirclePosition, obj.NewPosition);
if ((obj.BoundingCirclePosition.x - obj.BoundingCircleRadius) < LEFT) {
if ((obj.Velocity.x < 0) && (obj.Position.y < 250)) {
obj.Velocity.x = -obj.Velocity.x;
} else {
obj.Velocity.x = (-(obj.BoundingCirclePosition.x - obj.BoundingCircleRadius)) * 10;
}
}
if ((obj.BoundingCirclePosition.x + obj.BoundingCircleRadius) > RIGHT) {
if ((obj.Velocity.x > 0) && (obj.Position.y < 250)) {
obj.Velocity.x = -obj.Velocity.x;
} else {
obj.Velocity.x = (-((obj.BoundingCirclePosition.x + obj.BoundingCircleRadius) - RIGHT)) * 10;
}
}
if ((obj.BoundingCirclePosition.y + obj.BoundingCircleRadius) > obj.Ground) {
if (BOUNDCLIPSVISIBLE) {
obj.BoundClip.gotoAndPlay(1);
}
var collisions = new Array();
j = 0;
while (j < obj.Nodes.length) {
var point = obj.Nodes[j];
if (!point.PositionGlobal) {
point.PositionGlobal = new Vector(0, 0);
}
vRotate2D(obj.NewRotation, point.PositionLocal, point.PositionGlobal);
vAdd(point.PositionGlobal, obj.NewPosition);
if (point.PositionGlobal.y > obj.Ground) {
collisions.push(new Array(j, point.PositionGlobal.y - obj.Ground));
}
j++;
}
if (collisions.length > 0) {
var distance = -1;
j = 0;
while (j < collisions.length) {
if (collisions[j][1] > distance) {
distance = collisions[j][1];
point = obj.Nodes[collisions[j][0]];
}
j++;
}
obj.NewPosition.y = obj.NewPosition.y - distance;
point.PositionGlobal.y = point.PositionGlobal.y - distance;
if (Math.abs(obj.Velocity.y) > 27) {
var pointvelocity = new Vector(0, 0);
vCopy(obj.Velocity, pointvelocity);
if (VERTEXVISIBLE) {
point.Clip.gotoAndPlay(2);
}
var normal = new Vector(0, -1);
var reaction = new Vector();
vProj(pointvelocity, normal, reaction);
vReverse(reaction);
vRotate2D(-obj.NewRotation, reaction);
var angularimpulse = vCross(point.PositionLocal, reaction);
angularimpulse = angularimpulse / obj.Inertia;
angularimpulse = angularimpulse * ANGULARREBOUND;
obj.Spin = obj.Spin + (angularimpulse * FRAMERATE);
obj.Velocity.x = obj.Velocity.x;
obj.Velocity.y = (-obj.Velocity.y) * REBOUND;
if (obj.CollisionFunction) {
obj.CollisionFunction();
}
} else {
obj.Velocity.y = 0;
obj.Velocity.x = 0;
if ((!IsMouseDragging(obj)) && ((collisions.length > 1) || (obj.Nodes.length == 1))) {
obj.Spin = 0;
obj.State = ATREST;
}
}
}
delete collisions;
}
}
function UpdateParticles() {
var i = 0;
while (i < particleObjects.length) {
var deletepart = false;
var pobj = particleObjects[i];
if (pobj.Delay > 0) {
pobj.Delay--;
pobj.Clip._visible = false;
} else {
pobj.Clip._visible = true;
if (!pobj.dragVec) {
pobj.dragVec = new Vector(0.98, 0.98);
}
vMultiply(pobj.Velocity, pobj.dragVec);
vAdd(pobj.Velocity, pobj.Gravity);
if (pobj.TargetPos) {
var diff = new Vector(pobj.TargetPos.x - pobj.Clip._x, pobj.TargetPos.y - pobj.Clip._y);
vMultiplyWithScalar(diff, pobj.TargetSpeed);
pobj.Velocity.x = pobj.Velocity.x + diff.x;
pobj.Velocity.y = pobj.Velocity.y + diff.y;
}
pobj.Clip._x = pobj.Clip._x + pobj.Velocity.x;
pobj.Clip._y = pobj.Clip._y + pobj.Velocity.y;
pobj.Clip._rotation = pobj.Clip._rotation + pobj.Spin;
if (pobj.Ground) {
if (pobj.Clip._y > pobj.Ground) {
pobj.Velocity.y = -pobj.Velocity.y;
pobj.Clip._y = pobj.Ground - (pobj.Clip._y - pobj.Ground);
}
}
if (pobj.Shrink) {
pobj.Clip._xscale = pobj.Clip._xscale * pobj.Shrink;
pobj.Clip._yscale = pobj.Clip._yscale * pobj.Shrink;
}
if (pobj.Fade) {
pobj.Clip._alpha = pobj.Clip._alpha * pobj.Fade;
}
pobj.Life++;
if (!pobj.KeepAlive) {
var pos = new Vector(pobj.Clip._x, pobj.Clip._y);
pobj.Clip._parent.localToGlobal(pos);
if ((((pos.x < LEFT) || (pos.x > RIGHT)) || (pos.y < TOP)) || (pos.y > BOTTOM)) {
deletepart = true;
}
}
if (pobj.Clip._alpha <= 3) {
deletepart = true;
}
if (pobj.Clip._xscale <= 5) {
deletepart = true;
}
if (pobj.Life > pobj.LifeExpectancy) {
deletepart = true;
}
if (deletepart) {
DeleteParticle(i);
i--;
}
}
i++;
}
}
function DeleteParticle(pnum) {
var pobj = particleObjects[pnum];
pobj.Clip._visible = false;
removeMovieClip(pobj.Clip);
particleObjects.splice(pnum, 1);
delete pobj;
if (pnum > 0) {
pnum--;
}
return(pnum);
}
function SparkObject(startpoint, endpoint, intensity, delay, colour, sparks, sparkclip, audio) {
if (!SparkCount) {
SparkCount = 0;
}
SparkCount++;
this.Delay = delay;
this.Life = 0;
this.Intensity = intensity;
this.Colour = colour;
this.Audio = audio;
this.Program = new Array();
if (intensity == 1) {
this.Program = Array(1);
} else if (intensity == 2) {
this.Program = Array(1, 2, 1);
} else if (intensity == 3) {
this.Program = Array(1, 2, 2, 1);
} else if (intensity == 3) {
this.Program = Array(1, 2, 3, 3, 2, 1);
} else if (intensity == 4) {
this.Program = Array(2, 3, 4, 3, 1);
} else if (intensity == 5) {
this.Program = Array(2, 3, 4, 3, 1);
}
this.StartPoint = startpoint;
this.EndPoint = endpoint;
if (!sparkclip) {
this.Clip = objMovie.createEmptyMovieClip("sparkclip" + SparkCount, 1000 + SparkCount);
} else {
this.Clip = sparkclip.createEmptyMovieClip("sparkclip" + SparkCount, 1000 + SparkCount);
}
this.Clip2 = this.Clip.createEmptyMovieClip("sparkclip" + SparkCount, 1000 + SparkCount);
this.SparkParticles = sparks;
}
function MakeSpark(startpoint, endpoint, intensity, delay, colour, sparks, sparkclip, audio) {
sparkObjects.push(new SparkObject(startpoint, endpoint, intensity, delay, colour, sparks, sparkclip, audio));
}
function UpdateSparks() {
var i = 0;
while (i < sparkObjects.length) {
var sparky = sparkObjects[i];
if (sparky.Delay > 0) {
sparky.Delay--;
} else if (sparky.Life < sparky.Program.length) {
if (sparky.Program[sparky.Life] == 1) {
if (sparky.Audio) {
SparkClick.start();
SparkClick.setVolume((Math.random() * 10) + 90);
}
drawSpark(sparky.StartPoint, sparky.EndPoint, 1, sparky.Colour, sparky.Clip, sparky.Clip2);
} else {
drawSpark(sparky.StartPoint, sparky.EndPoint, 3, sparky.Colour, sparky.Clip, sparky.Clip2);
if (sparky.Audio) {
SparkBuzz.start();
SparkBuzz.setVolume((Math.random() * 10) + 20);
}
}
if ((sparky.Program.length == 1) && (Math.random() < 0.7)) {
SparkBuzz.stop();
SparkClick.start();
SparkClick.setVolume((Math.random() * 10) + 90);
}
trace("spark particles = " + sparky.SparkParticles);
if (sparky.SparkParticles > 0) {
if (Math.random() < sparky.SparkParticles) {
MakeParticleSpark(sparky.StartPoint, 1, false, false, sparky.Colour);
}
if (Math.random() < sparky.SparkParticles) {
MakeParticleSpark(sparky.EndPoint, 1, null, null, sparky.Colour);
}
}
sparky.Life++;
} else {
sparky.Clip.clear();
sparky.Clip2.clear();
sparky.EndFunction();
i = DeleteSpark(i);
}
i++;
}
}
function DeleteSpark(snum) {
var sobj = sparkObjects[snum];
removeMovieClip(sobj.Clip2);
removeMovieClip(sobj.Clip);
sparkObjects.splice(snum, 1);
delete sobj;
if (snum > 0) {
snum--;
}
return(snum);
}
function MakePivot(obj, pos, offset, type) {
pivotObjects.push({});
var pivot = pivotObjects[pivotObjects.length - 1];
pivot.Obj = obj;
pivot.PositionLocal = new Vector();
pivot.PositionGlobal = new Vector();
pivot.Type = type;
if (offset == GLOBAL) {
vSubtract(pos, obj.Position, pivot.PositionLocal);
vRotate2D(-obj.Rotation, pivot.PositionLocal);
ScreenToWorld(pos, pivot.PositionGlobal);
} else if (offset == LOCAL) {
vMultiply(pos, obj.ClipScale, pivot.PositionLocal);
vRotate2D(pivot.PositionLocal, -obj.Rotation, pivot.PositionGlobal);
vAdd(pivot.PositionGlobal, obj.Position);
}
}
function CheckPivots(obj) {
var i = 0;
while (i < pivotObjects.length) {
if (pivotObjects[i].Obj == obj) {
pivotobj = pivotObjects[i];
var pivot = new Vector(0, 0);
vRotate2D(obj.Rotation, pivotobj.PositionLocal, pivot);
var tmp = new Vector(0, 0);
vAdd(pivot, obj.Position, tmp);
var newvelocity = new Vector(0, 0);
var velocity = new Vector(0, 0);
vMultiplyWithScalar(obj.Velocity, FRAMERATE, velocity);
var inertia = obj.Inertia;
var spin = (obj.Spin * FRAMERATE);
var velfromspin = new Vector(0, 0);
vVelFromSpin(pivot, spin, velfromspin);
vSubtract(velocity, velfromspin);
var newspin = 0;
newspin = newspin + spin;
norm = new Vector(0, 0);
vCopy(pivot, norm);
vNormalise(norm);
var anglediff = 0;
var pivotvelocity = new Vector(0, 0);
if (pivotobj.Type == JOINT) {
var p = pivotobj;
var joinpos = new Vector(0, 0);
vRotate2D(p.JoinObj.Rotation, p.Join.PositionLocal, joinpos);
vAdd(joinpos, p.JoinObj.Position);
vSubtract(joinpos, obj.Position);
vSubtract(joinpos, pivot, pivotvelocity);
anglediff = obj.Rotation - p.JoinObj.Rotation;
} else if (pivotobj.Type == MOUSEDRAG) {
vCopy(MouseVelocity, pivotvelocity);
} else {
anglediff = obj.Rotation;
}
if (obj.Inertia != Infinity) {
newspin = newspin + (vCross(velocity, norm) / inertia);
newspin = newspin - (vCross(pivotvelocity, norm) / inertia);
obj.NewRotation = obj.Rotation + radiansToDegrees(newspin);
obj.Spin = newspin / FRAMERATE;
}
var origin = new Vector(0, 0);
vRotate2DAroundPoint(radiansToDegrees(newspin), origin, pivot, newvelocity);
vAdd(newvelocity, pivotvelocity);
vAdd(obj.Position, newvelocity, obj.NewPosition);
vDivideByScalar(newvelocity, FRAMERATE, obj.Velocity);
}
i++;
}
}
function MakeJoint(obj, pos, offset, type) {
obj.Pivots.push({});
var pivot = obj.Pivots[obj.Pivots.length - 1];
pivot.PositionLocal = new Vector();
pivot.PositionGlobal = new Vector();
pivot.Type = type;
if (offset == GLOBAL) {
vSubtract(pos, obj.Position, pivot.PositionLocal);
vRotate2D(-obj.Rotation, pivot.PositionLocal);
vScreenToGlobal(pos, pivot.PositionGlobal);
} else if (offset == LOCAL) {
vMultiply(pos, obj.ClipScale, pivot.PositionLocal);
vRotate2D(pivot.PositionLocal, -obj.Rotation, pivot.PositionGlobal);
vAdd(pivot.PositionGlobal, obj.Position);
}
}
function IsMouseDragging(obj) {
var i = 0;
while (i < pivotObjects.length) {
if ((pivotObjects[i].Obj == obj) && (pivotObjects[i].Type == MOUSEDRAG)) {
return(true);
}
i++;
}
return(false);
}
function vVelFromSpin(p, spin, target) {
var av = {};
var v = {};
av.x = 0;
av.y = 0;
av.z = spin;
v.x = p.x;
v.y = p.y;
v.z = 0;
var r = {};
r.x = 0;
r.y = 0;
r.z = 0;
v3dCross(v, av, r);
target.x = r.x;
target.y = r.y;
}
function HighlightObject(obj) {
if (!HIGHLIGHTING) {
return(false);
}
var lightsource = 135;
var i = 0;
while (i < obj.Panels.length) {
var panel = obj.Panels[i];
if (!panel.specularity) {
panel.specularity = 50;
}
var c = new Color(panel);
var angle = ((obj.Rotation + panel.angle) + SHADOWANGLE);
var brightness = (cos(angle) * panel.specularity);
c.setBrightness(brightness, true);
delete c;
i++;
}
}
function RigidBody(clip) {
this.Position = new Vector(0, 0);
getPosition(clip, this.Position);
this.Rotation = clip._rotation;
this.Velocity = new Vector(0, 0);
this.VelocityLocal = new Vector(0, 0);
this.Spin = 0;
this.Mass = DEFAULTMASS;
this.Inertia = DEFAULTINERTIA;
this.Ground = GROUND;
this.NewPosition = new Vector(0, 0);
this.NewRotation = 0;
this.BoundingCircleRadius = 0;
this.BoundingCircleOffset = new Vector(0, 0);
this.BoundingCirclePosition = new Vector(0, 0);
this.Clip = clip;
this.State = ATREST;
this.Nodes = new Array();
this.Panels = new Array();
this.Pivots = new Array();
this.ClipScale = new Vector(clip._xscale / 100, clip._yscale / 100);
this.CollisionFunction = "";
if (!CENTRESVISIBLE) {
clip.centre._visible = false;
}
this.ExplodeClip = objMovie[clip._name + "Explode"];
if (this.ExplodeClip) {
this.ExplodeClip._visible = false;
}
var pnum = 0;
while (clip["point" + pnum] != undefined) {
var pclip = clip["point" + pnum];
if (!VERTEXVISIBLE) {
pclip._visible = false;
}
this.Nodes[pnum] = {};
var point = this.Nodes[pnum];
point.Clip = pclip;
point.PositionLocal = new Vector(pclip._x, pclip._y);
vMultiply(point.PositionLocal, this.ClipScale);
UpdateGlobalPosition(this, point);
var distance = vMagnitude(point.PositionLocal);
if (distance > this.BoundingCircleRadius) {
this.BoundingCircleRadius = distance;
}
pnum++;
}
var pivotnum = 0;
while (clip["link" + pivotnum] != undefined) {
var pclip = clip["link" + pivotnum];
if (!VERTEXVISIBLE) {
pclip._visible = false;
}
var tmp = new Vector(pclip._x, pclip._y);
MakeJoint(this, tmp, LOCAL, FIXED);
delete tmp;
pivotnum++;
}
clip.onRollOver = function () {
};
var panelnum = 0;
while (clip["panel" + panelnum] != undefined) {
var panel = clip["panel" + panelnum];
this.Panels.push(panel);
if (panel.angleclip) {
panel.angle = panel.angleclip._rotation;
panel.angleclip._visible = false;
} else {
panel.angle = atan(panel._y / panel._x);
if (panel._x < 0) {
panel.angle = panel.angle + 180;
}
}
panelnum++;
}
if (clip.circle != undefined) {
this.BoundingCircleRadius = (clip.circle._width / 2) * this.ClipScale.x;
this.BoundingCircleOffset.x = clip.circle._x;
this.BoundingCircleOffset.y = clip.circle._y;
vMultiply(this.BoundingCircleOffset, this.ClipScale);
clip.circle._visible = false;
}
if (BOUNDCLIPSVISIBLE) {
duplicateMovieClip ("circle", "bound" + objectcount, 2000 + objectcount);
this.BoundClip = _root["bound" + objectcount];
this.BoundClip._xscale = this.BoundingCircleRadius;
this.BoundClip._yscale = this.BoundingCircleRadius;
}
}
function DisableBody(obj) {
obj.State = DISABLED;
obj.Clip.anim.stop();
obj.Clip._visible = false;
}
function EnableBody(obj) {
obj.State = ACTIVE;
obj.Clip.anim.play();
obj.Clip._visible = true;
UpdateAllGlobalPositions(obj);
}
function UpdateGlobalPosition(obj, point, newpos) {
if (!point.PositionGlobal) {
point.PositionGlobal = new Vector(0, 0);
}
if (!point.GlobalPositionUpdated) {
if (newpos) {
vRotate2D(obj.NewRotation, point.PositionLocal, point.PositionGlobal);
vAdd(point.PositionGlobal, obj.NewPosition);
} else {
vRotate2D(obj.Rotation, point.PositionLocal, point.PositionGlobal);
vAdd(point.PositionGlobal, obj.Position);
}
point.GlobalPositionUpdated = true;
}
}
function UpdateAllGlobalPositions(obj) {
var i = 0;
while (i < obj.Nodes.length) {
UpdateGlobalPosition(obj, obj.Nodes[i]);
i++;
}
}
function ResetPoints(obj) {
var i = 0;
while (i < obj.Nodes.length) {
obj.Nodes[i].GlobalPositionUpdated = false;
i++;
}
}
function setBodyPosition(obj) {
if (setPosition(obj.Clip, obj.Position, obj.Rotation)) {
HighlightObject(obj);
Update3DObject(obj);
ResetPoints(obj);
}
}
function InitBodies() {
objectcount = 0;
while (objMovie["object" + objectcount] != undefined) {
var clip = objMovie["object" + objectcount];
bodyObjects.push(new RigidBody(clip));
HighlightObject(bodyObjects[bodyObjects.length - 1]);
objectcount++;
}
}
function getPointsAndBones(linkprefix) {
this.FirstBone = false;
var prevbone = false;
this.Left = LEFT;
this.Right = RIGHT;
var p1 = new Vector(0, 0);
getPosition(objMovie[linkprefix + "0"], p1);
objMovie[linkprefix + "0"].Point = p1;
p1.Clip = objMovie[linkprefix + "0"];
if (!JOINTSVISIBLE) {
p1.Clip._visible = false;
}
var i = 1;
while (objMovie[linkprefix + i]) {
var p2 = new Vector(0, 0);
p2.Clip = objMovie[linkprefix + i];
if (!JOINTSVISIBLE) {
p2.Clip._visible = false;
}
objMovie[linkprefix + i].Point = p2;
getPosition(objMovie[linkprefix + i], p2);
var currbone = new Bone(p1, p2, prevbone);
currbone.Skeleton = this;
p1.PrevBone = prevbone;
p1.NextBone = currbone;
prevbone.NextBone = currbone;
if (!this.FirstBone) {
this.FirstBone = currbone;
}
AttachObjectToBone(currbone, bodyObjects[i - 1], 0, 1);
p1 = p2;
prevbone = currbone;
i++;
}
this.LastBone = currbone;
this.GroundBone = false;
this.DragBone = false;
this.DragBoneOffset = new Vector(0, 0);
this.Velocity = new Vector(0, 0);
this.Ground = GROUND;
}
function UpdateBones() {
var i = 0;
while (i < skeletonObjects.length) {
var skeleton = skeletonObjects[i];
var masterbone = false;
if (skeleton.DragBone) {
if ((MouseVector.x != 0) && (MouseVector.y != 0)) {
var point1 = new Vector(0, 0);
var point2 = new Vector(0, 0);
vAdd(MouseVector, skeleton.DragBoneOffset, point1);
vAdd(point1, skeleton.DragBone.Vec, point2);
if ((point1.x > point2.x) && (point1.x > skeleton.Right)) {
point1.x = skeleton.Right;
vAdd(point1, skeleton.DragBone.Vec, point2);
}
if ((point2.x > point1.x) && (point2.x > skeleton.Right)) {
point2.x = skeleton.Right;
vSubtract(point2, skeleton.DragBone.Vec, point1);
}
if ((point1.x < point2.x) && (point1.x < skeleton.Left)) {
point1.x = skeleton.Left;
vAdd(point1, skeleton.DragBone.Vec, point2);
}
if ((point1.x > point2.x) && (point2.x < skeleton.Left)) {
point2.x = skeleton.Left;
vSubtract(point2, skeleton.DragBone.Vec, point1);
}
vCopy(point1, skeleton.DragBone.Point1);
vCopy(point2, skeleton.DragBone.Point2);
UpdateBone(skeleton.DragBone, FORWARDS);
skeleton.DragBone.Changed = true;
}
masterbone = skeleton.DragBone;
skeleton.LastMasterBone = masterbone;
} else {
masterbone = skeleton.LastMasterBone;
if (((skeleton.GroundBone.Point1.x > skeleton.Right) || (skeleton.GroundBone.Point2.x > skeleton.Right)) && (skeleton.Velocity.x > 0)) {
skeleton.Velocity.x = 0;
}
if (((skeleton.GroundBone.Point1.x < skeleton.Left) || (skeleton.GroundBone.Point2.x < skeleton.Left)) && (skeleton.Velocity.x < 0)) {
skeleton.Velocity.x = 0;
}
if (skeleton.GroundBone.Point2.y < (skeleton.Ground - 10)) {
masterbone.Point2.y = masterbone.Point2.y + (skeleton.Velocity.y * FRAMERATE);
masterbone.Point2.x = masterbone.Point2.x + (skeleton.Velocity.x * FRAMERATE);
skeleton.Velocity.y = skeleton.Velocity.y + GRAVITY;
masterbone.Changed = true;
masterbone.PrevBone.Changed = true;
} else {
if (skeleton.Velocity.y > 0) {
skeleton.DropFunction();
skeleton.Velocity.x = 0;
}
masterbone = skeleton.GroundBone;
skeleton.LastMasterBone = masterbone;
masterbone.Point2.x = masterbone.Point2.x + (skeleton.Velocity.x * FRAMERATE);
skeleton.Velocity.y = 0;
}
UpdateBone(masterbone, BACKWARDS);
}
var currbone = masterbone.NextBone;
while (currbone) {
UpdateBone(currbone, FORWARDS);
currbone = currbone.NextBone;
}
var currbone = masterbone.PrevBone;
while (currbone) {
UpdateBone(currbone, BACKWARDS);
currbone = currbone.PrevBone;
}
i++;
}
}
function UpdateBone(currbone, direction) {
currbone.Changed = false;
if (currbone.Obj.State != BONED) {
return(false);
}
if (currbone.Point1.y > currbone.Skeleton.Ground) {
currbone.Point1.y = currbone.Skeleton.Ground;
currbone.Changed = true;
}
if (currbone.Point2.y > currbone.Skeleton.Ground) {
currbone.Point2.y = currbone.Skeleton.Ground;
currbone.Changed = true;
}
vSubtract(currbone.Point2, currbone.Point1, currbone.Vec);
currbone.Mag = (currbone.Vec.x * currbone.Vec.x) + (currbone.Vec.y * currbone.Vec.y);
if (Math.abs(currbone.Mag - (currbone.OrigMag * currbone.OrigMag)) > 0.1) {
currbone.Mag = Math.sqrt(currbone.Mag);
var ratio = (currbone.OrigMag / currbone.Mag);
vMultiplyWithScalar(currbone.Vec, ratio);
if (direction == FORWARDS) {
vAdd(currbone.Point1, currbone.Vec, currbone.Point2);
} else {
vSubtract(currbone.Point2, currbone.Vec, currbone.Point1);
}
currbone.Changed = true;
} else {
currbone.Mag = currbone.OrigMag;
}
var a = (currbone.Angle - currbone.OrigAngle);
if (a > 180) {
a = a - 360;
} else if (a < -180) {
a = a + 360;
}
if (Math.abs(a) > 0.2) {
if (direction == FORWARDS) {
vRotate2DAroundPoint((-a) * BONERIGIDITY, currbone.Point2, currbone.Point1, currbone.Point2);
vSubtract(currbone.Point2, currbone.Point1, currbone.Vec);
} else {
vRotate2DAroundPoint((-a) * BONERIGIDITY, currbone.Point1, currbone.Point2, currbone.Point1);
vSubtract(currbone.Point2, currbone.Point1, currbone.Vec);
}
currbone.Changed = true;
}
if (currbone.Changed) {
currbone.Angle = vAngle(currbone.Vec);
if (JOINTSVISIBLE) {
setPosition(currbone.Point2.Clip, currbone.Point2);
setPosition(currbone.Point1.Clip, currbone.Point1);
}
currbone.Changed = true;
return(CHANGED);
}
currbone.Changed = false;
return(UNCHANGED);
}
function Bone(p1, p2, prevbone) {
this.Point1 = p1;
this.Point2 = p2;
this.Vec = new Vector(0, 0);
vSubtract(p2, p1, this.Vec);
this.Mag = vMagnitude(this.Vec);
this.Angle = vAngle(this.Vec);
this.OrigVec = new Vector();
vCopy(this.Vec, this.OrigVec);
this.OrigMag = this.Mag;
this.OrigAngle = this.Angle;
this.PrevBone = prevbone;
this.NextBone = false;
this.Changed = true;
}
function AttachObjectToBone(mybone, obj, pivot1num, pivot2num) {
mybone.Obj = obj;
mybone.ObjStartPoint = obj.Pivots[pivot1num].PositionLocal;
mybone.ObjVector = new Vector(0, 0);
vSubtract(obj.Pivots[pivot2num].PositionLocal, obj.Pivots[pivot1num].PositionLocal, mybone.ObjVector);
mybone.ObjAngle = vAngle(mybone.ObjVector);
mybone.Magnitude = vMagnitude(mybone.ObjVector);
obj.Bone = mybone;
obj.State = BONED;
}
function ExplodeAndShowObject(objexplode, objshow) {
EnableBody(objshow);
vCopy(objexplode.Position, objshow.Position);
objshow.Velocity.y = -250;
objshow.Ground = objexplode.Ground;
ExplodeObject(objexplode);
}
function ExplodeObject(obj, shrink, fade, sparks) {
obj.ExplodeSound.start();
var explodeclip = obj.ExplodeClip;
explodeclip.anim.gotoAndPlay(1);
DisableBody(obj);
explodeclip._visible = true;
explodeclip._x = obj.Clip._x;
explodeclip._y = obj.Clip._y;
explodeclip._rotation = obj.Clip._rotation;
var pgravity = new Vector(0, 3);
vRotate2D(-explodeclip._rotation, pgravity);
var localvelocity = new Vector(0, 0);
vCopy(obj.Velocity, localvelocity);
vRotate2D(-obj.Rotation, localvelocity);
vMultiplyWithScalar(localvelocity, FRAMERATE);
for (var inst in explodeclip) {
if (inst._name != "anim") {
particleObjects.push({});
pobj = particleObjects[particleObjects.length - 1];
pobj.Clip = explodeclip[inst];
pobj.Velocity = new Vector((pobj.clip._x * obj.ClipScale.x) * 2, (pobj.clip._y * obj.ClipScale.y) * 2);
vAdd(pobj.Velocity, localvelocity);
pobj.Spin = (Math.random() * 80) - 40;
pobj.Gravity = pgravity;
pobj.Life = 0;
pobj.LifeExpectancy = 60;
if (shrink) {
pobj.Shrink = shrink;
} else {
pobj.Shrink = 0.97;
}
if (fade) {
pobj.Fade = fade;
}
}
}
if (sparks) {
var j = 0;
while (j < 20) {
var temp = new Vector(0, 0);
vCopy(obj.Position, temp);
temp.x = temp.x + ((Math.random() * obj.Clip._width) - (obj.Clip._width / 2));
temp.y = temp.y + ((Math.random() * obj.Clip._height) - (obj.Clip._height / 2));
MakeParticleSpark(temp, 1, 0.7, null, "cyan");
particleObjects[particleObjects.length - 1].Delay = j / 4;
j++;
}
}
}
function ScreenToWorld(v, w) {
if (!w) {
w = v;
}
w.x = v.x;
w.y = v.y;
}
function WorldToScreen(v, w) {
if (!w) {
w = v;
}
w.x = v.x;
w.y = v.y;
}
function cloneObject(obj) {
for (var i in obj) {
if (obj[i] instanceof Object) {
this[i] = new cloneObject(obj[i]);
} else {
this[i] = obj[i];
}
}
}
function traceObject(obj, level) {
if (!level) {
level = 1;
trace("Object - ");
}
var spacer = "";
var i = 0;
while (i < level) {
spacer = spacer + " ";
i++;
}
objcount = 0;
for (var i in obj) {
trace(((spacer + i) + " = ") + obj[i]);
tcount = traceObject(obj[i], level + 1);
objcount++;
}
return(objcount);
}
function setPosition(clip, vtarget, rotation) {
var changed = false;
var tmp = new Vector(0, 0);
WorldToScreen(vtarget, tmp);
if ((clip._x != tmp.x) || (clip._y != tmp.y)) {
clip._x = tmp.x;
clip._y = tmp.y;
changed = true;
}
if (rotation) {
if (rotation != clip._rotation) {
clip._rotation = rotation;
changed = true;
}
}
delete tmp;
return(changed);
}
function getPosition(clip, vtarget) {
vtarget.x = clip._x;
vtarget.y = clip._y;
ScreenToWorld(vtarget);
}
function drawLine(u, v, lineclip, absolute, multiplier) {
var tmp = new Vector(0, 0);
if (absolute) {
vSubtract(v, u, tmp);
} else {
vCopy(v, tmp);
}
if (multiplier) {
vMultiplyWithScalar(tmp, multiplier);
}
setPosition(lineclip, u);
lineclip._rotation = vAngle(tmp);
lineclip._xscale = vMagnitude(tmp);
lineclip._yscale = 100;
delete tmp;
}
function drawSpark(p1, p2, sparkwidth, sparkcolour, targetclip, targetclip2) {
targetclip.clear();
targetclip2.clear();
var tmp = new Vector(0, 0);
var v1 = new Vector(0, 0);
vSubtract(p2, p1, v1);
var distance = vMagnitude(v1);
var normal = new Vector(0, 0);
vNormalise(v1, normal);
var numpoints = parseInt(distance / 40);
if (numpoints < 4) {
numpoints = 4;
}
if (numpoints > 6) {
numpoints = 6;
}
var averagelength = (distance / numpoints);
var points = new Array();
points.push(p1);
var col1 = 0;
var col2 = 0;
var col3 = 0;
switch (sparkcolour) {
case "blue" :
col1 = 16777215 /* 0xFFFFFF */;
col2 = 14009599 /* 0xD5C4FF */;
col3 = 255;
break;
case "purple" :
col1 = 16777215 /* 0xFFFFFF */;
col2 = 16762111 /* 0xFFC4FF */;
col3 = 14483711 /* 0xDD00FF */;
}
if (sparkwidth > 2) {
targetclip.lineStyle(sparkwidth, col3, 100);
targetclip2.lineStyle(1, col1, 100);
} else {
targetclip2.lineStyle(1, col2, 100);
}
targetclip.moveTo(points[0].x, points[0].y);
targetclip2.moveTo(points[0].x, points[0].y);
var i = 1;
while (i < (numpoints - 1)) {
points.push(new Vector(0, 0));
vSubtract(p2, points[i - 1], tmp);
distance = vMagnitude(tmp);
averagelength = distance / ((numpoints - i) + 1);
var pointlength = (averagelength * (Math.random() + 0.5));
vNormalise(tmp, normal);
vMultiplyWithScalar(normal, pointlength, points[i]);
vRotate2DAroundPoint((Math.random() * 40) - 20, points[i], points[i + 1]);
vAdd(points[i], points[i - 1]);
if (sparkwidth > 2) {
targetclip.lineTo(points[i].x, points[i].y);
if (i == (numpoints - 2)) {
targetclip.lineTo(p2.x, p2.y);
}
}
targetclip2.lineTo(points[i].x, points[i].y);
if (i == (numpoints - 2)) {
targetclip2.lineTo(p2.x, p2.y);
}
i++;
}
points.push(p2);
delete tmp;
delete normal;
delete v1;
}
function drawSparkOld(p1, p2, lineclip) {
if (!sparklinecount) {
sparklinecount = 1;
}
var tmp = new Vector(0, 0);
var v1 = new Vector(0, 0);
vSubtract(p2, p1, v1);
var distance = vMagnitude(v1);
var normal = new Vector(0, 0);
vNormalise(v1, normal);
var numpoints = parseInt(distance / 40);
if (numpoints < 4) {
numpoints = 4;
}
if (numpoints > 6) {
numpoints = 6;
}
var averagelength = (distance / numpoints);
var points = new Array();
points.push(p1);
var i = 1;
while (i < (numpoints - 1)) {
points.push(new Vector(0, 0));
vSubtract(p2, points[i - 1], tmp);
distance = vMagnitude(tmp);
averagelength = distance / ((numpoints - i) + 1);
var pointlength = (averagelength * (Math.random() + 0.5));
vNormalise(tmp, normal);
vMultiplyWithScalar(normal, pointlength, points[i]);
vRotate2DAroundPoint((Math.random() * 40) - 20, points[i], points[i + 1]);
vAdd(points[i], points[i - 1]);
drawSparkLine(points[i - 1], points[i], lineclip);
if (i == (numpoints - 2)) {
drawSparkLine(points[i], p2, lineclip);
}
i++;
}
points.push(p2);
delete tmp;
delete normal;
delete v1;
}
function drawSparkLine(u, v, lineclip) {
if (!sparklinecount) {
sparklinecount = 1;
}
if (!objMovie["sparkline" + sparklinecount]) {
objMovie.attachMovie(lineclip, "sparkline" + sparklinecount, 1200 + sparklinecount);
}
var clip = objMovie["sparkline" + sparklinecount];
var tmp = new Vector(0, 0);
vSubtract(v, u, tmp);
setPosition(clip, u);
clip._rotation = vAngle(tmp);
clip._xscale = vMagnitude(tmp);
clip._yscale = 100;
sparklinecount++;
delete tmp;
}
function clearSparks() {
i = 1;
while (objMovie["sparkline" + i]) {
removeMovieClip(objMovie["sparkline" + i]);
i++;
}
sparklinecount = 0;
}
function clearSpareSparks() {
var i = sparklinecount;
while (objMovie["sparkline" + i]) {
removeMovieClip(objMovie["sparkline" + i]);
i++;
}
}
function MakeParticleSpark(pos, num, shrinkage, clip, colour) {
if ((colour == null) || (colour == "blue")) {
colour = "";
}
if (!num) {
num = 1;
}
if (!clip) {
clip = objMovie;
}
var j = 0;
while (clip["spark" + j]) {
j++;
}
var i = j;
while (i < (j + num)) {
particleObjects.push({});
pobj = particleObjects[particleObjects.length - 1];
clip.attachMovie("Spark" + colour, "spark" + i, 2000 + i);
pobj.Clip = clip["spark" + i];
trace("particle clip = " + pobj.Clip);
pobj.Clip._x = pos.x;
pobj.Clip._y = pos.y;
pobj.Clip._xscale = (Math.random() * 50) + 50;
pobj.Clip._yscale = pobj.Clip._xscale;
pobj.Velocity = new Vector((Math.random() * 10) - 5, Math.random() * -10);
vAdd(pobj.Velocity, localvelocity);
pobj.Spin = 0;
pobj.Gravity = new Vector(0, 1);
pobj.Life = 0;
pobj.LifeExpectancy = 40;
if (!shrinkage) {
pobj.Shrink = 0.85;
} else {
pobj.Shrink = shrinkage;
}
i++;
}
}
function UpdateStrings() {
var i = 0;
while (i < stringObjects.length) {
UpdateString(stringObjects[i]);
i++;
}
}
function MakeString(startpoint, endpoint, numpoints, plength, clip, colour) {
this.StartPoint = startpoint;
this.EndPoint = endpoint;
this.LastStartPoint = new Vector(0, 0);
this.LastEndPoint = new Vector(0, 0);
this.AtRest = false;
this.Points1 = new Array();
this.Points2 = new Array();
this.Velocity = new Array();
this.Angles = new Array();
this.Diffs = new Array();
this.Damping = 0.4;
this.Tightness = 20;
this.Gravity = 80;
this.Speed = 0.025;
this.NumPoints = numpoints;
this.PointLength = plength;
this.Clip = clip.createEmptyMovieClip("stringclip", 900);
this.HighlightAngle = -100;
this.HighlightClip = clip.createEmptyMovieClip("highlight", 1000);
this.ShadowClip = clip.createEmptyMovieClip("shadowclip", 800);
this.ShadowClip._alpha = 30;
if (colour == "red") {
this.StringColour = 6684672 /* 0x660000 */;
this.HighlightColour = 16711680 /* 0xFF0000 */;
this.ShineColour = 16746632 /* 0xFF8888 */;
} else if (colour == "green") {
this.StringColour = 26112;
this.HighlightColour = 47872;
this.ShineColour = 16777215 /* 0xFFFFFF */;
} else if (colour == "yellow") {
this.StringColour = 10053120 /* 0x996600 */;
this.HighlightColour = 16776960 /* 0xFFFF00 */;
this.ShineColour = 16777215 /* 0xFFFFFF */;
}
var diff = new Vector(0, 0);
vSubtract(this.EndPoint, this.StartPoint, diff);
if ((diff.x == 0) && (diff.y == 0)) {
diff.x = 0.1;
diff.y = 0.1;
}
vDivideByScalar(diff, numpoints);
this.Points1[0] = this.StartPoint;
this.Points2[0] = this.StartPoint;
this.Points1[numpoints - 1] = this.EndPoint;
this.Points2[numpoints - 1] = this.EndPoint;
var i = 1;
while (i < (numpoints - 1)) {
this.Points1[i] = new Vector(0, 0);
this.Points2[i] = new Vector(0, 0);
vAdd(this.Points1[i - 1], diff, this.Points1[i]);
vAdd(this.Points2[i - 1], diff, this.Points2[i]);
i++;
}
var i = 1;
while (i < (numpoints - 1)) {
this.Velocity[i] = new Vector(0, 0);
this.Angles[i] = 0;
this.Diffs[i] = new Vector(0, 0);
i++;
}
}
function JoltString(strobj, xvel, yvel) {
i = 1;
while (i < (strobj.NumPoints - 1)) {
strobj.Velocity[i] = new Vector(xvel, yvel);
i++;
}
}
function UpdateString(strobj) {
var vec1 = new Vector(0, 0);
var vec2 = new Vector(0, 0);
var diff = new Vector(0, 0);
var numpoints = strobj.NumPoints;
var Damping = strobj.Damping;
var Tightness = strobj.Tightness;
var Gravity = strobj.Gravity;
var Speed = strobj.Speed;
var Normal_Length = strobj.PointLength;
var stringMovie = strobj.Clip;
var hclip = strobj.HighlightClip;
if ((!AreVectorsEqual(strobj.StartPoint, strobj.LastStartPoint)) || (!AreVectorsEqual(strobj.EndPoint, strobj.LastEndPoint))) {
strobj.AtRest = false;
}
if (strobj.AtRest) {
return(false);
}
strobj.AtRest = true;
vCopy(strobj.StartPoint, strobj.Points1[0]);
vCopy(strobj.EndPoint, strobj.Points1[numpoints - 1]);
var i = 0;
while (i < (numpoints - 1)) {
vec1.x = strobj.Points1[i - 1].x - strobj.Points1[i].x;
vec1.y = strobj.Points1[i - 1].y - strobj.Points1[i].y;
var Magnitude1 = vMagnitude(vec1);
var Extension1 = ((Magnitude1 - Normal_Length) * Tightness);
vec2.x = strobj.Points1[i + 1].x - strobj.Points1[i].x;
vec2.y = strobj.Points1[i + 1].y - strobj.Points1[i].y;
var Magnitude2 = vMagnitude(vec2);
var Extension2 = ((Magnitude2 - Normal_Length) * Tightness);
diff.x = ((vec1.x / Magnitude1) * Extension1) + ((vec2.x / Magnitude2) * Extension2);
diff.y = (((vec1.y / Magnitude1) * Extension1) + ((vec2.y / Magnitude2) * Extension2)) + Gravity;
strobj.Velocity[i].x = (strobj.Velocity[i].x * Damping) + (diff.x * Speed);
strobj.Velocity[i].y = (strobj.Velocity[i].y * Damping) + (diff.y * Speed);
vAdd(strobj.Points1[i], strobj.Velocity[i], strobj.Points2[i]);
if (strobj.Points2[i].y > GROUND) {
strobj.Points2[i].y = GROUND;
strobj.Velocity[i].y = 0;
}
vSubtract(strobj.Points1[i], strobj.Points1[i - 1], strobj.Diffs[i]);
if (!VectorEqualToZero(strobj.Velocity[i], 0.2, true)) {
strobj.AtRest = false;
}
vCopy(strobj.Points2[i], strobj.Points1[i]);
strobj.Angles[i] = vAngle(strobj.Diffs[i]);
i++;
}
stringMovie.clear();
hclip.clear();
var rgb = 6684672;
stringMovie.lineStyle(4, strobj.StringColour, 100);
stringMovie.moveTo(strobj.Points1[0].x, strobj.Points1[0].y);
i = 1;
while (i < numpoints) {
stringMovie.lineTo(strobj.Points1[i].x, strobj.Points1[i].y);
i++;
}
stringMovie.moveTo(strobj.Points1[0].x + offset.x, strobj.Points1[0].y + offset.y);
i = 1;
while (i < numpoints) {
var angle = ((strobj.Angles[i] + 45) % 180);
vNormaliseAngle(angle);
if (angle > 90) {
angle = 180 - angle;
}
if (angle < 0) {
angle = -angle;
}
var brightness = ((90 - angle) / 90);
if (brightness > 0.3) {
var b1 = ((brightness - 0.3) * 1.42857142857143);
stringMovie.lineStyle(2, getHexShade(strobj.StringColour, strobj.HighlightColour, brightness), 100);
stringMovie.moveTo(strobj.Points1[i - 1].x - 0.2, strobj.Points1[i - 1].y - 0.5);
stringMovie.lineTo(strobj.Points1[i].x - 0.2, strobj.Points1[i].y - 0.5);
}
if (brightness > 0.8) {
var b2 = ((brightness - 0.8) * 5);
hclip.lineStyle(0, getHexShade(strobj.HighlightColour, strobj.ShineColour, b2), 100);
hclip.moveTo(strobj.Points1[i - 1].x - 1, strobj.Points1[i - 1].y - 1);
hclip.lineTo(strobj.Points1[i].x - 1, strobj.Points1[i].y - 1);
}
i++;
}
vCopy(strobj.StartPoint, strobj.LastStartPoint);
vCopy(strobj.EndPoint, strobj.LastEndPoint);
}
function VectorEqualToZero(v, acc, reset) {
if ((Math.abs(v.x) < acc) && (Math.abs(v.y) < acc)) {
if (reset) {
v.x = 0;
v.y = 0;
}
return(true);
}
return(false);
}
function getRGB(r, g, b) {
if ((isNaN(r) || (isNaN(g))) || (isNaN(b))) {
return(-1);
}
r = ((r <= 0) ? 0 : (((r >= 255) ? 255 : (Math.round(r)))));
g = ((g <= 0) ? 0 : (((g >= 255) ? 255 : (Math.round(g)))));
b = ((b <= 0) ? 0 : (((b >= 255) ? 255 : (Math.round(b)))));
return(((r << 16) | (g << 8)) | b);
}
function getShade(r1, g1, b1, r2, g2, b2, difference) {
var r3 = (((r2 - r1) * difference) + r1);
var g3 = (((g2 - g1) * difference) + g1);
var b3 = (((b2 - b1) * difference) + b1);
return(getRGB(r3, g3, b3));
}
function getHexShade(hex1, hex2, difference) {
var r1 = ((hex1 & 16711680) >> 16);
var g1 = ((hex1 & 65280) >> 8);
var b1 = (hex1 & 255);
var r2 = ((hex2 & 16711680) >> 16);
var g2 = ((hex2 & 65280) >> 8);
var b2 = (hex2 & 255);
var r3 = (((r2 - r1) * difference) + r1);
var g3 = (((g2 - g1) * difference) + g1);
var b3 = (((b2 - b1) * difference) + b1);
return(getRGB(r3, g3, b3));
}
function InitScene(scenenumber, level) {
switch (scenenumber) {
case 1 :
InitCruiserScene(level);
break;
case 2 :
InitGunScene(level);
break;
case 3 :
InitHoverboardScene(level);
break;
case 4 :
InitScorpionScene(level);
break;
case 5 :
InitDarkEcoScene(level);
break;
case 6 :
InitJailScene(level);
}
if (scenenumber <= 6) {
objMovie.onEnterFrame = function () {
FrameMasterFunction();
};
objMovie.onMouseDown = function () {
trace((("mouse down - " + objMovie._xmouse) + " ") + _root._xmouse);
var j = 0;
while (j < bodyObjects.length) {
if (((bodyObjects[j].State != DISABLED) && (bodyObjects[j].State != IGNORE)) && (bodyObjects[j].Clip.hitTest(MouseVector.x, MouseVector.y, true) | bodyObjects[j].Clip.hitTest(_root._xmouse, _root._ymouse, true))) {
var obj = bodyObjects[j];
if (obj.State == BONED) {
obj.Bone.Skeleton.DragBone = obj.Bone;
vSubtract(obj.Bone.Point1, MouseVector, obj.Bone.Skeleton.DragBoneOffset);
} else if (obj.State != IGNORE) {
MakePivot(obj, MouseVector, GLOBAL, MOUSEDRAG);
if (obj.State == ATTACHED) {
DetachObject(obj, true);
}
obj.State = ACTIVE;
}
bodyObjects[j].MouseClick();
return;
}
j++;
}
};
objMovie.onMouseUp = function () {
var i = 0;
while (i < skeletonObjects.length) {
if (skeletonObjects[i].DragBone) {
skeletonObjects[i].DragBone = false;
UpdateMouseSmoothVelocity();
vDivideByScalar(MouseSmoothVelocity, FRAMERATE * 4, skeletonObjects[i].Velocity);
}
i++;
}
var i = 0;
while (i < pivotObjects.length) {
if (pivotObjects[i].Type == MOUSEDRAG) {
UpdateMouseSmoothVelocity();
vDivideByScalar(MouseSmoothVelocity, FRAMERATE * 4, pivotObjects[i].Obj.Velocity);
pivotObjects.splice(i, 1);
i--;
}
i++;
}
};
}
}
function ResetScene() {
trace("reset scene");
objMovie.onEnterFrame = null;
if (HoverQuiet) {
HoverQuiet.stop();
HoverMid.stop();
HoverLoud.stop();
delete HoverQuiet;
delete HoverMid;
delete HoverLoud;
}
while (bodyObjects.length > 0) {
delete eval (bodyObjects.pop());
}
while (particleObjects.length > 0) {
var pobj = particleObjects.pop();
pobj.Clip._visible = false;
removeMovieClip(pobj.Clip);
delete pobj;
}
while (pivotObjects.length > 0) {
delete eval (pivotObjects.pop());
}
while (skeletonObjects.length > 0) {
delete eval (skeletonObjects.pop());
}
while (stringObjects.length > 0) {
delete eval (stringObjects.pop());
}
while (sparkObjects.length > 0) {
delete eval (sparkObjects.pop());
}
while (timeOuts.length > 0) {
delete eval (timeOuts.pop());
}
FirstTime = true;
frameFunction = null;
preFrameFunction = null;
}
function SetPDATimer(timer) {
timeOuts.push({});
var timeout = timeOuts[timeOuts.length - 1];
timeout.Func = function () {
ShowPDA(currentSwf);
};
timeout.Timer = timer;
}
play();
Color.prototype.setTint = function (col, percent, resetMode) {
if (isNaN(col) || (isNaN(percent))) {
return(undefined);
}
col = ((col <= 0) ? 0 : (((col >= 16777215) ? 16777215 : (Math.round(col)))));
percent = ((percent <= 0) ? 0 : (((percent >= 100) ? 1 : (percent / 100))));
if ((resetMode == undefined) || ((resetMode != true) && (resetMode != false))) {
resetMode = true;
}
var trans = this.getTransform();
if (resetMode) {
with (trans) {
ra = (ga = (ba = 100));
rb = (gb = (bb = 0));
}
}
with (trans) {
ra = ra - (ra * percent);
ga = ga - (ga * percent);
ba = ba - (ba * percent);
rb = rb + ((((col & 16711680) >> 16) - rb) * percent);
gb = gb + ((((col & 65280) >> 8) - gb) * percent);
bb = bb + (((col & 255) - bb) * percent);
}
this.setTransform(trans);
};
Color.prototype.resetBrightness = function () {
var trans = this.getTransform();
with (trans) {
ra = (ga = (ba = 100));
rb = (gb = (bb = 0));
}
this.setTransform(trans);
};
Color.prototype.setBrightness = function (value, resetMode) {
if (isNaN(value)) {
return(undefined);
}
value = ((value <= -100) ? -100 : (((value >= 100) ? 100 : (value))));
if ((resetMode == undefined) || ((resetMode != true) && (resetMode != false))) {
resetMode = true;
}
var trans = this.getTransform();
if (resetMode) {
with (trans) {
ra = (ga = (ba = 100));
rb = (gb = (bb = 0));
}
}
var percent = (Math.abs(value) / 100);
var brightnessColor = ((value > 0) ? 255 : 0);
with (trans) {
ra = ra - (ra * percent);
ga = ga - (ga * percent);
ba = ba - (ba * percent);
rb = rb + ((brightnessColor - rb) * percent);
gb = gb + ((brightnessColor - gb) * percent);
bb = bb + ((brightnessColor - bb) * percent);
}
this.setTransform(trans);
};
Color.prototype.negative = function () {
var trans = this.getTransform();
with (trans) {
ra = ra * -1;
ga = ga * -1;
ba = ba * -1;
rb = 255 - rb;
gb = 255 - gb;
bb = 255 - bb;
}
this.setTransform(trans);
};
Color.prototype.reset = function () {
this.setTransform({ra:100, ga:100, ba:100, aa:100, rb:0, gb:0, bb:0, ab:0});
};
Color.getColor = function (r, g, b) {
if ((isNaN(r) || (isNaN(g))) || (isNaN(b))) {
return(-1);
}
r = ((r <= 0) ? 0 : (((r >= 255) ? 255 : (Math.round(r)))));
g = ((g <= 0) ? 0 : (((g >= 255) ? 255 : (Math.round(g)))));
b = ((b <= 0) ? 0 : (((b >= 255) ? 255 : (Math.round(b)))));
return(((r << 16) | (g << 8)) | b);
};
TWOPI = (Math.PI*2);
InitConstants();
InitVars();
InitLookups(5);
Frame 3
function InitJailScene(level) {
objMovie = level.objMovieJail;
InitBodies();
DarkEco1Suck = new Sound(objMovie._parent);
DarkEco1Suck.attachSound("DarkEco1-Suck");
DarkEco2Absorb = new Sound(objMovie._parent);
DarkEco2Absorb.attachSound("DarkEco2-Absorb");
bodyObjects[0].Ground = 340;
bodyObjects[1].Ground = 340;
bodyObjects[2].Ground = 340;
objMovie.jakanim.progress = 0;
var jakpos = new Vector(375, 200);
var diff = new Vector(0, 0);
frameFunction = function () {
var i = 0;
while (i <= 3) {
var obj = bodyObjects[i];
if ((obj.State != DISABLED) && (obj.State != ATREST)) {
vSubtract(jakpos, obj.Position, diff);
var distance = vMagnitude(diff);
if (distance < 150) {
vNormalise(diff);
vMultiplyWithScalar(diff, 150);
diff.y = diff.y - (GRAVITY / 4);
vAdd(obj.Velocity, diff);
if ((!obj.Sucked) && (!IsMouseDragging(obj))) {
obj.Sucked = true;
DarkEco1Suck.start();
}
}
if (distance < 25) {
obj.State = DISABLED;
obj.Clip._x = jakpos.x;
obj.Clip._y = jakpos.y;
obj.Clip.anim.play();
objMovie.jakanim.progress++;
objMovie.jakanim.play();
objMovie.jakanim.jak.play();
var j = 0;
while (j < 5) {
var startpos = new Vector(0, 0);
vAdd(jakpos, new Vector((Math.random() * 30) - 15, (Math.random() * 60) - 40), startpos);
MakeSpark(startpos, new Vector(jakpos.x + ((Math.random() * 400) - 200), jakpos.y + ((Math.random() * 400) - 200)), 3, j, "purple", 0.75);
j++;
}
DarkEco2Absorb.start();
trace("jakanim progress = " + objMovie.jakanim.progress);
if (objMovie.jakanim.progress == 3) {
timeOuts.push({});
var timeout = timeOuts[timeOuts.length - 1];
timeout.Func = function () {
nextSwf = 10;
objMovie._parent.nextFrame();
trace("chinup game");
};
timeout.Timer = 50;
}
}
}
i++;
}
};
}
function InitDarkEcoScene(level) {
objMovie = level.objMovieDarkEco;
InitBodies();
DarkEco1Suck = new Sound(objMovie._parent);
DarkEco1Suck.attachSound("DarkEco1-Suck");
DarkEco2Absorb = new Sound(objMovie._parent);
DarkEco2Absorb.attachSound("DarkEco2-Absorb");
objMovie.plant.progress = 0;
var plantpos = new Vector(0, 0);
var diff = new Vector(0, 0);
getPosition(objMovie.plant, plantpos);
plantpos.y = plantpos.y - 30;
frameFunction = function () {
var i = 0;
while (i <= 3) {
var obj = bodyObjects[i];
if ((obj.State != DISABLED) && (obj.State != ATREST)) {
vSubtract(plantpos, obj.Position, diff);
var distance = vMagnitude(diff);
if (distance < 150) {
vNormalise(diff);
vMultiplyWithScalar(diff, 150);
diff.y = diff.y - (GRAVITY / 4);
vAdd(obj.Velocity, diff);
if ((!obj.Sucked) && (!IsMouseDragging(obj))) {
obj.Sucked = true;
DarkEco1Suck.start();
}
}
if (distance < 25) {
obj.State = DISABLED;
obj.Clip._x = plantpos.x;
obj.Clip._y = plantpos.y;
obj.Clip.anim.play();
if (obj.Clip.getDepth() > objMovie.plant.getDepth()) {
obj.Clip.swapDepths(objMovie.plant);
}
objMovie.plant.progress++;
objMovie.plant.play();
var j = 0;
while (j < 10) {
var startpos = new Vector(0, 0);
while (!objMovie.plant.hitTest(startpos.x, startpos.y, true)) {
vAdd(plantpos, new Vector((Math.random() * 30) - 15, (Math.random() * 60) - 40), startpos);
}
MakeSpark(startpos, new Vector(plantpos.x + ((Math.random() * 400) - 200), GROUND - (Math.random() * 30)), 3, 5 + (j * 1.5), "purple", 0.75);
j++;
}
DarkEco2Absorb.start();
if (objMovie.plant.progress == 4) {
SetPDATimer(200);
}
}
}
i++;
}
};
}
function InitCruiserScene(level) {
objMovie = level.objMovieCruiser;
InitBodies();
objMovie.cruiser.SoundTarget = this;
CruiserHovering = new Sound(objMovie._parent);
CruiserHovering.attachSound("CruiserHovering");
CruiserMovingOff = new Sound(objMovie._parent);
CruiserMovingOff.attachSound("CruiserMovingOff");
CruiserRising = new Sound(objMovie._parent);
CruiserRising.attachSound("CruiserRising");
CruiserStringExpel = new Sound(objMovie._parent);
CruiserStringExpel.attachSound("CruiserStringExpel");
CruiserCrackle = new Sound(objMovie._parent);
CruiserCrackle.attachSound("CruiserCrackle");
CruiserStringAttach = new Sound(objMovie._parent);
CruiserStringAttach.attachSound("CruiserStringAttach");
bodyObjects[0].Inertia = Infinity;
bodyObjects[1].Inertia = Infinity;
bodyObjects[2].Inertia = Infinity;
DisableBody(bodyObjects[0]);
DisableBody(bodyObjects[1]);
DisableBody(bodyObjects[2]);
objMovie.point1._visible = false;
objMovie.connect1._visible = false;
objMovie.connect2._visible = false;
objMovie.connect3._visible = false;
objMovie.cruiser.connectpoints.connect1._visible = false;
objMovie.cruiser.connectpoints.connect2._visible = false;
objMovie.cruiser.connectpoints.connect3._visible = false;
objMovie.nipple0._visible = false;
objMovie.nipple1._visible = false;
objMovie.nipple2._visible = false;
ConnectCount = 0;
objMovie.battery.onMouseDown = function () {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
NewString();
}
};
preFrameFunction = function () {
MakeSmoke();
UpdateConnectPoints();
};
frameFunction = function () {
var i = 0;
while (i < stringObjects.length) {
var strobj = stringObjects[i];
setPosition(objMovie["nipple" + i], strobj.StartPoint, strobj.Angles[1]);
i++;
}
CheckForConnections();
};
}
function MakeSmoke() {
var i = 1;
while (objMovie.cruiser["smoke" + i]) {
var clip = objMovie.cruiser["smoke" + i];
clip._visible = false;
clip._visible = false;
var j = 0;
while (objMovie["smokepart" + j]) {
j++;
}
particleObjects.push({});
pobj = particleObjects[particleObjects.length - 1];
objMovie.attachMovie("Smoke", "smokepart" + j, 1000 + j);
pobj.Clip = objMovie["smokepart" + j];
var pos = new Vector(clip.source._x, clip.source._y);
vAdd(pos, new Vector(clip._x, clip._y));
vMultiplyWithScalar(pos, objMovie.cruiser._xscale / 100);
vAdd(pos, new Vector(objMovie.cruiser._x, objMovie.cruiser._y));
pobj.Clip._x = pos.x;
pobj.Clip._y = pos.y;
pobj.Clip._xscale = clip._yscale * (objMovie.cruiser._xscale / 100);
pobj.Clip._yscale = pobj.Clip._xscale;
pobj.Clip._alpha = (Math.random() * 20) + 30;
pobj.Clip._rotation = Math.random() * 360;
pobj.Velocity = new Vector((clip._xscale / 150) * ((Math.random() / 2) + 0.5), 0);
vRotate2D(clip._rotation, pobj.Velocity);
pobj.Spin = (Math.random() * 6) - 3;
pobj.Gravity = new Vector(0, 0);
pobj.Life = 0;
pobj.LifeExpectancy = 20;
pobj.Shrink = 1 + (Math.random() / 10);
pobj.Fade = 0.8 + (Math.random() / 10);
i++;
}
}
function NewString() {
if (ConnectCount > 2) {
return(false);
}
CruiserStringExpel.start();
if (stringObjects.length == 0) {
var pstart = new Vector(objMovie.point1._x, objMovie.point1._y);
vCopy(pstart, bodyObjects[0].Position);
EnableBody(bodyObjects[0]);
bodyObjects[0].Velocity.x = 400;
bodyObjects[0].Velocity.y = -200;
bodyObjects[0].State = ACTIVE;
objMovie.nipple0._visible = true;
stringObjects.push(new MakeString(bodyObjects[0].Position, pstart, 10, 6, objMovie.stringMovie, "red"));
JoltString(stringObjects[stringObjects.length - 1], 10, -10);
} else if (stringObjects.length == 1) {
var pstart2 = new Vector(objMovie.point1._x, objMovie.point1._y);
vCopy(pstart2, bodyObjects[1].Position);
EnableBody(bodyObjects[1]);
bodyObjects[1].Velocity.x = 300;
bodyObjects[1].Velocity.y = -200;
bodyObjects[1].State = ACTIVE;
stringObjects.push(new MakeString(bodyObjects[1].Position, pstart2, 10, 6, objMovie.stringMovie2, "yellow"));
JoltString(stringObjects[stringObjects.length - 1], 10, -10);
objMovie.nipple1._visible = true;
} else if (stringObjects.length == 2) {
var pstart3 = new Vector(objMovie.point1._x, objMovie.point1._y);
vCopy(pstart3, bodyObjects[2].Position);
EnableBody(bodyObjects[2]);
bodyObjects[2].Velocity.x = 200;
bodyObjects[2].Velocity.y = -200;
bodyObjects[2].State = ACTIVE;
stringObjects.push(new MakeString(bodyObjects[2].Position, pstart3, 10, 6, objMovie.stringMovie3, "green"));
JoltString(stringObjects[stringObjects.length - 1], 10, -10);
objMovie.nipple2._visible = true;
}
}
function CheckForConnections() {
ClearSparks();
var i = 0;
while (i < 3) {
var point = new Vector(objMovie["connect" + (i + 1)]._x, objMovie["connect" + (i + 1)]._y);
if (IsMouseDragging(bodyObjects[i]) && (bodyObjects[i].State != IGNORE)) {
var obj = bodyObjects[i];
var diff = new Vector(0, 0);
vSubtract(obj.Position, point, diff);
distance = vMagnitude(diff);
if (distance < 10) {
vCopy(point, obj.Position);
obj.State = IGNORE;
pivotObjects = new Array();
CruiserStringAttach.start();
setBodyPosition(bodyObjects[i]);
MakeParticleSpark(point, 20, 0.7);
JoltString(stringObjects[i], 0, -50);
if (!ConnectCount) {
ConnectCount = 1;
} else {
ConnectCount++;
}
objMovie["nipple" + i]._visible = false;
objMovie.cruiser.connectpoints["socket" + i].gotoAndPlay(2);
if (ConnectCount < 3) {
if (!objMovie.cruiser.progress) {
objMovie.cruiser.progress = 0;
}
objMovie.cruiser.progress++;
objMovie.cruiser.play();
} else {
timeOuts.push({});
var timeout = timeOuts[timeOuts.length - 1];
timeout.Func = function () {
ExplodeString(stringObjects.pop());
bodyObjects[0].clip._visible = false;
DisableBody(bodyObjects[0]);
CruiserCrackle.start();
};
timeout.Timer = 20;
timeOuts.push({});
var timeout = timeOuts[timeOuts.length - 1];
timeout.Func = function () {
ExplodeString(stringObjects.pop());
bodyObjects[1].clip._visible = false;
DisableBody(bodyObjects[1]);
CruiserCrackle.start();
};
timeout.Timer = 25;
timeOuts.push({});
var timeout = timeOuts[timeOuts.length - 1];
timeout.Func = function () {
ExplodeString(stringObjects.pop());
objMovie.cruiser.progress++;
objMovie.cruiser.play();
bodyObjects[0].clip._visible = false;
DisableBody(bodyObjects[0]);
CruiserCrackle.start();
};
timeout.Timer = 30;
SetPDATimer(160);
}
} else if (distance < 60) {
objpos = obj.Position;
var randomfactor = ((75 - distance) / 50);
if (distance < 30) {
randomfactor = 0.5;
}
if (Math.random() < randomfactor) {
if (Math.random() < 0.3) {
JoltString(stringObjects[i], 0, -20);
}
MakeSpark(objpos, point, 1, 0, "blue", 0.7, null, true);
}
}
} else if (bodyObjects[i].State == IGNORE) {
bodyObjects[i].Position.x = point.x;
bodyObjects[i].Position.y = point.y;
setBodyPosition(bodyObjects[i]);
}
i++;
}
}
function ExplodeString(strobj) {
i = 1;
while (i < (strobj.NumPoints - 1)) {
MakeSpark(strobj.Points1[i - 1], strobj.Points1[i], 3, i / 3, "blue", 0.3);
i++;
}
timeOuts.push({});
var timeout = timeOuts[timeOuts.length - 1];
timeout.Func = function () {
ClearString(strobj);
};
timeout.Timer = 5;
}
function ClearString(strobj) {
strobj.Clip.clear();
strobj.HighlightClip.clear();
strobj.ShadowClip.clear();
delete strobj;
}
function UpdateConnectPoints() {
var i = 0;
while (i < 3) {
var point = new Vector(objMovie.cruiser.connectpoints["connect" + (i + 1)]._x, objMovie.cruiser.connectpoints["connect" + (i + 1)]._y);
objMovie.cruiser.connectpoints.localToGlobal(point);
vAdd(point, new Vector(objMovie._x, objMovie._y));
objMovie["connect" + (i + 1)]._y = point.y;
objMovie["connect" + (i + 1)]._x = point.x;
i++;
}
}
function InitHoverboardScene(level) {
objMovie = level.objMovieHoverboard;
InitBodies();
objMovie._parent.createEmptyMovieClip("hoversound1", 3004);
objMovie._parent.createEmptyMovieClip("hoversound2", 3005);
objMovie._parent.createEmptyMovieClip("hoversound3", 3006);
HoverQuiet = new Sound(objMovie._parent.hoversound1);
HoverQuiet.attachSound("HoverEngine1");
HoverQuiet.start(0, 100000);
HoverQuiet.setVolume(0);
HoverMid = new Sound(objMovie._parent.hoversound2);
HoverMid.attachSound("HoverEngine2");
HoverMid.start(0, 100000);
HoverMid.setVolume(0);
HoverLoud = new Sound(objMovie._parent.hoversound3);
HoverLoud.attachSound("HoverEngine3");
HoverLoud.start(0, 100000);
HoverLoud.setVolume(0);
HoverCrash = new Sound(objMovie._parent.hoversound3);
HoverCrash.attachSound("HoverboardCrash");
trace("initialising");
var i = 2;
while (i < bodyObjects.length) {
bodyObjects[i].ExplodeSound = new Sound(bodyObjects[i].Clip);
bodyObjects[i].ExplodeSound.attachSound("BoxSmash");
i++;
}
springObjects = new Array();
attachedObjects = new Array();
getFixedSprings();
DisableBody(bodyObjects[0]);
AddTopsAndBottoms();
bodyObjects[1].MouseClick = function () {
HoverStart();
};
bodyObjects[1].Inertia = Infinity;
bodyObjects[1].SelfRighting = true;
bodyObjects[2].Inertia = Infinity;
bodyObjects[3].Inertia = Infinity;
bodyObjects[4].Inertia = Infinity;
bodyObjects[5].Inertia = Infinity;
bodyObjects[6].Inertia = Infinity;
bodyObjects[7].Inertia = Infinity;
bodyObjects[8].Inertia = Infinity;
bodyObjects[2].SelfRighting = true;
bodyObjects[3].SelfRighting = true;
bodyObjects[4].SelfRighting = true;
bodyObjects[5].SelfRighting = true;
bodyObjects[6].SelfRighting = true;
bodyObjects[7].SelfRighting = true;
bodyObjects[8].SelfRighting = true;
bodyObjects[2].Ground = 369;
bodyObjects[3].Ground = 361;
bodyObjects[4].Ground = 372;
bodyObjects[5].Ground = 366;
bodyObjects[6].Ground = 370;
bodyObjects[7].Ground = 353;
bodyObjects[8].Ground = true;
collEdge = null;
preFrameFunction = function () {
objMovie.lineclip.clear();
if (bodyObjects[1].State == IGNORE) {
UpdateFixedSprings();
}
collEdge.Update();
if (SHOWOPTIMISE) {
var timer = getTimer();
}
var i = 2;
while (i < bodyObjects.length) {
var obj = bodyObjects[i];
if ((obj.State == ACTIVE) && (!IsMouseDragging(obj))) {
if (collEdge) {
var bottom = obj.Bottom;
var top = collEdge;
vCopy(bottom.Obj.NewPosition, bottom.Obj.Position);
bottom.Update();
var nextypos = (bottom.y + ((bottom.Obj.Velocity.y + GRAVITY) * FRAMERATE));
if (((top.y - (top.Obj.Velocity.y * FRAMERATE)) >= (bottom.y - 1)) && (top.y <= (nextypos + 1))) {
if (!((bottom.x2 < top.x1) || (bottom.x1 > top.x2))) {
bottom.Obj.Position.y = bottom.Obj.Position.y + (top.y - bottom.y);
bottom.y = top.y;
setBodyPosition(bottom.Obj);
var x1 = bottom.x1;
var x2 = bottom.x2;
if (top.x1 > x1) {
x1 = top.x1;
}
if (top.x2 < x2) {
x2 = top.x2;
}
bottom.Obj.Clip.swapDepths(top.Obj.Clip.getDepth() + 1);
AttachObject(top.Obj, bottom.Obj, new Vector(x1, bottom.y), new Vector(x2, bottom.y));
}
}
}
}
i++;
}
if (SHOWOPTIMISE) {
trace(("collision checks - " + (getTimer() - timer)) + " ");
}
};
}
function HoverStart() {
var smallhover = bodyObjects[0];
DisableBody(smallhover);
var hoverboard = bodyObjects[1];
EnableBody(hoverboard);
collEdge = hoverboard.Top;
hoverboard.State = IGNORE;
UpdateAllGlobalPositions(hoverboard);
springObjects[0].CurrentPosition.y = springObjects[0].CurrentPosition.y + 30;
springObjects[1].CurrentPosition.y = springObjects[1].CurrentPosition.y + 30;
setBodyPosition(hoverboard);
}
function AttachObject(master, slave, point1, point2) {
var split1 = 0;
var split2 = 0;
var ox = slave.Position.x;
var x1 = (springObjects[0].CurrentPosition.x + 20);
var x2 = (springObjects[1].CurrentPosition.x - 20);
if (ox < x1) {
split1 = 1;
split2 = 0;
} else if (ox > x2) {
split1 = 0;
split2 = 1;
} else {
var diff = (x2 - x1);
var offset = (ox - x1);
split2 = offset / diff;
split1 = 1 - split2;
}
var weight = slave.Mass;
var impact = ((slave.Mass * slave.Velocity.y) * FRAMERATE);
var force1 = (weight * split1);
var force2 = (weight * split2);
springObjects[0].TempForce.y = springObjects[0].TempForce.y + (impact * split1);
springObjects[1].TempForce.y = springObjects[1].TempForce.y + (impact * split2);
if ((slave.Position.x > point1.x) && (slave.Position.x < point2.x)) {
collEdge = slave.top;
slave.bottom.Update();
collEdge.Update();
springObjects[1].Force.y = springObjects[1].Force.y + force2;
springObjects[0].Force.y = springObjects[0].Force.y + force1;
attachedObjects.push(new AttachedObject(master, slave, point1, point2, force1, force2));
slave.State = ATTACHED;
slave.Velocity.x = 0;
slave.Velocity.y = 0;
slave.Rotation = 0;
} else {
springObjects[1].TempForce.y = springObjects[1].TempForce.y + force2;
springObjects[0].TempForce.y = springObjects[0].TempForce.y + force1;
slave.Velocity.y = -slave.Velocity.y;
if (slave.Rotation > 180) {
slave.Rotation = slave.Rotation - 360;
}
if (slave.Position.x < point1.x) {
slave.Velocity.x = -100;
if (slave.Rotation > -20) {
slave.Rotation = -20;
}
} else {
slave.Velocity.x = 100;
if (slave.Rotation < 20) {
slave.Rotation = 20;
}
}
}
}
function AttachedObject(master, slave, point1, point2, force1, force2) {
this.Master = master;
this.Slave = slave;
this.RelativeRotation = 0;
this.RelativePosition = new Vector(0, 0);
vSubtract(slave.Position, master.Position, this.RelativePosition);
this.Point1 = new Vector(0, 0);
this.Point2 = new Vector(0, 0);
vSubtract(point1, slave.Position, this.Point1);
vSubtract(point2, slave.Position, this.Point2);
this.Force1 = force1;
this.Force2 = force2;
}
function DetachObject(obj, mousepickup) {
var objnum = 0;
while (attachedObjects[objnum].Slave != obj) {
objnum++;
}
collEdge = attachedObjects[objnum].Master.top;
var i = (attachedObjects.length - 1);
while (i >= objnum) {
var attach = attachedObjects.pop();
attach.Slave.State = ACTIVE;
if (mousepickup) {
attach.Slave.Velocity.y = -50 * i;
}
ResetPoints(attach.Slave);
UpdateAllGlobalPositions(attach.Slave);
attach.Slave.Bottom.Update();
attach.Slave.Clip.lineclip.clear();
attach.Slave.Clip.swapDepths(attach.Slave.Clip.getDepth() + 10);
springObjects[0].Force.y = springObjects[0].Force.y - attach.Force1;
springObjects[1].Force.y = springObjects[1].Force.y - attach.Force2;
delete attach;
i--;
}
}
function UpdateAttachedObjects() {
if (SHOWOPTIMISE) {
var timer = getTimer();
}
if (attachedObjects[0].Master.Changed) {
var relativeposition = new Vector(0, 0);
var i = 0;
while (i < attachedObjects.length) {
var attach = attachedObjects[i];
if (attach.Slave.State != ATTACHED) {
trace("WARNING! Object not attached!!!");
}
var point1global = new Vector(0, 0);
vRotate2D(attach.Slave.Rotation, attach.Point1, point1global);
vAdd(point1global, attach.Slave.Position);
var point2global = new Vector(0, 0);
vRotate2D(attach.Slave.Rotation, attach.Point2, point2global);
vAdd(point2global, attach.Slave.Position);
if (attach.Slave.Position.x < point1global.x) {
attach.RelativeRotation = attach.RelativeRotation - 1;
offset = new Vector(0, 0);
vRotate2DAroundPoint(-1, new Vector(0, 0), attach.Point1, offset);
vRotate2D(attach.RelativeRotation, offset);
vAdd(attach.RelativePosition, offset);
if (attach.Point2.x <= attach.Point1.x) {
attach.Slave.Velocity.x = -100;
attach.Slave.Velocity.y = 0;
vRotate2D(attach.Slave.Rotation, attach.Slave.Velocity);
DetachObject(attach.Slave);
return(false);
}
} else if (attach.Slave.Position.x > point2global.x) {
attach.RelativeRotation = attach.RelativeRotation + 1;
offset = new Vector(0, 0);
vRotate2DAroundPoint(1, new Vector(0, 0), attach.Point2, offset);
vRotate2D(attach.RelativeRotation, offset);
vAdd(attach.RelativePosition, offset);
if (attach.Point2.x <= attach.Point1.x) {
attach.Slave.Velocity.x = 100;
attach.Slave.Velocity.y = 0;
vRotate2D(attach.Slave.Rotation, attach.Slave.Velocity);
DetachObject(attach.Slave);
return(false);
}
}
attach.Slave.Velocity.x = attach.Slave.Rotation / 10;
attach.Slave.Velocity.y = 0;
if (attach.Slave.Velocity.x > 0) {
vSubtract(attach.Point2, attach.Slave.Velocity);
} else {
vSubtract(attach.Point1, attach.Slave.Velocity);
}
vAdd(attach.RelativePosition, attach.Slave.Velocity);
vRotate2D(attach.Slave.Rotation, attach.Slave.Velocity);
setBodyPosition(attach.Slave);
if (SHOWCOLLISIONEDGES) {
attach.Slave.Clip.lineclip.clear();
attach.Slave.Clip.lineclip.lineStyle(1, 16776960, 100);
attach.Slave.Clip.lineclip.moveTo(attach.Point1.x, attach.Point1.y);
attach.Slave.Clip.lineclip.lineTo(attach.Point2.x, attach.Point2.y);
}
vRotate2D(attach.Master.Rotation, attach.RelativePosition, relativeposition);
vAdd(attach.Master.Position, relativeposition, attach.Slave.NewPosition);
attach.Slave.Rotation = attach.Master.Rotation + attach.RelativeRotation;
vSubtract(attach.Slave.NewPosition, attach.Slave.Position, attach.Slave.Velocity);
vDivideByScalar(attach.Slave.Velocity, FRAMERATE);
vCopy(attach.Slave.NewPosition, attach.Slave.Position);
setBodyPosition(attach.Slave);
i++;
}
}
if (SHOWOPTIMISE) {
trace((("update attached bodies - " + (getTimer() - timer)) + " ") + attachedObjects.length);
}
}
function getFixedSprings() {
var i = 0;
while (objMovie["spring" + i]) {
springObjects.push(new ThrusterSpring(objMovie["spring" + i]));
if (!VERTEXVISIBLE) {
objMovie["spring" + i]._visible = false;
}
i++;
}
}
function UpdateFixedSprings() {
if (SHOWOPTIMISE) {
var timer = getTimer();
}
var reactionspeed = 0.1;
var diff = new Vector(0, 0);
var i = 0;
while (i < springObjects.length) {
var spring = springObjects[i];
if ((Math.abs(spring.TempForce.x) > 0) || (Math.abs(spring.TempForce.y) > 0)) {
vMultiplyWithScalar(spring.TempForce, 0.5);
if (Math.abs(spring.TempForce.y) < 0.1) {
spring.TempForce.y = 0;
}
}
vAdd(spring.Force, spring.TempForce, diff);
vSubtract(diff, spring.Reaction);
if ((Math.abs(diff.x) > 0) || (Math.abs(diff.y) > 0)) {
vMultiplyWithScalar(diff, reactionspeed);
vAdd(spring.Reaction, diff);
}
var desiredposition = new Vector(0, 0);
vAdd(spring.Force, spring.TempForce, desiredposition);
vSubtract(desiredposition, spring.Reaction);
vMultiplyWithScalar(desiredposition, 0.05);
vAdd(desiredposition, spring.StartPosition);
var vel = new Vector(0, 0);
vSubtract(desiredposition, spring.CurrentPosition, vel);
vMultiplyWithScalar(vel, 0.1);
vAdd(spring.Velocity, vel);
vMultiplyWithScalar(spring.Velocity, 0.95);
vAdd(spring.CurrentPosition, spring.Velocity);
if (spring.CurrentPosition.y > BOTTOM) {
spring.CurrentPosition.y = BOTTOM;
}
if ((Math.abs(spring.Velocity.x) < 0.1) && (Math.abs(spring.Velocity.y) < 0.1)) {
spring.Velocity.x = 0;
spring.Velocity.y = 0;
spring.Changed = false;
} else {
spring.Changed = true;
setPosition(spring.Clip, spring.CurrentPosition);
}
if ((Math.abs(spring.Force.x) < 0.1) && (Math.abs(spring.Force.y) < 0.1)) {
spring.Force.x = 0;
spring.Force.y = 0;
}
if ((Math.abs(spring.Reaction.x - spring.Force.x) < 0.1) && (Math.abs(spring.Reaction.y - spring.Force.y) < 0.1)) {
spring.Reaction.x = spring.Force.x;
spring.Reaction.y = spring.Force.y;
}
i++;
}
var spring1 = springObjects[0];
var spring2 = springObjects[1];
var hover = bodyObjects[1];
var reaction = (spring1.Reaction.y + spring2.Reaction.y);
var vol1 = Math.round((reaction + 20) / 3);
var vol2 = Math.round((reaction - 200) / 3);
var vol3 = Math.round((reaction - 600) / 3);
if (vol2 < 0) {
vol2 = 0;
}
if (vol3 < 0) {
vol3 = 0;
}
if (vol1 > 100) {
vol1 = 100;
}
if (vol2 > 100) {
vol2 = 100;
}
if (vol3 > 100) {
vol3 = 100;
}
vol1 = (vol1 / 3) + 5;
vol2 = vol2 / 2;
vol3 = (vol3 / 3) + 2;
HoverQuiet.setVolume(vol1);
HoverMid.setVolume(vol2);
HoverLoud.setVolume(vol3);
trace((((("vol1 = " + vol1) + " vol2 = ") + vol2) + " vol3 = ") + vol3);
trace(reaction);
if ((reaction < 1000) && (!HoverOverloaded)) {
if (spring1.Changed || (spring2.Changed)) {
RenderHover();
if (VELOCITYVISIBLE) {
drawLine(hover.Position, hover.Velocity, _root.arrow0);
}
hover.Changed = true;
} else {
hover.Changed = false;
}
MakeHoverGlowParticle((spring1.Reaction.y + spring2.Reaction.y) / 1000);
OverloadHoverTimer = getTimer();
} else {
var movement = ((Math.random() * 2) - 1);
movement = movement * ((getTimer() - OverloadHoverTimer) / 1000);
spring1.CurrentPosition.y = spring1.CurrentPosition.y + movement;
spring2.CurrentPosition.y = spring2.CurrentPosition.y + movement;
RenderHover();
hover.Changed = true;
HoverOverloaded = true;
var horizpos = ((Math.random() * 2) - 1);
horizpos = hover.Position.x + (hover.BoundingCircleRadius * horizpos);
var toppos = new Vector(horizpos, hover.Position.y + 10);
MakeParticleSpark(toppos, 1, null, null, "cyan");
if (Math.random() < 0.4) {
SparkBuzz.start();
SparkBuzz.setVolume(100);
}
MakeHoverGlowParticle(1, true);
MakeHoverGlowParticle(1);
if ((getTimer() - OverloadHoverTimer) > 4000) {
ExplodeOrder = new Array();
var i = 0;
while (i < attachedObjects.length) {
ExplodeOrder.push(attachedObjects[i].Slave);
i++;
}
if (ExplodeOrder.length < 6) {
var i = 2;
while (i < bodyObjects.length) {
if (bodyObjects[i].State != ATTACHED) {
ExplodeOrder.push(bodyObjects[i]);
}
i++;
}
}
DetachObject(attachedObjects[0].slave, true);
HoverQuiet.stop();
HoverMid.stop();
HoverLoud.stop();
bodyObjects[1].State = ATREST;
bodyObjects[1].Clip.gotoAndPlay(2);
HoverCrash.start();
HoverCrash.setVolume(75);
timeOuts.push({});
var timeout = timeOuts[timeOuts.length - 1];
timeout.Func = function () {
ExplodeObject(bodyObjects[1], 0.8, 0.8, true);
ExplodeNext();
};
timeout.Timer = 8;
collEdge = null;
HoverOverloaded = false;
SetPDATimer(100);
}
}
if (SHOWOPTIMISE) {
trace(("updating springs - " + (getTimer() - timer)) + " ");
}
}
function ExplodeNext() {
timeOuts.push({});
var timeout = timeOuts[timeOuts.length - 1];
timeout.Func = function () {
if (ExplodeOrder.length > 0) {
ExplodeObject(ExplodeOrder.shift());
ExplodeNext();
}
};
timeout.Timer = 4;
}
function RenderHover() {
var spring1 = springObjects[0];
var spring2 = springObjects[1];
var hover = bodyObjects[1];
var currvec = new Vector(0, 0);
vSubtract(spring2.CurrentPosition, spring1.CurrentPosition, currvec);
var angle = vAngle(currvec);
hover.Rotation = angle;
var newpos = new Vector(0, 0);
vRotate2D(hover.Rotation, hover.Nodes[3].PositionLocal, newpos);
vSubtract(spring1.CurrentPosition, newpos, newpos);
vSubtract(newpos, hover.Position, hover.Velocity);
vDivideByScalar(hover.Velocity, FRAMERATE);
vCopy(newpos, hover.Position);
setBodyPosition(hover);
}
function MakeHoverGlowParticle(intensity, mad) {
if (!glowcounter) {
glowcounter = 0;
}
glowcounter++;
if (!mad) {
var testfactor = 2;
if ((glowcounter % testfactor) > 0) {
return(false);
}
}
var j = 0;
while (objMovie.GlowClip["hoverglow" + j]) {
j++;
}
var i = j;
objMovie.GlowClip.attachMovie("hoverglow", "hoverglow" + i, 1300 + i);
particleObjects.push({});
pobj = particleObjects[particleObjects.length - 1];
pobj.Clip = objMovie.GlowClip["hoverglow" + i];
pobj.Clip._x = bodyObjects[1].Clip._x;
pobj.Clip._y = bodyObjects[1].Clip._y;
pobj.Clip._xscale = 100;
pobj.Clip._yscale = 80;
pobj.Clip._rotation = bodyObjects[1].Clip._rotation;
pobj.Velocity = new Vector(0, 0);
pobj.Spin = 0;
pobj.Gravity = new Vector(0, 0.3 + (intensity / 4));
vRotate2D(pobj.Clip._rotation, pobj.Gravity);
pobj.Life = 0;
pobj.Ground = GROUND;
if (!mad) {
pobj.Clip._alpha = ((Math.random() * 25) + (intensity * 50)) + 25;
pobj.Fade = 0.8;
pobj.Shrink = 1.03;
pobj.LifeExpectancy = 20;
} else {
pobj.Clip._alpha = 100;
pobj.Fade = 0.8 + ((glowcounter % 2) * 0.01);
pobj.Shrink = 1.04 + ((glowcounter % 2) * 0.02);
pobj.LifeExpectancy = 40;
pobj.Gravity = new Vector(0, -0.5);
}
}
function ThrusterSpring(clip) {
this.StartPosition = new Vector(0, 0);
this.CurrentPosition = new Vector(0, 0);
this.Force = new Vector(0, 0);
this.TempForce = new Vector(0, 0);
this.Reaction = new Vector(0, 0);
this.Velocity = new Vector(0, 0);
this.Clip = clip;
getPosition(clip, this.StartPosition);
vCopy(this.StartPosition, this.CurrentPosition);
}
function CollisionEdge(obj, point1, point2) {
this.Obj = obj;
this.Point1 = point1;
this.Point2 = point2;
this.x1 = point1.PositionGlobal.x;
this.x2 = point2.PositionGlobal.x;
this.y = point1.PositionGlobal.y;
this.Update = function () {
UpdateGlobalPosition(this.Obj, this.Point1);
UpdateGlobalPosition(this.Obj, this.Point2);
this.x1 = point1.PositionGlobal.x;
this.x2 = point2.PositionGlobal.x;
this.y = point1.PositionGlobal.y + ((point2.PositionGlobal.y - point1.PositionGlobal.y) / 2);
if (SHOWCOLLISIONEDGES) {
if (this == collEdge) {
objMovie.lineclip.lineStyle(1, 16711680, 100);
} else {
objMovie.lineclip.lineStyle(1, 255, 100);
}
objMovie.lineclip.moveTo(this.x1, this.y);
objMovie.lineclip.lineTo(this.x2, this.y);
}
};
}
function AddTopsAndBottoms() {
var i = 0;
while (i < bodyObjects.length) {
var obj = bodyObjects[i];
obj.Top = new CollisionEdge(obj, obj.Nodes[0], obj.Nodes[1]);
obj.Bottom = new CollisionEdge(obj, obj.Nodes[3], obj.Nodes[2]);
i++;
}
}
function ExtrudePoints(obj, depth) {
obj.Points3D = new Array();
var i = 0;
while (i < obj.Nodes.length) {
obj.Points3D.push({});
var point3d = obj.Points3D[obj.Points3D.length - 1];
var point = obj.Nodes[i];
point3d.PositionLocal = point.PositionLocal;
point3d.PositionGlobal = new Vector(0, 0);
point3d.RenderPosition = new Vector(0, 0);
point3d.Depth = depth + 50;
i++;
}
Render3DObject(obj);
}
function Update3DObject(obj) {
if ((!obj.Points3D) || (obj.Points3D.length == 0)) {
return(false);
}
var f = 50;
var centrepos = new Vector(300, 150);
var temp = new Vector(0, 0);
UpdateAllGlobalPositions(obj);
var i = 0;
while (i < obj.Points3D.length) {
var point3d = obj.Points3D[i];
vSubtract(point3d.PositionGlobal, centrepos, temp);
point3d.RenderPosition.x = (f * temp.x) / point3d.Depth;
point3d.RenderPosition.y = (f * temp.y) / point3d.Depth;
vAdd(point3d.RenderPosition, centrepos);
i++;
}
}
function Render3DObject(obj) {
var i = 0;
while (i < obj.Points3D.length) {
var next3dpoint = ((i + 1) % obj.Points3D.length);
objMovie.beginFill("0x999999");
objMovie.moveTo(obj.Nodes[i].PositionGlobal.x, obj.Nodes[i].PositionGlobal.y);
objMovie.lineTo(obj.Points3D[i].RenderPosition.x, obj.Points3D[i].RenderPosition.y);
objMovie.lineTo(obj.Points3D[next3dpoint].RenderPosition.x, obj.Points3D[next3dpoint].RenderPosition.y);
objMovie.lineTo(obj.Nodes[next3dpoint].PositionGlobal.x, obj.Nodes[next3dpoint].PositionGlobal.y);
objMovie.endFill();
i++;
}
}
function InitGunScene(level) {
var gunmovie = level;
objMovie = level.objMovieGun;
InitBodies();
frameFunction = function () {
if ((AmmoCount == 4) && (objMovie.GunClip.finished)) {
SetPDATimer(1);
AmmoCount++;
}
};
ammoAttach = new Sound(objMovie._parent);
ammoAttach.attachSound("ammocollect");
boxExplode = new Sound(objMovie._parent);
boxExplode.attachSound("boxsmash");
bodyObjects[0].CollisionFunction = function () {
if (bodyObjects[0].Velocity.y < -220) {
_level0.ExplodeAndShowObject(bodyObjects[0], bodyObjects[4]);
}
};
bodyObjects[1].CollisionFunction = function () {
if (bodyObjects[1].Velocity.y < -220) {
_level0.ExplodeAndShowObject(bodyObjects[1], bodyObjects[5]);
}
};
bodyObjects[2].CollisionFunction = function () {
if (bodyObjects[2].Velocity.y < -220) {
_level0.ExplodeAndShowObject(bodyObjects[2], bodyObjects[6]);
}
};
bodyObjects[3].CollisionFunction = function () {
if (bodyObjects[3].Velocity.y < -220) {
_level0.ExplodeAndShowObject(bodyObjects[3], bodyObjects[7]);
}
};
_level0.DisableBody(bodyObjects[4]);
_level0.DisableBody(bodyObjects[5]);
_level0.DisableBody(bodyObjects[6]);
_level0.DisableBody(bodyObjects[7]);
bodyObjects[0].Inertia = 180;
bodyObjects[1].Inertia = 180;
bodyObjects[2].Inertia = 180;
bodyObjects[3].Inertia = 180;
bodyObjects[0].SelfRighting = true;
bodyObjects[1].SelfRighting = true;
bodyObjects[2].SelfRighting = true;
bodyObjects[3].SelfRighting = true;
bodyObjects[4].Inertia = Infinity;
bodyObjects[5].Inertia = Infinity;
bodyObjects[6].Inertia = Infinity;
bodyObjects[7].Inertia = Infinity;
bodyObjects[0].Ground = 340;
bodyObjects[3].Ground = 340;
objMovie.BoxSmashSound();
bodyObjects[0].ExplodeSound = boxExplode;
bodyObjects[1].ExplodeSound = boxExplode;
bodyObjects[2].ExplodeSound = boxExplode;
bodyObjects[3].ExplodeSound = boxExplode;
AmmoCount = 0;
bodyObjects[4].MouseClick = function () {
if (objMovie.GunClip.finished) {
ammoAttach.start();
objMovie.GunClip.ChangeAmmo(2);
_level0.DisableBody(bodyObjects[4]);
AmmoCount++;
ShowGunText(1);
}
};
bodyObjects[5].MouseClick = function () {
if (objMovie.GunClip.finished) {
ammoAttach.start();
objMovie.GunClip.ChangeAmmo(1);
_level0.DisableBody(bodyObjects[5]);
AmmoCount++;
ShowGunText(2);
}
};
bodyObjects[6].MouseClick = function () {
if (objMovie.GunClip.finished) {
ammoAttach.start();
objMovie.GunClip.ChangeAmmo(3);
_level0.DisableBody(bodyObjects[6]);
AmmoCount++;
ShowGunText(3);
}
};
bodyObjects[7].MouseClick = function () {
if (objMovie.GunClip.finished) {
ammoAttach.start();
objMovie.GunClip.ChangeAmmo(0);
_level0.DisableBody(bodyObjects[7]);
AmmoCount++;
ShowGunText(4);
}
};
}
function ShowGunText(num) {
particleObjects.push({});
pobj = particleObjects[particleObjects.length - 1];
pobj.Clip = objMovie._parent["text" + num];
trace("particle clip = " + pobj.Clip);
pobj.Clip._x = 300;
pobj.Clip._y = 50;
pobj.Clip._xscale = 100;
pobj.Clip._yscale = 100;
pobj.Velocity = new Vector(0, 0);
pobj.Spin = 0;
pobj.Gravity = new Vector(0, 0);
pobj.Life = 0;
pobj.LifeExpectancy = 80;
pobj.Shrink = 1.02;
pobj.Fade = 0.95;
pobj.Delay = 15;
}
function InitScorpionScene(level) {
objMovie = level.objMovieScorpion;
Flipped = 0;
ScorpionDropCount = 0;
InitBodies();
skeletonObjects.push(new getPointsAndBones("c"));
bodyObjects[5].Clip.anim.stop();
BoneAttach = new Sound(objMovie._parent);
BoneAttach.attachSound("Spark1");
ChainSpark = new Sound(objMovie._parent);
ChainSpark.attachSound("ScorpionSpark");
bodyObjects[5].Clip.anim.point._visible = false;
skeletonObjects[0].DropFunction = function () {
ChainSpark.start();
ChainSpark.setVolume(50);
if (NextLinked) {
SparkBones(NextLinked.Bone.NextBone);
} else {
if (!ScorpionDropCount) {
ScorpionDropCount = 1;
bodyObjects[4].Clip.anim.play();
} else {
ScorpionDropCount++;
}
if (ScorpionDropCount == 3) {
bodyObjects[5].Clip.anim.play();
skeletonObjects[0].Left = -200;
}
SparkBones(bodyObjects[0].Bone);
}
};
skeletonObjects[0].GroundBone = bodyObjects[5].Bone;
skeletonObjects[0].Ground = skeletonObjects[0].Ground - 40;
skeletonObjects[0].GroundBone.Changed = true;
skeletonObjects[0].Left = 50;
var k = 0;
while (k < (bodyObjects.length - 1)) {
bodyObjects[k].State = ATREST;
bodyObjects[k].Inertia = 180;
k++;
}
bodyObjects[4].Inertia = Infinity;
SparkCount = 5;
NextLinked = bodyObjects[4];
preFrameFunction = function () {
if (ScorpionDropCount >= 3) {
var skeleton = skeletonObjects[0];
if ((skeleton.GroundBone.Point1.x < -100) && (!Flipped)) {
Flipped = 1;
objMovie._xscale = -75;
objMovie._yscale = 75;
objMovie._x = -200;
objMovie._y = 42;
skeleton.Left = -1200;
skeleton.Velocity.x = -250;
skeleton.Right = 200;
MakeParticleSpark(new Vector(300, -1200), 30);
MakeParticleSpark(new Vector(300, 200), 30);
}
if ((skeleton.GroundBone.Point1.x <= -1200) && (Flipped == 1)) {
Flipped = 2;
objMovie._xscale = 35;
objMovie._yscale = 35;
objMovie._x = 1100;
objMovie._y = 120;
skeleton.Left = -3300;
skeleton.Velocity.x = -250;
skeleton.Right = -1200;
MakeParticleSpark(new Vector(300, -1000), 30);
MakeParticleSpark(new Vector(300, -2400), 30);
}
if ((skeleton.GroundBone.Point1.x <= -3300) && (Flipped == 2)) {
SetPDATimer(1);
Flipped++;
bodyObjects[5].Clip.anim.stop();
}
if (skeleton.GroundBone.Point2.y >= (skeleton.Ground - 10)) {
skeleton.LastMasterBone = skeleton.GroundBone;
skeleton.Velocity.x = -250;
}
skeleton.LastMasterBone = skeleton.GroundBone;
var animpoint = new Vector(0, 0);
skeleton.GroundBone.Obj.Clip.anim.point._visible = false;
var clip = skeleton.GroundBone.Obj.Clip;
getPosition(clip.anim.point, animpoint);
animpoint.y = animpoint.y + clip.anim._y;
animpoint.y = animpoint.y * (clip._xscale / 100);
animpoint.y = animpoint.y + clip._y;
var bone = skeleton.GroundBone;
bone.Point1.y = animpoint.y;
}
};
frameFunction = function () {
if (NextLinked) {
var objpos = new Vector(0, 0);
vAdd(NextLinked.Bone.ObjStartPoint, NextLinked.Bone.ObjVector, objpos);
vRotate2D(NextLinked.Rotation, objpos);
vAdd(objpos, NextLinked.Position);
var pointpos = NextLinked.Bone.Point2;
var vectorbetween = new Vector(0, 0);
vSubtract(objpos, pointpos, vectorbetween);
var distance = vMagnitude(vectorbetween);
if (distance < 15) {
NextLinked.State = BONED;
NextLinked.Bone.Changed = true;
vCopy(objpos, NextLinked.Bone.Point1);
MakeParticleSpark(pointpos, 20, 0.95);
SparkBones(NextLinked.Bone);
NextLinked = NextLinked.Bone.PrevBone.Obj;
BoneAttach.start();
ChainSpark.start();
ChainSpark.setVolume(50);
} else {
var randomfactor = ((100 - distance) / 500);
if (distance < 30) {
randomfactor = 0.5;
}
if (Math.random() < randomfactor) {
MakeSpark(objpos, pointpos, 2, 0, "blue", 0.5, null, true);
}
}
}
};
}
function SparkBones(bone) {
var counter = 0;
while (bone.NextBone) {
MakeSpark(bone.point1, bone.point2, 3, counter, "blue", 0.2);
MakeSpark(bone.point1, bone.point2, 3, 10 - counter, "blue", 0.2);
counter++;
bone = bone.NextBone;
}
}
Frame 4
function localiseObject(language, URL) {
this.language = language;
this.URL = URL;
}
function createLocalise() {
locationArray = new Array();
locationArray[0] = null;
locationArray[1] = new localiseObject("ge", "http://at.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047394");
locationArray[2] = new localiseObject("du", "http://be.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047378&locale=nl_BE");
locationArray[3] = new localiseObject("fr", "http://be.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047377&locale=fr_BE");
locationArray[4] = new localiseObject("da", "http://dk.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047379");
locationArray[5] = new localiseObject("ge", "http://de.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047382");
locationArray[6] = new localiseObject("sp", "http://es.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047389");
locationArray[7] = new localiseObject("fr", "http://fr.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047381");
locationArray[8] = new localiseObject("en", "http://ie.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047384");
locationArray[9] = new localiseObject("it", "http://it.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047385");
locationArray[10] = new localiseObject("fr", "http://lu.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047386&locale=fr_LU");
locationArray[11] = new localiseObject("ge", "http://lu.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047395&locale=de_LU");
locationArray[12] = new localiseObject("du", "http://nl.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047383");
locationArray[13] = new localiseObject("no", "http://no.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047387");
locationArray[14] = new localiseObject("po", "http://pt.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047388");
locationArray[15] = new localiseObject("ge", "http://ch.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047392&locale=de_CH");
locationArray[16] = new localiseObject("fr", "http://ch.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047391&locale=fr_CH");
locationArray[17] = new localiseObject("fi", "http://fi.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047380");
locationArray[18] = new localiseObject("sw", "http://se.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047390");
locationArray[19] = new localiseObject("it", "http://ch.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047393&locale=it_CH");
locationArray[20] = new localiseObject("en", "http://uk.playstation.com/games/gamesinfo04_game.jhtml?localeTitleId=1047376");
locationArray[21] = new localiseObject("en", "http://au.playstation.com/ps2/games/j/jak2renegade.jhtml");
}
function myHandler(component) {
if (lang.getSelectedItem().data != 0) {
this.language = this.locationArray[lang.getSelectedItem().data].language;
this.URL = this.locationArray[lang.getSelectedItem().data].URL;
trace("URL = " + this.URL);
initSite();
}
}
function MyDebug(dtext) {
if (DebugText) {
_level200.DebugText._visible = true;
_level200.DebugText.text = _level200.DebugText.text + (newline + dtext);
trace(DebugText);
}
}
function createArray() {
textArray = new Array();
var i = 1;
while (i <= totalScenes) {
_root.textArray[i] = new Array();
i++;
}
}
function getLocationText() {
loadVariables (("textFiles/" + this.language) + ".txt", this);
}
function populateArray() {
var m = 1;
while (m <= totalScenes) {
var n = 0;
while (n < 10) {
this.textArray[m][n] = this[(("text" + m) + "_") + n];
n++;
}
m++;
}
}
function loadText(level) {
var i = 0;
while (i <= this.textArray[level].length) {
this[mySharedObj.data.myArray[level].level]["text" + i].textBox.html = true;
this[mySharedObj.data.myArray[level].level]["text" + i].textBox.htmlText = textArray[level][i];
this[mySharedObj.data.myArray[level].level]["text" + i]._visible = false;
i++;
}
}
function createSharedObject() {
mySharedObj = SharedObject.getLocal("sony001");
}
function sceneObject(state, level, levelNo, soundID) {
this.state = state;
this.level = level;
this.levelNo = levelNo;
this.soundID = soundID;
}
function populateEmptyObject() {
if (mySharedObj.data.myArray == undefined) {
myArray = new Array();
myArray[0] = null;
myArray[1] = new sceneObject(2, "_level10", 10, 1);
myArray[2] = new sceneObject(1, "_level20", 20, 2);
myArray[3] = new sceneObject(1, "_level30", 30, 2);
myArray[4] = new sceneObject(1, "_level40", 40, 4);
myArray[5] = new sceneObject(1, "_level50", 50, 5);
myArray[6] = new sceneObject(1, "_level60", 60, 6);
myArray[7] = new sceneObject(1, "_level70", 70, 6);
myArray[8] = new sceneObject(1, "_level80", 80, 6);
myArray[9] = new sceneObject(1, "_level90", 90, 6);
myArray[10] = new sceneObject(1, "_level100", 100, 6);
myArray[11] = new sceneObject(1, "_level110", 110, 1);
mySharedObj.data.myArray = myArray;
}
}
function createNav() {
var i = 1;
while (i <= totalScenes) {
if (mySharedObj.data.myArray[i].state != 1) {
_level200.navbar["button" + i].gotoAndStop(mySharedObj.data.myArray[i].state);
}
i++;
}
}
function updateNav(i, frame) {
if (mySharedObj.data.myArray[i].state != 3) {
mySharedObj.data.myArray[i].state = frame;
createNav();
}
}
function checkLast() {
this.lastSwf = 0;
var i = 1;
while (i <= totalSwfs) {
if (mySharedObj.data.myArray[i].state != 1) {
this.lastSwf = i;
}
i++;
}
}
function loadSwfs(swfNo) {
loadMovieNum (((path + "scene") + swfNo) + ".swf", mySharedObj.data.myArray[swfNo].levelNo);
trace("swfloaded");
}
function checkLoad() {
if ((this[mySharedObj.data.myArray[swfcounter].level].getBytesTotal() > 0) && (this[mySharedObj.data.myArray[swfcounter].level].getBytesLoaded() >= this[mySharedObj.data.myArray[swfcounter].level].getBytesTotal())) {
trace((("swfcounter - " + swfcounter) + "load level - ") + mySharedObj.data.myArray[swfcounter].level);
trace((("bytes loaded = " + this[mySharedObj.data.myArray[swfcounter].level].getBytesLoaded()) + " total bytes - ") + this[mySharedObj.data.myArray[swfcounter].level].getBytesTotal());
MyDebug("swfcounter - " + swfcounter);
this.loadText(swfcounter);
if (swfcounter < this.totalscenes) {
swfcounter = swflist.shift();
} else {
checkLoad = null;
}
this.loadSwfs(swfcounter);
MyDebug("loading swf - " + swfcounter);
}
}
function startOutro(level) {
trace("startOutro = " + level);
this[mySharedObj.data.myArray[level].level].nextFrame();
this[mySharedObj.data.myArray[level].level].complete = true;
}
function changeSwf(newSwf) {
var nextmovie = this["_level" + (newSwf * 10)];
trace((("Next movie #" + newSwf) + " = ") + nextmovie);
if ((newSwf == 1) && (_level200.getBytesLoaded() != _level200.getBytesTotal())) {
nextmovie = false;
}
if ((!nextmovie) || (nextmovie.getBytesLoaded() != nextmovie.getBytesTotal())) {
SwfWaiting = newSwf;
var pframe = Math.round(((8 * nextmovie.getBytesLoaded()) / nextmovie.getBytesTotal()) + 2);
_level200.ProgressAnim.gotoAndStop(pframe);
} else {
if (_level200.ProgressAnim._currentframe != 1) {
_level200.ProgressAnim.gotoAndPlay(11);
}
if (newSwf == 1) {
_level200.gotoAndStop(2);
this.createNav();
}
MyDebug("changing to scene " + newSwf);
this[mySharedObj.data.myArray[newswf].level].nextFrame();
this.currentSwf = newSwf;
this.updateNav(this.currentSwf, 2);
this.initSound("sound" + mySharedObj.data.myArray[this.currentSwf].soundID, 0, 50);
SwfWaiting = -1;
}
}
function initSeb() {
ResetScene();
InitScene(this.currentSwf, _root["_level" + (this.currentSwf * 10)]);
this.loadText(this.currentSwf);
}
function changeComplete() {
trace("changecomplete");
if (this.currentSwf == 5) {
this.updateNav(this.currentSwf, 3);
this.updateNav(this.currentSwf + 1, 3);
this.currentSwf++;
this.changeSwf(this.currentSwf);
} else if (this.currentSwf < 5) {
this.updateNav(this.currentSwf, 3);
this.currentSwf++;
this.changeSwf(this.currentSwf);
} else if (this.currentSwf > 5) {
this.updateNav(this.currentSwf, 3);
if (((((mySharedObj.data.myArray[7].state == 3) && (mySharedObj.data.myArray[8].state == 3)) && (mySharedObj.data.myArray[9].state == 3)) && (mySharedObj.data.myArray[10].state == 3)) && (mySharedObj.data.myArray[11].state == 1)) {
this.updateNav(11, 3);
_level0.StartFade(_level0.currentSwf, 11, 10, null);
_level0.nextSwf = 11;
} else {
_level0.StartFade(_level0.currentSwf, 6, 10, null);
_level0.nextSwf = 6;
}
}
}
function changeIncomplete(newSwf) {
trace("Change Incomplete");
if ((newswf > 6) && (mySharedObj.data.myArray[newswf].state == 1)) {
this.updateNav(newswf, 2);
}
this.changeSwf(newSwf);
}
function checkComplete() {
}
function StartFade(movienum1, movienum2, speed, fadefunction) {
var i = 0;
while (i < swflist.length) {
if (swflist[i] == movienum2) {
swflist.splice(i, 1);
swflist.unshift(movienum2);
}
i++;
}
if (_level200.ProgressAnim._currentframe != 1) {
_level200.ProgressAnim.gotoAndPlay(11);
}
trace((("fade from " + movienum1) + " to ") + movienum2);
FadeMovie1 = this["_level" + (movienum1 * 10)];
FadeMovie2 = this["_level" + (movienum2 * 10)];
FadeMovieNum2 = movienum2;
trace((((("clips - " + this["_level" + movienum1]) + " ") + FadeMovie1) + " ") + FadeMovie2);
FadeMovieSpeed = speed;
FadeProgress = 0;
FadeFunction = fadefunction;
Fading = true;
initFadeOut();
}
function CheckFade() {
if (Fading) {
if (FadeProgress < 100) {
FadeProgress = FadeProgress + (100 / FadeMovieSpeed);
if (FadeMovie1) {
var c = new Color(FadeMovie1);
c.setBrightness(-FadeProgress, true);
delete c;
}
} else if (FadeProgress == 100) {
if (FadeMovie1) {
FadeMovie1.gotoAndStop(1);
var d = new Color(FadeMovie1);
d.resetBrightness();
delete d;
FadeMovie1 = false;
}
if (!FadeMovie2) {
FadeMovie2 = this["_level" + (FadeMovieNum2 * 10)];
_level200.ProgressAnim.gotoAndStop(2);
}
if ((FadeMovie2 && (FadeMovie2.getBytesTotal() > 0)) && (FadeMovie2.getBytesLoaded() < FadeMovie2.getBytesTotal())) {
var pframe = Math.round(((8 * FadeMovie2.getBytesLoaded()) / FadeMovie2.getBytesTotal()) + 2);
_level200.ProgressAnim.gotoAndStop(pframe);
} else if ((FadeMovie2.getBytesTotal() > 0) && (FadeMovie2.getBytesLoaded() >= FadeMovie2.getBytesTotal())) {
_level200.ProgressAnim.gotoAndStop(1);
FadeProgress = FadeProgress + (100 / FadeMovieSpeed);
var c = new Color(FadeMovie2);
c.setBrightness(-100, true);
delete c;
FadeMovie2.gotoAndStop("static");
ResetScene();
trace("currentswf = " + this.currentSwf);
InitScene(this.nextSwf, _root["_level" + (this.nextSwf * 10)]);
this.loadText(this.nextSwf);
trace("nextswf = " + this.nextSwf);
var i = 0;
while (i < this.textArray[this.currentswf].length) {
this[mySharedObj.data.myArray[this.currentswf].level]["text" + i]._visible = false;
i++;
}
this[mySharedObj.data.myArray[this.currentswf].level].pda.gotoAndStop(1);
this[mySharedObj.data.myArray[this.currentswf].level].pda.movie.gotoAndStop(1);
this.currentswf = this.nextswf;
}
} else if ((FadeProgress > 100) && (FadeProgress < 200)) {
FadeProgress = FadeProgress + (100 / FadeMovieSpeed);
var c = new Color(FadeMovie2);
c.setBrightness(FadeProgress - 200, true);
delete c;
} else if (FadeProgress >= 200) {
this.initSound("sound" + mySharedObj.data.myArray[this.currentSwf].soundID, 0, 50);
allowchange = true;
Fading = false;
FadeFunction();
}
}
}
function preload(swf, num) {
var loadedK = this["_level" + (swf * 10)].getBytesLoaded();
var totalK = this["_level" + (swf * 10)].getBytesTotal();
var percent = Math.floor((loadedk / totalk) * num);
var newFrame = (frame + percent);
this["_level" + (swf * 10)].preloadMov.gotoAndStop(newFrame);
}
function loadVideo(scene) {
loadMovie (((path2 + "video") + scene) + ".swf", this["_level" + (scene * 10)].pda.movie);
trace(((("! " + path2) + "video") + scene) + ".swf");
}
function videoPreload(scene) {
var loadedK = this[mySharedObj.data.myArray[scene].level].pda.movie.getBytesLoaded();
var totalK = this[mySharedObj.data.myArray[scene].level].pda.movie.getBytesTotal();
var percent = Math.floor((loadedK / totalK) * 13);
this[mySharedObj.data.myArray[scene].level].pda.preload.gotoAndStop(percent);
if (loadedK >= totalK) {
trace(totalK);
this[mySharedObj.data.myArray[scene].level].pda.movie.nextFrame();
this[mySharedObj.data.myArray[scene].level].pda.bits.nextFrame();
this.checkVideoLoad = false;
}
}
function videoComplete() {
this[mySharedObj.data.myArray[this.currentSwf].level].pda.button._visible = true;
}
function ShowPDA(scenenum) {
startOutro(scenenum);
trace("Show PDA - scene #" + scenenum);
initFadeOut();
}
function initSound(SoundName, volume, maxVol) {
this.soundInId = this.currentSwf;
this["sound" + soundInId] = new Sound(_level0);
this["sound" + soundInId].attachSound(soundName);
this["sound" + soundInId].start(0, 10000);
this["sound" + soundInId].setVolume(volume);
this.fadeInProgress = 0;
this.MaxVol = MaxVol;
this.fadeInSpeed = 10;
this.allowFadeIn = true;
}
function FadeIn() {
if (fadeInProgress <= MaxVol) {
FadeInProgress = FadeInProgress + (maxVol / FadeInSpeed);
var vol = this["sound" + soundInId].getVolume();
this["sound" + soundInId].setVolume(FadeInProgress);
} else {
allowFadeIn = false;
}
}
function initFadeOut() {
this.soundOutId = this.currentSwf;
startVol = this["sound" + soundOutId].getVolume();
this.fadeOutProgress = 0;
this.FadeOutSpeed = 10;
this.allowFadeOut = true;
trace("fadeout");
}
function FadeOut() {
if (fadeOutProgress < startvol) {
FadeOutProgress = FadeOutProgress + (StartVol / FadeOutSpeed);
var vol = this["sound" + soundOutId].getVolume();
this["sound" + soundOutId].setVolume(startVol - FadeOutProgress);
} else {
this["sound" + soundOutId].stop();
trace(sceneSound);
allowFadeOut = false;
}
}
function getLink() {
getURL (this.URL, "_blank");
}
function InitSite() {
trace(_root.onEnterFrame);
totalScenes = 11;
totalSwfs = 6;
path = "scenes/";
path2 = "video/";
allowChange = false;
checkVideoLoad = false;
preloading = true;
swflist = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
swfcounter = swflist.shift();
fading = false;
createArray();
getLocationText();
}
function InitSite2() {
trace("InitSite2");
createSharedObject();
populateEmptyObject();
checkLast();
checkProg = true;
nextFrame();
Loaded = false;
}
stop();
this.createLocalise();
lang.setChangeHandler("myHandler");
DebugText = false;
loadMovieNum ("nav.swf", 200);
this.onEnterFrame = function () {
if (Loaded == "true") {
trace("Loaded = " + Loaded);
InitSite2();
}
_level10.bytes = _level10._currentframe;
if (_level10.getBytesLoaded() > 12000) {
this.checkLoad();
}
this.checkFade();
if (this.checkVideoLoad) {
this.videopreload(this.currentSwf);
}
if (allowFadeIn) {
FadeIn();
}
if (allowFadeOut) {
fadeOut();
}
if (allowPreload) {
this.preload(this.currentSwf, 8);
}
if (SwfWaiting != -1) {
changeSwf(SwfWaiting);
}
};
this.onData = function () {
if (Loaded == "true") {
this.populateArray();
introText.html = true;
introText.htmlText = this.intro;
introText._visible = false;
}
};
Instance of Symbol 103 MovieClip [FComboBoxSymbol] "lang" in Frame 4
//component parameters
onClipEvent (initialize) {
editable = false;
labels = [];
labels[0] = "Select Country";
labels[1] = "\u00D6sterreich";
labels[2] = "Australia";
labels[3] = "Belgi\u00EB";
labels[4] = "Belgique";
labels[5] = "Danmark";
labels[6] = "Deutschland";
labels[7] = "Espa\u00F1a";
labels[8] = "France";
labels[9] = "Ireland";
labels[10] = "Italia";
labels[11] = "Luxembourg";
labels[12] = "Luxemburg";
labels[13] = "Nederland";
labels[14] = "Norge";
labels[15] = "Portugal";
labels[16] = "Schweiz";
labels[17] = "Suisse";
labels[18] = "Suomi";
labels[19] = "Sverige";
labels[20] = "Svizzera";
labels[21] = "United Kingdom";
data = [];
data[0] = 0;
data[1] = 1;
data[2] = 21;
data[3] = 2;
data[4] = 3;
data[5] = 4;
data[6] = 5;
data[7] = 6;
data[8] = 7;
data[9] = 8;
data[10] = 9;
data[11] = 10;
data[12] = 11;
data[13] = 12;
data[14] = 13;
data[15] = 14;
data[16] = 15;
data[17] = 16;
data[18] = 17;
data[19] = 18;
data[20] = 19;
data[21] = 20;
rowCount = 10;
changeHandler = "";
}
Frame 5
play();
Frame 14
stop();
Frame 15
play();
Frame 25
introText._visible = true;
if (language == "fr") {
logo.gotoAndStop(1);
} else if (language == "sp") {
logo.gotoAndStop(2);
} else {
logo.gotoAndStop(3);
}
Instance of Symbol 178 MovieClip "logo" in Frame 25
/* no clip actions */
Frame 36
stop();
Instance of Symbol 186 MovieClip in Frame 36
onClipEvent (load) {
gotoAndPlay (1);
}
Frame 37
play();
Frame 51
stop();
loadSwfs(1);
changeSwf(1);
Symbol 3 MovieClip [FUIComponentSymbol] Frame 1
#initclip 3
function FUIComponentClass() {
this.init();
}
FUIComponentClass.prototype = new MovieClip();
Object.registerClass("FUIComponentSymbol", FUIComponentClass);
FUIComponentClass.prototype.init = function () {
this.enable = true;
this.focused = false;
this.useHandCursor = false;
this._accImpl = new Object();
this._accImpl.stub = true;
this.styleTable = new Array();
if (_global.globalStyleFormat == undefined) {
_global.globalStyleFormat = new FStyleFormat();
globalStyleFormat.isGlobal = true;
_global._focusControl = new Object();
_global._focusControl.onSetFocus = function (oldFocus, newFocus) {
oldFocus.myOnKillFocus();
newFocus.myOnSetFocus();
};
Selection.addListener(_global._focusControl);
}
if (this._name != undefined) {
this._focusrect = false;
this.tabEnabled = true;
this.focusEnabled = true;
this.tabChildren = false;
this.tabFocused = true;
if (this.hostStyle == undefined) {
globalStyleFormat.addListener(this);
} else {
this.styleTable = this.hostStyle;
}
this.deadPreview._visible = false;
this.deadPreview._width = (this.deadPreview._height = 1);
this.methodTable = new Object();
this.keyListener = new Object();
this.keyListener.controller = this;
this.keyListener.onKeyDown = function () {
this.controller.myOnKeyDown();
};
this.keyListener.onKeyUp = function () {
this.controller.myOnKeyUp();
};
for (var i in this.styleFormat_prm) {
this.setStyleProperty(i, this.styleFormat_prm[i]);
}
}
};
FUIComponentClass.prototype.setEnabled = function (enabledFlag) {
this.enable = ((arguments.length > 0) ? (enabledFlag) : true);
this.tabEnabled = (this.focusEnabled = enabledFlag);
if ((!this.enable) && (this.focused)) {
Selection.setFocus(undefined);
}
};
FUIComponentClass.prototype.getEnabled = function () {
return(this.enable);
};
FUIComponentClass.prototype.setSize = function (w, h) {
this.width = w;
this.height = h;
this.focusRect.removeMovieClip();
};
FUIComponentClass.prototype.setChangeHandler = function (chng, obj) {
this.handlerObj = ((obj == undefined) ? (this._parent) : (obj));
this.changeHandler = chng;
};
FUIComponentClass.prototype.invalidate = function (methodName) {
this.methodTable[methodName] = true;
this.onEnterFrame = this.cleanUI;
};
FUIComponentClass.prototype.cleanUI = function () {
if (this.methodTable.setSize) {
this.setSize(this.width, this.height);
} else {
this.cleanUINotSize();
}
this.methodTable = new Object();
delete this.onEnterFrame;
};
FUIComponentClass.prototype.cleanUINotSize = function () {
for (var funct in this.methodTable) {
this[funct]();
}
};
FUIComponentClass.prototype.drawRect = function (x, y, w, h) {
var inner = this.styleTable.focusRectInner.value;
var outer = this.styleTable.focusRectOuter.value;
if (inner == undefined) {
inner = 16777215 /* 0xFFFFFF */;
}
if (outer == undefined) {
outer = 0;
}
this.createEmptyMovieClip("focusRect", 1000);
this.focusRect.controller = this;
with (this.focusRect) {
lineStyle(1, outer);
moveTo(x, y);
lineTo(x + w, y);
lineTo(x + w, y + h);
lineTo(x, y + h);
lineTo(x, y);
lineStyle(1, inner);
moveTo(x + 1, y + 1);
lineTo((x + w) - 1, y + 1);
lineTo((x + w) - 1, (y + h) - 1);
lineTo(x + 1, (y + h) - 1);
lineTo(x + 1, y + 1);
}
};
FUIComponentClass.prototype.pressFocus = function () {
this.tabFocused = false;
this.focusRect.removeMovieClip();
Selection.setFocus(this);
};
FUIComponentClass.prototype.drawFocusRect = function () {
this.drawRect(-2, -2, this.width + 4, this.height + 4);
};
FUIComponentClass.prototype.myOnSetFocus = function () {
this.focused = true;
Key.addListener(this.keyListener);
if (this.tabFocused) {
this.drawFocusRect();
}
};
FUIComponentClass.prototype.myOnKillFocus = function () {
this.tabFocused = true;
this.focused = false;
this.focusRect.removeMovieClip();
Key.removeListener(this.keyListener);
};
FUIComponentClass.prototype.executeCallBack = function () {
this.handlerObj[this.changeHandler](this);
};
FUIComponentClass.prototype.updateStyleProperty = function (styleFormat, propName) {
this.setStyleProperty(propName, styleFormat[propName], styleFormat.isGlobal);
};
FUIComponentClass.prototype.setStyleProperty = function (propName, value, isGlobal) {
if (value == "") {
return(undefined);
}
var tmpValue = parseInt(value);
if (!isNaN(tmpValue)) {
value = tmpValue;
}
var global = ((arguments.length > 2) ? (isGlobal) : false);
if (this.styleTable[propName] == undefined) {
this.styleTable[propName] = new Object();
this.styleTable[propName].useGlobal = true;
}
if (this.styleTable[propName].useGlobal || (!global)) {
this.styleTable[propName].value = value;
if (propName == "embedFonts") {
this.invalidate("setSize");
} else if (propName.subString(0, 4) == "text") {
if (this.textStyle == undefined) {
this.textStyle = new TextFormat();
}
var textProp = propName.subString(4, propName.length);
this.textStyle[textProp] = value;
this.invalidate("setSize");
} else {
for (var j in this.styleTable[propName].coloredMCs) {
var myColor = new Color(this.styleTable[propName].coloredMCs[j]);
if (this.styleTable[propName].value == undefined) {
var myTObj = {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
myColor.setTransform(myTObj);
} else {
myColor.setRGB(value);
}
}
}
this.styleTable[propName].useGlobal = global;
}
};
FUIComponentClass.prototype.registerSkinElement = function (skinMCRef, propName) {
if (this.styleTable[propName] == undefined) {
this.styleTable[propName] = new Object();
this.styleTable[propName].useGlobal = true;
}
if (this.styleTable[propName].coloredMCs == undefined) {
this.styleTable[propName].coloredMCs = new Object();
}
this.styleTable[propName].coloredMCs[skinMCRef] = skinMCRef;
if (this.styleTable[propName].value != undefined) {
var myColor = new Color(skinMCRef);
myColor.setRGB(this.styleTable[propName].value);
}
};
_global.FStyleFormat = function () {
this.nonStyles = {listeners:true, isGlobal:true, isAStyle:true, addListener:true, removeListener:true, nonStyles:true, applyChanges:true};
this.listeners = new Object();
this.isGlobal = false;
if (arguments.length > 0) {
for (var i in arguments[0]) {
this[i] = arguments[0][i];
}
}
};
_global.FStyleFormat.prototype = new Object();
FStyleFormat.prototype.addListener = function () {
var arg = 0;
while (arg < arguments.length) {
var mcRef = arguments[arg];
this.listeners[arguments[arg]] = mcRef;
for (var i in this) {
if (this.isAStyle(i)) {
mcRef.updateStyleProperty(this, i.toString());
}
}
arg++;
}
};
FStyleFormat.prototype.removeListener = function (component) {
this.listeners[component] = undefined;
for (var prop in this) {
if (this.isAStyle(prop)) {
if (component.styleTable[prop].useGlobal == this.isGlobal) {
component.styleTable[prop].useGlobal = true;
var value = (this.isGlobal ? undefined : (globalStyleFormat[prop]));
component.setStyleProperty(prop, value, true);
}
}
}
};
FStyleFormat.prototype.applyChanges = function () {
var count = 0;
for (var i in this.listeners) {
var component = this.listeners[i];
if (arguments.length > 0) {
var j = 0;
while (j < arguments.length) {
if (this.isAStyle(arguments[j])) {
component.updateStyleProperty(this, arguments[j]);
}
j++;
}
} else {
for (var j in this) {
if (this.isAStyle(j)) {
component.updateStyleProperty(this, j.toString());
}
}
}
}
};
FStyleFormat.prototype.isAStyle = function (name) {
return((this.nonStyles[name] ? false : true));
};
#endinitclip
Symbol 6 MovieClip Frame 1
var component = _parent;
component.registerSkinElement(track_mc, "scrollTrack");
Symbol 19 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "arrow");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 29 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "arrow");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 38 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "foregroundDisabled");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 39 MovieClip [UpArrow] Frame 1
stop();
Symbol 39 MovieClip [UpArrow] Frame 2
stop();
Symbol 39 MovieClip [UpArrow] Frame 3
stop();
Symbol 45 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(highlight3D_mc, "highlight3D");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
Symbol 52 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 58 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 59 MovieClip [ScrollThumb] Frame 1
stop();
Symbol 67 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "arrow");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 75 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "arrow");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 83 MovieClip Frame 1
var component = _parent._parent;
component.registerSkinElement(arrow_mc, "foregroundDisabled");
component.registerSkinElement(face_mc, "face");
component.registerSkinElement(shadow_mc, "shadow");
component.registerSkinElement(darkshadow_mc, "darkshadow");
component.registerSkinElement(highlight_mc, "highlight");
component.registerSkinElement(highlight3D_mc, "highlight3D");
Symbol 84 MovieClip [DownArrow] Frame 1
stop();
Symbol 84 MovieClip [DownArrow] Frame 2
stop();
Symbol 84 MovieClip [DownArrow] Frame 3
stop();
Symbol 85 MovieClip [FScrollBarSymbol] Frame 1
#initclip 5
FScrollBarClass = function () {
if (this._height == 1) {
return(undefined);
}
this.init();
this.minPos = (this.maxPos = (this.pageSize = (this.largeScroll = 0)));
this.smallScroll = 1;
this.width = this._height;
this._xscale = (this._yscale = 100);
this.setScrollPosition(0);
this.tabEnabled = false;
if (this._targetInstanceName.length > 0) {
this.setScrollTarget(this._parent[this._targetInstanceName]);
}
this.tabChildren = false;
this.setSize(this.width);
};
FScrollBarClass.prototype = new FUIComponentClass();
FScrollBarClass.prototype.setHorizontal = function (flag) {
if (this.horizontal && (!flag)) {
this._xscale = 100;
this._rotation = 0;
} else if (flag && (!this.horizontal)) {
this._xscale = -100;
this._rotation = -90;
}
this.horizontal = flag;
};
FScrollBarClass.prototype.setScrollProperties = function (pSize, mnPos, mxPos) {
if (!this.enable) {
return(undefined);
}
this.pageSize = pSize;
this.minPos = Math.max(mnPos, 0);
this.maxPos = Math.max(mxPos, 0);
this.scrollPosition = Math.max(this.minPos, this.scrollPosition);
this.scrollPosition = Math.min(this.maxPos, this.scrollPosition);
if ((this.maxPos - this.minPos) <= 0) {
this.scrollThumb_mc.removeMovieClip();
this.upArrow_mc.gotoAndStop(3);
this.downArrow_mc.gotoAndStop(3);
this.downArrow_mc.onPress = (this.downArrow_mc.onRelease = (this.downArrow_mc.onDragOut = null));
this.upArrow_mc.onPress = (this.upArrow_mc.onRelease = (this.upArrow_mc.onDragOut = null));
this.scrollTrack_mc.onPress = (this.scrollTrack_mc.onRelease = null);
this.scrollTrack_mc.onDragOut = (this.scrollTrack_mc.onRollOut = null);
this.scrollTrack_mc.useHandCursor = false;
} else {
var tmp = this.getScrollPosition();
this.upArrow_mc.gotoAndStop(1);
this.downArrow_mc.gotoAndStop(1);
this.upArrow_mc.onPress = (this.upArrow_mc.onDragOver = this.startUpScroller);
this.upArrow_mc.onRelease = (this.upArrow_mc.onDragOut = this.stopScrolling);
this.downArrow_mc.onPress = (this.downArrow_mc.onDragOver = this.startDownScroller);
this.downArrow_mc.onRelease = (this.downArrow_mc.onDragOut = this.stopScrolling);
this.scrollTrack_mc.onPress = (this.scrollTrack_mc.onDragOver = this.startTrackScroller);
this.scrollTrack_mc.onRelease = this.stopScrolling;
this.scrollTrack_mc.onDragOut = this.stopScrolling;
this.scrollTrack_mc.onRollOut = this.stopScrolling;
this.scrollTrack_mc.useHandCursor = false;
this.attachMovie("ScrollThumb", "scrollThumb_mc", 3);
this.scrollThumb_mc._x = 0;
this.scrollThumb_mc._y = this.upArrow_mc._height;
this.scrollThumb_mc.onPress = this.startDragThumb;
this.scrollThumb_mc.controller = this;
this.scrollThumb_mc.onRelease = (this.scrollThumb_mc.onReleaseOutside = this.stopDragThumb);
this.scrollThumb_mc.useHandCursor = false;
this.thumbHeight = (this.pageSize / ((this.maxPos - this.minPos) + this.pageSize)) * this.trackSize;
this.thumbMid_mc = this.scrollThumb_mc.mc_sliderMid;
this.thumbTop_mc = this.scrollThumb_mc.mc_sliderTop;
this.thumbBot_mc = this.scrollThumb_mc.mc_sliderBot;
this.thumbHeight = Math.max(this.thumbHeight, 6);
this.midHeight = (this.thumbHeight - this.thumbTop_mc._height) - this.thumbBot_mc._height;
this.thumbMid_mc._yScale = (this.midHeight * 100) / this.thumbMid_mc._height;
this.thumbMid_mc._y = this.thumbTop_mc._height;
this.thumbBot_mc._y = this.thumbTop_mc._height + this.midHeight;
this.scrollTop = this.scrollThumb_mc._y;
this.trackHeight = this.trackSize - this.thumbHeight;
this.scrollBot = this.trackHeight + this.scrollTop;
tmp = Math.min(tmp, this.maxPos);
this.setScrollPosition(Math.max(tmp, this.minPos));
}
};
FScrollBarClass.prototype.getScrollPosition = function () {
return(this.scrollPosition);
};
FScrollBarClass.prototype.setScrollPosition = function (pos) {
if (this.scrollThumb_mc != undefined) {
pos = Math.min(pos, this.maxPos);
pos = Math.max(pos, this.minPos);
}
this.scrollPosition = pos;
this.scrollThumb_mc._y = (((pos - this.minPos) * this.trackHeight) / (this.maxPos - this.minPos)) + this.scrollTop;
this.executeCallBack();
};
FScrollBarClass.prototype.setLargeScroll = function (lScroll) {
this.largeScroll = lScroll;
};
FScrollBarClass.prototype.setSmallScroll = function (sScroll) {
this.smallScroll = sScroll;
};
FScrollBarClass.prototype.setEnabled = function (enabledFlag) {
var wasEnabled = this.enable;
if (enabledFlag && (!wasEnabled)) {
this.enable = enabledFlag;
if (this.textField != undefined) {
this.setScrollTarget(this.textField);
} else {
this.setScrollProperties(this.pageSize, this.cachedMinPos, this.cachedMaxPos);
this.setScrollPosition(this.cachedPos);
}
this.isAKludge = undefined;
} else if ((!enabledFlag) && (wasEnabled)) {
this.textField.removeListener(this);
this.cachedPos = this.getScrollPosition();
this.cachedMinPos = this.minPos;
this.cachedMaxPos = this.maxPos;
if (this.isAKludge == undefined) {
this.setScrollProperties(this.pageSize, 0, 0);
} else {
this.isAKludge = true;
}
this.enable = enabledFlag;
}
};
FScrollBarClass.prototype.setSize = function (hgt) {
if (this._height == 1) {
return(undefined);
}
this.width = hgt;
this.scrollTrack_mc._yscale = 100;
this.scrollTrack_mc._yscale = (100 * this.width) / this.scrollTrack_mc._height;
if (this.upArrow_mc == undefined) {
this.attachMovie("UpArrow", "upArrow_mc", 1);
this.attachMovie("DownArrow", "downArrow_mc", 2);
this.downArrow_mc.controller = (this.upArrow_mc.controller = this);
this.upArrow_mc.useHandCursor = (this.downArrow_mc.useHandCursor = false);
this.upArrow_mc._x = (this.upArrow_mc._y = 0);
this.downArrow_mc._x = 0;
}
this.scrollTrack_mc.controller = this;
this.downArrow_mc._y = this.width - this.downArrow_mc._height;
this.trackSize = this.width - (2 * this.downArrow_mc._height);
this.setScrollProperties(this.pageSize, this.minPos, this.maxPos);
};
FScrollBarClass.prototype.scrollIt = function (inc, mode) {
var delt = this.smallScroll;
if (inc != "one") {
delt = ((this.largeScroll == 0) ? (this.pageSize) : (this.largeScroll));
}
var newPos = (this.getScrollPosition() + (mode * delt));
if (newPos > this.maxPos) {
newPos = this.maxPos;
} else if (newPos < this.minPos) {
newPos = this.minPos;
}
this.setScrollPosition(newPos);
};
FScrollBarClass.prototype.startDragThumb = function () {
this.lastY = this._ymouse;
this.onMouseMove = this.controller.dragThumb;
};
FScrollBarClass.prototype.dragThumb = function () {
this.scrollMove = this._ymouse - this.lastY;
this.scrollMove = this.scrollMove + this._y;
if (this.scrollMove < this.controller.scrollTop) {
this.scrollMove = this.controller.scrollTop;
} else if (this.scrollMove > this.controller.scrollBot) {
this.scrollMove = this.controller.scrollBot;
}
this._y = this.scrollMove;
var c = this.controller;
c.scrollPosition = Math.round(((c.maxPos - c.minPos) * (this._y - c.scrollTop)) / c.trackHeight) + c.minPos;
this.controller.isScrolling = true;
updateAfterEvent();
this.controller.executeCallBack();
};
FScrollBarClass.prototype.stopDragThumb = function () {
this.controller.isScrolling = false;
this.onMouseMove = null;
};
FScrollBarClass.prototype.startTrackScroller = function () {
this.controller.trackScroller();
this.controller.scrolling = setInterval(this.controller, "scrollInterval", 500, "page", -1);
};
FScrollBarClass.prototype.scrollInterval = function (inc, mode) {
clearInterval(this.scrolling);
if (inc == "page") {
this.trackScroller();
} else {
this.scrollIt(inc, mode);
}
this.scrolling = setInterval(this, "scrollInterval", 35, inc, mode);
};
FScrollBarClass.prototype.trackScroller = function () {
if ((this.scrollThumb_mc._y + this.thumbHeight) < this._ymouse) {
this.scrollIt("page", 1);
} else if (this.scrollThumb_mc._y > this._ymouse) {
this.scrollIt("page", -1);
}
};
FScrollBarClass.prototype.stopScrolling = function () {
this.controller.downArrow_mc.gotoAndStop(1);
this.controller.upArrow_mc.gotoAndStop(1);
clearInterval(this.controller.scrolling);
};
FScrollBarClass.prototype.startUpScroller = function () {
this.controller.upArrow_mc.gotoAndStop(2);
this.controller.scrollIt("one", -1);
this.controller.scrolling = setInterval(this.controller, "scrollInterval", 500, "one", -1);
};
FScrollBarClass.prototype.startDownScroller = function () {
this.controller.downArrow_mc.gotoAndStop(2);
this.controller.scrollIt("one", 1);
this.controller.scrolling = setInterval(this.controller, "scrollInterval", 500, "one", 1);
};
FScrollBarClass.prototype.setScrollTarget = function (tF) {
if (tF == undefined) {
this.textField.removeListener(this);
delete this.textField[(this.horizontal ? "hScroller" : "vScroller")];
if ((this.textField.hScroller != undefined) && (this.textField.vScroller != undefined)) {
this.textField.unwatch("text");
this.textField.unwatch("htmltext");
}
}
this.textField = undefined;
if (!(tF instanceof TextField)) {
return(undefined);
}
this.textField = tF;
this.textField[(this.horizontal ? "hScroller" : "vScroller")] = this;
this.onTextChanged();
this.onChanged = function () {
this.onTextChanged();
};
this.onScroller = function () {
if (!this.isScrolling) {
if (!this.horizontal) {
this.setScrollPosition(this.textField.scroll);
} else {
this.setScrollPosition(this.textField.hscroll);
}
}
};
this.textField.addListener(this);
this.textField.watch("text", this.callback);
this.textField.watch("htmlText", this.callback);
};
FScrollBarClass.prototype.callback = function (prop, oldVal, newVal) {
clearInterval(this.hScroller.synchScroll);
clearInterval(this.vScroller.synchScroll);
this.hScroller.synchScroll = setInterval(this.hScroller, "onTextChanged", 50);
this.vScroller.synchScroll = setInterval(this.vScroller, "onTextChanged", 50);
return(newVal);
};
FScrollBarClass.prototype.onTextChanged = function () {
if ((!this.enable) || (this.textField == undefined)) {
return(undefined);
}
clearInterval(this.synchScroll);
if (this.horizontal) {
var pos = this.textField.hscroll;
this.setScrollProperties(this.textField._width, 0, this.textField.maxhscroll);
this.setScrollPosition(Math.min(pos, this.textField.maxhscroll));
} else {
var pos = this.textField.scroll;
var pageSize = (this.textField.bottomScroll - this.textField.scroll);
this.setScrollProperties(pageSize, 1, this.textField.maxscroll);
}
};
FScrollBarClass.prototype.executeCallBack = function () {
if (this.textField == undefined) {
super.executeCallBack();
} else if (this.horizontal) {
this.textField.hscroll = this.getScrollPosition();
} else {
this.textField.scroll = this.getScrollPosition();
}
};
Object.registerClass("FScrollBarSymbol", FScrollBarClass);
#endinitclip
Instance of Symbol 3 MovieClip [FUIComponentSymbol] in Symbol 85 MovieClip [FScrollBarSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Symbol 92 MovieClip [FBoundingBoxSymbol] Frame 1
var component = _parent;
component.registerSkinElement(boundingBox, "background");
stop();
Symbol 92 MovieClip [FBoundingBoxSymbol] Frame 2
component.registerSkinElement(boundingBox2, "backgroundDisabled");
stop();
Symbol 95 MovieClip [FHighlightSymbol] Frame 1
var component = _parent.controller;
component.registerSkinElement(highlight_mc, "selection");
stop();
Symbol 95 MovieClip [FHighlightSymbol] Frame 2
component.registerSkinElement(highlight_mc2, "selectionDisabled");
stop();
Symbol 95 MovieClip [FHighlightSymbol] Frame 3
component.registerSkinElement(highlight_mc3, "selectionUnfocused");
stop();
Symbol 96 MovieClip [FSelectableItemSymbol] Frame 1
#initclip 7
function FSelectableItemClass() {
this.init();
}
FSelectableItemClass.prototype = new FUIComponentClass();
Object.registerClass("FSelectableItemSymbol", FSelectableItemClass);
FSelectableItemClass.prototype.init = function () {
this.attachMovie("FLabelSymbol", "fLabel_mc", 2, {hostComponent:this.controller});
this.fLabel_mc._x = 2;
this.fLabel_mc._y = 0;
this.highlighted = false;
};
FSelectableItemClass.prototype.drawLabel = function (itmObj, selected) {
var tmpLabel = "";
if (itmObj.label != undefined) {
tmpLabel = itmObj.label;
} else if (typeof(itmObj) == "object") {
for (var i in itmObj) {
if (i != "__ID__") {
tmpLabel = (itmObj[i] + ", ") + tmpLabel;
}
}
tmpLabel = tmpLabel.substring(0, tmpLabel.length - 2);
} else {
tmpLabel = itmObj;
}
if (this.fLabel_mc.labelField.text != tmpLabel) {
this.fLabel_mc.setLabel(tmpLabel);
}
};
FSelectableItemClass.prototype.drawItem = function (itmObj, selected) {
this.drawLabel(itmObj);
if ((this.highlighted != selected) || ((this.controller.focused != this.oldFocus) && (selected))) {
this.setHighlighted(selected);
var clr = (selected ? (this.controller.styleTable.textSelected.value) : (this.controller.styleTable.textColor.value));
if (clr == undefined) {
clr = (selected ? 16777215 : 0);
}
this.fLabel_mc.setColor(clr);
}
this.oldFocus = this.controller.focused;
};
FSelectableItemClass.prototype.setSize = function (width, height) {
this.width = width;
this.attachMovie("FHighlightSymbol", "highlight_mc", -16000);
this.highlight_mc._width = width;
this.highlight_mc._height = height;
this.highlight_mc.controller = this;
this.highlight_mc._alpha = 0;
this.fLabel_mc.setSize(this.width - 2);
this.fLabel_mc.labelField.selectable = false;
this.highlight_mc.trackAsMenu = true;
this.highlight_mc.onPress = function () {
if (this.controller.enable) {
this.controller.controller.clickHandler(this.controller.itemNum);
}
};
this.highlight_mc.onDragOver = function () {
if (this.controller.controller.focused) {
this.onPress();
}
};
this.highlight_mc.useHandCursor = false;
this.highlight_mc.trackAsMenu = true;
};
FSelectableItemClass.prototype.setEnabled = function (enabledFlag) {
this.enable = enabledFlag;
this.fLabel_mc.setEnabled(enabledFlag);
this.highlight_mc.gotoAndStop((enabledFlag ? "unfocused" : "disabled"));
};
FSelectableItemClass.prototype.getItemIndex = function () {
return(this.controller.getScrollPosition() + this.itemNum);
};
FSelectableItemClass.prototype.getItemModel = function () {
return(this.controller.getItemAt(this.getItemIndex()));
};
FSelectableItemClass.prototype.getHostDataProvider = function () {
return(this.controller.dataProvider);
};
FSelectableItemClass.prototype.setHighlighted = function (flag) {
fade = this.controller.styleTable.fadeRate.value;
if (((fade == undefined) || (fade == 0)) || (!flag)) {
this.highlight_mc._alpha = (flag ? 100 : 0);
delete this.onEnterFrame;
} else {
this.fadeN = fade;
this.fadeX = 1;
this.highLight_mc._alpha = 20;
this.onEnterFrame = function () {
this.highLight_mc._alpha = (60 * Math.sqrt((this.fadeX++) / this.fadeN)) + 40;
if (this.fadeX > this.fadeN) {
delete this.onEnterFrame;
}
};
}
this.highlighted = flag;
};
#endinitclip
Symbol 98 MovieClip [FLabelSymbol] Frame 1
#initclip 1
_global.FLabelClass = function () {
if (this.hostComponent == undefined) {
this.hostComponent = ((this._parent.controller == undefined) ? (this._parent) : (this._parent.controller));
}
if (this.hostComponent.textStyle == undefined) {
this.hostComponent.textStyle = new TextFormat();
}
this.textStyle = this.hostComponent.textStyle;
this.enable = true;
};
FLabelClass.prototype = new MovieClip();
Object.registerClass("FLabelSymbol", FLabelClass);
FLabelClass.prototype.setLabel = function (label) {
var val = this.hostComponent.styleTable.embedFonts.value;
if (val != undefined) {
this.labelField.embedFonts = val;
}
this.labelField.setNewTextFormat(this.hostComponent.textStyle);
this.labelField.text = label;
this.labelField._height = this.labelField.textHeight + 2;
};
FLabelClass.prototype.setSize = function (width) {
this.labelField._width = width;
};
FLabelClass.prototype.setEnabled = function (enable) {
this.enable = enable;
var tmpColor = this.hostComponent.styleTable[(enable ? "textColor" : "textDisabled")].value;
if (tmpColor == undefined) {
tmpColor = (enable ? 0 : 8947848);
}
this.setColor(tmpColor);
};
FLabelClass.prototype.getLabel = function () {
return(this.labelField.text);
};
FLabelClass.prototype.setColor = function (col) {
this.labelField.textColor = col;
};
#endinitclip
Symbol 99 MovieClip [FComboBoxItemSymbol] Frame 1
#initclip 9
function FComboBoxItemClass() {
this.init();
}
FComboBoxItemClass.prototype = new FSelectableItemClass();
Object.registerClass("FComboBoxItemSymbol", FComboBoxItemClass);
FComboBoxItemClass.prototype.setSize = function (w, h) {
super.setSize(w, h);
this.highlight_mc.onRollOver = function () {
this.controller.controller.selectionHandler(this.controller.itemNum);
};
};
#endinitclip
Instance of Symbol 96 MovieClip [FSelectableItemSymbol] in Symbol 99 MovieClip [FComboBoxItemSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Instance of Symbol 98 MovieClip [FLabelSymbol] in Symbol 99 MovieClip [FComboBoxItemSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Symbol 100 MovieClip [DataProviderSymbol] Frame 1
#initclip 2
_global.DataProviderClass = function () {
this.init();
};
DataProviderClass.prototype.init = function () {
this.items = new Array();
this.uniqueID = 0;
this.views = new Array();
};
DataProviderClass.prototype.addView = function (viewRef) {
this.views.push(viewRef);
var eventObj = {event:"updateAll"};
viewRef.modelChanged(eventObj);
};
DataProviderClass.prototype.addItemAt = function (index, value) {
if (index < this.getLength()) {
this.items.splice(index, 0, "tmp");
}
this.items[index] = new Object();
if (typeof(value) == "object") {
this.items[index] = value;
} else {
this.items[index].label = value;
}
this.items[index].__ID__ = this.uniqueID++;
var eventObj = {event:"addRows", firstRow:index, lastRow:index};
this.updateViews(eventObj);
};
DataProviderClass.prototype.addItem = function (value) {
this.addItemAt(this.getLength(), value);
};
DataProviderClass.prototype.removeItemAt = function (index) {
var tmpItm = this.items[index];
this.items.splice(index, 1);
var eventObj = {event:"deleteRows", firstRow:index, lastRow:index};
this.updateViews(eventObj);
return(tmpItm);
};
DataProviderClass.prototype.removeAll = function () {
this.items = new Array();
this.updateViews({event:"deleteRows", firstRow:0, lastRow:this.getLength() - 1});
};
DataProviderClass.prototype.replaceItemAt = function (index, itemObj) {
if ((index < 0) || (index >= this.getLength())) {
return(undefined);
}
var tmpID = this.getItemID(index);
if (typeof(itemObj) == "object") {
this.items[index] = itemObj;
} else {
this.items[index].label = itemObj;
}
this.items[index].__ID__ = tmpID;
this.updateViews({event:"updateRows", firstRow:index, lastRow:index});
};
DataProviderClass.prototype.getLength = function () {
return(this.items.length);
};
DataProviderClass.prototype.getItemAt = function (index) {
return(this.items[index]);
};
DataProviderClass.prototype.getItemID = function (index) {
return(this.items[index].__ID__);
};
DataProviderClass.prototype.sortItemsBy = function (fieldName, order) {
this.items.sortOn(fieldName);
if (order == "DESC") {
this.items.reverse();
}
this.updateViews({event:"sort"});
};
DataProviderClass.prototype.updateViews = function (eventObj) {
var i = 0;
while (i < this.views.length) {
this.views[i].modelChanged(eventObj);
i++;
}
};
#endinitclip
Symbol 101 MovieClip [FSelectableListSymbol] Frame 1
#initclip 4
function FSelectableListClass() {
this.init();
}
FSelectableListClass.prototype = new FUIComponentClass();
Object.registerClass("FSelectableListSymbol", FSelectableListClass);
FSelectableListClass.prototype.init = function () {
super.init();
this.enable = true;
this.selected = new Array();
this.topDisplayed = (this.numDisplayed = 0);
this.lastSelected = 0;
this.tabChildren = false;
if (this._name != undefined) {
this.dataProvider = new DataProviderClass();
this.dataProvider.addView(this);
}
};
FSelectableListClass.prototype.addItemAt = function (index, label, data) {
if ((index < 0) || (!this.enable)) {
return(undefined);
}
this.dataProvider.addItemAt(index, {label:label, data:data});
};
FSelectableListClass.prototype.addItem = function (label, data) {
if (!this.enable) {
return(undefined);
}
this.dataProvider.addItem({label:label, data:data});
};
FSelectableListClass.prototype.removeItemAt = function (index) {
this.selectHolder = this.getSelectedIndex();
var item = this.getItemAt(index);
this.dataProvider.removeItemAt(index);
return(item);
};
FSelectableListClass.prototype.removeAll = function () {
this.dataProvider.removeAll();
};
FSelectableListClass.prototype.replaceItemAt = function (index, newLabel, newData) {
this.dataProvider.replaceItemAt(index, {label:newLabel, data:newData});
};
FSelectableListClass.prototype.sortItemsBy = function (fieldName, order) {
this.lastSelID = this.dataProvider.getItemID(this.lastSelected);
this.dataProvider.sortItemsBy(fieldName, order);
};
FSelectableListClass.prototype.getLength = function () {
return(this.dataProvider.getLength());
};
FSelectableListClass.prototype.getSelectedIndex = function () {
for (var index in this.selected) {
return(this.selected[index]);
}
};
FSelectableListClass.prototype.getSelectedItem = function () {
return(this.getItemAt(this.getSelectedIndex()));
};
FSelectableListClass.prototype.getItemAt = function (index) {
return(this.dataProvider.getItemAt(index));
};
FSelectableListClass.prototype.getEnabled = function () {
return(this.enable);
};
FSelectableListClass.prototype.getValue = function () {
var item = this.getSelectedItem();
return(((item.data == undefined) ? (item.label) : (item.data)));
};
FSelectableListClass.prototype.setSelectedIndex = function (index, flag) {
if (((index >= 0) && (index < this.getLength())) && (this.enable)) {
this.clearSelected();
this.selectItem(index, true);
this.lastSelected = index;
this.invalidate("updateControl");
if (flag != false) {
this.executeCallBack();
}
}
};
FSelectableListClass.prototype.setDataProvider = function (obj) {
this.clearSelected();
if (obj instanceof Array) {
this.dataProvider = new DataProviderClass();
var i = 0;
while (i < obj.length) {
var value = ((typeof(obj[i]) == "string") ? ({label:obj[i]}) : (obj[i]));
this.dataProvider.addItem(value);
i++;
}
} else {
this.dataProvider = obj;
}
this.dataProvider.addView(this);
};
FSelectableListClass.prototype.setItemSymbol = function (linkID) {
this.tmpPos = this.getScrollPosition();
this.itemSymbol = linkID;
this.invalidate("setSize");
this.setScrollPosition(this.tmpPos);
};
FSelectableListClass.prototype.setEnabled = function (enabledFlag) {
super.setEnabled(enabledFlag);
this.enable = enabledFlag;
this.boundingBox_mc.gotoAndStop((this.enable ? "enabled" : "disabled"));
var limit = Math.min(this.numDisplayed, this.getLength());
var i = 0;
while (i < limit) {
this.container_mc[("fListItem" + i) + "_mc"].setEnabled(this.enable);
i++;
}
if (this.enable) {
this.invalidate("updateControl");
}
};
FSelectableListClass.prototype.updateControl = function () {
var i = 0;
while (i < this.numDisplayed) {
this.container_mc[("fListItem" + i) + "_mc"].drawItem(this.getItemAt(this.topDisplayed + i), this.isSelected(this.topDisplayed + i));
i++;
}
};
FSelectableListClass.prototype.setSize = function (w, h) {
super.setSize(w, h);
this.boundingBox_mc._xscale = (this.boundingBox_mc._yscale = 100);
this.boundingBox_mc._xscale = (this.width * 100) / this.boundingBox_mc._width;
this.boundingBox_mc._yscale = (this.height * 100) / this.boundingBox_mc._height;
var i = 0;
while (i < this.numDisplayed) {
this.container_mc.attachMovie(this.itemSymbol, ("fListItem" + i) + "_mc", 10 + i, {controller:this, itemNum:i});
var item_mc = this.container_mc[("fListItem" + i) + "_mc"];
var offset = ((this.scrollOffset == undefined) ? 0 : (this.scrollOffset));
item_mc.setSize(this.width - offset, this.itmHgt);
item_mc._y = (this.itmHgt - 2) * i;
i++;
}
this.updateControl();
};
FSelectableListClass.prototype.modelChanged = function (eventObj) {
var firstRow = eventObj.firstRow;
var lastRow = eventObj.lastRow;
var event = eventObj.event;
if (event == "addRows") {
for (var i in this.selected) {
if (this.selected[i] >= firstRow) {
this.selected[i] = this.selected[i] + ((lastRow - firstRow) + 1);
this.setSelectedIndex(this.selected[i], false);
}
}
} else if (event == "deleteRows") {
if (firstRow == lastRow) {
var index = firstRow;
if (this.selectHolder == index) {
this.selectionDeleted = true;
}
if (((this.topDisplayed + this.numDisplayed) >= this.getLength()) && (this.topDisplayed > 0)) {
this.topDisplayed--;
if (this.selectionDeleted && ((index - 1) >= 0)) {
this.setSelectedIndex(index - 1, false);
}
} else if (this.selectionDeleted) {
var len = this.getLength();
if (((index == (len - 1)) && (len > 1)) || (index > (len / 2))) {
this.setSelectedIndex(index - 1, false);
} else {
this.setSelectedIndex(index, false);
}
}
for (var i in this.selected) {
if (this.selected[i] > firstRow) {
this.selected[i]--;
}
}
} else {
this.clearSelected();
this.topDisplayed = 0;
}
} else if (event == "sort") {
var len = this.getLength();
var i = 0;
while (i < len) {
if (this.isSelected(i)) {
var id = this.dataProvider.getItemID(i);
if (id == this.lastSelID) {
this.lastSelected = i;
}
this.selected[String(id)] = i;
}
i++;
}
}
this.invalidate("updateControl");
};
FSelectableListClass.prototype.measureItmHgt = function () {
this.attachMovie(this.itemSymbol, "tmpItem_mc", 0, {controller:this});
this.tmpItem_mc.drawItem({label:"Sizer: PjtTopg"}, false);
this.itmHgt = this.tmpItem_mc._height;
this.tmpItem_mc.removeMovieClip();
};
FSelectableListClass.prototype.selectItem = function (index, selectedFlag) {
if (selectedFlag && (!this.isSelected(index))) {
this.selected[String(this.dataProvider.getItemID(index))] = index;
} else if (!selectedFlag) {
delete this.selected[String(this.dataProvider.getItemID(index))];
}
};
FSelectableListClass.prototype.isSelected = function (index) {
return(this.selected[String(this.dataProvider.getItemID(index))] != undefined);
};
FSelectableListClass.prototype.clearSelected = function () {
for (var uniqueID in this.selected) {
var index = this.selected[uniqueID];
if ((this.topDisplayed <= index) && (index < (this.topDisplayed + this.numDisplayed))) {
this.container_mc[("fListItem" + (index - this.topDisplayed)) + "_mc"].drawItem(this.getItemAt(index), false);
}
}
delete this.selected;
this.selected = new Array();
};
FSelectableListClass.prototype.selectionHandler = function (itemNum) {
var tmpInd = (this.topDisplayed + itemNum);
if (this.getItemAt(tmpInd == undefined)) {
this.changeFlag = false;
return(undefined);
}
this.changeFlag = true;
this.clearSelected();
this.selectItem(tmpInd, true);
this.container_mc[("fListItem" + itemNum) + "_mc"].drawItem(this.getItemAt(tmpInd), this.isSelected(tmpInd));
};
FSelectableListClass.prototype.moveSelBy = function (incr) {
var itmNum = this.getSelectedIndex();
var newItm = (itmNum + incr);
if ((itmNum < this.topDisplayed) || (itmNum >= (this.topDisplayed + this.numDisplayed))) {
this.setScrollPosition(itmNum);
}
if ((newItm >= (this.topDisplayed + this.numDisplayed)) || (newItm < this.topDisplayed)) {
this.setScrollPosition(this.topDisplayed + incr);
}
this.selectionHandler(newItm - this.topDisplayed);
};
FSelectableListClass.prototype.clickHandler = function (itmNum) {
this.focusRect.removeMovieClip();
if (!this.focused) {
this.pressFocus();
}
this.selectionHandler(itmNum);
this.onMouseUp = this.releaseHandler;
};
FSelectableListClass.prototype.releaseHandler = function () {
if (this.changeFlag) {
this.executeCallBack();
}
this.changeFlag = false;
this.onMouseUp = undefined;
};
FSelectableListClass.prototype.myOnSetFocus = function () {
super.myOnSetFocus();
var i = 0;
while (i < this.numDisplayed) {
this.container_mc[("fListItem" + i) + "_mc"].highlight_mc.gotoAndStop("enabled");
i++;
}
};
FSelectableListClass.prototype.myOnKillFocus = function () {
super.myOnKillFocus();
var i = 0;
while (i < this.numDisplayed) {
this.container_mc[("fListItem" + i) + "_mc"].highlight_mc.gotoAndStop("unfocused");
i++;
}
};
#endinitclip
Instance of Symbol 100 MovieClip [DataProviderSymbol] in Symbol 101 MovieClip [FSelectableListSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Instance of Symbol 3 MovieClip [FUIComponentSymbol] in Symbol 101 MovieClip [FSelectableListSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Symbol 102 MovieClip [FScrollSelectListSymbol] Frame 1
#initclip 6
function FScrollSelectListClass() {
this.init();
}
FScrollSelectListClass.prototype = new FSelectableListClass();
Object.registerClass("FScrollSelectListSymbol", FScrollSelectListClass);
FScrollSelectListClass.prototype.getScrollPosition = function () {
return(this.topDisplayed);
};
FScrollSelectListClass.prototype.setScrollPosition = function (pos) {
if (this.enable) {
pos = Math.min(pos, this.getLength() - this.numDisplayed);
pos = Math.max(pos, 0);
this.scrollBar_mc.setScrollPosition(pos);
}
};
FScrollSelectListClass.prototype.setAutoHideScrollBar = function (flag) {
this.permaScrollBar = !flag;
};
FScrollSelectListClass.prototype.setEnabled = function (enabledFlag) {
super.setEnabled(enabledFlag);
this.scrollBar_mc.setEnabled(this.enable);
};
FScrollSelectListClass.prototype.setSize = function (w, h) {
var pos = this.getScrollPosition();
super.setSize(w, h);
this.scrollBar_mc.removeMovieClip();
this.scrollBar_mc = undefined;
this.initScrollBar();
this.setScrollPosition(pos);
};
FScrollSelectListClass.prototype.modelChanged = function (eventObj) {
super.modelChanged(eventObj);
this.invalidate("initScrollBar");
};
FScrollSelectListClass.prototype.initScrollBar = function () {
if ((!this.permaScrollBar) && (this.getLength() <= this.numDisplayed)) {
this.scrollBar_mc.removeMovieClip();
this.scrollBar_mc = undefined;
this.scrollOffset = undefined;
} else {
if (this.scrollBar_mc == undefined) {
this.container_mc.attachMovie("FScrollBarSymbol", "scrollBar_mc", 3000, {hostStyle:this.styleTable});
this.scrollBar_mc = this.container_mc.scrollBar_mc;
this.scrollBar_mc.setChangeHandler("scrollHandler", this);
this.scrollBar_mc.setSize(this.height);
this.scrollBar_mc._x = this.width - this.scrollBar_mc._width;
this.scrollBar_mc._y = 0;
this.scrollBar_mc.setLargeScroll(this.numDisplayed - 1);
this.scrollOffset = this.scrollBar_mc._width;
this.invalidate("setSize");
}
this.scrollBar_mc.setScrollProperties(this.numDisplayed, 0, this.getLength() - this.numDisplayed);
}
};
FScrollSelectListClass.prototype.scrollHandler = function (scrollBar) {
var pos = scrollBar.getScrollPosition();
this.topDisplayed = pos;
if (this.lastPosition != pos) {
this.updateControl();
}
this.lastPosition = pos;
};
FScrollSelectListClass.prototype.clickHandler = function (itmNum) {
super.clickHandler(itmNum);
if ((this.dragScrolling == undefined) && (this.scrollBar_mc != undefined)) {
this.dragScrolling = setInterval(this, "dragScroll", 15);
}
};
FScrollSelectListClass.prototype.releaseHandler = function () {
clearInterval(this.dragScrolling);
this.dragScrolling = undefined;
super.releaseHandler();
};
FScrollSelectListClass.prototype.dragScroll = function () {
clearInterval(this.dragScrolling);
if (this.container_mc._ymouse < 0) {
this.setScrollPosition(this.getScrollPosition() - 1);
this.selectionHandler(0);
this.scrollInterval = Math.max(25, (-23.8 * (-this.container_mc._ymouse)) + 500);
this.dragScrolling = setInterval(this, "dragScroll", this.scrollInterval);
} else if (this.container_mc._ymouse > ((this.itmHgt - 2) * this.numDisplayed)) {
this.setScrollPosition(this.getScrollPosition() + 1);
this.selectionHandler(this.numDisplayed - 1);
this.scrollInterval = Math.max(25, (-23.8 * Math.abs((this.container_mc._ymouse - ((this.itmHgt - 2) * this.numDisplayed)) - 2)) + 500);
this.dragScrolling = setInterval(this, "dragScroll", this.scrollInterval);
} else {
this.dragScrolling = setInterval(this, "dragScroll", 15);
}
};
FScrollSelectListClass.prototype.myOnKeyDown = function () {
if (this.focused) {
this.keyCodes = new Array(40, 38, 34, 33, 36, 35);
this.keyIncrs = new Array(1, -1, this.numDisplayed - 1, -(this.numDisplayed - 1), -this.getLength(), this.getLength());
var i = 0;
while (i < this.keyCodes.length) {
if (Key.isDown(this.keyCodes[i])) {
this.moveSelBy(this.keyIncrs[i]);
return(undefined);
}
i++;
}
this.findInputText();
}
};
FScrollSelectListClass.prototype.findInputText = function () {
var tmpCode = Key.getAscii();
if ((tmpCode >= 33) && (tmpCode <= 126)) {
this.findString(String.fromCharCode(tmpCode));
}
};
FScrollSelectListClass.prototype.findString = function (str) {
var itemNum = this.getSelectedIndex();
var jump = 0;
var i = (itemNum + 1);
while (i != itemNum) {
var itmStr = this.getItemAt(i).label.substring(0, str.length);
if ((str == itmStr) || (str.toUpperCase() == itmStr.toUpperCase())) {
var jump = (i - itemNum);
break;
}
if (i >= (this.getLength() - 1)) {
i = -1;
}
i++;
}
if (jump != 0) {
this.moveSelBy(jump);
}
};
#endinitclip
Instance of Symbol 101 MovieClip [FSelectableListSymbol] in Symbol 102 MovieClip [FScrollSelectListSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Instance of Symbol 85 MovieClip [FScrollBarSymbol] in Symbol 102 MovieClip [FScrollSelectListSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
_targetInstanceName = "";
horizontal = false;
}
Symbol 103 MovieClip [FComboBoxSymbol] Frame 1
#initclip 8
function FComboBoxClass() {
_global._popUpLevel = ((_global._popUpLevel == undefined) ? 20000 : (_global._popUpLevel + 1));
_root.createEmptyMovieClip("superHolder" + _popUpLevel, _popUpLevel);
this.superHolder = _root["superHolder" + _popUpLevel];
this.popUpLevel = 0;
if (this.rowCount == undefined) {
this.rowCount = 8;
this.editable = false;
}
this.itemSymbol = "FComboBoxItemSymbol";
this.init();
this.permaScrollBar = false;
this.proxyBox_mc.gotoAndStop(1);
this.width = this._width;
this.height = (this.proxyBox_mc._height * this._yscale) / 100;
var i = 0;
while (i < this.labels.length) {
this.addItem(this.labels[i], this.data[i]);
i++;
}
this.lastSelected = 0;
this.selectItem(0);
this._xscale = (this._yscale = 100);
this.opened = false;
this.setSize(this.width);
this.highlightTop(false);
if (this.changeHandler.length > 0) {
this.setChangeHandler(this.changeHandler);
}
this.onUnload = function () {
this.superHolder.removeMovieClip();
};
this.setSelectedIndex(0, false);
this.value = "";
this.focusEnabled = true;
this.changeFlag = false;
}
FComboBoxClass.prototype = new FScrollSelectListClass();
Object.registerClass("FComboBoxSymbol", FComboBoxClass);
FComboBoxClass.prototype.modelChanged = function (eventObj) {
super.modelChanged(eventObj);
var event = eventObj.event;
if ((event == "addRows") || (event == "deleteRows")) {
var diff = ((eventObj.lastRow - eventObj.firstRow) + 1);
var mode = ((event == "addRows") ? 1 : -1);
var len = this.getLength();
var lenBefore = (len - (mode * diff));
if ((this.rowCount > lenBefore) || (this.rowCount > len)) {
this.invalidate("setSize");
}
if (this.getSelectedIndex() == undefined) {
this.setSelectedIndex(0, false);
}
} else if (event == "updateAll") {
this.invalidate("setSize");
}
};
FComboBoxClass.prototype.removeAll = function () {
if (!this.enable) {
return(undefined);
}
super.removeAll();
if (this.editable) {
this.value = "";
}
this.invalidate("setSize");
};
FComboBoxClass.prototype.setSize = function (w) {
if ((((w == undefined) || (typeof(w) != "number")) || (w <= 0)) || (!this.enable)) {
return(undefined);
}
this.proxyBox_mc._width = w;
this.popUpLevel++;
this.container_mc.removeMovieClip();
this.measureItmHgt();
this.superHolder.createEmptyMovieClip("container_mc" + this.popUpLevel, this.popUpLevel);
this.container_mc = this.superHolder["container_mc" + this.popUpLevel];
this.container_mc.tabChildren = false;
this.setPopUpLocation(this.container_mc);
this.container_mc.attachMovie("FBoundingBoxSymbol", "boundingBox_mc", 0);
this.boundingBox_mc = this.container_mc.boundingBox_mc;
this.boundingBox_mc.component = this;
this.registerSkinElement(this.boundingBox_mc.boundingBox, "background");
this.proxyBox_mc._height = this.itmHgt;
this.numDisplayed = Math.min(this.rowCount, this.getLength());
this.height = (this.numDisplayed * (this.itmHgt - 2)) + 2;
super.setSize(w, this.height);
this.attachMovie("DownArrow", "downArrow", 10);
this.downArrow._y = 0;
this.downArrow._width = this.itmHgt;
this.downArrow._height = this.itmHgt;
this.downArrow._x = this.proxyBox_mc._width - this.downArrow._width;
this.setEditable(this.editable);
this.container_mc._visible = this.opened;
this.highlightTop(false);
};
FComboBoxClass.prototype.setDataProvider = function (dp) {
super.setDataProvider(dp);
this.invalidate("setSize");
this.setSelectedIndex(0);
};
FComboBoxClass.prototype.getValue = function () {
if (this.editable) {
return(this.fLabel_mc.getLabel());
}
return(super.getValue());
};
FComboBoxClass.prototype.getRowCount = function () {
return(this.rowCount);
};
FComboBoxClass.prototype.setRowCount = function (count) {
this.rowCount = ((this.getLength() > count) ? (Math.max(count, 3)) : (count));
this.setSize(this.width);
var len = this.getLength();
if ((len - this.getScrollPosition()) < this.rowCount) {
this.setScrollPosition(len - Math.min(this.rowCount, len));
this.invalidate("updateControl");
}
};
FComboBoxClass.prototype.setEditable = function (editableFlag) {
if (!this.enable) {
return(undefined);
}
this.editable = editableFlag;
if (!this.editable) {
this.onPress = this.pressHandler;
this.useHandCursor = false;
this.trackAsMenu = true;
this.attachMovie("FComboBoxItemSymbol", "fLabel_mc", 5, {controller:this, itemNum:-1});
this.fLabel_mc.onRollOver = undefined;
this.fLabel_mc.setSize(this.width - this.itmHgt, this.itmHgt);
this.topLabel = this.getSelectedItem();
this.fLabel_mc.drawItem(this.topLabel, false);
this.highlightTop(false);
} else {
this.attachMovie("FLabelSymbol", "fLabel_mc", 5);
this.fLabel_txt = this.fLabel_mc.labelField;
this.fLabel_txt.type = "input";
this.fLabel_txt._x = 4;
this.fLabel_txt.onSetFocus = this.onLabelFocus;
this.fLabel_mc.setSize((this.width - this.itmHgt) - 3);
delete this.onPress;
this.fLabel_txt.onKillFocus = function () {
this._parent._parent.myOnKillFocus();
};
this.fLabel_mc.setLabel(this.value);
this.fLabel_txt.onChanged = function () {
this._parent._parent.findInputText();
};
this.downArrow.onPress = this.buttonPressHandler;
this.downArrow.useHandCursor = false;
this.downArrow.trackAsMenu = true;
}
};
FComboBoxClass.prototype.setEnabled = function (enabledFlag) {
enabledFlag = (((enabledFlag == undefined) || (typeof(enabledFlag) != "boolean")) ? true : (enabledFlag));
super.setEnabled(enabledFlag);
this.proxyBox_mc.gotoAndStop((this.enable ? "enabled" : "disabled"));
this.downArrow.gotoAndStop((this.enable ? 1 : 3));
if (this.editable) {
this.fLabel_txt.type = (enabledFlag ? "input" : "dynamic");
this.fLabel_txt.selectable = enabledFlag;
} else if (enabledFlag) {
this.fLabel_mc.drawItem(this.topLabel, false);
this.setSelectedIndex(this.getSelectedIndex(), false);
}
this.fLabel_mc.setEnabled(this.enable);
this.fLabel_txt.onSetFocus = (enabledFlag ? (this.onLabelFocus) : undefined);
};
FComboBoxClass.prototype.setSelectedIndex = function (index, flag) {
super.setSelectedIndex(index, flag);
if (!this.editable) {
this.topLabel = this.getSelectedItem();
this.fLabel_mc.drawItem(this.topLabel, false);
} else {
this.value = ((flag != undefined) ? "" : (this.getSelectedItem().label));
this.fLabel_mc.setLabel(this.value);
}
this.invalidate("updateControl");
};
FComboBoxClass.prototype.setValue = function (value) {
if (this.editable) {
this.fLabel_mc.setLabel(value);
this.value = value;
}
};
FComboBoxClass.prototype.pressHandler = function () {
this.focusRect.removeMovieClip();
if (this.enable) {
if (!this.opened) {
this.onMouseUp = this.releaseHandler;
} else {
this.onMouseUp = undefined;
}
this.changeFlag = false;
if (!this.focused) {
this.pressFocus();
this.isThisAKludge = (this.editable ? false : true);
}
if (!this.isThisAKludge) {
this.openOrClose(!this.opened);
} else {
this.isThisAKludge = false;
}
}
};
FComboBoxClass.prototype.clickHandler = function (itmNum) {
if (!this.focused) {
if (this.editable) {
this.fLabel_txt.onKillFocus = undefined;
}
this.pressFocus();
}
super.clickHandler(itmNum);
this.selectionHandler(itmNum);
this.onMouseUp = this.releaseHandler;
};
FComboBoxClass.prototype.highlightTop = function (flag) {
if (!this.editable) {
this.fLabel_mc.drawItem(this.topLabel, flag);
}
};
FComboBoxClass.prototype.myOnSetFocus = function () {
clearInterval(this.labelInt);
super.myOnSetFocus();
this.fLabel_mc.highlight_mc.gotoAndStop("enabled");
this.highlightTop(true);
};
FComboBoxClass.prototype.drawFocusRect = function () {
this.drawRect(-2, -2, this.width + 4, this._height + 4);
};
FComboBoxClass.prototype.myOnKillFocus = function () {
super.myOnKillFocus();
this.openOrClose(false);
this.highlightTop(false);
};
FComboBoxClass.prototype.setPopUpLocation = function (mcRef) {
mcRef._x = this._x;
var point = {x:this._x, y:this._y + this.proxyBox_mc._height};
this._parent.localToGlobal(point);
mcRef._x = point.x;
mcRef._y = point.y;
if ((this.height + mcRef._y) >= Stage.height) {
this.upward = true;
mcRef._y = (point.y - this.height) - this.proxyBox_mc._height;
} else {
this.upward = false;
}
};
FComboBoxClass.prototype.openOrClose = function (flag) {
this.setPopUpLocation(this.container_mc);
if ((this.lastSelected != -1) && ((this.lastSelected < this.topDisplayed) || (this.lastSelected > (this.topDisplayed + this.numDisplayed)))) {
super.moveSelBy(this.lastSelected - this.getSelectedIndex());
}
if (!flag) {
(this.downArrow.gotoAndStop(1));// not popped
} else {
(this.downArrow.gotoAndStop(2));// not popped
}
if (flag == this.opened) {
return(undefined);
}
this.highlightTop(!flag);
this.container_mc._visible = (this.opened = flag);
};
FComboBoxClass.prototype.fireChange = function () {
this.lastSelected = this.getSelectedIndex();
if (!this.editable) {
this.topLabel = this.getSelectedItem();
this.fLabel_mc.drawItem(this.topLabel, true);
} else {
this.value = this.getSelectedItem().label;
this.fLabel_mc.setLabel(this.value);
}
this.executeCallback();
};
FComboBoxClass.prototype.releaseHandler = function () {
var onCombo = this.boundingBox_mc.hitTest(_root._xmouse, _root._ymouse);
if (this.changeFlag) {
if (onCombo) {
this.fireChange();
}
this.openOrClose(!this.opened);
} else if (onCombo) {
this.openOrClose(false);
} else {
this.onMouseDown = function () {
if ((!this.boundingBox_mc.hitTest(_root._xmouse, _root._ymouse)) && (!this.hitTest(_root._xmouse, _root._ymouse))) {
this.onMouseDown = undefined;
this.openOrClose(false);
}
};
}
this.changeFlag = false;
this.onMouseUp = undefined;
clearInterval(this.dragScrolling);
this.dragScrolling = undefined;
};
FComboBoxClass.prototype.moveSelBy = function (itemNum) {
if (itemNum != 0) {
super.moveSelBy(itemNum);
if (this.editable) {
this.setValue(this.getSelectedItem().label);
}
if (!this.opened) {
if (this.changeFlag && (!this.isSelected(this.lastSelected))) {
this.fireChange();
}
}
}
};
FComboBoxClass.prototype.myOnKeyDown = function () {
if (!this.focused) {
return(undefined);
}
if (this.editable && (Key.isDown(13))) {
this.setValue(this.fLabel_mc.getLabel());
this.executeCallback();
this.openOrClose(false);
this.fLabel_txt.hscroll = 0;
} else if ((Key.isDown(13) || (Key.isDown(32) && (!this.editable))) && (this.opened)) {
if (this.getSelectedIndex() != this.lastSelected) {
this.fireChange();
}
this.openOrClose(false);
this.fLabel_txt.hscroll = 0;
}
super.myOnKeyDown();
};
FComboBoxClass.prototype.findInputText = function () {
if (!this.editable) {
super.findInputText();
}
};
FComboBoxClass.prototype.onLabelFocus = function () {
this._parent._parent.tabFocused = false;
this._parent._parent.labelInt = setInterval(this._parent._parent, "myOnSetFocus", 10);
this.onKeyDown = function () {
this._parent._parent.onKeyDown();
};
Key.addListener(this);
};
FComboBoxClass.prototype.buttonPressHandler = function () {
this._parent.pressHandler();
};
#endinitclip
Instance of Symbol 102 MovieClip [FScrollSelectListSymbol] "superClassAsset" in Symbol 103 MovieClip [FComboBoxSymbol] Frame 1
//component parameters
onClipEvent (initialize) {
}
Symbol 126 MovieClip Frame 17
_parent.frame = this._currentframe;
_parent.AllowPreload1 = true;
stop();
Symbol 126 MovieClip Frame 25
play();
_parent.AllowPreload1 = false;
Symbol 126 MovieClip Frame 34
stop();
_parent.nextFrame();
Symbol 141 Button
on (press) {
getURL ("http://eu.playstation.com", "_blank");
}
Symbol 171 MovieClip Frame 47
stop();
_parent.nextFrame();
Symbol 178 MovieClip Frame 1
stop();
Symbol 185 Button
on (press) {
nextFrame();
}
Symbol 186 MovieClip Frame 10
stop();
Symbol 186 MovieClip Frame 11
play();
Symbol 186 MovieClip Frame 18
stop();
_parent.nextFrame();
Symbol 186 MovieClip Frame 19
stop();