Section 1
//KeyPoll (bigroom.input.KeyPoll)
package bigroom.input {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class KeyPoll {
private var states:ByteArray;
private var dispObj:DisplayObject;
public function KeyPoll(_arg1:DisplayObject){
states = new ByteArray();
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
dispObj = _arg1;
dispObj.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener, false, 0, true);
dispObj.addEventListener(KeyboardEvent.KEY_UP, keyUpListener, false, 0, true);
dispObj.addEventListener(Event.ACTIVATE, activateListener, false, 0, true);
dispObj.addEventListener(Event.DEACTIVATE, deactivateListener, false, 0, true);
}
public function isUp(_arg1:uint):Boolean{
return (((states[(_arg1 >>> 3)] & (1 << (_arg1 & 7))) == 0));
}
private function activateListener(_arg1:Event):void{
var _local2:int;
_local2 = 0;
while (_local2 < 32) {
states[_local2] = 0;
_local2++;
};
}
private function deactivateListener(_arg1:Event):void{
var _local2:int;
_local2 = 0;
while (_local2 < 32) {
states[_local2] = 0;
_local2++;
};
}
public function isDown(_arg1:uint):Boolean{
return (!(((states[(_arg1 >>> 3)] & (1 << (_arg1 & 7))) == 0)));
}
private function keyDownListener(_arg1:KeyboardEvent):void{
states[(_arg1.keyCode >>> 3)] = (states[(_arg1.keyCode >>> 3)] | (1 << (_arg1.keyCode & 7)));
}
private function keyUpListener(_arg1:KeyboardEvent):void{
states[(_arg1.keyCode >>> 3)] = (states[(_arg1.keyCode >>> 3)] & ~((1 << (_arg1.keyCode & 7))));
}
}
}//package bigroom.input
Section 2
//bombSparks (com.shaunthesheep.colourchain.bombSparks)
package com.shaunthesheep.colourchain {
import org.flintparticles.emitters.*;
import flash.geom.*;
import flash.filters.*;
import org.flintparticles.zones.*;
import org.flintparticles.initializers.*;
import org.flintparticles.actions.*;
import org.flintparticles.counters.*;
import org.flintparticles.displayObjects.*;
public class bombSparks extends BitmapEmitter {
public function bombSparks():void{
addFilter(new BlurFilter(2, 2, 1));
addFilter(new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0.95, 0]));
setCounter(new Steady(40));
addInitializer(new SharedImage(new Line(12)));
addInitializer(new ColorInit(4294953984, 4294953984));
addInitializer(new Velocity(new DiscZone(new Point(0, 0), 200, 350)));
addInitializer(new Lifetime(0.2, 0.4));
addAction(new Age());
addAction(new Move());
addAction(new RotateToDirection());
}
}
}//package com.shaunthesheep.colourchain
Section 3
//gameEngine (com.shaunthesheep.colourchain.gameEngine)
package com.shaunthesheep.colourchain {
import flash.events.*;
import gs.*;
import flash.display.*;
public class gameEngine extends Sprite {
private var alreadyPlayed:Boolean;// = false
private var menu:mainMenu;
private var intro:introSequence;
private var grid:gridManager;
private var sfx:soundFX;
private var playercomms:playerCommunications;
private var instructions:Bitmap;
private var gameover:gameOverSequence;
public function gameEngine(_arg1:String):void{
intro = new introSequence();
menu = new mainMenu();
grid = new gridManager();
sfx = new soundFX();
gameover = new gameOverSequence();
alreadyPlayed = false;
super();
trace("Game Engine Ready");
playercomms = new playerCommunications(_arg1);
TweenLite.delayedCall(1, playIntro);
}
private function hideInstructions(_arg1:MouseEvent):void{
removeEventListener(MouseEvent.CLICK, hideInstructions);
TweenLite.to(instructions, 0.5, {alpha:0, onComplete:startGameEvents});
}
private function showGameOver(_arg1:Event):void{
trace("Game Over");
cleanUpGame();
addChild(gameover);
playercomms.saveToServer(3, grid.getPercentComplete(), grid.getScore());
gameover.addEventListener(gameOverSequence.GAME_OVER_COMPLETE, gameOverComplete, false, 0, true);
gameover.go(grid.getScore(), grid.getGameStatus());
}
private function playMainMenu():void{
trace("Starting Main Menu");
addChild(menu);
menu.go();
menu.addEventListener(mainMenu.MAINMENU_STARTGAME, startGame, false, 0, true);
menu.startMainMenu();
}
private function waitForInstructionsClick():void{
addEventListener(MouseEvent.CLICK, hideInstructions, false, 0, true);
}
private function gameOverComplete(_arg1:Event):void{
removeChild(grid);
removeChild(gameover);
menu.setDisplayLocations();
playMainMenu();
}
private function startGame(_arg1:Event):void{
trace("Main Menu - Start Game Selected");
_arg1.stopImmediatePropagation();
removeChild(menu);
menu.removeEventListener(mainMenu.MAINMENU_STARTGAME, startGame);
addChild(grid);
grid.mouseEnabled = false;
grid.init();
if (alreadyPlayed == false){
playercomms.saveToServer(1, 0, 0);
instructions = new Bitmap(new instructionsPNG(640, 450));
instructions.alpha = 0;
addChild(instructions);
TweenLite.to(instructions, 0.5, {alpha:1, onComplete:waitForInstructionsClick});
} else {
playercomms.saveToServer(2, 0, 0);
startGameEvents();
};
}
private function playIntro():void{
trace("Starting Aardboy Intro Sequence");
addChild(intro);
intro.addEventListener(introSequence.INTRO_COMPLETE, introComplete, false, 0, true);
intro.runIntro();
}
private function startGameEvents():void{
if (alreadyPlayed == false){
removeChild(instructions);
alreadyPlayed = true;
};
grid.createEvents();
grid.addEventListener(gridManager.GAME_OVER, showGameOver, false, 0, true);
grid.addEventListener(soundFX.PLAY_EFFECT_CLICK, sfx.playEffectClick, false, 0, true);
grid.addEventListener(soundFX.PLAY_EFFECT_EXPLODE, sfx.playEffectExplode, false, 0, true);
grid.addEventListener(soundFX.PLAY_EFFECT_COLLAPSE, sfx.playEffectCollapse, false, 0, true);
grid.addEventListener(soundFX.PLAY_EFFECT_BOMB, sfx.playEffectBomb, false, 0, true);
}
private function introComplete(_arg1:Event):void{
trace("Intro Sequence complete");
removeChild(intro);
intro.removeEventListener(introSequence.INTRO_COMPLETE, introComplete);
playMainMenu();
}
private function cleanUpGame():void{
grid.cleanUpManager();
grid.removeEventListener(gridManager.GAME_OVER, showGameOver);
grid.removeEventListener(soundFX.PLAY_EFFECT_CLICK, sfx.playEffectClick);
grid.removeEventListener(soundFX.PLAY_EFFECT_EXPLODE, sfx.playEffectExplode);
grid.removeEventListener(soundFX.PLAY_EFFECT_COLLAPSE, sfx.playEffectCollapse);
grid.removeEventListener(soundFX.PLAY_EFFECT_BOMB, sfx.playEffectBomb);
}
}
}//package com.shaunthesheep.colourchain
Section 4
//gameItem (com.shaunthesheep.colourchain.gameItem)
package com.shaunthesheep.colourchain {
import gs.*;
import flash.display.*;
import fl.motion.easing.*;
public class gameItem extends Sprite {
private var itemHeight:uint;// = 22
private var gridLocation:uint;
private var itemBitmap:Bitmap;
private var itemIsAlive:Boolean;
private var itemNumber:uint;
private var itemColumn:uint;
private var highlighted:Boolean;
private var itemWidth:uint;// = 32
private var itemIsWildcard:Boolean;
private var dropSpeed:Number;// = 0.7
private var inChain:Boolean;
private var itemRow:uint;
private var itemColour:uint;
private var shiftSpeed:Number;// = 0.7
private var destY:int;
private var destX:int;
public function gameItem(_arg1:uint, _arg2:uint, _arg3:int, _arg4:int):void{
itemWidth = 32;
itemHeight = 22;
dropSpeed = 0.7;
shiftSpeed = 0.7;
super();
itemIsAlive = true;
itemIsWildcard = false;
gridLocation = _arg1;
itemNumber = _arg1;
itemColour = _arg2;
itemColumn = ((_arg3 / itemWidth) + 1);
itemRow = ((_arg4 / itemHeight) + 1);
switch (itemColour){
case 1:
itemBitmap = new Bitmap(new shaun1PNG(itemWidth, itemHeight));
break;
case 2:
itemBitmap = new Bitmap(new shaun2PNG(itemWidth, itemHeight));
break;
case 3:
itemBitmap = new Bitmap(new shaun3PNG(itemWidth, itemHeight));
break;
case 4:
itemBitmap = new Bitmap(new shaun4PNG(itemWidth, itemHeight));
break;
case 5:
itemBitmap = new Bitmap(new shaun5PNG(itemWidth, itemHeight));
break;
case 6:
itemBitmap = new Bitmap(new shaun6PNG(itemWidth, itemHeight));
break;
};
addChild(itemBitmap);
setHighlightOff();
this.x = _arg3;
this.y = _arg4;
destX = _arg3;
destY = _arg4;
}
public function isWildcard():Boolean{
return (itemIsWildcard);
}
public function getColumn():uint{
return (itemColumn);
}
public function getNumber():uint{
return (itemNumber);
}
public function getGridLocation():uint{
return (gridLocation);
}
public function isChained():Boolean{
return (inChain);
}
public function getRow():uint{
return (itemRow);
}
public function shiftLeft(_arg1:uint, _arg2:uint, _arg3:uint):void{
var _local4:int;
_local4 = (destX - (_arg1 * itemWidth));
if (destX > 0){
destX = (destX - (_arg1 * itemWidth));
};
if (_local4 < 0){
_local4 = 0;
};
TweenLite.to(this, shiftSpeed, {x:_local4, ease:Bounce.easeOut, overwrite:false});
gridLocation = _arg2;
itemNumber = _arg2;
itemColumn = _arg3;
}
public function setHighlightOff():void{
highlighted = false;
inChain = false;
TweenFilterLite.to(itemBitmap, 0.25, {type:"Color", brightness:1});
}
public function getColour():uint{
return (itemColour);
}
public function isAlive():Boolean{
return (itemIsAlive);
}
public function changeColour(_arg1:uint):void{
itemColour = _arg1;
removeChild(itemBitmap);
switch (_arg1){
case 1:
itemBitmap = new Bitmap(new shaun1PNG(itemWidth, itemHeight));
break;
case 2:
itemBitmap = new Bitmap(new shaun2PNG(itemWidth, itemHeight));
break;
case 3:
itemBitmap = new Bitmap(new shaun3PNG(itemWidth, itemHeight));
break;
case 4:
itemBitmap = new Bitmap(new shaun4PNG(itemWidth, itemHeight));
break;
case 5:
itemBitmap = new Bitmap(new shaun5PNG(itemWidth, itemHeight));
break;
case 6:
itemBitmap = new Bitmap(new shaun6PNG(itemWidth, itemHeight));
itemIsWildcard = true;
break;
};
addChild(itemBitmap);
}
public function instantDisable():void{
highlighted = false;
inChain = false;
TweenFilterLite.to(itemBitmap, 0.25, {type:"Color", brightness:1});
}
public function explode():void{
this.mouseEnabled = false;
removeChild(itemBitmap);
itemIsAlive = false;
}
public function drop(_arg1:uint, _arg2:uint, _arg3:uint):void{
var _local4:int;
_local4 = (destY + (_arg1 * itemHeight));
destY = (destY + (_arg1 * itemHeight));
TweenLite.to(this, dropSpeed, {y:_local4, ease:Bounce.easeOut, overwrite:false});
gridLocation = _arg2;
itemNumber = _arg2;
itemRow = _arg3;
}
public function setHighlightOn():void{
highlighted = true;
inChain = true;
TweenFilterLite.to(itemBitmap, 0.25, {type:"Color", brightness:0.25});
}
}
}//package com.shaunthesheep.colourchain
Section 5
//gameOverSequence (com.shaunthesheep.colourchain.gameOverSequence)
package com.shaunthesheep.colourchain {
import flash.events.*;
import gs.*;
import flash.display.*;
import flash.filters.*;
import fl.motion.easing.*;
import flash.text.*;
public class gameOverSequence extends Sprite {
private var scoreFormat:TextFormat;
private var score:uint;
private var scoreDisplay:TextField;
private var gameOver:Sprite;
private var status:Boolean;
public static const GAME_OVER_COMPLETE:String = "gameOverComplete";
public function gameOverSequence():void{
trace("Game Over object is Alive");
init();
}
private function init():void{
var _local1:Bitmap;
var _local2:GlowFilter;
trace("Game Over init() should only run once");
gameOver = new Sprite();
_local1 = new Bitmap(new gameOverPNG(582, 136));
_local1.x = -291;
_local1.y = -136;
gameOver.addChild(_local1);
gameOver.buttonMode = true;
gameOver.cacheAsBitmap = true;
gameOver.useHandCursor = true;
scoreFormat = new TextFormat("BubbleGum", 40, 0xFFFFFF);
scoreFormat.align = TextFormatAlign.CENTER;
scoreDisplay = new TextField();
scoreDisplay.embedFonts = true;
scoreDisplay.defaultTextFormat = scoreFormat;
scoreDisplay.autoSize = TextFieldAutoSize.CENTER;
scoreDisplay.multiline = true;
scoreDisplay.selectable = false;
_local2 = new GlowFilter(4737082, 1, 3, 3, 100, 3);
scoreDisplay.filters = [_local2];
addChild(gameOver);
addChild(scoreDisplay);
}
private function startTween():void{
TweenLite.to(gameOver, 0.5, {scaleY:1.5, scaleX:1.5, ease:Exponential.easeIn});
TweenLite.to(gameOver, 0.5, {tint:0xFFFFFF, ease:Exponential.easeIn, overwrite:false});
TweenLite.to(gameOver, 0.5, {scaleY:1, scaleX:1, delay:0.5, ease:Exponential.easeOut, overwrite:false});
TweenLite.to(gameOver, 0.5, {tint:0, ease:Exponential.easeOut, delay:0.75, overwrite:false, onComplete:startTween});
}
private function buttonClicked(_arg1:MouseEvent):void{
trace("Game Over Click Handler");
gameOver.removeEventListener(MouseEvent.CLICK, buttonClicked);
dispatchEvent(new Event(gameOverSequence.GAME_OVER_COMPLETE));
}
public function go(_arg1:uint, _arg2:Boolean):void{
gameOver.x = (291 + 29);
gameOver.y = -400;
score = _arg1;
status = _arg2;
if (status == false){
scoreDisplay.text = ("no moves left!\nfinal score: " + score.toString());
} else {
scoreDisplay.text = ("congratulations!\nfinal score: " + score.toString());
};
scoreDisplay.x = ((640 / 2) - (scoreDisplay.width / 2));
scoreDisplay.y = 290;
gameOver.addEventListener(MouseEvent.CLICK, buttonClicked, false, 0, true);
TweenLite.to(gameOver, 2, {y:200, ease:Circular.easeOut, onComplete:startTween});
}
}
}//package com.shaunthesheep.colourchain
Section 6
//gamePanel (com.shaunthesheep.colourchain.gamePanel)
package com.shaunthesheep.colourchain {
import flash.events.*;
import gs.*;
import flash.display.*;
import fl.motion.easing.*;
import flash.ui.*;
public class gamePanel extends Sprite {
private var panel:Bitmap;
private var mute:Sprite;
private var background:Bitmap;
private var muteIcon:Bitmap;
private var sparks:bombSparks;
private var bombCursor:Sprite;
private var sfx:soundFX;
private var bombCount:uint;
private var darkness:Bitmap;
public var bomb1:Sprite;
public var bomb2:Sprite;
public var bomb3:Sprite;
public var bomb4:Sprite;
public function gamePanel():void{
sfx = new soundFX();
super();
}
public function addBomb():void{
if (bombCount < 5){
bombCount++;
switch (bombCount){
case 1:
bomb1.x = 0x0200;
bomb1.y = 480;
bomb1.visible = true;
TweenLite.to(bomb1, 1, {y:405, ease:Sine.easeIn});
break;
case 2:
bomb2.x = 538;
bomb2.y = 480;
bomb2.visible = true;
TweenLite.to(bomb2, 1, {y:405, ease:Sine.easeIn});
break;
case 3:
bomb3.x = 564;
bomb3.y = 480;
bomb3.visible = true;
TweenLite.to(bomb3, 1, {y:405, ease:Sine.easeIn});
break;
case 4:
bomb4.x = 590;
bomb4.y = 480;
bomb4.visible = true;
TweenLite.to(bomb4, 1, {y:405, ease:Sine.easeIn});
break;
};
};
}
public function init():void{
trace("Game Panel Created");
background = new Bitmap(new background1JPG(640, 450));
darkness = new Bitmap(new BitmapData(640, 450, true, 4278190080));
darkness.alpha = 0.5;
panel = new Bitmap(new gamePanelPNG(635, 43));
panel.x = 2;
panel.y = 407;
mute = new Sprite();
mute.x = 116;
mute.y = 409;
mute.graphics.beginFill(0, 0);
mute.graphics.drawRect(0, 0, 49, 40);
mute.graphics.endFill();
mute.mouseEnabled = true;
mute.buttonMode = true;
mute.useHandCursor = true;
muteIcon = new Bitmap(new mutePNG(0, 0));
muteIcon.x = 126;
muteIcon.y = 427;
muteIcon.visible = false;
bomb1 = new Sprite();
bomb1.addChild(new Bitmap(new bombPNG(46, 46)));
bomb1.x = 0x0200;
bomb1.y = 405;
bomb1.buttonMode = true;
bomb1.useHandCursor = true;
bomb1.cacheAsBitmap = true;
bomb2 = new Sprite();
bomb2.addChild(new Bitmap(new bombPNG(46, 46)));
bomb2.visible = false;
bomb2.buttonMode = true;
bomb2.useHandCursor = true;
bomb2.cacheAsBitmap = true;
bomb3 = new Sprite();
bomb3.addChild(new Bitmap(new bombPNG(46, 46)));
bomb3.visible = false;
bomb3.buttonMode = true;
bomb3.useHandCursor = true;
bomb3.cacheAsBitmap = true;
bomb4 = new Sprite();
bomb4.addChild(new Bitmap(new bombPNG(46, 46)));
bomb4.visible = false;
bomb4.buttonMode = true;
bomb4.useHandCursor = true;
bomb4.cacheAsBitmap = true;
bombCursor = new Sprite();
bombCursor.addChild(new Bitmap(new bombCursorPNG(41, 36)));
bombCursor.cacheAsBitmap = true;
bombCursor.visible = false;
bombCount = 1;
mute.addEventListener(MouseEvent.CLICK, toggleMute, false, 0, true);
addChild(background);
addChild(darkness);
addChild(panel);
addChild(mute);
addChild(muteIcon);
addChild(bomb4);
addChild(bomb3);
addChild(bomb2);
addChild(bomb1);
}
public function enterBombMode():void{
trace("Entering bomb mode");
stage.addChild(bombCursor);
bombCursor.x = mouseX;
bombCursor.y = mouseY;
bombCursor.visible = true;
Mouse.hide();
sparks = new bombSparks();
sparks.mouseEnabled = false;
stage.addChild(sparks);
sparks.start();
switch (bombCount){
case 1:
bomb1.visible = false;
break;
case 2:
bomb2.visible = false;
break;
case 3:
bomb3.visible = false;
break;
case 4:
bomb4.visible = false;
break;
};
stage.addEventListener(MouseEvent.MOUSE_MOVE, bombTrackMouse, false, 0, true);
}
private function bombTrackMouse(_arg1:MouseEvent):void{
bombCursor.x = mouseX;
bombCursor.y = mouseY;
sparks.x = (mouseX + 46);
sparks.y = (mouseY + 10);
}
public function replaceBomb():void{
bombCursor.visible = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, bombTrackMouse);
Mouse.show();
stage.removeChild(sparks);
addBomb();
}
private function toggleMute(_arg1:MouseEvent):void{
trace("toggle mute");
if (sfx.isMuted){
sfx.unMuteEffects();
muteIcon.visible = false;
} else {
sfx.muteEffects();
muteIcon.visible = true;
};
}
public function useBomb():void{
bombCount--;
bombCursor.visible = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, bombTrackMouse);
Mouse.show();
stage.removeChild(sparks);
}
public function getBombCount():uint{
return (bombCount);
}
public function liftDarkness():void{
TweenLite.to(darkness, 1, {alpha:0, delay:1});
}
}
}//package com.shaunthesheep.colourchain
Section 7
//gameParticles (com.shaunthesheep.colourchain.gameParticles)
package com.shaunthesheep.colourchain {
import flash.display.*;
import org.flintparticles.emitters.*;
import flash.geom.*;
import flash.filters.*;
import org.flintparticles.zones.*;
import org.flintparticles.initializers.*;
import org.flintparticles.actions.*;
import org.flintparticles.counters.*;
import org.flintparticles.utils.*;
public class gameParticles extends BitmapEmitter {
private var prevVelocity:Velocity;
private var particleImage4:Bitmap;
private var particleImage7:Bitmap;
private var particleImage5:Bitmap;
private var particleImage6:Bitmap;
private var particleImage2:Bitmap;
private var particleImage3:Bitmap;
private var prevPosition:Position;
private var particleImage1:Bitmap;
public function gameParticles():void{
particleImage1 = new Bitmap(new shaun1PNG(32, 22));
particleImage2 = new Bitmap(new shaun2PNG(32, 22));
particleImage3 = new Bitmap(new shaun3PNG(32, 22));
particleImage4 = new Bitmap(new shaun4PNG(32, 22));
particleImage5 = new Bitmap(new shaun5PNG(32, 22));
particleImage6 = new Bitmap(new shaun6PNG(32, 22));
particleImage7 = new Bitmap(new shaun7PNG(32, 22));
trace("new particles created");
super();
addFilter(new BlurFilter(4, 4, 1));
addFilter(new ColorMatrixFilter([0.5, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0.95, 0]));
addInitializer(new Lifetime(2.5));
addAction(new Age());
addAction(new Move());
addAction(new Accelerate(0, 270));
addAction(new Fade(1, 0));
addAction(new DeathOffStage(32));
}
public function setQuantity(_arg1:uint):void{
setCounter(new Blast(_arg1));
}
public function setLocation(_arg1:uint, _arg2:uint):void{
var _local3:Velocity;
var _local4:Position;
if (prevVelocity != null){
removeInitializer(prevVelocity);
};
if (prevPosition != null){
removeInitializer(prevPosition);
};
_local3 = new Velocity(new DiscSectorZone(new Point(0, 0), 290, 290, Maths.asRadians(180), Maths.asRadians(0)));
_local4 = new Position(new DiscZone(new Point(0, 0), 20, 20));
addInitializer(_local3);
addInitializer(_local4);
prevVelocity = _local3;
prevPosition = _local4;
}
public function setColour(_arg1:uint):void{
switch (_arg1){
case 1:
addInitializer(new SharedImage(particleImage1));
break;
case 2:
addInitializer(new SharedImage(particleImage2));
break;
case 3:
addInitializer(new SharedImage(particleImage3));
break;
case 4:
addInitializer(new SharedImage(particleImage4));
break;
case 5:
addInitializer(new SharedImage(particleImage5));
break;
case 6:
addInitializer(new SharedImage(particleImage6));
break;
case 7:
addInitializer(new SharedImage(particleImage7));
break;
};
}
}
}//package com.shaunthesheep.colourchain
Section 8
//gameScore (com.shaunthesheep.colourchain.gameScore)
package com.shaunthesheep.colourchain {
import gs.*;
import flash.display.*;
import flash.filters.*;
import flash.text.*;
public final class gameScore extends Sprite {
private var scoreFormat:TextFormat;
private var percentDisplay:TextField;
private var percentFormat:TextFormat;
private var scoreDisplay:TextField;
private static var totalItems:uint;
private static var completeBonus:uint = 50000;
private static var columnBonus:uint = 10000;
private static var matchPoint:uint = 250;
private static var totalScore:uint;
private static var itemsComplete:uint;
private static var percentComplete:Number;
public function gameScore():void{
}
public function addColumnBonus(_arg1:int):void{
trace(("Adding Column Bonus X " + _arg1));
totalScore = (totalScore + (columnBonus * _arg1));
updateScore();
}
public function init():void{
trace("Score Init - only run once");
scoreFormat = new TextFormat("BubbleGum", 20, 4294967295);
scoreDisplay = new TextField();
scoreDisplay.embedFonts = true;
scoreDisplay.defaultTextFormat = scoreFormat;
scoreDisplay.selectable = false;
scoreDisplay.mouseEnabled = false;
scoreDisplay.width = 100;
scoreDisplay.height = 40;
scoreDisplay.x = 266;
scoreDisplay.y = 417;
scoreDisplay.text = "0";
scoreDisplay.filters = [new GlowFilter(1661891, 1, 3, 3, 100, 3)];
percentFormat = new TextFormat("BubbleGum", 20, 4294967295);
percentDisplay = new TextField();
percentDisplay.embedFonts = true;
percentDisplay.defaultTextFormat = percentFormat;
percentDisplay.selectable = false;
percentDisplay.mouseEnabled = false;
percentDisplay.width = 60;
percentDisplay.height = 40;
percentDisplay.x = 434;
percentDisplay.y = 417;
percentDisplay.text = "100%";
percentDisplay.filters = [new GlowFilter(1661891, 1, 3, 3, 100, 3)];
addChild(scoreDisplay);
addChild(percentDisplay);
resetValues();
}
public function updatePercent():void{
percentComplete = ((itemsComplete / totalItems) * 100);
percentComplete = Math.ceil(percentComplete);
percentComplete = (100 - percentComplete);
if (percentComplete < 0){
percentComplete = 0;
};
percentDisplay.text = (percentComplete.toString() + "%");
}
public function addCompleteBonus():void{
if (itemsComplete == totalItems){
totalScore = (totalScore + completeBonus);
updateScore();
};
}
public function updateScore():void{
scoreDisplay.text = getTotalScore().toString();
}
public function addMatchPoint(_arg1:int, _arg2:uint, _arg3:int, _arg4:int):void{
var _local5:uint;
_local5 = (matchPoint * _arg1);
itemsComplete = (itemsComplete + _arg2);
totalScore = (totalScore + _local5);
updateScore();
updatePercent();
createPointBurst(_local5, _arg3, _arg4);
}
public function getItemsComplete():uint{
return (itemsComplete);
}
public function resetValues():void{
itemsComplete = 0;
totalScore = 0;
percentComplete = 0;
scoreDisplay.text = getTotalScore().toString();
}
private function killPointBurst(_arg1:pointBurst):void{
stage.removeChild(_arg1);
_arg1 = null;
}
public function getPercentComplete():uint{
return (percentComplete);
}
public function getTotalScore():uint{
return (totalScore);
}
private function createPointBurst(_arg1:uint, _arg2:int, _arg3:int){
var _local4:pointBurst;
_local4 = new pointBurst(_arg1, _arg2, _arg3);
stage.addChild(_local4);
_local4.moveIt();
TweenLite.delayedCall(2, killPointBurst, [_local4]);
}
public function getTotalItems():uint{
return (totalItems);
}
public function setTotalItems(_arg1:uint):void{
totalItems = _arg1;
}
}
}//package com.shaunthesheep.colourchain
Section 9
//gridManager (com.shaunthesheep.colourchain.gridManager)
package com.shaunthesheep.colourchain {
import flash.events.*;
import gs.*;
import flash.display.*;
import bigroom.input.*;
import fl.motion.easing.*;
public class gridManager extends Sprite {
private var gridCoords:Array;
private var panel:gamePanel;
private var itemHeight:uint;// = 22
private var addBombAmount:uint;// = 8
private var walker:gridWalker;
private var key:KeyPoll;
private var emitter:gameParticles;
private var bombMode:Boolean;// = false
private var bombPreviouslySet:Boolean;// = false
private var itemWidth:uint;// = 32
private var chain:itemChain;
private var addWildcardAmount:uint;// = 5
private var gridShiftDistance:uint;
public static const GAME_OVER:String = "gameOver";
public static const PAUSE_MOUSECLICKS:String = "pauseMouseClicks";
public static const RESUME_MOUSECLICKS:String = "resumeMouseClicks";
public static const EXPLODE_PROCESS_STEP1:String = "explodeProcess1";
public static const EXPLODE_PROCESS_STEP2:String = "explodeProcess2";
public static const EXPLODE_PROCESS_STEP3:String = "explodeProcess3";
protected static var gridHeight:uint = 18;
private static var score:gameScore;
protected static var gameGrid:Array;
protected static var gridItems:Array;
protected static var gridContainer:Sprite;
protected static var gridWidth:uint = 20;
protected static var gridSize:uint;
protected static var currentGridWidth:uint;
public function gridManager(){
itemWidth = 32;
itemHeight = 22;
addBombAmount = 8;
addWildcardAmount = 5;
bombMode = false;
bombPreviouslySet = false;
super();
}
public function getScore():uint{
return (score.getTotalScore());
}
public function init():void{
trace("GM Init");
key = new KeyPoll(this.stage);
chain = new itemChain();
walker = new gridWalker();
score = new gameScore();
panel = new gamePanel();
panel.init();
panel.mouseEnabled = false;
addChild(panel);
addChild(score);
score.init();
score.setTotalItems((gridWidth * gridHeight));
currentGridWidth = gridWidth;
createGrid();
populateGrid();
addChild(gridContainer);
bombMode = false;
emitter = new gameParticles();
emitter.mouseEnabled = false;
addChild(emitter);
}
private function collapseSingleColumn(_arg1:uint, _arg2:uint):void{
var _local3:uint;
var _local4:uint;
var _local5:int;
var _local6:uint;
var _local7:uint;
var _local8:gameItem;
trace(((("Collapsing Single Column " + _arg1) + " by a distance of ") + _arg2));
_local3 = _arg1;
_local4 = 0;
if ((_local3 - _arg2) < 1){
_local4 = 1;
} else {
_local4 = (_local3 - _arg2);
};
trace(((("Moving single column: " + _local3) + " to column: ") + _local4));
_local5 = 0;
while (_local5 < gridHeight) {
_local6 = getGridLocation(_local5, _local3);
_local7 = getGridLocation(_local5, _local4);
gameGrid[_local7] = gameGrid[_local6];
gameGrid[_local6] = 0;
_local8 = gridItems[_local7];
gridItems[_local7] = gridItems[_local6];
gridItems[_local6] = _local8;
gridItems[_local7].shiftLeft(_arg2, _local7, _local4);
_local5++;
};
}
private function scanForEmptyColumns():void{
var _local1:uint;
var _local2:Boolean;
var _local3:uint;
var _local4:uint;
var _local5:int;
_local1 = 0;
_local2 = true;
calculateCurrentGridWidth();
_local3 = 1;
while (_local3 <= currentGridWidth) {
_local4 = 0;
_local5 = gridHeight;
while (_local5 >= 0) {
if (gameGrid[getGridLocation(_local5, _local3)] == 0){
_local4++;
};
_local5--;
};
if (_local4 == gridHeight){
trace((("Column " + _local3) + " is now EMPTY"));
_local1++;
score.addColumnBonus(_local1);
if (_local2){
TweenLite.delayedCall(0.25, dispatchCollapseSoundEvent);
_local2 = false;
};
} else {
if (_local1 > 0){
collapseSingleColumn(_local3, _local1);
};
};
_local3++;
};
dispatchEvent(new Event(gridManager.EXPLODE_PROCESS_STEP3));
}
private function enableBombMode(_arg1:MouseEvent):void{
if (bombMode == true){
return;
};
if (panel.getBombCount() > 0){
bombMode = true;
panel.enterBombMode();
};
}
private function startClickEvent(_arg1:Event):void{
trace("Resuming click events");
gridContainer.addEventListener(MouseEvent.CLICK, processClick, false, 0, true);
}
private function findRandomItem():gameItem{
var _local1:Array;
var _local2:gameItem;
var _local3:uint;
_local1 = new Array();
for each (_local2 in gridItems) {
if ((((_local2.isAlive() == true)) && ((_local2.isWildcard() == false)))){
_local1.push(_local2);
};
};
_local3 = (Math.random() * _local1.length);
return (_local1[_local3]);
}
public function createEvents():void{
trace("Creating Game Events in GM");
gridContainer.addEventListener(MouseEvent.CLICK, processClick, true, 0, true);
gridContainer.addEventListener(gridManager.PAUSE_MOUSECLICKS, pauseClickEvent, false, 0, true);
gridContainer.addEventListener(gridManager.RESUME_MOUSECLICKS, startClickEvent, false, 0, true);
panel.bomb1.addEventListener(MouseEvent.CLICK, enableBombMode, false, 0, true);
panel.bomb2.addEventListener(MouseEvent.CLICK, enableBombMode, false, 0, true);
panel.bomb3.addEventListener(MouseEvent.CLICK, enableBombMode, false, 0, true);
addEventListener(gridManager.EXPLODE_PROCESS_STEP1, explodeProcessStep1, false, 0, true);
addEventListener(gridManager.EXPLODE_PROCESS_STEP2, explodeProcessStep2, false, 0, true);
addEventListener(gridManager.EXPLODE_PROCESS_STEP3, explodeProcessStep3, false, 0, true);
}
private function explodeProcessStep1(_arg1:Event):void{
trace("Explode Process Step 1");
dropColumns();
}
private function explodeProcessStep2(_arg1:Event):void{
trace("Explode Process Step 2");
scanForEmptyColumns();
}
public function getGridShiftDistance():uint{
return ((gridShiftDistance * itemWidth));
}
private function calculateCurrentGridWidth():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:int;
_local1 = 0;
_local2 = gridWidth;
while (_local2 >= 1) {
_local3 = 0;
_local4 = gridHeight;
while (_local4 >= 0) {
if (gameGrid[getGridLocation(_local4, _local2)] == 0){
_local3++;
};
_local4--;
};
if (_local3 == gridHeight){
_local1++;
} else {
break;
};
_local2--;
};
currentGridWidth = (gridWidth - _local1);
trace(("Current width is: " + currentGridWidth));
}
private function addWildcards(_arg1:uint):void{
var _local2:gameItem;
var _local3:uint;
_local2 = null;
_local3 = 0;
while (_local3 < _arg1) {
_local2 = findRandomItem();
gridItems[_local2.getGridLocation()].changeColour(6);
gameGrid[_local2.getGridLocation()] = 6;
trace(("Creating WildCard at: " + _local2.getGridLocation()));
_local3++;
};
}
private function explodeProcessStep3(_arg1:Event):void{
trace("Explode Process Step 3");
checkForMoves();
}
public function cleanUpManager():void{
trace("Cleaning up GM events");
gridContainer.removeEventListener(MouseEvent.CLICK, processClick);
gridContainer.removeEventListener(gridManager.PAUSE_MOUSECLICKS, pauseClickEvent);
gridContainer.removeEventListener(gridManager.RESUME_MOUSECLICKS, startClickEvent);
}
private function startExplodeProcess():void{
trace("Explode Process Started");
removeGridItems();
}
public function populateGrid():void{
var _local1:uint;
var _local2:*;
var _local3:int;
var _local4:int;
gridItems = new Array();
gridContainer = new Sprite();
_local1 = 1;
for each (_local2 in gameGrid) {
_local3 = gridCoords[_local1][0];
_local4 = gridCoords[_local1][1];
gridItems[_local1] = new gameItem(_local1, _local2, _local3, _local4);
gridItems[_local1].cacheAsBitmap = true;
gridContainer.addChild(gridItems[_local1]);
_local1++;
};
addWildcards(10);
gridItems[3].changeColour(1);
gameGrid[3] = 1;
gridItems[4].changeColour(1);
gameGrid[4] = 1;
gridItems[5].changeColour(1);
gameGrid[5] = 1;
}
public function createGrid():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:uint;
gridSize = (gridWidth * gridHeight);
gameGrid = new Array(gridSize);
_local1 = 1;
while (_local1 <= gridSize) {
_local3 = (1 + (Math.random() * 5));
gameGrid[_local1] = _local3;
_local1++;
};
gridCoords = new Array();
_local3 = 1;
_local2 = 0;
while (_local2 < gridHeight) {
_local4 = 1;
while (_local4 <= gridWidth) {
gridCoords[_local3] = [((_local4 * itemWidth) - itemWidth), (_local2 * itemHeight)];
_local3++;
_local4++;
};
_local2++;
};
}
private function dumpGrid():void{
var _local1:int;
var _local2:String;
var _local3:uint;
var _local4:uint;
trace("--------------------------------------------");
trace(" 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K");
trace(" | | | | | | | | | | | | | | | | | | | |");
_local1 = 0;
while (_local1 < gridHeight) {
_local2 = _local1.toString();
if (_local1 < 10){
_local2 = (_local2 + " - ");
} else {
_local2 = (_local2 + " - ");
};
_local3 = 1;
while (_local3 <= gridWidth) {
_local4 = gameGrid[getGridLocation(_local1, _local3)];
if (_local4 == 0){
_local2 = (_local2 + " ");
} else {
_local2 = (_local2 + _local4);
};
if (_local3 != gridWidth){
_local2 = (_local2 + " ");
};
_local3++;
};
trace(_local2);
_local1++;
};
trace("--------------------------------------------");
}
public function getPercentComplete():uint{
return (score.getPercentComplete());
}
public function processClick(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:Boolean;
var _local4:gameItem;
_local2 = 0;
for each (_local4 in gridItems) {
if (((_local4.isAlive()) && ((_local4.isWildcard() == false)))){
if (_local4.hitTestPoint(mouseX, mouseY, false)){
trace(((((((("Clicked Item " + _local4.getNumber()) + " colour: ") + _local4.getColour()) + " row: ") + _local4.getRow()) + " col: ") + _local4.getColumn()));
if (bombMode){
chain.clear();
_local3 = walker.createBombChain(_local4);
if (_local3){
panel.useBomb();
dispatchEvent(new Event(soundFX.PLAY_EFFECT_BOMB));
_local2 = 0;
bombPreviouslySet = true;
};
};
if (_local2 == 0){
if (_local4.isChained()){
dispatchEvent(new Event(gridManager.PAUSE_MOUSECLICKS));
score.addMatchPoint(chain.getChainSize(), chain.getItemsInChain(), mouseX, mouseY);
if (bombMode){
emitter.setColour(7);
bombMode = false;
} else {
emitter.setColour(_local4.getColour());
};
emitter.x = mouseX;
emitter.y = mouseY;
emitter.setLocation(mouseX, mouseY);
emitter.setQuantity(chain.getItemsInChain());
emitter.start();
dumpGrid();
startExplodeProcess();
dumpGrid();
} else {
chain.clear();
_local3 = walker.startWalking(_local4);
if (_local3){
dispatchEvent(new Event(soundFX.PLAY_EFFECT_CLICK));
};
};
} else {
_local4.changeColour(_local2);
gameGrid[_local4.getGridLocation()] = _local2;
dumpGrid();
};
break;
};
};
};
}
private function dispatchCollapseSoundEvent():void{
dispatchEvent(new Event(soundFX.PLAY_EFFECT_COLLAPSE));
}
protected function getGridLocationFromItem(_arg1:uint, _arg2:uint):uint{
var _local3:uint;
_arg1--;
_local3 = ((_arg1 * gridWidth) + _arg2);
return (_local3);
}
private function pauseClickEvent(_arg1:Event):void{
trace("Pausing click events");
gridContainer.removeEventListener(MouseEvent.CLICK, processClick);
}
protected function getGridLocation(_arg1:uint, _arg2:uint):uint{
var _local3:uint;
_local3 = ((_arg1 * gridWidth) + _arg2);
return (_local3);
}
private function checkForMoves():void{
if (score.getItemsComplete() == score.getTotalItems()){
score.addCompleteBonus();
gameOver();
} else {
if ((((walker.quickWalk() == false)) && ((panel.getBombCount() == 0)))){
gameOver();
} else {
dispatchEvent(new Event(gridManager.RESUME_MOUSECLICKS));
};
};
}
public function getGameStatus():Boolean{
if (score.getPercentComplete() > 0){
return (false);
};
return (true);
}
private function sendGameOverEvent():void{
removeChild(gridContainer);
dispatchEvent(new Event(gridManager.GAME_OVER));
}
private function gameOver():void{
TweenLite.to(gridContainer, 1.5, {y:-460, alpha:0.25, ease:Exponential.easeOut, onComplete:sendGameOverEvent});
panel.liftDarkness();
}
private function dropColumns():void{
var _local1:uint;
var _local2:uint;
var _local3:int;
var _local4:uint;
var _local5:uint;
var _local6:gameItem;
_local1 = 1;
while (_local1 <= gridWidth) {
_local2 = 0;
_local3 = gridHeight;
while (_local3 >= 0) {
if (gameGrid[getGridLocation(_local3, _local1)] == 0){
_local2++;
} else {
if (_local2 > 0){
_local4 = getGridLocation(_local3, _local1);
_local5 = getGridLocation((_local3 + _local2), _local1);
gameGrid[_local5] = gameGrid[_local4];
gameGrid[_local4] = 0;
_local6 = gridItems[_local5];
gridItems[_local5] = gridItems[_local4];
gridItems[_local4] = _local6;
gridItems[_local5].drop(_local2, _local5, ((_local3 + _local2) + 1));
};
};
_local3--;
};
_local1++;
};
dispatchEvent(new Event(gridManager.EXPLODE_PROCESS_STEP2));
}
private function getGridCoords(_arg1:uint):Array{
var _local2:uint;
var _local3:uint;
_local2 = Math.ceil((_arg1 / gridWidth));
_local3 = (_arg1 - ((_local2 - 1) * gridWidth));
return ([_local2, _local3]);
}
private function removeGridItems():void{
var _local1:Array;
var _local2:uint;
_local1 = chain.explode();
if ((((chain.getItemsInChain() > addBombAmount)) && ((bombPreviouslySet == false)))){
panel.addBomb();
};
for each (_local2 in _local1) {
gameGrid[_local2] = 0;
};
trace(("PEC " + score.getPercentComplete()));
if ((((chain.getItemsInChain() > addWildcardAmount)) && ((score.getPercentComplete() > 10)))){
addWildcards(1);
};
bombPreviouslySet = false;
dispatchEvent(new Event(soundFX.PLAY_EFFECT_EXPLODE));
dispatchEvent(new Event(gridManager.EXPLODE_PROCESS_STEP1));
}
}
}//package com.shaunthesheep.colourchain
Section 10
//gridWalker (com.shaunthesheep.colourchain.gridWalker)
package com.shaunthesheep.colourchain {
public class gridWalker extends gridManager {
private var originColour:uint;
private static var chain:itemChain;
public function gridWalker():void{
trace("Grid Walker Created");
chain = new itemChain();
}
private function completeTheChain():void{
var _local1:uint;
var _local2:gameItem;
_local1 = 0;
while (chain.getCheckedTotal() > 0) {
_local2 = chain.getChainItem(_local1);
walkTheGrid(_local2);
_local1++;
};
}
private function walkTheGrid(_arg1:gameItem):void{
if (_arg1.getRow() > 1){
travelGridUp(_arg1);
};
if (_arg1.getRow() <= gridHeight){
travelGridDown(_arg1);
};
if (_arg1.getColumn() > 1){
travelGridLeft(_arg1);
};
if (_arg1.getColumn() < currentGridWidth){
travelGridRight(_arg1);
};
}
public function quickWalk():Boolean{
var _local1:uint;
var _local2:uint;
_local1 = 0;
while (_local1 < gridHeight) {
_local2 = 1;
while (_local2 <= gridWidth) {
if (gameGrid[getGridLocation(_local2, _local1)] > 0){
if (starScan(_local2, _local1)){
return (true);
};
};
_local2++;
};
_local1++;
};
return (false);
}
private function travelGridUp(_arg1:gameItem):void{
var _local2:uint;
var _local3:Boolean;
var _local4:uint;
_local2 = (_arg1.getGridLocation() - gridWidth);
_local3 = true;
_local4 = 0;
if (_arg1.isWildcard()){
_local4 = originColour;
} else {
_local4 = _arg1.getColour();
};
do {
if (_local2 > 0){
if ((((gameGrid[_local2] == _local4)) || ((gameGrid[_local2] == 6)))){
chain.addToChain(gridItems[_local2]);
_local2 = (_local2 - gridWidth);
} else {
_local3 = false;
};
} else {
_local3 = false;
};
} while (_local3 == true);
}
private function travelGridDown(_arg1:gameItem):void{
var _local2:uint;
var _local3:Boolean;
var _local4:uint;
_local2 = (_arg1.getGridLocation() + gridWidth);
_local3 = true;
_local4 = 0;
if (_arg1.isWildcard()){
_local4 = originColour;
} else {
_local4 = _arg1.getColour();
};
do {
if (_local2 <= gridSize){
if ((((gameGrid[_local2] == _local4)) || ((gameGrid[_local2] == 6)))){
chain.addToChain(gridItems[_local2]);
_local2 = (_local2 + gridWidth);
} else {
_local3 = false;
};
} else {
_local3 = false;
};
} while (_local3 == true);
}
private function travelGridRight(_arg1:gameItem):void{
var _local2:uint;
var _local3:uint;
var _local4:Boolean;
var _local5:uint;
_local2 = (_arg1.getGridLocation() + 1);
_local3 = (_arg1.getColumn() + 1);
_local4 = true;
_local5 = 0;
if (_arg1.isWildcard()){
_local5 = originColour;
} else {
_local5 = _arg1.getColour();
};
do {
if (_local3 <= currentGridWidth){
if ((((gameGrid[_local2] == _local5)) || ((gameGrid[_local2] == 6)))){
chain.addToChain(gridItems[_local2]);
_local2 = (_local2 + 1);
_local3 = (_local3 + 1);
} else {
_local4 = false;
};
} else {
_local4 = false;
};
} while (_local4 == true);
}
public function startWalking(_arg1:gameItem):Boolean{
chain.addToChain(_arg1);
originColour = _arg1.getColour();
walkTheGrid(_arg1);
if (chain.getLinksCount() > 1){
completeTheChain();
return (true);
};
chain.clear();
return (false);
}
public function createBombChain(_arg1:gameItem):Boolean{
var _local2:uint;
var _local3:uint;
var _local4:gameItem;
trace(((("creating bomb at: col: " + _arg1.getColumn()) + " row: ") + _arg1.getRow()));
chain.addToChain(_arg1);
_local2 = 0;
_local3 = 0;
if ((((_arg1.getRow() > 1)) && ((_arg1.getColumn() > 1)))){
_local2 = (_arg1.getColumn() - 1);
_local3 = (_arg1.getRow() - 1);
_local4 = gridItems[getGridLocationFromItem(_local3, _local2)];
if (_local4.isAlive()){
chain.addToChain(_local4);
};
};
if (_arg1.getRow() > 1){
_local2 = _arg1.getColumn();
_local3 = (_arg1.getRow() - 1);
_local4 = gridItems[getGridLocationFromItem(_local3, _local2)];
if (_local4.isAlive()){
chain.addToChain(_local4);
};
};
if ((((_arg1.getRow() > 1)) && ((_arg1.getColumn() < gridWidth)))){
_local2 = (_arg1.getColumn() + 1);
_local3 = (_arg1.getRow() - 1);
_local4 = gridItems[getGridLocationFromItem(_local3, _local2)];
if (_local4.isAlive()){
chain.addToChain(_local4);
};
};
if (_arg1.getColumn() > 1){
_local2 = (_arg1.getColumn() - 1);
_local3 = _arg1.getRow();
_local4 = gridItems[getGridLocationFromItem(_local3, _local2)];
if (_local4.isAlive()){
chain.addToChain(_local4);
};
};
if (_arg1.getColumn() < gridWidth){
_local2 = (_arg1.getColumn() + 1);
_local3 = _arg1.getRow();
_local4 = gridItems[getGridLocationFromItem(_local3, _local2)];
if (_local4.isAlive()){
chain.addToChain(_local4);
};
};
if ((((_arg1.getRow() < gridHeight)) && ((_arg1.getColumn() > 1)))){
_local2 = (_arg1.getColumn() - 1);
_local3 = (_arg1.getRow() + 1);
_local4 = gridItems[getGridLocationFromItem(_local3, _local2)];
if (_local4.isAlive()){
chain.addToChain(_local4);
};
};
if (_arg1.getRow() < gridHeight){
_local2 = _arg1.getColumn();
_local3 = (_arg1.getRow() + 1);
_local4 = gridItems[getGridLocationFromItem(_local3, _local2)];
if (_local4.isAlive()){
chain.addToChain(_local4);
};
};
if ((((_arg1.getRow() < gridHeight)) && ((_arg1.getColumn() < gridWidth)))){
_local2 = (_arg1.getColumn() + 1);
_local3 = (_arg1.getRow() + 1);
_local4 = gridItems[getGridLocationFromItem(_local3, _local2)];
if (_local4.isAlive()){
chain.addToChain(_local4);
};
};
return (true);
}
private function travelGridLeft(_arg1:gameItem):void{
var _local2:uint;
var _local3:uint;
var _local4:Boolean;
var _local5:uint;
_local2 = (_arg1.getGridLocation() - 1);
_local3 = (_arg1.getColumn() - 1);
_local4 = true;
_local5 = 0;
if (_arg1.isWildcard()){
_local5 = originColour;
} else {
_local5 = _arg1.getColour();
};
do {
if (_local3 >= 1){
if ((((gameGrid[_local2] == _local5)) || ((gameGrid[_local2] == 6)))){
chain.addToChain(gridItems[_local2]);
_local2--;
_local3--;
} else {
_local4 = false;
};
} else {
_local4 = false;
};
} while (_local4 == true);
}
private function starScan(_arg1:uint, _arg2:uint):Boolean{
var _local3:uint;
_local3 = gameGrid[getGridLocation(_arg1, _arg2)];
if (_arg2 > 0){
if ((((gameGrid[getGridLocation(_arg1, (_arg2 - 1))] == _local3)) || ((gameGrid[getGridLocation(_arg1, (_arg2 - 1))] == 6)))){
return (true);
};
};
if (_arg2 < gridHeight){
if ((((gameGrid[getGridLocation(_arg1, (_arg2 + 1))] == _local3)) || ((gameGrid[getGridLocation(_arg1, (_arg2 + 1))] == 6)))){
return (true);
};
};
if (_arg1 > 0){
if ((((gameGrid[getGridLocation((_arg1 - 1), _arg2)] == _local3)) || ((gameGrid[getGridLocation((_arg1 - 1), _arg2)] == 6)))){
return (true);
};
};
if (_arg1 < gridWidth){
if ((((gameGrid[getGridLocation((_arg1 + 1), _arg2)] == _local3)) || ((gameGrid[getGridLocation((_arg1 + 1), _arg2)] == 6)))){
return (true);
};
};
return (false);
}
}
}//package com.shaunthesheep.colourchain
Section 11
//introSequence (com.shaunthesheep.colourchain.introSequence)
package com.shaunthesheep.colourchain {
import flash.events.*;
import gs.*;
import flash.display.*;
import fl.motion.easing.*;
public class introSequence extends Sprite {
private var logo:Sprite;
private var logoBitmap:Bitmap;
public static const INTRO_COMPLETE:String = "introComplete";
public function introSequence():void{
logo = new Sprite();
super();
trace("Intro Sequence object created");
}
private function endIntro():void{
dispatchEvent(new Event(introSequence.INTRO_COMPLETE));
}
public function runIntro():void{
var _local1:Sprite;
_local1 = new Sprite();
_local1.graphics.lineStyle();
_local1.graphics.beginFill(12898209);
_local1.graphics.drawRect(0, 0, 640, 450);
_local1.graphics.endFill();
logoBitmap = new Bitmap(new aardboyPNG(262, 92));
logo.addChild(logoBitmap);
logo.x = 189;
logo.y = -100;
addChild(_local1);
addChild(logo);
TweenLite.to(logo, 1.5, {y:"270", ease:Bounce.easeOut, overwrite:false});
TweenLite.to(logo, 0.5, {alpha:0, ease:Sine.easeIn, delay:2, overwrite:false});
TweenLite.to(_local1, 0.25, {alpha:0, ease:Sine.easeIn, delay:2.5, overwrite:false, onComplete:endIntro});
}
}
}//package com.shaunthesheep.colourchain
Section 12
//itemChain (com.shaunthesheep.colourchain.itemChain)
package com.shaunthesheep.colourchain {
public final class itemChain {
private static var chain:Array = new Array();
private static var itemsInChain:uint = 0;
private static var chainSize:uint = 0;
private static var checkedTotal:uint = 0;
public function itemChain():void{
trace("Item Chain Created");
}
public function addToChain(_arg1:gameItem):void{
chainSize++;
if (_arg1.isChained() == false){
itemsInChain++;
chain.push(_arg1);
checkedTotal++;
_arg1.setHighlightOn();
};
}
public function explode():Array{
var _local1:Array;
var _local2:gameItem;
trace("Kaboom");
_local1 = new Array();
for each (_local2 in chain) {
_local1.push(_local2.getGridLocation());
_local2.explode();
};
chain = new Array();
return (_local1);
}
public function getLinksCount():uint{
return (chain.length);
}
public function clear():void{
var _local1:gameItem;
for each (_local1 in chain) {
_local1.setHighlightOff();
};
chain = new Array();
chainSize = 0;
checkedTotal = 0;
itemsInChain = 0;
}
public function getItemsInChain():uint{
return (itemsInChain);
}
public function getCheckedTotal():uint{
return (checkedTotal);
}
public function dump():void{
}
public function getChainSize():uint{
return (chainSize);
}
public function getChainItem(_arg1:uint):gameItem{
checkedTotal--;
return (chain[_arg1]);
}
}
}//package com.shaunthesheep.colourchain
Section 13
//mainMenu (com.shaunthesheep.colourchain.mainMenu)
package com.shaunthesheep.colourchain {
import flash.events.*;
import gs.*;
import flash.display.*;
import flash.geom.*;
import fl.motion.easing.*;
import flash.text.*;
import flash.net.*;
import flash.external.*;
public class mainMenu extends Sprite {
private var tooltip:Sprite;
private var background:Bitmap;
private var startButton:Sprite;
private var emitter:menuParticles;
private var particle:Bitmap;
private var spriteSheet:Bitmap;
private var credits:Bitmap;
private var logo:Sprite;
private var gameLogo:Bitmap;
public static const MAINMENU_STARTGAME:String = "startGame";
public function mainMenu():void{
trace("Main Menu object created");
}
private function init():void{
var _local1:BitmapData;
var _local2:BitmapData;
var _local3:TextField;
background = new Bitmap(new menuBackgroundPNG(640, 450));
_local1 = new menuSpritesPNG(500, 368);
startButton = new Sprite();
_local2 = new BitmapData(251, 48);
_local2.copyPixels(_local1, new Rectangle(0, 315, 251, 48), new Point(0, 0));
startButton.addChild(new Bitmap(_local2));
startButton.buttonMode = true;
startButton.useHandCursor = true;
logo = new Sprite();
_local2 = new BitmapData(295, 63);
_local2.copyPixels(_local1, new Rectangle(0, 252, 295, 63), new Point(0, 0));
logo.addChild(new Bitmap(_local2));
logo.buttonMode = true;
logo.mouseEnabled = true;
logo.useHandCursor = true;
_local2 = new BitmapData(500, 252);
_local2.copyPixels(_local1, new Rectangle(0, 0, 500, 252), new Point(0, 0));
gameLogo = new Bitmap(_local2);
_local2 = new BitmapData(24, 24);
_local2.copyPixels(_local1, new Rectangle(295, 252, 24, 24), new Point(0, 0));
particle = new Bitmap(_local2);
_local2 = new BitmapData(544, 173);
_local2.copyPixels(_local1, new Rectangle(0, 366, 544, 173), new Point(0, 0));
credits = new Bitmap(_local2);
credits.alpha = 0;
tooltip = new Sprite();
_local3 = new TextField();
_local3.defaultTextFormat = new TextFormat(null, 12, 0, false);
_local3.text = "Visit the Shaun The Sheep web site";
_local3.selectable = false;
_local3.autoSize = TextFieldAutoSize.LEFT;
tooltip.graphics.beginFill(0xFFFF00);
tooltip.graphics.lineStyle(1, 0, 1, true);
tooltip.graphics.drawRect(0, 0, _local3.width, _local3.height);
tooltip.graphics.endFill();
tooltip.addChild(_local3);
tooltip.visible = false;
addChild(background);
startParticles();
addChild(logo);
addChild(gameLogo);
addChild(credits);
addChild(startButton);
addChild(tooltip);
}
private function swapLogoForCredits():void{
TweenLite.to(gameLogo, 2, {autoAlpha:0});
TweenLite.to(credits, 1, {autoAlpha:1});
TweenLite.delayedCall(10, swapCreditsForLogo);
}
public function setDisplayLocations():void{
logo.x = 173;
logo.y = 16;
gameLogo.x = 70;
gameLogo.y = 90;
credits.x = 48;
credits.y = 140;
startButton.x = 195;
startButton.y = 380;
}
public function startMainMenu():void{
startButton.addEventListener(MouseEvent.CLICK, clickHandler, false, 0, true);
logo.addEventListener(MouseEvent.CLICK, linkClickHandler, false, 0, true);
addEventListener(Event.ENTER_FRAME, updateToolTip, false, 0, true);
startButtonTween();
TweenLite.delayedCall(6, swapLogoForCredits);
}
private function getURL(_arg1:String, _arg2:String="_blank"):void{
var browser:String;
var url = _arg1;
var window = _arg2;
browser = (ExternalInterface.call("function getBrowser(){return navigator.userAgent}") as String);
if (((!((browser.indexOf("Firefox") == -1))) || (!((browser.indexOf("MSIE 7.0") == -1))))){
ExternalInterface.call((((("window.open(\"" + url) + "\",\"") + window) + "\")"));
} else {
try {
navigateToURL(new URLRequest(url), window);
} catch(e:Error) {
trace(("Error opening URL: " + url));
};
};
}
private function startParticles():void{
emitter = new menuParticles(particle);
addChild(emitter);
emitter.x = 320;
emitter.y = 230;
emitter.start();
}
private function startGame():void{
dispatchEvent(new Event(mainMenu.MAINMENU_STARTGAME));
}
private function startButtonTween():void{
TweenLite.to(startButton, 0.5, {tint:0xFFFFFF, ease:Sine.easeIn});
TweenLite.to(startButton, 0.5, {tint:0, ease:Sine.easeIn, delay:0.5, overwrite:false, onComplete:startButtonTween});
}
private function clickHandler(_arg1:MouseEvent):void{
startButton.removeEventListener(MouseEvent.CLICK, clickHandler);
killAllTweens();
startGame();
}
private function swapCreditsForLogo():void{
TweenLite.to(gameLogo, 1, {autoAlpha:1});
TweenLite.to(credits, 2, {autoAlpha:0});
TweenLite.delayedCall(10, swapLogoForCredits);
}
private function linkClickHandler(_arg1:MouseEvent):void{
trace("Logo click");
getURL("http://www.shaunthesheep.com");
}
private function killAllTweens():void{
TweenLite.killTweensOf(startButton);
}
private function updateToolTip(_arg1:Event):void{
if (logo.hitTestPoint(mouseX, mouseY, false)){
tooltip.x = (mouseX + 16);
tooltip.y = (mouseY + 8);
if (tooltip.visible == false){
tooltip.visible = true;
};
} else {
if (tooltip.visible){
tooltip.visible = false;
};
};
}
public function go():void{
trace("Menu Started");
init();
setDisplayLocations();
}
}
}//package com.shaunthesheep.colourchain
Section 14
//menuParticles (com.shaunthesheep.colourchain.menuParticles)
package com.shaunthesheep.colourchain {
import flash.display.*;
import org.flintparticles.emitters.*;
import flash.geom.*;
import flash.filters.*;
import org.flintparticles.zones.*;
import org.flintparticles.initializers.*;
import org.flintparticles.actions.*;
import org.flintparticles.activities.*;
import org.flintparticles.counters.*;
public class menuParticles extends BitmapEmitter {
public function menuParticles(_arg1:Bitmap):void{
addActivity(new FollowMouse());
addFilter(new BlurFilter(2, 2, 1));
addFilter(new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0.95, 0]));
setCounter(new Steady(40));
addInitializer(new SharedImage(_arg1));
addInitializer(new Velocity(new DiscZone(new Point(0, 0), 320, 320)));
addInitializer(new Lifetime(1, 2));
addAction(new Age());
addAction(new Move());
addAction(new RotateToDirection());
addAction(new SpeedLimit(100));
}
}
}//package com.shaunthesheep.colourchain
Section 15
//playerCommunications (com.shaunthesheep.colourchain.playerCommunications)
package com.shaunthesheep.colourchain {
import flash.events.*;
import flash.net.*;
public class playerCommunications {
private static var captureScriptLoader:URLLoader = new URLLoader();
private static var userID:String;
private static var saveData:Boolean = false;
private static var gameKey:String;
private static var initScriptLoader:URLLoader = new URLLoader();
private static var captureScript:URLRequest;
private static var hotwireID:String;
private static var initScript:URLRequest;
private static var gameSessionID:String;
public function playerCommunications(_arg1:String):void{
trace("Starting Player Comms");
hotwireID = _arg1;
gameKey = "jr8Ef2";
if (_arg1 != ""){
initScript = new URLRequest(("http://wip.shaunthesheep.com/games/game_loader/" + _arg1));
getGameSessionID();
};
}
private function initComplete(_arg1:Event):void{
var _local2:URLLoader;
var _local3:URLVariables;
trace("Player Comms: Data Returned");
_local2 = URLLoader(_arg1.target);
_local3 = new URLVariables(_local2.data);
if (_local3.status == "valid"){
saveData = true;
userID = _local3.userID;
gameSessionID = _local3.gameSessionID;
};
initScriptLoader.removeEventListener(Event.COMPLETE, initComplete);
}
private function getGameSessionID():void{
trace("Player Comms: Getting Game Session ID");
initScriptLoader.addEventListener(Event.COMPLETE, initComplete, false, 0, true);
initScriptLoader.load(initScript);
}
public function saveToServer(_arg1:uint, _arg2:uint, _arg3:uint):void{
var _local4:String;
if (hotwireID != ""){
if (saveData){
_local4 = ((((((((((gameKey + "/") + gameSessionID) + "/") + userID) + "/") + _arg1) + "/") + _arg2) + "/") + _arg3);
trace(_local4);
captureScript = new URLRequest(("http://wip.shaunthesheep.com/games/game_event/" + _local4));
captureScriptLoader.load(captureScript);
};
};
}
}
}//package com.shaunthesheep.colourchain
Section 16
//pointBurst (com.shaunthesheep.colourchain.pointBurst)
package com.shaunthesheep.colourchain {
import gs.*;
import flash.display.*;
import flash.filters.*;
import fl.motion.easing.*;
import flash.text.*;
public final class pointBurst extends Sprite {
private var burstFormat:TextFormat;
private var burstDisplay:TextField;
public function pointBurst(_arg1:uint, _arg2:int, _arg3:int):void{
init(_arg1);
this.mouseEnabled = false;
this.cacheAsBitmap = true;
this.x = _arg2;
this.y = _arg3;
}
private function init(_arg1:uint):void{
var _local2:GlowFilter;
_local2 = new GlowFilter(16715518, 1, 3, 3, 100, 3);
burstFormat = new TextFormat("BubbleGum", 24, 16748287);
burstDisplay = new TextField();
burstDisplay.embedFonts = true;
burstDisplay.defaultTextFormat = burstFormat;
burstDisplay.selectable = false;
burstDisplay.mouseEnabled = false;
burstDisplay.width = 80;
burstDisplay.height = 40;
burstDisplay.text = _arg1.toString();
burstDisplay.filters = [_local2];
addChild(burstDisplay);
}
public function moveIt():void{
TweenLite.to(this, 1.5, {x:270, y:415, ease:Sine.easeIn});
TweenLite.to(this, 0.25, {alpha:0, delay:1.25, overwrite:false});
}
}
}//package com.shaunthesheep.colourchain
Section 17
//soundFX (com.shaunthesheep.colourchain.soundFX)
package com.shaunthesheep.colourchain {
import flash.events.*;
import flash.display.*;
import flash.media.*;
public class soundFX extends Sprite {
private var effectExplodePlaying:Boolean;// = false
private var effectExplode:Sound;
private var effectCollapse:Sound;
private var effectClick:Sound;
private var effectClickPlaying:Boolean;// = false
private var effectBomb:Sound;
private var effectBombPlaying:Boolean;// = false
private var effectCollapsePlaying:Boolean;// = false
public static const PLAY_EFFECT_COLLAPSE:String = "playEffectCollapse";
public static const PLAY_EFFECT_BOMB:String = "playEffectBomb";
public static const PLAY_EFFECT_CLICK:String = "playEffectClick";
public static const PLAY_EFFECT_EXPLODE:String = "playEffectExplode";
private static var soundMuted:Boolean = false;
public function soundFX(){
effectClick = new clickedWAV();
effectExplode = new explodeWAV();
effectCollapse = new collapseWAV();
effectBomb = new bombWAV();
effectClickPlaying = false;
effectExplodePlaying = false;
effectCollapsePlaying = false;
effectBombPlaying = false;
super();
trace("SoundFX Started");
}
private function stopEffectCollapse(_arg1:Event):void{
effectCollapsePlaying = false;
}
private function stopEffectClick(_arg1:Event):void{
effectClickPlaying = false;
}
public function playEffectBomb(_arg1:Event):void{
var _local2:SoundChannel;
if ((((effectBombPlaying == false)) && ((soundMuted == false)))){
effectBombPlaying = true;
_local2 = effectBomb.play();
_local2.addEventListener(Event.SOUND_COMPLETE, stopEffectBomb, false, 0, true);
};
}
private function stopEffectExplode(_arg1:Event):void{
effectExplodePlaying = false;
}
public function playEffectExplode(_arg1:Event):void{
var _local2:SoundChannel;
if ((((effectExplodePlaying == false)) && ((soundMuted == false)))){
effectExplodePlaying = true;
_local2 = effectExplode.play();
_local2.addEventListener(Event.SOUND_COMPLETE, stopEffectExplode, false, 0, true);
};
}
public function unMuteEffects():void{
soundMuted = false;
}
public function get isMuted():Boolean{
return (soundMuted);
}
private function stopEffectBomb(_arg1:Event):void{
effectBombPlaying = false;
}
public function muteEffects():void{
soundMuted = true;
SoundMixer.stopAll();
}
public function playEffectCollapse(_arg1:Event):void{
var _local2:SoundChannel;
if ((((effectCollapsePlaying == false)) && ((soundMuted == false)))){
effectCollapsePlaying = true;
_local2 = effectCollapse.play();
_local2.addEventListener(Event.SOUND_COMPLETE, stopEffectCollapse, false, 0, true);
};
}
public function playEffectClick(_arg1:Event):void{
var _local2:SoundChannel;
if ((((effectClickPlaying == false)) && ((soundMuted == false)))){
effectClickPlaying = true;
_local2 = effectClick.play();
_local2.addEventListener(Event.SOUND_COMPLETE, stopEffectClick, false, 0, true);
};
}
}
}//package com.shaunthesheep.colourchain
Section 18
//Bounce (fl.motion.easing.Bounce)
package fl.motion.easing {
public class Bounce {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 - easeOut((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeIn((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOut(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
}
}//package fl.motion.easing
Section 19
//Circular (fl.motion.easing.Circular)
package fl.motion.easing {
public class Circular {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
}
}//package fl.motion.easing
Section 20
//Exponential (fl.motion.easing.Exponential)
package fl.motion.easing {
public class Exponential {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg1 == _arg4)) ? (_arg2 + _arg3) : ((_arg3 * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg1 == 0)) ? _arg2 : ((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2));
};
--_arg1;
return ((((_arg3 / 2) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2));
}
}
}//package fl.motion.easing
Section 21
//Sine (fl.motion.easing.Sine)
package fl.motion.easing {
public class Sine {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
}
}//package fl.motion.easing
Section 22
//TweenFilterLite (gs.TweenFilterLite)
package gs {
import flash.display.*;
import flash.filters.*;
import flash.utils.*;
public class TweenFilterLite extends TweenLite {
private var _mc:DisplayObject;
private var _clrsa:Array;
private var _fType:Class;
private var _clrMtxTw:TweenLite;
public var _matrix:Array;
private var _f:BitmapFilter;
private var _endMatrix:Array;
public static var version:Number = 5.87;
private static var _idMatrix:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
public static var killTweensOf:Function = TweenLite.killTweensOf;
public static var delayedCall:Function = TweenLite.delayedCall;
private static var _lumB:Number = 0.072169;
private static var _lumG:Number = 0.71516;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
private static var _lumR:Number = 0.212671;
public function TweenFilterLite(_arg1:DisplayObject, _arg2:Number, _arg3:Object){
_fType = TweenFilterLite;
super(_arg1, _arg2, _arg3);
if (_arg1 == null){
return;
};
_mc = _arg1;
_clrsa = [];
if (this.vars.runBackwards == true){
initTweenVals();
};
if ((((TweenLite.version < 5.87)) || (isNaN(TweenLite.version)))){
trace("ERROR! Please update your TweenLite class. TweenFilterLite requires a more recent version. Download updates at http://www.TweenLite.com.");
};
}
private function setFilter(_arg1:Class, _arg2:Array, _arg3:BitmapFilter):void{
var _local4:Array;
var _local5:int;
var _local6:Number;
var _local7:String;
var _local8:Object;
var _local9:Object;
var _local10:Object;
_fType = _arg1;
_local4 = _mc.filters;
_local5 = 0;
while (_local5 < _local4.length) {
if ((_local4[_local5] is _arg1)){
_f = _local4[_local5];
break;
};
_local5++;
};
if (_f == null){
_local4.push(_arg3);
_mc.filters = _local4;
_f = _arg3;
};
_local5 = 0;
while (_local5 < _arg2.length) {
_local7 = _arg2[_local5];
if (this.tweens[_local7] != undefined){
_local8 = this.tweens[_local7];
delete this.tweens[_local7];
} else {
if (this.extraTweens[_local7] != undefined){
_local8 = this.extraTweens[_local7];
} else {
_local8 = null;
};
};
if (_local8 != null){
if ((((((((((((((_local7 == "brightness")) || ((_local7 == "colorize")))) || ((_local7 == "amount")))) || ((_local7 == "saturation")))) || ((_local7 == "contrast")))) || ((_local7 == "hue")))) || ((_local7 == "threshold")))){
} else {
if ((((((_local7 == "color")) || ((_local7 == "highlightColor")))) || ((_local7 == "shadowColor")))){
_local9 = HEXtoRGB(_f[_local7]);
_local10 = HEXtoRGB(this.vars[_local7]);
_clrsa.push({p:_local7, e:this.vars.ease, sr:_local9.rb, cr:(_local10.rb - _local9.rb), sg:_local9.gb, cg:(_local10.gb - _local9.gb), sb:_local9.bb, cb:(_local10.bb - _local9.bb)});
} else {
if ((((((((_local7 == "quality")) || ((_local7 == "inner")))) || ((_local7 == "knockout")))) || ((_local7 == "hideObject")))){
_f[_local7] = this.vars[_local7];
} else {
if (typeof(this.vars[_local7]) == "number"){
_local6 = (this.vars[_local7] - _f[_local7]);
} else {
_local6 = Number(this.vars[_local7]);
};
this.tweens[_local7] = {o:_f, p:_local7, s:_f[_local7], c:_local6, e:this.vars.ease};
};
};
};
};
_local5++;
};
}
override public function render(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
var _local4:Object;
var _local5:String;
var _local6:int;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Array;
_local2 = ((_arg1 - this.startTime) / 1000);
if (_local2 > this.duration){
_local2 = this.duration;
};
_local3 = this.vars.ease(_local2, 0, 1, this.duration);
for (_local5 in this.tweens) {
_local4 = this.tweens[_local5];
_local4.o[_local5] = (_local4.s + (_local3 * _local4.c));
};
if (_mc.parent != null){
_local6 = 0;
while (_local6 < _clrsa.length) {
_local4 = _clrsa[_local6];
_local7 = (_local4.sr + (_local3 * _local4.cr));
_local8 = (_local4.sg + (_local3 * _local4.cg));
_local9 = (_local4.sb + (_local3 * _local4.cb));
_f[_local4.p] = (((_local7 << 16) | (_local8 << 8)) | _local9);
_local6++;
};
if (_endMatrix != null){
ColorMatrixFilter(_f).matrix = _matrix;
};
_local10 = _mc.filters.slice();
_local6 = (_local10.length - 1);
while (_local6 > -1) {
if ((_local10[_local6] is _fType)){
_local10[_local6] = _f;
break;
};
_local6--;
};
_mc.filters = _local10;
};
if (this.vars.onUpdate != null){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
super.complete(true);
};
}
public function HEXtoRGB(_arg1:Number):Object{
return ({rb:(_arg1 >> 16), gb:((_arg1 >> 8) & 0xFF), bb:(_arg1 & 0xFF)});
}
override public function initTweenVals():void{
var _local1:String;
var _local2:Number;
if (_mc != null){
super.initTweenVals();
if (this.vars.type != null){
_clrsa = [];
_matrix = _idMatrix.slice();
if ((((this.vars.quality == undefined)) || (isNaN(this.vars.quality)))){
this.vars.quality = 2;
};
if (this.vars.runBackwards == true){
for (_local1 in this.tweens) {
this.tweens[_local1].flipped = true;
};
};
switch (this.vars.type.toLowerCase()){
case "blur":
setFilter(BlurFilter, ["blurX", "blurY", "quality"], new BlurFilter(0, 0, this.vars.quality));
break;
case "glow":
setFilter(GlowFilter, ["alpha", "blurX", "blurY", "color", "quality", "strength", "inner", "knockout"], new GlowFilter(0xFFFFFF, 0, 0, 0, ((this.vars.strength) || (1)), this.vars.quality, this.vars.inner, this.vars.knockout));
break;
case "colormatrix":
case "color":
case "colormatrixfilter":
case "colorize":
setFilter(ColorMatrixFilter, [], new ColorMatrixFilter(_matrix));
_matrix = ColorMatrixFilter(_f).matrix;
if (this.vars.relative == true){
_endMatrix = _matrix.slice();
} else {
_endMatrix = _idMatrix.slice();
};
_endMatrix = setBrightness(_endMatrix, this.vars.brightness);
_endMatrix = setContrast(_endMatrix, this.vars.contrast);
_endMatrix = setHue(_endMatrix, this.vars.hue);
_endMatrix = setSaturation(_endMatrix, this.vars.saturation);
_endMatrix = setThreshold(_endMatrix, this.vars.threshold);
if (!isNaN(this.vars.colorize)){
_endMatrix = colorize(_endMatrix, this.vars.colorize, this.vars.amount);
} else {
if (!isNaN(this.vars.color)){
_endMatrix = colorize(_endMatrix, this.vars.color, this.vars.amount);
};
};
_local2 = (this.delay - ((getTimer() - this.initTime) / 1000));
_clrMtxTw = new TweenLite(_matrix, this.duration, {endArray:_endMatrix, ease:this.vars.ease, delay:_local2, overwrite:false, runBackwards:this.vars.runBackwards});
_clrMtxTw.endTarget = _mc;
break;
case "shadow":
case "dropshadow":
setFilter(DropShadowFilter, ["alpha", "angle", "blurX", "blurY", "color", "distance", "quality", "strength", "inner", "knockout", "hideObject"], new DropShadowFilter(0, 45, 0, 0, 0, 0, 1, this.vars.quality, this.vars.inner, this.vars.knockout, this.vars.hideObject));
break;
case "bevel":
setFilter(BevelFilter, ["angle", "blurX", "blurY", "distance", "highlightAlpha", "highlightColor", "quality", "shadowAlpha", "shadowColor", "strength"], new BevelFilter(0, 0, 0xFFFFFF, 0.5, 0, 0.5, 2, 2, 0, this.vars.quality));
break;
};
if (this.vars.runBackwards == true){
flipFilterVals();
};
};
};
}
private function flipFilterVals():void{
var _local1:Boolean;
var _local2:int;
var _local3:Object;
var _local4:String;
var _local5:Array;
_local1 = this.active;
for (_local4 in this.tweens) {
if (this.tweens[_local4].flipped != true){
_local3 = this.tweens[_local4];
_local3.s = (_local3.s + _local3.c);
_local3.c = (_local3.c * -1);
_local3.o[_local4] = _local3.s;
_local3.flipped = true;
};
};
_local2 = 0;
while (_local2 < _clrsa.length) {
_local3 = _clrsa[_local2];
_local3.sr = (_local3.sr + _local3.cr);
_local3.cr = (_local3.cr * -1);
_local3.sg = (_local3.sg + _local3.cg);
_local3.cg = (_local3.cg * -1);
_local3.sb = (_local3.sb + _local3.cb);
_local3.cb = (_local3.cb * -1);
if (!_local1){
_f[_local3.p] = (((_local3.sr << 16) | (_local3.sg << 8)) | _local3.sb);
};
_local2++;
};
if (((_local1) && (!((this.duration == 0.001))))){
render(getTimer());
} else {
if (((!((_mc.parent == null))) && (!((_fType == null))))){
if (_endMatrix != null){
ColorMatrixFilter(_f).matrix = _matrix;
};
_local5 = _mc.filters.slice();
_local2 = (_local5.length - 1);
while (_local2 > -1) {
if ((_local5[_local2] is _fType)){
_local5[_local2] = _f;
break;
};
_local2--;
};
_mc.filters = _local5;
};
};
if (this.vars.onUpdate != null){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
}
public static function setContrast(_arg1:Array, _arg2:Number):Array{
var _local3:Array;
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 + 0.01);
_local3 = [_arg2, 0, 0, 0, (128 * (1 - _arg2)), 0, _arg2, 0, 0, (128 * (1 - _arg2)), 0, 0, _arg2, 0, (128 * (1 - _arg2)), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
public static function applyMatrix(_arg1:Array, _arg2:Array):Array{
var _local3:Array;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (_arg2);
};
_local3 = [];
_local4 = 0;
_local5 = 0;
_local6 = 0;
while (_local6 < 4) {
_local7 = 0;
while (_local7 < 5) {
if (_local7 == 4){
_local5 = _arg1[(_local4 + 4)];
} else {
_local5 = 0;
};
_local3[(_local4 + _local7)] = (((((_arg1[_local4] * _arg2[_local7]) + (_arg1[(_local4 + 1)] * _arg2[(_local7 + 5)])) + (_arg1[(_local4 + 2)] * _arg2[(_local7 + 10)])) + (_arg1[(_local4 + 3)] * _arg2[(_local7 + 15)])) + _local5);
_local7++;
};
_local4 = (_local4 + 5);
_local6++;
};
return (_local3);
}
public static function colorize(_arg1:Array, _arg2:Number, _arg3:Number=100):Array{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Array;
if (isNaN(_arg2)){
return (_arg1);
};
if (isNaN(_arg3)){
_arg3 = 1;
};
_local4 = (((_arg2 >> 16) & 0xFF) / 0xFF);
_local5 = (((_arg2 >> 8) & 0xFF) / 0xFF);
_local6 = ((_arg2 & 0xFF) / 0xFF);
_local7 = (1 - _arg3);
_local8 = [(_local7 + ((_arg3 * _local4) * _lumR)), ((_arg3 * _local4) * _lumG), ((_arg3 * _local4) * _lumB), 0, 0, ((_arg3 * _local5) * _lumR), (_local7 + ((_arg3 * _local5) * _lumG)), ((_arg3 * _local5) * _lumB), 0, 0, ((_arg3 * _local6) * _lumR), ((_arg3 * _local6) * _lumG), (_local7 + ((_arg3 * _local6) * _lumB)), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local8, _arg1));
}
public static function setBrightness(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = ((_arg2 * 100) - 100);
return (applyMatrix([1, 0, 0, 0, _arg2, 0, 1, 0, 0, _arg2, 0, 0, 1, 0, _arg2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], _arg1));
}
public static function setSaturation(_arg1:Array, _arg2:Number):Array{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Array;
if (isNaN(_arg2)){
return (_arg1);
};
_local3 = (1 - _arg2);
_local4 = (_local3 * _lumR);
_local5 = (_local3 * _lumG);
_local6 = (_local3 * _lumB);
_local7 = [(_local4 + _arg2), _local5, _local6, 0, 0, _local4, (_local5 + _arg2), _local6, 0, 0, _local4, _local5, (_local6 + _arg2), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local7, _arg1));
}
public static function from(_arg1:DisplayObject, _arg2:Number, _arg3:Object):TweenFilterLite{
_arg3.runBackwards = true;
return (new TweenFilterLite(_arg1, _arg2, _arg3));
}
public static function setThreshold(_arg1:Array, _arg2:Number):Array{
var _local3:Array;
if (isNaN(_arg2)){
return (_arg1);
};
_local3 = [(_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
public static function setHue(_arg1:Array, _arg2:Number):Array{
var _local3:Number;
var _local4:Number;
var _local5:Array;
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 * (Math.PI / 180));
_local3 = Math.cos(_arg2);
_local4 = Math.sin(_arg2);
_local5 = [((_lumR + (_local3 * (1 - _lumR))) + (_local4 * -(_lumR))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * -(_lumG))), ((_lumB + (_local3 * -(_lumB))) + (_local4 * (1 - _lumB))), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * 0.143)), ((_lumG + (_local3 * (1 - _lumG))) + (_local4 * 0.14)), ((_lumB + (_local3 * -(_lumB))) + (_local4 * -0.283)), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * -((1 - _lumR)))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * _lumG)), ((_lumB + (_local3 * (1 - _lumB))) + (_local4 * _lumB)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
return (applyMatrix(_local5, _arg1));
}
public static function to(_arg1:DisplayObject, _arg2:Number, _arg3:Object):TweenFilterLite{
return (new TweenFilterLite(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 23
//TweenLite (gs.TweenLite)
package gs {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
public class TweenLite {
public var delay:Number;
protected var _endTarget:Object;
private var _sound:SoundTransform;
public var target:Object;
public var duration:Number;
public var startTime:uint;
public var extraTweens:Object;
protected var _color:ColorTransform;
protected var _active:Boolean;
protected var _endColor:ColorTransform;
public var vars:Object;
public var tweens:Object;
public var initTime:uint;
private static var _sprite:Sprite = new Sprite();
private static var _timer:Timer = new Timer(2000);
protected static var _all:Dictionary = new Dictionary();
public static var killDelayedCallsTo:Function = killTweensOf;
public static var version:Number = 5.87;
private static var _listening:Boolean;
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
if (_arg1 == null){
return;
};
if (((((!((_arg3.overwrite == false))) && (!((_arg1 == null))))) || ((_all[_arg1] == undefined)))){
delete _all[_arg1];
_all[_arg1] = new Dictionary();
};
_all[_arg1][this] = this;
this.vars = _arg3;
this.duration = _arg2;
this.delay = ((_arg3.delay) || (0));
if (_arg2 == 0){
this.duration = 0.001;
if (this.delay == 0){
this.vars.runBackwards = true;
};
};
this.target = (_endTarget = _arg1);
if (!(this.vars.ease is Function)){
this.vars.ease = easeOut;
};
if (this.vars.easeParams != null){
this.vars.proxiedEase = this.vars.ease;
this.vars.ease = easeProxy;
};
if (this.vars.mcColor != null){
this.vars.tint = this.vars.mcColor;
};
if (!isNaN(Number(this.vars.autoAlpha))){
this.vars.alpha = Number(this.vars.autoAlpha);
};
this.tweens = {};
this.extraTweens = {};
this.initTime = getTimer();
if (this.vars.runBackwards == true){
initTweenVals();
};
_active = false;
if ((((_arg2 == 0)) && ((this.delay == 0)))){
complete(true);
} else {
if (!_listening){
_sprite.addEventListener(Event.ENTER_FRAME, executeAll);
_timer.addEventListener("timer", killGarbage);
_timer.start();
_listening = true;
};
};
}
public function set endTarget(_arg1:Object):void{
if ((((this.duration == 0.001)) && ((this.delay <= 0)))){
removeTween(this);
} else {
delete _all[_endTarget][this];
_endTarget = _arg1;
if (_all[_arg1] == undefined){
_all[_arg1] = new Dictionary();
};
_all[_arg1][this] = this;
};
}
public function get colorProxy():Number{
return (0);
}
public function get endTarget():Object{
return (_endTarget);
}
public function get active():Boolean{
if (_active){
return (true);
};
if (((getTimer() - this.initTime) / 1000) > this.delay){
_active = true;
this.startTime = (this.initTime + (this.delay * 1000));
if (this.vars.runBackwards != true){
initTweenVals();
} else {
if (typeof(this.vars.autoAlpha) == "number"){
this.target.visible = true;
};
};
if (this.vars.onStart != null){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (this.duration == 0.001){
this.startTime = (this.startTime - 1);
};
return (true);
//unresolved jump
};
return (false);
}
public function initTweenVals():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
var _local7:TweenLite;
var _local8:Object;
_local1 = (this.delay - ((getTimer() - this.initTime) / 1000));
if ((this.target is Array)){
_local4 = ((this.vars.endArray) || ([]));
_local5 = 0;
while (_local5 < _local4.length) {
if (((!((this.target[_local5] == _local4[_local5]))) && (!((this.target[_local5] == undefined))))){
this.tweens[_local5.toString()] = {o:this.target, s:this.target[_local5], c:(_local4[_local5] - this.target[_local5])};
};
_local5++;
};
} else {
for (_local2 in this.vars) {
if ((((((((((((((((((((((((((((_local2 == "delay")) || ((_local2 == "ease")))) || ((_local2 == "overwrite")))) || ((_local2 == "onComplete")))) || ((_local2 == "onCompleteParams")))) || ((_local2 == "runBackwards")))) || ((_local2 == "onUpdate")))) || ((_local2 == "onUpdateParams")))) || ((_local2 == "autoAlpha")))) || ((_local2 == "onStart")))) || ((_local2 == "onStartParams")))) || ((_local2 == "easeParams")))) || ((_local2 == "mcColor")))) || ((_local2 == "type")))){
} else {
if ((((_local2 == "tint")) && ((this.target is DisplayObject)))){
_color = this.target.transform.colorTransform;
_endColor = new ColorTransform();
if (this.vars.alpha != undefined){
_endColor.alphaMultiplier = this.vars.alpha;
delete this.vars.alpha;
delete this.tweens.alpha;
} else {
_endColor.alphaMultiplier = this.target.alpha;
};
if (((!((this.vars[_local2] == null))) && (!((this.vars[_local2] == ""))))){
_endColor.color = this.vars[_local2];
};
_local6 = new TweenLite(this, this.duration, {colorProxy:1, delay:_local1, overwrite:false, ease:this.vars.ease, runBackwards:this.vars.runBackwards});
_local6.endTarget = this.target;
} else {
if ((((_local2 == "volume")) && ((this.target is MovieClip)))){
_sound = this.target.soundTransform;
_local7 = new TweenLite(this, this.duration, {volumeProxy:this.vars[_local2], ease:easeOut, delay:_local1, overwrite:false, runBackwards:this.vars.runBackwards});
_local7.endTarget = this.target;
} else {
if (this.target.hasOwnProperty(_local2)){
if (typeof(this.vars[_local2]) == "number"){
_local3 = (this.vars[_local2] - this.target[_local2]);
} else {
_local3 = Number(this.vars[_local2]);
};
this.tweens[_local2] = {o:this.target, s:this.target[_local2], c:_local3};
} else {
this.extraTweens[_local2] = {o:this.target, s:0, c:0, v:this.vars[_local2]};
};
};
};
};
};
};
if (this.vars.runBackwards == true){
for (_local2 in this.tweens) {
_local8 = this.tweens[_local2];
this.tweens[_local2].s = (_local8.s + _local8.c);
_local8.c = (_local8.c * -1);
_local8.o[_local2] = _local8.s;
};
if (this.vars.onUpdate != null){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
};
if (typeof(this.vars.autoAlpha) == "number"){
this.target.visible = !((((this.vars.runBackwards == true)) && ((this.target.alpha == 0))));
};
}
public function render(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
var _local4:Object;
var _local5:String;
_local2 = ((_arg1 - this.startTime) / 1000);
if (_local2 > this.duration){
_local2 = this.duration;
};
_local3 = this.vars.ease(_local2, 0, 1, this.duration);
for (_local5 in this.tweens) {
_local4 = this.tweens[_local5];
_local4.o[_local5] = (_local4.s + (_local3 * _local4.c));
};
if (this.vars.onUpdate != null){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
public function set colorProxy(_arg1:Number):void{
var _local2:Number;
_local2 = (1 - _arg1);
this.target.transform.colorTransform = new ColorTransform(((_color.redMultiplier * _local2) + (_endColor.redMultiplier * _arg1)), ((_color.greenMultiplier * _local2) + (_endColor.greenMultiplier * _arg1)), ((_color.blueMultiplier * _local2) + (_endColor.blueMultiplier * _arg1)), ((_color.alphaMultiplier * _local2) + (_endColor.alphaMultiplier * _arg1)), ((_color.redOffset * _local2) + (_endColor.redOffset * _arg1)), ((_color.greenOffset * _local2) + (_endColor.greenOffset * _arg1)), ((_color.blueOffset * _local2) + (_endColor.blueOffset * _arg1)), ((_color.alphaOffset * _local2) + (_endColor.alphaOffset * _arg1)));
}
public function get volumeProxy():Number{
return (_sound.volume);
}
public function set volumeProxy(_arg1:Number):void{
_sound.volume = _arg1;
this.target.soundTransform = _sound;
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public function complete(_arg1:Boolean=false):void{
if (!_arg1){
this.startTime = 0;
render((this.duration * 1000));
return;
};
if ((((typeof(this.vars.autoAlpha) == "number")) && ((this.target.alpha == 0)))){
this.target.visible = false;
};
if (this.vars.onComplete != null){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
};
removeTween(this);
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, overwrite:false}));
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function removeTween(_arg1:TweenLite=null):void{
if (((!((_arg1 == null))) && (!((_all[_arg1.endTarget] == undefined))))){
delete _all[_arg1.endTarget][_arg1];
};
}
protected static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function killGarbage(_arg1:TimerEvent):void{
var _local2:Object;
var _local3:uint;
var _local4:Boolean;
var _local5:Object;
var _local6:Object;
var _local7:Object;
_local2 = _all;
_local3 = 0;
for (_local5 in _local2) {
_local4 = false;
for (_local6 in _local2[_local5]) {
_local4 = true;
break;
};
if (!_local4){
delete _local2[_local5];
} else {
_local3++;
};
};
if (_local3 == 0){
_sprite.removeEventListener(Event.ENTER_FRAME, executeAll);
_timer.removeEventListener("timer", killGarbage);
_timer.stop();
_listening = false;
};
}
public static function executeAll(_arg1:Event):void{
var _local2:Object;
var _local3:uint;
var _local4:Object;
var _local5:Object;
_local2 = _all;
_local3 = getTimer();
for (_local4 in _local2) {
for (_local5 in _local2[_local4]) {
if (((!((_local2[_local4][_local5] == undefined))) && (_local2[_local4][_local5].active))){
_local2[_local4][_local5].render(_local3);
if (_local2[_local4] == undefined){
break;
};
};
};
};
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Object;
var _local4:*;
if (((!((_arg1 == null))) && (!((_all[_arg1] == undefined))))){
if (_arg2){
_local3 = _all[_arg1];
for (_local4 in _local3) {
_local3[_local4].complete(false);
};
};
delete _all[_arg1];
};
}
}
}//package gs
Section 24
//Accelerate (org.flintparticles.actions.Accelerate)
package org.flintparticles.actions {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class Accelerate extends Action {
private var _x:Number;
private var _y:Number;
public function Accelerate(_arg1:Number, _arg2:Number){
_x = _arg1;
_y = _arg2;
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
_arg2.velX = (_arg2.velX + (_x * _arg3));
_arg2.velY = (_arg2.velY + (_y * _arg3));
}
}
}//package org.flintparticles.actions
Section 25
//Action (org.flintparticles.actions.Action)
package org.flintparticles.actions {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class Action {
public function addedToEmitter(_arg1:Emitter):void{
}
public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
}
public function getDefaultPriority():Number{
return (0);
}
}
}//package org.flintparticles.actions
Section 26
//Age (org.flintparticles.actions.Age)
package org.flintparticles.actions {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
import org.flintparticles.energyEasing.*;
public class Age extends Action {
private var _easing:Function;
public function Age(_arg1:Function=null){
if (_arg1 == null){
_easing = Linear.easeNone;
} else {
_easing = _arg1;
};
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
_arg2.age = (_arg2.age + _arg3);
if (_arg2.age >= _arg2.lifetime){
_arg2.energy = 0;
_arg2.isDead = true;
} else {
_arg2.energy = _easing(_arg2.age, _arg2.lifetime);
};
}
}
}//package org.flintparticles.actions
Section 27
//DeathOffStage (org.flintparticles.actions.DeathOffStage)
package org.flintparticles.actions {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
import flash.geom.*;
public class DeathOffStage extends Action {
private var _top:Number;// = NAN
private var _left:Number;// = NAN
private var _bottom:Number;// = NAN
private var _padding:Number;
private var _right:Number;// = NAN
public function DeathOffStage(_arg1:Number=10){
_left = NaN;
_right = NaN;
_top = NaN;
_bottom = NaN;
super();
_padding = _arg1;
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
var _local4:Point;
if (!_arg1.stage){
return;
};
if (isNaN(_top)){
_local4 = _arg1.parent.localToGlobal(new Point(0, 0));
_left = (_local4.x - _padding);
_right = ((_local4.x + _arg1.stage.stageWidth) + _padding);
_top = (_local4.y - _padding);
_bottom = ((_local4.y + _arg1.stage.stageHeight) + _padding);
};
if ((((((((_arg2.x < _left)) || ((_arg2.x > _right)))) || ((_arg2.y < _top)))) || ((_arg2.y > _bottom)))){
_arg2.isDead = true;
};
}
override public function getDefaultPriority():Number{
return (-20);
}
}
}//package org.flintparticles.actions
Section 28
//Fade (org.flintparticles.actions.Fade)
package org.flintparticles.actions {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class Fade extends Action {
private var _endAlpha:Number;
private var _diffAlpha:Number;
public function Fade(_arg1:Number=1, _arg2:Number=0){
_diffAlpha = (_arg1 - _arg2);
_endAlpha = _arg2;
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
var _local4:Number;
_local4 = (_endAlpha + (_diffAlpha * _arg2.energy));
_arg2.color = ((_arg2.color & 0xFFFFFF) | (Math.round((_local4 * 0xFF)) << 24));
}
override public function getDefaultPriority():Number{
return (-5);
}
}
}//package org.flintparticles.actions
Section 29
//Move (org.flintparticles.actions.Move)
package org.flintparticles.actions {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class Move extends Action {
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
_arg2.x = (_arg2.x + (_arg2.velX * _arg3));
_arg2.y = (_arg2.y + (_arg2.velY * _arg3));
}
override public function getDefaultPriority():Number{
return (-10);
}
}
}//package org.flintparticles.actions
Section 30
//RotateToDirection (org.flintparticles.actions.RotateToDirection)
package org.flintparticles.actions {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class RotateToDirection extends Action {
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
_arg2.rotation = Math.atan2(_arg2.velY, _arg2.velX);
}
}
}//package org.flintparticles.actions
Section 31
//SpeedLimit (org.flintparticles.actions.SpeedLimit)
package org.flintparticles.actions {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class SpeedLimit extends Action {
private var _isMinimum:Boolean;
private var _limitSq:Number;
private var _limit:Number;
public function SpeedLimit(_arg1:Number, _arg2:Boolean=false){
_limit = _arg1;
_limitSq = (_arg1 * _arg1);
_isMinimum = _arg2;
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
var _local4:Number;
var _local5:Number;
_local4 = ((_arg2.velX * _arg2.velX) + (_arg2.velY * _arg2.velY));
if (((((_isMinimum) && ((_local4 < _limitSq)))) || (((!(_isMinimum)) && ((_local4 > _limitSq)))))){
_local5 = (_limit / Math.sqrt(_local4));
_arg2.velX = (_arg2.velX * _local5);
_arg2.velY = (_arg2.velY * _local5);
};
}
override public function getDefaultPriority():Number{
return (-5);
}
}
}//package org.flintparticles.actions
Section 32
//Activity (org.flintparticles.activities.Activity)
package org.flintparticles.activities {
import org.flintparticles.emitters.*;
public class Activity {
public function initialize(_arg1:Emitter):void{
}
public function addedToEmitter(_arg1:Emitter):void{
}
public function update(_arg1:Emitter, _arg2:Number):void{
}
public function getDefaultPriority():Number{
return (0);
}
}
}//package org.flintparticles.activities
Section 33
//FollowMouse (org.flintparticles.activities.FollowMouse)
package org.flintparticles.activities {
import org.flintparticles.emitters.*;
public class FollowMouse extends Activity {
override public function update(_arg1:Emitter, _arg2:Number):void{
_arg1.x = _arg1.parent.mouseX;
_arg1.y = _arg1.parent.mouseY;
}
}
}//package org.flintparticles.activities
Section 34
//Blast (org.flintparticles.counters.Blast)
package org.flintparticles.counters {
public class Blast implements Counter {
protected var _startMax:uint;
protected var _startMin:uint;
public function Blast(_arg1:Number, _arg2:Number=NaN){
_startMin = _arg1;
_startMax = (isNaN(_arg2)) ? _arg1 : _arg2;
}
public function updateEmitter(_arg1:Number):uint{
return (0);
}
public function startEmitter():uint{
return (Math.round((_startMin + (Math.random() * (_startMax - _startMin)))));
}
}
}//package org.flintparticles.counters
Section 35
//Counter (org.flintparticles.counters.Counter)
package org.flintparticles.counters {
public interface Counter {
function updateEmitter(_arg1:Number):uint;
function startEmitter():uint;
}
}//package org.flintparticles.counters
Section 36
//Steady (org.flintparticles.counters.Steady)
package org.flintparticles.counters {
public class Steady implements Counter {
protected var _rateMax:Number;
private var _stop:Boolean;
protected var _rateMin:Number;
protected var _timeToNext:Number;
public function Steady(_arg1:Number, _arg2:Number=NaN){
_stop = false;
_rateMin = _arg1;
_rateMax = (isNaN(_arg2)) ? _arg1 : _arg2;
}
public function stop():void{
_stop = true;
}
public function startEmitter():uint{
newTimeToNext();
return (0);
}
public function updateEmitter(_arg1:Number):uint{
var _local2:Number;
var _local3:uint;
if (_stop){
return (0);
};
_local2 = _arg1;
_local3 = 0;
_local2 = (_local2 - _timeToNext);
while (_local2 >= 0) {
_local3++;
newTimeToNext();
_local2 = (_local2 - _timeToNext);
};
_timeToNext = -(_local2);
return (_local3);
}
private function newTimeToNext():void{
var _local1:Number;
_local1 = (_rateMin + (Math.random() * (_rateMax - _rateMin)));
_timeToNext = (1 / _local1);
}
}
}//package org.flintparticles.counters
Section 37
//Line (org.flintparticles.displayObjects.Line)
package org.flintparticles.displayObjects {
import flash.display.*;
public class Line extends Shape {
public function Line(_arg1:Number){
graphics.lineStyle(1, 0xFFFFFF);
graphics.moveTo((-(_arg1) * 0.5), 0);
graphics.lineTo((_arg1 * 0.5), 0);
graphics.endFill();
}
}
}//package org.flintparticles.displayObjects
Section 38
//BitmapEmitter (org.flintparticles.emitters.BitmapEmitter)
package org.flintparticles.emitters {
import flash.events.*;
import flash.display.*;
import org.flintparticles.particles.*;
import flash.geom.*;
import flash.filters.*;
public class BitmapEmitter extends Emitter {
protected var _bitmap:Bitmap;
private var _postFilters:Array;
private var _preFilters:Array;
protected var _offset:Point;
public function BitmapEmitter(){
_preFilters = new Array();
_postFilters = new Array();
addEventListener(Event.ADDED_TO_STAGE, addedToStage, false, 0, true);
}
public function removeFilter(_arg1:BitmapFilter):void{
var _local2:uint;
_local2 = 0;
while (_local2 < _preFilters.length) {
if (_preFilters[_local2] == _arg1){
_preFilters.splice(_local2, 1);
return;
};
_local2++;
};
_local2 = 0;
while (_local2 < _postFilters.length) {
if (_postFilters[_local2] == _arg1){
_postFilters.splice(_local2, 1);
return;
};
_local2++;
};
}
private function addedToStage(_arg1:Event):void{
if (((_bitmap) && (_bitmap.bitmapData))){
_bitmap.bitmapData.dispose();
};
_bitmap = new Bitmap();
_bitmap.bitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0);
addChild(_bitmap);
_offset = parent.localToGlobal(new Point(0, 0));
_bitmap.x = -(_offset.x);
_bitmap.y = -(_offset.y);
}
override public function start():void{
super.start();
if (!_bitmap){
_bitmap = new Bitmap();
_bitmap.bitmapData = new BitmapData(10, 10, true, 0);
trace("No Bitmap");
};
}
override protected function render(_arg1:Number):void{
var _local2:uint;
var _local3:uint;
if (!_bitmap){
return;
};
_bitmap.bitmapData.lock();
_local3 = _preFilters.length;
_local2 = 0;
while (_local2 < _local3) {
_bitmap.bitmapData.applyFilter(_bitmap.bitmapData, _bitmap.bitmapData.rect, new Point(0, 0), _preFilters[_local2]);
_local2++;
};
if ((((_local3 == 0)) && ((_postFilters.length == 0)))){
_bitmap.bitmapData.fillRect(_bitmap.bitmapData.rect, 0);
};
_local3 = _particles.length;
if (_local3){
_local2 = 0;
while (_local2 < _local3) {
drawParticle(_particles[_local2]);
_local2++;
};
};
_local3 = _postFilters.length;
_local2 = 0;
while (_local2 < _local3) {
_bitmap.bitmapData.applyFilter(_bitmap.bitmapData, _bitmap.bitmapData.rect, new Point(0, 0), _postFilters[_local2]);
_local2++;
};
_bitmap.bitmapData.unlock();
}
public function addFilter(_arg1:BitmapFilter, _arg2:Boolean=false):void{
if (_arg2){
_postFilters.push(_arg1);
} else {
_preFilters.push(_arg1);
};
}
override protected function cleanUp():void{
_bitmap.bitmapData.dispose();
}
protected function drawParticle(_arg1:Particle):void{
var _local2:Matrix;
_local2 = _arg1.matrixTransform;
_local2.translate(_offset.x, _offset.y);
_bitmap.bitmapData.draw(_arg1.image, _local2, _arg1.colorTransform);
}
}
}//package org.flintparticles.emitters
Section 39
//Emitter (org.flintparticles.emitters.Emitter)
package org.flintparticles.emitters {
import flash.events.*;
import flash.display.*;
import org.flintparticles.particles.*;
import flash.geom.*;
import org.flintparticles.initializers.*;
import org.flintparticles.actions.*;
import org.flintparticles.activities.*;
import org.flintparticles.counters.*;
import flash.utils.*;
import org.flintparticles.utils.*;
import org.flintparticles.events.*;
public class Emitter extends Sprite {
protected var _x:Number;// = 0
protected var _particles:Array;
protected var _activitiesPriority:Array;
protected var _initializersPriority:Array;
public var spaceSortedX:Array;
protected var _actionsPriority:Array;
protected var _activities:Array;
private var _time:uint;
protected var _initializers:Array;
protected var _counter:Counter;
protected var _actions:Array;
public var spaceSort:Boolean;// = false
protected var _rotation:Number;// = 0
protected var _particlesPriority:Array;
protected var _y:Number;// = 0
private static var _creator:ParticleCreator = new ParticleCreator();
public function Emitter(){
_x = 0;
_y = 0;
_rotation = 0;
spaceSort = false;
super();
_particles = new Array();
_actions = new Array();
_initializers = new Array();
_activities = new Array();
_particlesPriority = new Array();
_actionsPriority = new Array();
_initializersPriority = new Array();
_activitiesPriority = new Array();
addEventListener(Event.REMOVED_FROM_STAGE, removed, false, 0, true);
}
public function runAhead(_arg1:Number, _arg2:Number=10):void{
var _local3:Number;
pause();
_local3 = (1 / _arg2);
while (_arg1 > 0) {
_arg1 = (_arg1 - _local3);
frameUpdate(_local3);
};
resume();
}
private function dispose():void{
var _local1:uint;
var _local2:uint;
removeEventListener(Event.ENTER_FRAME, frameLoop);
_local1 = _particles.length;
_local2 = 0;
while (_local2 < _local1) {
_creator.disposeParticle(_particles[_local2]);
_local2++;
};
_particles.length = 0;
cleanUp();
}
public function resume():void{
removeEventListener(Event.ENTER_FRAME, frameLoop);
addEventListener(Event.ENTER_FRAME, frameLoop, false, 0, true);
_time = getTimer();
}
public function set rotRadians(_arg1:Number):void{
_rotation = _arg1;
}
public function addAction(_arg1:Action, _arg2:Number=NaN):void{
var _local3:uint;
if (isNaN(_arg2)){
_arg2 = _arg1.getDefaultPriority();
};
_local3 = 0;
while (_local3 < _actionsPriority.length) {
if (_actionsPriority[_local3] < _arg2){
break;
};
_local3++;
};
_actions.splice(_local3, 0, _arg1);
_actionsPriority.splice(_local3, 0, _arg2);
_arg1.addedToEmitter(this);
}
public function setCounter(_arg1:Counter):void{
_counter = _arg1;
}
public function start():void{
var _local1:uint;
var _local2:uint;
removeEventListener(Event.ENTER_FRAME, frameLoop);
addEventListener(Event.ENTER_FRAME, frameLoop, false, 0, true);
_time = getTimer();
_local1 = _activities.length;
_local2 = 0;
while (_local2 < _local1) {
_activities[_local2].initialize(this);
_local2++;
};
_local1 = _counter.startEmitter();
_local2 = 0;
while (_local2 < _local1) {
createParticle();
_local2++;
};
}
private function removed(_arg1:Event):void{
if (_arg1.target == this){
dispose();
};
}
override public function get x():Number{
return (_x);
}
override public function get y():Number{
return (_y);
}
override public function get rotation():Number{
return (Maths.asDegrees(_rotation));
}
protected function particleDestroyed(_arg1:Particle):void{
}
override public function localToGlobal(_arg1:Point):Point{
var _local2:Point;
_local2 = super.localToGlobal(_arg1);
_local2.x = (_local2.x + _x);
_local2.y = (_local2.y + _y);
return (_local2);
}
public function addInitializer(_arg1:Initializer, _arg2:Number=NaN):void{
var _local3:uint;
if (isNaN(_arg2)){
_arg2 = _arg1.getDefaultPriority();
};
_local3 = 0;
while (_local3 < _initializersPriority.length) {
if (_initializersPriority[_local3] < _arg2){
break;
};
_local3++;
};
_initializers.splice(_local3, 0, _arg1);
_initializersPriority.splice(_local3, 0, _arg2);
_arg1.addedToEmitter(this);
}
protected function particleCreated(_arg1:Particle):void{
}
override public function globalToLocal(_arg1:Point):Point{
var _local2:Point;
_local2 = super.globalToLocal(_arg1);
_local2.x = (_local2.x - _x);
_local2.y = (_local2.y - _y);
return (_local2);
}
protected function frameUpdate(_arg1:Number):void{
var _local2:uint;
var _local3:Particle;
var _local4:uint;
var _local5:Action;
var _local6:uint;
var _local7:uint;
_local4 = _counter.updateEmitter(_arg1);
_local2 = 0;
while (_local2 < _local4) {
createParticle();
_local2++;
};
if (spaceSort){
spaceSortedX = _particles.sortOn("x", (Array.NUMERIC | Array.RETURNINDEXEDARRAY));
_local4 = _particles.length;
_local2 = 0;
while (_local2 < _local4) {
_particles[spaceSortedX[_local2]].spaceSortX = _local2;
_local2++;
};
};
_local4 = _activities.length;
_local2 = 0;
while (_local2 < _local4) {
_activities[_local2].update(this, _arg1);
_local2++;
};
if (_particles.length > 0){
_local4 = _actions.length;
_local6 = _particles.length;
_local7 = 0;
while (_local7 < _local4) {
_local5 = _actions[_local7];
_local2 = 0;
while (_local2 < _local6) {
_local3 = _particles[_local2];
_local5.update(this, _local3, _arg1);
_local2++;
};
_local7++;
};
_local2 = _local6;
while (_local2--) {
_local3 = _particles[_local2];
if (_local3.isDead){
dispatchEvent(new FlintEvent(FlintEvent.PARTICLE_DEAD, _local3));
particleDestroyed(_local3);
_creator.disposeParticle(_local3);
_particles.splice(_local2, 1);
};
};
} else {
dispatchEvent(new FlintEvent(FlintEvent.EMITTER_EMPTY));
};
render(_arg1);
}
protected function render(_arg1:Number):void{
}
private function createParticle():Particle{
var _local1:Particle;
var _local2:uint;
var _local3:uint;
_local1 = _creator.createParticle();
_local2 = _initializers.length;
_local3 = 0;
while (_local3 < _local2) {
_initializers[_local3].initialize(this, _local1);
_local3++;
};
_local1.x = (_local1.x + _x);
_local1.y = (_local1.y + _y);
_particles.unshift(_local1);
particleCreated(_local1);
return (_local1);
}
public function get particles():Array{
return (_particles);
}
public function get rotRadians():Number{
return (_rotation);
}
public function removeActivity(_arg1:Activity):void{
var _local2:uint;
_local2 = 0;
while (_local2 < _activities.length) {
if (_activities[_local2] == _arg1){
_activities.splice(_local2, 1);
_activitiesPriority.splice(_local2, 1);
return;
};
_local2++;
};
}
public function removeInitializer(_arg1:Initializer):void{
var _local2:uint;
_local2 = 0;
while (_local2 < _initializers.length) {
if (_initializers[_local2] == _arg1){
_initializers.splice(_local2, 1);
_initializersPriority.splice(_local2, 1);
return;
};
_local2++;
};
}
private function frameLoop(_arg1:Event):void{
var _local2:uint;
var _local3:Number;
_local2 = _time;
_time = getTimer();
_local3 = ((_time - _local2) * 0.001);
frameUpdate(_local3);
}
public function addActivity(_arg1:Activity, _arg2:Number=NaN):void{
var _local3:uint;
if (isNaN(_arg2)){
_arg2 = _arg1.getDefaultPriority();
};
_local3 = 0;
while (_local3 < _activitiesPriority.length) {
if (_activitiesPriority[_local3] < _arg2){
break;
};
_local3++;
};
_activities.splice(_local3, 0, _arg1);
_activitiesPriority.splice(_local3, 0, _arg2);
_arg1.addedToEmitter(this);
}
public function removeAction(_arg1:Action):void{
var _local2:uint;
_local2 = 0;
while (_local2 < _actions.length) {
if (_actions[_local2] == _arg1){
_actions.splice(_local2, 1);
_actionsPriority.splice(_local2, 1);
return;
};
_local2++;
};
}
protected function cleanUp():void{
}
override public function set x(_arg1:Number):void{
_x = _arg1;
}
override public function set y(_arg1:Number):void{
_y = _arg1;
}
override public function set rotation(_arg1:Number):void{
_rotation = Maths.asRadians(_arg1);
}
public function pause():void{
removeEventListener(Event.ENTER_FRAME, frameLoop);
}
}
}//package org.flintparticles.emitters
Section 40
//Linear (org.flintparticles.energyEasing.Linear)
package org.flintparticles.energyEasing {
public class Linear {
public static function easeOut(_arg1:Number, _arg2:Number):Number{
return ((1 - (_arg1 / _arg2)));
}
public static function easeIn(_arg1:Number, _arg2:Number):Number{
return ((1 - (_arg1 / _arg2)));
}
public static function easeInOut(_arg1:Number, _arg2:Number):Number{
return ((1 - (_arg1 / _arg2)));
}
public static function easeNone(_arg1:Number, _arg2:Number):Number{
return ((1 - (_arg1 / _arg2)));
}
}
}//package org.flintparticles.energyEasing
Section 41
//FlintEvent (org.flintparticles.events.FlintEvent)
package org.flintparticles.events {
import flash.events.*;
import org.flintparticles.particles.*;
public class FlintEvent extends Event {
public var particle:Particle;
public static var EMITTER_EMPTY:String = "emitterEmpty";
public static var PARTICLE_DEAD:String = "particleDead";
public function FlintEvent(_arg1:String, _arg2:Particle=null, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
particle = _arg2;
}
}
}//package org.flintparticles.events
Section 42
//ColorInit (org.flintparticles.initializers.ColorInit)
package org.flintparticles.initializers {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
import org.flintparticles.utils.*;
public class ColorInit extends Initializer {
private var _max:uint;
private var _min:uint;
public function ColorInit(_arg1:uint, _arg2:uint){
_min = _arg1;
_max = _arg2;
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
if (_max == _min){
_arg2.color = _min;
} else {
_arg2.color = interpolateColors(_min, _max, Math.random());
};
}
}
}//package org.flintparticles.initializers
Section 43
//Initializer (org.flintparticles.initializers.Initializer)
package org.flintparticles.initializers {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class Initializer {
public function initialize(_arg1:Emitter, _arg2:Particle):void{
}
public function addedToEmitter(_arg1:Emitter):void{
}
public function getDefaultPriority():Number{
return (0);
}
}
}//package org.flintparticles.initializers
Section 44
//Lifetime (org.flintparticles.initializers.Lifetime)
package org.flintparticles.initializers {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class Lifetime extends Initializer {
private var _min:Number;
private var _max:Number;
public function Lifetime(_arg1:Number, _arg2:Number=NaN){
_max = _arg2;
_min = _arg1;
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
if (isNaN(_max)){
_arg2.lifetime = _min;
} else {
_arg2.lifetime = (_min + (Math.random() * (_max - _min)));
};
}
}
}//package org.flintparticles.initializers
Section 45
//Position (org.flintparticles.initializers.Position)
package org.flintparticles.initializers {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
import flash.geom.*;
import org.flintparticles.zones.*;
public class Position extends Initializer {
private var _zone:Zone;
public function Position(_arg1:Zone){
_zone = _arg1;
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
var _local3:Point;
_local3 = _zone.getLocation();
_arg2.x = _local3.x;
_arg2.y = _local3.y;
}
}
}//package org.flintparticles.initializers
Section 46
//SharedImage (org.flintparticles.initializers.SharedImage)
package org.flintparticles.initializers {
import flash.display.*;
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
public class SharedImage extends Initializer {
private var _image:DisplayObject;
public function SharedImage(_arg1:DisplayObject){
_image = _arg1;
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
_arg2.image = _image;
}
}
}//package org.flintparticles.initializers
Section 47
//Velocity (org.flintparticles.initializers.Velocity)
package org.flintparticles.initializers {
import org.flintparticles.emitters.*;
import org.flintparticles.particles.*;
import flash.geom.*;
import org.flintparticles.zones.*;
public class Velocity extends Initializer {
private var _zone:Zone;
public function Velocity(_arg1:Zone){
_zone = _arg1;
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
var _local3:Point;
var _local4:Number;
var _local5:Number;
if (_arg1.rotRadians == 0){
_local3 = _zone.getLocation();
_arg2.velX = _local3.x;
_arg2.velY = _local3.y;
} else {
_local4 = Math.sin(_arg1.rotRadians);
_local5 = Math.cos(_arg1.rotRadians);
_local3 = _zone.getLocation();
_arg2.velX = ((_local5 * _local3.x) - (_local4 * _local3.y));
_arg2.velY = ((_local5 * _local3.y) + (_local4 * _local3.x));
};
}
}
}//package org.flintparticles.initializers
Section 48
//Particle (org.flintparticles.particles.Particle)
package org.flintparticles.particles {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class Particle {
public var rotation:Number;// = 0
public var energy:Number;// = 1
public var lifetime:Number;// = 0
public var scale:Number;// = 1
public var dictionary:Dictionary;
public var angVelocity:Number;// = 0
public var image:DisplayObject;// = null
public var velY:Number;// = 0
public var velX:Number;// = 0
public var color:uint;// = 4294967295
public var spaceSortX:uint;
public var isDead:Boolean;// = false
public var x:Number;// = 0
public var y:Number;// = 0
public var age:Number;// = 0
public function Particle(){
x = 0;
y = 0;
velX = 0;
velY = 0;
rotation = 0;
angVelocity = 0;
color = 4294967295;
scale = 1;
image = null;
lifetime = 0;
age = 0;
energy = 1;
isDead = false;
super();
}
public function get matrixTransform():Matrix{
var _local1:Number;
var _local2:Number;
_local1 = (scale * Math.cos(rotation));
_local2 = (scale * Math.sin(rotation));
return (new Matrix(_local1, _local2, -(_local2), _local1, x, y));
}
public function get colorTransform():ColorTransform{
return (new ColorTransform((((color >>> 16) & 0xFF) / 0xFF), (((color >>> 8) & 0xFF) / 0xFF), ((color & 0xFF) / 0xFF), (((color >>> 24) & 0xFF) / 0xFF), 0, 0, 0, 0));
}
public function initialize():void{
x = 0;
y = 0;
velX = 0;
velY = 0;
rotation = 0;
angVelocity = 0;
color = 4294967295;
scale = 1;
lifetime = 0;
age = 0;
energy = 1;
isDead = false;
image = null;
spaceSortX = 0;
dictionary = new Dictionary();
}
}
}//package org.flintparticles.particles
Section 49
//ParticleCreator (org.flintparticles.particles.ParticleCreator)
package org.flintparticles.particles {
public class ParticleCreator {
private var _particles:Array;
public function ParticleCreator(){
_particles = new Array();
}
public function createParticle():Particle{
if (_particles.length){
return (_particles.pop());
};
return (new Particle());
}
public function disposeParticle(_arg1:Particle):void{
_arg1.initialize();
_particles.push(_arg1);
}
public function clearAllParticles():void{
_particles = new Array();
}
}
}//package org.flintparticles.particles
Section 50
//interpolateColors (org.flintparticles.utils.interpolateColors)
package org.flintparticles.utils {
public function interpolateColors(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
_local4 = (1 - _arg3);
_local5 = ((((_arg1 >>> 16) & 0xFF) * _arg3) + (((_arg2 >>> 16) & 0xFF) * _local4));
_local6 = ((((_arg1 >>> 8) & 0xFF) * _arg3) + (((_arg2 >>> 8) & 0xFF) * _local4));
_local7 = (((_arg1 & 0xFF) * _arg3) + ((_arg2 & 0xFF) * _local4));
_local8 = ((((_arg1 >>> 24) & 0xFF) * _arg3) + (((_arg2 >>> 24) & 0xFF) * _local4));
return (((((_local8 << 24) | (_local5 << 16)) | (_local6 << 8)) | _local7));
}
}//package org.flintparticles.utils
Section 51
//Maths (org.flintparticles.utils.Maths)
package org.flintparticles.utils {
public class Maths {
private static const DEGTORAD:Number = 0.0174532925199433;
private static const RADTODEG:Number = 57.2957795130823;
public static function asRadians(_arg1:Number):Number{
return ((_arg1 * DEGTORAD));
}
public static function asDegrees(_arg1:Number):Number{
return ((_arg1 * RADTODEG));
}
}
}//package org.flintparticles.utils
Section 52
//DiscSectorZone (org.flintparticles.zones.DiscSectorZone)
package org.flintparticles.zones {
import flash.geom.*;
public class DiscSectorZone implements Zone {
private var _minAngle:Number;
private var _innerRadius:Number;
private var _minAllowed:Number;
private var _innerSq:Number;
private var _outerRadius:Number;
private var _center:Point;
private var _maxAngle:Number;
private var _outerSq:Number;
private static var TWOPI:Number = 6.28318530717959;
public function DiscSectorZone(_arg1:Point, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
_center = _arg1;
_innerRadius = _arg3;
_outerRadius = _arg2;
_innerSq = (_innerRadius * _innerRadius);
_outerSq = (_outerRadius * _outerRadius);
_minAngle = _arg4;
_maxAngle = _arg5;
while (_maxAngle > TWOPI) {
_maxAngle = (_maxAngle - TWOPI);
};
while (_maxAngle < 0) {
_maxAngle = (_maxAngle + TWOPI);
};
_minAllowed = (_maxAngle - TWOPI);
if (_arg4 == _arg5){
_minAngle = _maxAngle;
} else {
_minAngle = clamp(_minAngle);
};
}
public function getArea():Number{
return (((Math.PI * _outerSq) - (Math.PI * _innerSq)));
}
public function contains(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number;
var _local4:Number;
_arg1 = (_arg1 - _center.x);
_arg2 = (_arg2 - _center.y);
_local3 = ((_arg1 * _arg1) + (_arg2 * _arg2));
if ((((_local3 > _outerSq)) || ((_local3 < _innerSq)))){
return (false);
};
_local4 = Math.atan2(_arg2, _arg1);
_local4 = clamp(_local4);
return ((_local4 >= _minAngle));
}
public function getLocation():Point{
var _local1:Number;
var _local2:Point;
_local1 = Math.random();
_local2 = Point.polar((_innerRadius + ((1 - (_local1 * _local1)) * (_outerRadius - _innerRadius))), (_minAngle + (Math.random() * (_maxAngle - _minAngle))));
_local2.x = (_local2.x + _center.x);
_local2.y = (_local2.y + _center.y);
return (_local2);
}
private function clamp(_arg1:Number):Number{
while (_arg1 > _maxAngle) {
_arg1 = (_arg1 - TWOPI);
};
while (_arg1 < _minAllowed) {
_arg1 = (_arg1 + TWOPI);
};
return (_arg1);
}
}
}//package org.flintparticles.zones
Section 53
//DiscZone (org.flintparticles.zones.DiscZone)
package org.flintparticles.zones {
import flash.geom.*;
public class DiscZone implements Zone {
private var _innerRadius:Number;
private var _outerRadius:Number;
private var _center:Point;
private var _innerSq:Number;
private var _outerSq:Number;
private static var TWOPI:Number = 6.28318530717959;
public function DiscZone(_arg1:Point, _arg2:Number, _arg3:Number=0){
_center = _arg1;
_innerRadius = _arg3;
_outerRadius = _arg2;
_innerSq = (_innerRadius * _innerRadius);
_outerSq = (_outerRadius * _outerRadius);
}
public function getArea():Number{
return (((Math.PI * _outerSq) - (Math.PI * _innerSq)));
}
public function getLocation():Point{
var _local1:Number;
var _local2:Point;
_local1 = Math.random();
_local2 = Point.polar((_innerRadius + ((1 - (_local1 * _local1)) * (_outerRadius - _innerRadius))), (Math.random() * TWOPI));
_local2.x = (_local2.x + _center.x);
_local2.y = (_local2.y + _center.y);
return (_local2);
}
public function contains(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number;
_arg1 = (_arg1 - _center.x);
_arg2 = (_arg2 - _center.y);
_local3 = ((_arg1 * _arg1) + (_arg2 * _arg2));
return ((((_local3 <= _outerSq)) && ((_local3 >= _innerSq))));
}
}
}//package org.flintparticles.zones
Section 54
//Zone (org.flintparticles.zones.Zone)
package org.flintparticles.zones {
import flash.geom.*;
public interface Zone {
function getArea():Number;
function getLocation():Point;
function contains(_arg1:Number, _arg2:Number):Boolean;
}
}//package org.flintparticles.zones
Section 55
//aardboyPNG (aardboyPNG)
package {
import flash.display.*;
public dynamic class aardboyPNG extends BitmapData {
public function aardboyPNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 56
//background1JPG (background1JPG)
package {
import flash.display.*;
public dynamic class background1JPG extends BitmapData {
public function background1JPG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 57
//bombCursorPNG (bombCursorPNG)
package {
import flash.display.*;
public dynamic class bombCursorPNG extends BitmapData {
public function bombCursorPNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 58
//bombPNG (bombPNG)
package {
import flash.display.*;
public dynamic class bombPNG extends BitmapData {
public function bombPNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 59
//bombWAV (bombWAV)
package {
import flash.media.*;
public dynamic class bombWAV extends Sound {
}
}//package
Section 60
//BubbleGum (BubbleGum)
package {
import flash.text.*;
public dynamic class BubbleGum extends Font {
}
}//package
Section 61
//clickedWAV (clickedWAV)
package {
import flash.media.*;
public dynamic class clickedWAV extends Sound {
}
}//package
Section 62
//collapseWAV (collapseWAV)
package {
import flash.media.*;
public dynamic class collapseWAV extends Sound {
}
}//package
Section 63
//colourchain (colourchain)
package {
import com.shaunthesheep.colourchain.*;
import flash.display.*;
public class colourchain extends Sprite {
public function colourchain():void{
var _local1:LoaderInfo;
var _local2:String;
var _local3:Object;
super();
trace("Colour Chain Loaded and waiting for go call");
_local1 = root.loaderInfo;
_local2 = new String();
if (_local1 != null){
_local3 = _local1.parameters;
if (_local3 != null){
if (_local3.hotwire != null){
_local2 = _local3.hotwire;
};
};
};
go(_local2);
}
public function go(_arg1:String):void{
var _local2:gameEngine;
_local2 = new gameEngine(_arg1);
addChild(_local2);
}
}
}//package
Section 64
//explodeWAV (explodeWAV)
package {
import flash.media.*;
public dynamic class explodeWAV extends Sound {
}
}//package
Section 65
//gameOverPNG (gameOverPNG)
package {
import flash.display.*;
public dynamic class gameOverPNG extends BitmapData {
public function gameOverPNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 66
//gamePanelPNG (gamePanelPNG)
package {
import flash.display.*;
public dynamic class gamePanelPNG extends BitmapData {
public function gamePanelPNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 67
//instructionsPNG (instructionsPNG)
package {
import flash.display.*;
public dynamic class instructionsPNG extends BitmapData {
public function instructionsPNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 68
//menuBackgroundPNG (menuBackgroundPNG)
package {
import flash.display.*;
public dynamic class menuBackgroundPNG extends BitmapData {
public function menuBackgroundPNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 69
//menuSpritesPNG (menuSpritesPNG)
package {
import flash.display.*;
public dynamic class menuSpritesPNG extends BitmapData {
public function menuSpritesPNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 70
//mutePNG (mutePNG)
package {
import flash.display.*;
public dynamic class mutePNG extends BitmapData {
public function mutePNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 71
//shaun1PNG (shaun1PNG)
package {
import flash.display.*;
public dynamic class shaun1PNG extends BitmapData {
public function shaun1PNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 72
//shaun2PNG (shaun2PNG)
package {
import flash.display.*;
public dynamic class shaun2PNG extends BitmapData {
public function shaun2PNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 73
//shaun3PNG (shaun3PNG)
package {
import flash.display.*;
public dynamic class shaun3PNG extends BitmapData {
public function shaun3PNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 74
//shaun4PNG (shaun4PNG)
package {
import flash.display.*;
public dynamic class shaun4PNG extends BitmapData {
public function shaun4PNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 75
//shaun5PNG (shaun5PNG)
package {
import flash.display.*;
public dynamic class shaun5PNG extends BitmapData {
public function shaun5PNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 76
//shaun6PNG (shaun6PNG)
package {
import flash.display.*;
public dynamic class shaun6PNG extends BitmapData {
public function shaun6PNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 77
//shaun7PNG (shaun7PNG)
package {
import flash.display.*;
public dynamic class shaun7PNG extends BitmapData {
public function shaun7PNG(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package