Section 1
//Ball02_59 (HockeyFLA_fla.Ball02_59)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class Ball02_59 extends MovieClip {
public function Ball02_59(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 2
//Ball3_60 (HockeyFLA_fla.Ball3_60)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class Ball3_60 extends MovieClip {
public function Ball3_60(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package HockeyFLA_fla
Section 3
//BallAnimation_52 (HockeyFLA_fla.BallAnimation_52)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation_52 extends MovieClip {
public function BallAnimation_52(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package HockeyFLA_fla
Section 4
//BallAnimation010_63 (HockeyFLA_fla.BallAnimation010_63)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation010_63 extends MovieClip {
public function BallAnimation010_63(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 5
//BallAnimation011_68 (HockeyFLA_fla.BallAnimation011_68)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation011_68 extends MovieClip {
public function BallAnimation011_68(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 6
//BallAnimation012_73 (HockeyFLA_fla.BallAnimation012_73)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation012_73 extends MovieClip {
public function BallAnimation012_73(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 7
//BallAnimation013_78 (HockeyFLA_fla.BallAnimation013_78)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation013_78 extends MovieClip {
public function BallAnimation013_78(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 8
//BallAnimation02_51 (HockeyFLA_fla.BallAnimation02_51)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation02_51 extends MovieClip {
public function BallAnimation02_51(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 9
//BallAnimation04_55 (HockeyFLA_fla.BallAnimation04_55)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation04_55 extends MovieClip {
public function BallAnimation04_55(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 10
//BallAnimation11_64 (HockeyFLA_fla.BallAnimation11_64)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation11_64 extends MovieClip {
public function BallAnimation11_64(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package HockeyFLA_fla
Section 11
//BallAnimation12_69 (HockeyFLA_fla.BallAnimation12_69)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation12_69 extends MovieClip {
public function BallAnimation12_69(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package HockeyFLA_fla
Section 12
//BallAnimation13_74 (HockeyFLA_fla.BallAnimation13_74)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation13_74 extends MovieClip {
public function BallAnimation13_74(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package HockeyFLA_fla
Section 13
//BallAnimation14_79 (HockeyFLA_fla.BallAnimation14_79)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation14_79 extends MovieClip {
public function BallAnimation14_79(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package HockeyFLA_fla
Section 14
//BallAnimation6_56 (HockeyFLA_fla.BallAnimation6_56)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class BallAnimation6_56 extends MovieClip {
public function BallAnimation6_56(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package HockeyFLA_fla
Section 15
//ButBg_44 (HockeyFLA_fla.ButBg_44)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class ButBg_44 extends MovieClip {
public function ButBg_44(){
addFrameScript(62, frame63);
}
function frame63(){
stop();
}
}
}//package HockeyFLA_fla
Section 16
//flashanimation_4 (HockeyFLA_fla.flashanimation_4)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class flashanimation_4 extends MovieClip {
public function flashanimation_4(){
addFrameScript(94, frame95);
}
function frame95(){
stop();
}
}
}//package HockeyFLA_fla
Section 17
//GameOverAnimation_156 (HockeyFLA_fla.GameOverAnimation_156)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class GameOverAnimation_156 extends MovieClip {
public function GameOverAnimation_156(){
addFrameScript(25, frame26);
}
function frame26(){
stop();
}
}
}//package HockeyFLA_fla
Section 18
//GameOverBallAnimation_158 (HockeyFLA_fla.GameOverBallAnimation_158)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class GameOverBallAnimation_158 extends MovieClip {
public function GameOverBallAnimation_158(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package HockeyFLA_fla
Section 19
//GameOverBallAnimation02_157 (HockeyFLA_fla.GameOverBallAnimation02_157)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class GameOverBallAnimation02_157 extends MovieClip {
public function GameOverBallAnimation02_157(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 20
//HighScoreFrame_143 (HockeyFLA_fla.HighScoreFrame_143)
package HockeyFLA_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HighScoreFrame_143 extends MovieClip {
public var score1:TextField;
public var score5:TextField;
public var score10:TextField;
public var backhs:SimpleButton;
public var score6:TextField;
public var date1:TextField;
public var date2:TextField;
public var date3:TextField;
public var date6:TextField;
public var date7:TextField;
public var playmorehs:SimpleButton;
public var date5:TextField;
public var date9:TextField;
public var player1:TextField;
public var player2:TextField;
public var player6:TextField;
public var player7:TextField;
public var player8:TextField;
public var player5:TextField;
public var date4:TextField;
public var date8:TextField;
public var player3:TextField;
public var player9:TextField;
public var player4:TextField;
public var date10:TextField;
public var player10:TextField;
public var score2:TextField;
public var score3:TextField;
public var score7:TextField;
public var score8:TextField;
public var score9:TextField;
public var score4:TextField;
}
}//package HockeyFLA_fla
Section 21
//InstructionsFrame_138 (HockeyFLA_fla.InstructionsFrame_138)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class InstructionsFrame_138 extends MovieClip {
public var backintro:SimpleButton;
}
}//package HockeyFLA_fla
Section 22
//IPWelcome_160 (HockeyFLA_fla.IPWelcome_160)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class IPWelcome_160 extends MovieClip {
public var highscore:SimpleButton;
public var intro:SimpleButton;
public var playGame:SimpleButton;
public var playmore:SimpleButton;
public var addMore:SimpleButton;
}
}//package HockeyFLA_fla
Section 23
//Level03BallAnimation_57 (HockeyFLA_fla.Level03BallAnimation_57)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class Level03BallAnimation_57 extends MovieClip {
public function Level03BallAnimation_57(){
addFrameScript(0, frame1, 249, frame250);
}
function frame1(){
gotoAndPlay(2);
}
function frame250(){
stop();
}
}
}//package HockeyFLA_fla
Section 24
//Level04Ball_61 (HockeyFLA_fla.Level04Ball_61)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class Level04Ball_61 extends MovieClip {
public function Level04Ball_61(){
addFrameScript(249, frame250);
}
function frame250(){
gotoAndStop(1);
}
}
}//package HockeyFLA_fla
Section 25
//Level05Ball_65 (HockeyFLA_fla.Level05Ball_65)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class Level05Ball_65 extends MovieClip {
public function Level05Ball_65(){
addFrameScript(249, frame250);
}
function frame250(){
gotoAndStop(1);
}
}
}//package HockeyFLA_fla
Section 26
//Level06Ball_70 (HockeyFLA_fla.Level06Ball_70)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class Level06Ball_70 extends MovieClip {
public function Level06Ball_70(){
addFrameScript(249, frame250);
}
function frame250(){
gotoAndStop(1);
}
}
}//package HockeyFLA_fla
Section 27
//Level07Ball_75 (HockeyFLA_fla.Level07Ball_75)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class Level07Ball_75 extends MovieClip {
public function Level07Ball_75(){
addFrameScript(249, frame250);
}
function frame250(){
gotoAndStop(1);
}
}
}//package HockeyFLA_fla
Section 28
//LevelBallAnimation_43 (HockeyFLA_fla.LevelBallAnimation_43)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class LevelBallAnimation_43 extends MovieClip {
public function LevelBallAnimation_43(){
addFrameScript(249, frame250);
}
function frame250(){
gotoAndStop(1);
}
}
}//package HockeyFLA_fla
Section 29
//LevelBallAnimation02_53 (HockeyFLA_fla.LevelBallAnimation02_53)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class LevelBallAnimation02_53 extends MovieClip {
public function LevelBallAnimation02_53(){
addFrameScript(250, frame251);
}
function frame251(){
gotoAndStop(1);
}
}
}//package HockeyFLA_fla
Section 30
//LogoAniFlashA_105 (HockeyFLA_fla.LogoAniFlashA_105)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class LogoAniFlashA_105 extends MovieClip {
public function LogoAniFlashA_105(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package HockeyFLA_fla
Section 31
//ResultBox_121 (HockeyFLA_fla.ResultBox_121)
package HockeyFLA_fla {
import flash.display.*;
import flash.text.*;
public dynamic class ResultBox_121 extends MovieClip {
public var bonus:TextField;
public var totalScore:TextField;
public var player:TextField;
}
}//package HockeyFLA_fla
Section 32
//ResultBox01_146 (HockeyFLA_fla.ResultBox01_146)
package HockeyFLA_fla {
import flash.display.*;
import flash.text.*;
public dynamic class ResultBox01_146 extends MovieClip {
public var bonus:TextField;
public var totalScore:TextField;
}
}//package HockeyFLA_fla
Section 33
//StAnimation_47 (HockeyFLA_fla.StAnimation_47)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class StAnimation_47 extends MovieClip {
public function StAnimation_47(){
addFrameScript(89, frame90);
}
function frame90(){
stop();
}
}
}//package HockeyFLA_fla
Section 34
//total_mc_1 (HockeyFLA_fla.total_mc_1)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class total_mc_1 extends MovieClip {
public function total_mc_1(){
addFrameScript(179, frame180);
}
function frame180(){
stop();
}
}
}//package HockeyFLA_fla
Section 35
//Welcome_128 (HockeyFLA_fla.Welcome_128)
package HockeyFLA_fla {
import flash.display.*;
public dynamic class Welcome_128 extends MovieClip {
public var hs:MovieClip;
public var highscore:SimpleButton;
public var intro:SimpleButton;
public var playGame:SimpleButton;
public var playmore:SimpleButton;
public var addMore:SimpleButton;
public var introframe:MovieClip;
public function Welcome_128(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package HockeyFLA_fla
Section 36
//AbstractButton (AbstractButton)
package {
import flash.display.*;
public class AbstractButton extends SimpleButton {
private var size:uint;// = 12
private var upColor:uint;// = 0xFFCC00
private var downColor:uint;// = 52479
private var overColor:uint;// = 0xCCFF00
public function AbstractButton(_arg1:String){
upColor = 0xFFCC00;
overColor = 0xCCFF00;
downColor = 52479;
size = 12;
super();
downState = new ButtonDisplayState(_arg1, downColor, size);
overState = new ButtonDisplayState(_arg1, overColor, size);
upState = new ButtonDisplayState(_arg1, upColor, size);
hitTestState = new ButtonDisplayState(_arg1, upColor, (size * 2));
hitTestState.x = -((size / 4));
hitTestState.y = hitTestState.x;
useHandCursor = true;
}
public function draw(){
this.visible = true;
}
public function clear(){
this.visible = false;
}
}
}//package
Section 37
//AirHockey (AirHockey)
package {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
public class AirHockey extends Sprite {
private var foulBallPanel:FoulBallPanel;// = null
var sound:LoadSoundIP;// = null
private var welcomePage:Welcome;// = null
private var kickOffText:KickOffText;// = null
var result:Result;
var levelPage:Levels;// = null
private var youWin:YouWin;// = null
var timer:Timer;
private var cbs:CorrectBallSound;// = null
private var ballCount:Number;// = 0
var welcome:Welcome;
var paddle:Paddle;// = null
private var bonusTimer:Timer;// = null
var levelStartTimer:Timer;
private var ibs:IncorrectBallSound;// = null
var bgs:BGSound;// = null
private var gameOver:GameOver;// = null
var _channel:SoundChannel;
public function AirHockey(){
paddle = null;
levelPage = null;
ballCount = 0;
welcomePage = null;
kickOffText = null;
gameOver = null;
youWin = null;
bonusTimer = null;
foulBallPanel = null;
sound = null;
cbs = null;
ibs = null;
bgs = null;
super();
cbs = new CorrectBallSound();
ibs = new IncorrectBallSound();
bgs = new BGSound();
createBG();
createWelcome();
timer = new Timer(1000, Constants.timeLimit);
timer.addEventListener(TimerEvent.TIMER, afterSecond);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, timeout);
bonusTimer = new Timer(50, 0);
bonusTimer.addEventListener(TimerEvent.TIMER, updateBonusValue);
bonusTimer.addEventListener(TimerEvent.TIMER_COMPLETE, gotoNextLevel);
bonusTimer.stop();
}
public function createGameOver(){
timer.reset();
timer.stop();
Mouse.show();
clearGraphics();
gameOver = GameOver.getInstance();
gameOver.updateScores();
addChild(gameOver);
gameOver.x = Constants.stageCenter.x;
gameOver.y = Constants.stageCenter.y;
gameOver.playAgain.addEventListener(MouseEvent.CLICK, clickPlayAgain);
_channel.stop();
}
public function updateBonusValue(_arg1:TimerEvent){
Constants.text.decrementTime();
Constants.text.incrementScore(Constants.bonusOnSec);
}
public function init(){
clearGraphics();
Constants.text = TextDisplay.getInstance();
addChild(Constants.text);
switch (Constants.currentLevel){
case 1:
Constants.surface = SquareSurface.getInstance();
ballCount = Constants.ballCountLEVEL1;
break;
case 2:
Constants.surface = RectangleSurface.getInstance();
ballCount = Constants.ballCountLEVEL2;
break;
case 3:
Constants.surface = SquareSurface.getInstance();
ballCount = Constants.ballCountLEVEL3;
break;
case 4:
Constants.surface = HexSurface.getInstance();
ballCount = Constants.ballCountLEVEL4;
break;
case 5:
Constants.surface = HexSurface.getInstance();
ballCount = Constants.ballCountLEVEL5;
break;
case 6:
Constants.surface = OctoSurface.getInstance();
ballCount = Constants.ballCountLEVEL6;
break;
default:
Constants.surface = HexSurface.getInstance();
ballCount = Constants.ballCountLEVEL3;
break;
};
Constants.maxDirtyPockets = (Constants.maxDirtyPockets + Constants.maxIncorrectPockets[(Constants.currentLevel - 1)]);
Constants.totalDirtyPockets = 0;
Constants.surface.x = Constants.stageCenter.x;
Constants.surface.y = Constants.stageCenter.y;
addChild(Constants.surface);
createReflectors();
createBalls();
createPaddle();
Constants.text.updateSpareCount();
createLevelKickoff();
}
private function setVolume(_arg1:Number):void{
var _local2:SoundTransform;
trace(("setVolume: " + _arg1.toFixed(2)));
_local2 = _channel.soundTransform;
_local2.volume = _arg1;
_channel.soundTransform = _local2;
}
public function gotoNextLevel(_arg1:TimerEvent){
if (Constants.currentLevel == 6){
createYouWin();
} else {
clearGraphics();
createLevelsPage();
};
}
public function createReflectors(){
var _local1:*;
var _local2:Number;
var _local3:*;
var _local4:Number;
_local1 = Constants.reflectorCount[(Constants.currentLevel - 1)];
Constants.reflectorArray = new Array(_local1);
if (_local1 > 0){
_local2 = ((Math.random() * 2) * Math.PI);
_local3 = ((2 / _local1) * Math.PI);
_local4 = 0;
while (_local4 < _local1) {
Constants.reflectorArray[_local4] = Reflector.getInstance(_local4);
addChild(Constants.reflectorArray[_local4]);
Constants.reflectorArray[_local4].x = ((Math.cos(_local2) * Constants.surface.abstaclesBoundary) + Constants.surface.center.x);
Constants.reflectorArray[_local4].y = ((Math.sin(_local2) * Constants.surface.abstaclesBoundary) + Constants.surface.center.y);
_local2 = (_local2 + _local3);
_local4++;
};
};
}
private function checkCollision(_arg1:Ball, _arg2:Ball):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Point;
var _local10:Point;
var _local11:Point;
var _local12:Point;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Object;
var _local17:Object;
var _local18:Object;
var _local19:Object;
_local3 = (_arg2.x - _arg1.x);
_local4 = (_arg2.y - _arg1.y);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
if (_local5 < (_arg1.radius + _arg2.radius)){
_local6 = Math.atan2(_local4, _local3);
_local7 = Math.sin(_local6);
_local8 = Math.cos(_local6);
_local9 = new Point(0, 0);
_local10 = rotate(_local3, _local4, _local7, _local8, true);
_local11 = rotate(_arg1.fvx, _arg1.fvy, _local7, _local8, true);
_local12 = rotate(_arg2.fvx, _arg2.fvy, _local7, _local8, true);
_local13 = (_local11.x - _local12.x);
_local11.x = (((_arg1.mass - (_arg2.mass * _local11.x)) + (((2 * _arg2.mass) * _local12.x) / _arg1.mass)) + _arg2.mass);
_local12.x = (_local13 + _local11.x);
_local14 = (Math.abs(_local11.x) + Math.abs(_local12.x));
_local15 = ((_arg1.radius + _arg2.radius) - Math.abs((_local9.x - _local10.x)));
_local9.x = (_local9.x + ((_local11.x / _local14) * _local15));
_local10.x = (_local10.x + ((_local12.x / _local14) * _local15));
_local16 = rotate(_local9.x, _local9.y, _local7, _local8, false);
_local17 = rotate(_local10.x, _local10.y, _local7, _local8, false);
_arg2.x = (_arg1.x + (_local17.x * 1.3));
_arg2.y = (_arg1.y + (_local17.y * 1.3));
_arg1.x = (_arg1.x + (_local16.x * 1.3));
_arg1.y = (_arg1.y + (_local16.y * 1.3));
_local18 = rotate(_local11.x, _local11.y, _local7, _local8, false);
_local19 = rotate(_local12.x, _local12.y, _local7, _local8, false);
_arg1.fvx = (_local18.x * 0.85);
_arg1.fvy = (_local18.y * 0.85);
_arg2.fvx = (_local19.x * 0.85);
_arg2.fvy = (_local19.y * 0.85);
};
}
public function emptyPocket(_arg1:Number){
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = Constants.ballArray.length;
_local3 = (Math.random() * 360);
_local4 = 0;
while (_local4 < Constants.surface.pockets[_arg1].ballCount) {
Constants.ballArray.push(BallFactory.createBall(Constants.surface.pockets[_arg1].colorIndex));
Constants.ballArray[_local2].init(_local2, Constants.surface.pockets[_arg1].colorIndex);
addChild(Constants.ballArray[_local2]);
Constants.ballArray[_local2].x = (Constants.stageCenter.x + (((Math.cos(_local3) * Constants.ballArray[_local2].diameter) * ballCount) * 0.25));
Constants.ballArray[_local2].y = (Constants.stageCenter.y + (((Math.sin(_local3) * Constants.ballArray[_local2].diameter) * ballCount) * 0.25));
Constants.ballArray[_local2].setInititalVel(_local3);
Constants.ballArray[_local2].addEventListener(Event.ENTER_FRAME, Constants.ballArray[_local2].onEnterFrame);
_local3 = (_local3 + 40);
_local2 = (_local2 + 1);
_local4++;
};
Constants.surface.pockets[_arg1].ballCount = 0;
}
public function startLevel(_arg1:TimerEvent){
init();
}
public function sendData(_arg1:String, _arg2:Number):Boolean{
var request:URLRequest;
var variables:URLVariables;
var playerName = _arg1;
var score = _arg2;
try {
request = new URLRequest("http://www.flasharcade.com/setscores.php");
request.method = URLRequestMethod.POST;
variables = new URLVariables();
variables.scoreName = playerName;
variables.scoreText = score;
variables.gameId = "ace003";
variables.gameName = "Impact Pool";
request.data = variables;
sendToURL(request);
} catch(e:Error) {
trace(" caught error");
youWin.setErrorMesg("Could not submit the score");
return (false);
} catch(e:SecurityError) {
trace(("error is : " + e));
};
return (true);
}
public function assignBallIndices(){
var _local1:Number;
_local1 = 0;
while (_local1 < Constants.ballArray.length) {
Constants.ballArray[_local1].ballindex = _local1;
_local1++;
};
}
public function startBonusCounter(){
var _local1:*;
_local1 = (Constants.timeLimit - timer.currentCount);
timer.reset();
timer.stop();
Mouse.show();
bonusTimer.repeatCount = _local1;
Constants.text.addBonusOnTime(_local1);
if (_local1 <= 0){
nextLevel();
} else {
bonusTimer.reset();
bonusTimer.start();
};
}
public function createBG(){
var _local1:*;
_local1 = BG.getInstance();
addChild(_local1);
_local1.x = Constants.stageCenter.x;
_local1.y = Constants.stageCenter.y;
}
public function createFoulBallPanel(){
foulBallPanel = FoulBallPanel.getInstance();
addChild(foulBallPanel);
foulBallPanel.x = 660;
foulBallPanel.y = 200;
foulBallPanel.visible = false;
}
public function gotoLEVEL1(_arg1:MouseEvent){
removeChild(welcomePage);
createLevelsPage();
}
public function createYouWin(){
timer.reset();
timer.stop();
Mouse.show();
clearGraphics();
youWin = YouWin.getInstance();
youWin.updateScores();
addChild(youWin);
youWin.x = Constants.stageCenter.x;
youWin.y = Constants.stageCenter.y;
youWin.playAgain1.addEventListener(MouseEvent.CLICK, clickPlayAgain);
youWin.submitScore.addEventListener(MouseEvent.CLICK, submitScore);
_channel.stop();
}
public function startGame(_arg1:TimerEvent){
var _local2:Number;
removeChild(kickOffText);
levelStartTimer.stop();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
Mouse.hide();
_local2 = 0;
while (_local2 < Constants.ballArray.length) {
Constants.ballArray[_local2].addEventListener(Event.ENTER_FRAME, Constants.ballArray[_local2].onEnterFrame);
_local2++;
};
timer.start();
}
public function fetchHighScore(_arg1:MouseEvent){
var _local2:URLRequest;
var _local3:URLLoader;
var _local4:URLVariables;
welcomePage.setChildIndex(welcomePage.hs, 2);
welcomePage.emptyScores();
_local2 = new URLRequest("http://www.flasharcade.com/getscoresas3.php");
_local2.method = URLRequestMethod.POST;
_local3 = new URLLoader();
_local3.dataFormat = URLLoaderDataFormat.VARIABLES;
_local4 = new URLVariables();
_local4.gameId = "ace003";
_local2.data = _local4;
_local3.load(_local2);
_local3.addEventListener(Event.COMPLETE, completeHandler);
}
public function afterSecond(_arg1:TimerEvent){
Constants.text.updateTime(timer.currentCount);
}
public function submitScore(_arg1:MouseEvent){
var _local2:String;
var _local3:Number;
youWin.setErrorMesg("");
_local2 = null;
_local2 = youWin.getPlayerName();
_local3 = Constants.text.scoreValue;
if ((((_local2 == null)) || ((_local2 == "")))){
youWin.setErrorMesg("Please enter your name");
} else {
trace(((("namep : " + _local2) + " score : ") + _local3));
if (sendData(_local2, _local3) == false){
return;
};
displayHighScoreScreen();
};
}
public function createLevelKickoff(){
kickOffText = KickOffText.getInstance();
levelStartTimer.reset();
levelStartTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, startLevel);
levelStartTimer.addEventListener(TimerEvent.TIMER, updateKickOffText);
levelStartTimer.addEventListener(TimerEvent.TIMER_COMPLETE, startGame);
levelStartTimer.start();
addChild(kickOffText);
kickOffText.x = (Constants.stageCenter.x - 50);
kickOffText.y = (Constants.stageCenter.y + 100);
kickOffText.updateText("6");
}
public function instruction(_arg1:MouseEvent){
welcomePage.gotoAndStop(2);
}
public function timeout(_arg1:TimerEvent){
removeEventListener(Event.ENTER_FRAME, onEnterFrame, false);
clearGraphics();
if (Constants.ballArray.length == 0){
showResult(Constants.RESULT_SUCCESS, (timer.repeatCount - timer.currentCount));
return;
};
if (getTimer() > (Constants.timeLimit * 1000)){
showResult(Constants.RESULT_TIMEOUT, 0);
};
}
private function rotate(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean):Point{
var _local6:Point;
_local6 = new Point();
if (_arg5){
_local6.x = ((_arg1 * _arg4) + (_arg2 * _arg3));
_local6.y = ((_arg2 * _arg4) - (_arg1 * _arg3));
} else {
_local6.x = ((_arg1 * _arg4) - (_arg2 * _arg3));
_local6.y = ((_arg2 * _arg4) + (_arg1 * _arg3));
};
return (_local6);
}
public function createPaddle(){
paddle = Paddle.getInstance();
addChild(paddle);
paddle.x = Constants.stageCenter.x;
paddle.y = ((Constants.stageCenter.y - paddle.radius) + 120);
}
public function updateKickOffText(_arg1:TimerEvent){
kickOffText.updateText((6 - levelStartTimer.currentCount).toString());
}
public function completeBGSHandler(_arg1:Event){
_channel.removeEventListener(Event.SOUND_COMPLETE, completeBGSHandler);
_channel = bgs.play();
setVolume(Constants.soundVolume);
_channel.addEventListener(Event.SOUND_COMPLETE, completeBGSHandler);
}
public function createLevelsPage(){
Constants.currentLevel = (Constants.currentLevel + 1);
levelPage = Levels.getInstance();
levelPage.gotoAndPlay(("Level" + Constants.currentLevel.toString()));
levelPage.x = Constants.stageCenter.x;
levelPage.y = Constants.stageCenter.y;
levelStartTimer = new Timer(1000, 4);
levelStartTimer.addEventListener(TimerEvent.TIMER_COMPLETE, startLevel);
levelStartTimer.start();
addChild(levelPage);
}
public function onEnterFrame(_arg1:Event){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
if (Constants.ballArray.length == 0){
showResult(Constants.RESULT_SUCCESS, (timer.repeatCount - timer.currentCount));
return;
};
paddle.movePaddle(mouseX, mouseY);
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
while (_local5 < (Constants.ballArray.length - 1)) {
_local7 = (_local5 + 1);
while (_local7 < Constants.ballArray.length) {
if ((((Constants.ballArray[_local5].isMoving == true)) && ((Constants.ballArray[_local7].isMoving == true)))){
checkCollision(Constants.ballArray[_local5], Constants.ballArray[_local7]);
};
_local7++;
};
_local5++;
};
_local6 = 0;
while (_local6 < Constants.ballArray.length) {
if (Constants.ballArray[_local6].alpha < 0.6){
if (Constants.ballArray[_local6].bringBack == false){
Constants.ballArray[_local6].removeEventListener(Event.ENTER_FRAME, Constants.ballArray[_local6].onEnterFrame);
if (contains(Constants.ballArray[_local6])){
removeChild(Constants.ballArray[_local6]);
};
Constants.ballArray.splice(_local6, 1);
_local6--;
cbs.play();
} else {
if (Constants.maxDirtyPockets > 0){
emptyPocket(Constants.ballArray[_local6].inPocketIndex);
Constants.ballArray[_local6].reinit(_local6);
Constants.totalDirtyPockets = (Constants.totalDirtyPockets + 1);
Constants.maxDirtyPockets = (Constants.maxDirtyPockets - 1);
Constants.text.updateSpareCount();
ibs.play();
} else {
showResult(Constants.RESULT_POCKETFAIL, 0);
return;
};
};
};
_local6++;
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function createBalls(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
BallFactory.createBalls(ballCount);
_local1 = (Math.PI * (2 / ballCount));
_local2 = (Math.random() * 360);
_local3 = 0;
while (_local3 < ballCount) {
addChild(Constants.ballArray[_local3]);
Constants.ballArray[_local3].x = (Constants.stageCenter.x + (Math.cos(_local2) * 50));
Constants.ballArray[_local3].y = (Constants.stageCenter.y + (Math.sin(_local2) * 50));
Constants.ballArray[_local3].setInititalVel(_local2);
_local2 = (_local2 + _local1);
_local3++;
};
}
public function createWelcome(){
welcomePage = Welcome.getInstance();
welcomePage.setChildIndex(welcomePage.ipwelcome, 2);
addChild(welcomePage);
welcomePage.x = Constants.stageCenter.x;
welcomePage.y = Constants.stageCenter.y;
Constants.currentLevel = Constants.startLevel;
if (Constants.text != null){
Constants.text.resetScore();
};
Constants.maxDirtyPockets = 0;
welcomePage.ipwelcome.playGame.addEventListener(MouseEvent.CLICK, gotoLEVEL1);
welcomePage.ipwelcome.highscore.addEventListener(MouseEvent.CLICK, fetchHighScore);
_channel = bgs.play();
setVolume(Constants.soundVolume);
_channel.addEventListener(Event.SOUND_COMPLETE, completeBGSHandler);
}
private function completeHandler(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:URLLoader;
var _local5:String;
var _local6:Array;
_local3 = 0;
_local4 = URLLoader(_arg1.target);
_local5 = "";
_local6 = null;
if (_local4.data.data0 != undefined){
_local6 = _local4.data.data0.split("|", 3);
welcomePage.hs.player1.text = _local6[0];
welcomePage.hs.score1.text = _local6[1];
welcomePage.hs.date1.text = _local6[2];
};
if (_local4.data.data1 != undefined){
_local6 = _local4.data.data1.split("|", 3);
welcomePage.hs.player2.text = _local6[0];
welcomePage.hs.score2.text = _local6[1];
welcomePage.hs.date2.text = _local6[2];
};
if (_local4.data.data2 != undefined){
_local6 = _local4.data.data2.split("|", 3);
welcomePage.hs.player3.text = _local6[0];
welcomePage.hs.score3.text = _local6[1];
welcomePage.hs.date3.text = _local6[2];
};
if (_local4.data.data3 != undefined){
_local6 = _local4.data.data3.split("|", 3);
welcomePage.hs.player4.text = _local6[0];
welcomePage.hs.score4.text = _local6[1];
welcomePage.hs.date4.text = _local6[2];
};
if (_local4.data.data4 != undefined){
_local6 = _local4.data.data4.split("|", 3);
welcomePage.hs.player5.text = _local6[0];
welcomePage.hs.score5.text = _local6[1];
welcomePage.hs.date5.text = _local6[2];
};
if (_local4.data.data5 != undefined){
_local6 = _local4.data.data5.split("|", 3);
welcomePage.hs.player6.text = _local6[0];
welcomePage.hs.score6.text = _local6[1];
welcomePage.hs.date6.text = _local6[2];
};
if (_local4.data.data6 != undefined){
_local6 = _local4.data.data6.split("|", 3);
welcomePage.hs.player7.text = _local6[0];
welcomePage.hs.score7.text = _local6[1];
welcomePage.hs.date7.text = _local6[2];
};
if (_local4.data.data7 != undefined){
_local6 = _local4.data.data7.split("|", 3);
welcomePage.hs.player8.text = _local6[0];
welcomePage.hs.score8.text = _local6[1];
welcomePage.hs.date8.text = _local6[2];
};
if (_local4.data.data8 != undefined){
_local6 = _local4.data.data8.split("|", 3);
welcomePage.hs.player9.text = _local6[0];
welcomePage.hs.score9.text = _local6[1];
welcomePage.hs.date9.text = _local6[2];
};
if (_local4.data.data9 != undefined){
_local6 = _local4.data.data9.split("|", 3);
welcomePage.hs.player10.text = _local6[0];
welcomePage.hs.score10.text = _local6[1];
welcomePage.hs.date10.text = _local6[2];
};
}
public function displayHighScoreScreen(){
createWelcome();
fetchHighScore(null);
welcomePage.setChildIndex(welcomePage.hs, 2);
}
public function clickPlayAgain(_arg1:MouseEvent){
clearGraphics();
createWelcome();
}
private function showResult(_arg1:Number, _arg2:Number){
switch (_arg1){
case 0:
startBonusCounter();
break;
case 1:
createGameOver();
break;
};
}
public function nextLevel(){
clearGraphics();
createLevelsPage();
}
public function clearGraphics(){
var _local1:Number;
if (foulBallPanel != null){
if (contains(foulBallPanel)){
removeChild(foulBallPanel);
};
};
if (paddle != null){
if (contains(paddle)){
removeChild(paddle);
};
};
if (Constants.surface != null){
if (contains(Constants.surface)){
Constants.surface.reinit();
removeChild(Constants.surface);
};
};
if (Constants.text != null){
if (contains(Constants.text)){
removeChild(Constants.text);
};
};
if (Constants.ballArray != null){
_local1 = (Constants.ballArray.length - 1);
while (_local1 >= 0) {
if (contains(Constants.ballArray[_local1])){
Constants.ballArray[_local1].removeEventListener(Event.ENTER_FRAME, Constants.ballArray[_local1].onEnterFrame);
removeChild(Constants.ballArray[_local1]);
};
_local1--;
};
};
if (Constants.reflectorArray != null){
_local1 = (Constants.reflectorArray.length - 1);
while (_local1 >= 0) {
if (contains(Constants.reflectorArray[_local1])){
removeChild(Constants.reflectorArray[_local1]);
};
_local1--;
};
};
if (gameOver != null){
if (contains(gameOver)){
removeChild(gameOver);
};
};
if (youWin != null){
if (contains(youWin)){
removeChild(youWin);
};
};
if (levelPage != null){
if (contains(levelPage)){
removeChild(levelPage);
};
};
Mouse.show();
}
}
}//package
Section 38
//Ball (Ball)
package {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
public class Ball extends Sprite {
private var angle:Number;// = 0
public var stageBounce:Number;
public var mass:Number;// = 1
public var isDecaying:Boolean;// = false
public var ballindex:Number;// = 0
public var colorIndex:Number;
var bounceForce;// = 0
public var isMoving:Boolean;// = true
public var speed;
private var radian:Number;// = 0.0174532925199433
public var inPocketIndex:Number;// = -1
private var cos:Number;// = 0
public var radius:Number;
private var pockets:Array;
public var fvx:Number;
public var fvy:Number;
public var diameter:Number;
public var bringBack:Boolean;// = false
public var nextX;// = 0
public var nextY;// = 0
private var degree:Number;// = 57.2957795130823
public var num:MovieClip;
public var angularVelocity;// = 0
private var lineP:Point;
public var dampingEnabled:Boolean;// = false
private var tracecount:Number;// = 0
private var sin:Number;// = 0
public function Ball(){
radius = Constants.ballRadius;
fvx = Constants.FixedSpeedBall[(Constants.currentLevel - 1)];
fvy = Constants.FixedSpeedBall[(Constants.currentLevel - 1)];
speed = fvx;
mass = 1;
angularVelocity = 0;
diameter = (radius * 2);
stageBounce = Constants.StageBounceForce[(Constants.currentLevel - 1)];
isMoving = true;
isDecaying = false;
dampingEnabled = false;
ballindex = 0;
inPocketIndex = -1;
bounceForce = 0;
bringBack = false;
nextX = 0;
nextY = 0;
tracecount = 0;
radian = (Math.PI / 180);
degree = (180 / Math.PI);
lineP = new Point();
angle = 0;
cos = 0;
sin = 0;
super();
mass = 1;
this.pockets = pockets;
}
public function init(_arg1:Number, _arg2:Number){
this.ballindex = _arg1;
this.colorIndex = _arg2;
num = NumberClip.getInstance((_arg2 + 1));
addChild(num);
num.gotoAndStop(10);
this.inPocketIndex = -1;
}
public function checkPocketCollision():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local4 = 0;
while (_local4 < Constants.surface.pockets.length) {
_local1 = (Constants.surface.pockets[_local4].center.x - x);
_local2 = (Constants.surface.pockets[_local4].center.y - y);
_local3 = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
if (_local3 < (Constants.surface.pockets[_local4].radius + radius)){
x = Constants.surface.pockets[_local4].center.x;
y = Constants.surface.pockets[_local4].center.y;
if (Constants.surface.pockets[_local4].colorIndex == this.colorIndex){
Constants.surface.pockets[_local4].incrementCount();
this.inPocketIndex = _local4;
this.isMoving = false;
this.isDecaying = true;
Constants.text.incrementScore(Constants.scoreOnPocket);
bringBack = false;
} else {
this.isMoving = false;
isDecaying = true;
bringBack = true;
this.inPocketIndex = _local4;
};
this.num.stop();
return (true);
};
_local4++;
};
return (false);
}
public function checkLine(_arg1:Line):Boolean{
var _local2:*;
var _local3:Rectangle;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local2 = false;
lineP.x = (_arg1.x + Constants.surface.center.x);
lineP.y = (_arg1.y + Constants.surface.center.y);
_local3 = _arg1.getBounds(this.parent);
if ((((x >= _local3.left)) && ((x <= _local3.right)))){
angle = (_arg1.rotation * radian);
cos = Math.cos(angle);
sin = Math.sin(angle);
_local4 = (x - lineP.x);
_local5 = (y - lineP.y);
_local6 = ((cos * _local5) - (sin * _local4));
_local7 = ((cos * fvy) - (sin * fvx));
if ((((_local6 > -(radius))) && ((_local6 < _local7)))){
_local2 = true;
_local8 = ((cos * _local4) + (sin * _local5));
_local9 = ((cos * fvx) + (sin * fvy));
_local6 = -(radius);
_local7 = (_local7 * stageBounce);
dampingEnabled = true;
_local4 = ((cos * _local8) - (sin * _local6));
_local5 = ((cos * _local6) + (sin * _local8));
fvx = ((cos * _local9) - (sin * _local7));
fvy = ((cos * _local7) + (sin * _local9));
x = (lineP.x + _local4);
y = (lineP.y + _local5);
};
};
return (_local2);
}
public function setRotation(){
var _local1:*;
_local1 = (((Math.atan2(fvy, fvx) * 180) / Math.PI) + 180);
if (angularVelocity != _local1){
this.num.rotation = angularVelocity;
this.num.gotoAndPlay(10);
angularVelocity = _local1;
};
}
public function moveBall():void{
var _local1:*;
if (dampingEnabled == true){
if (Math.sqrt(((fvx * fvx) + (fvy * fvy))) < speed){
dampingEnabled = false;
_local1 = Math.atan2(fvy, fvx);
fvx = (Math.cos(_local1) * speed);
fvy = (Math.sin(_local1) * speed);
} else {
fvx = (fvx * 0.98);
fvy = (fvy * 0.98);
};
};
nextX = (x + fvx);
nextY = (y + fvy);
this.x = (this.x + fvx);
this.y = (this.y + fvy);
if (checkReflectorCollision() == true){
setRotation();
return;
};
if (checkPocketCollision() == true){
setRotation();
return;
};
Constants.surface.checkBoundary(this);
setRotation();
}
public function startDecay():void{
if (isDecaying == true){
this.alpha = (this.alpha - 0.1);
};
}
public function setInititalVel(_arg1:Number):void{
var _local2:*;
_local2 = (_arg1 + 180);
fvx = (speed * Math.cos(_local2));
fvy = (speed * Math.sin(_local2));
}
public function checkLineINNER(_arg1:Line):Boolean{
var _local2:*;
var _local3:Rectangle;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local2 = false;
lineP.x = (_arg1.x + Constants.surface.center.x);
lineP.y = (_arg1.y + Constants.surface.center.y);
_local3 = _arg1.getBounds(this.parent);
if ((((x > _local3.left)) && ((x < _local3.right)))){
angle = (_arg1.rotation * radian);
cos = Math.cos(angle);
sin = Math.sin(angle);
_local4 = (x - lineP.x);
_local5 = (y - lineP.y);
_local6 = ((cos * _local5) - (sin * _local4));
_local7 = ((cos * fvy) - (sin * fvx));
if ((((_local6 > -(radius))) && ((_local6 < _local7)))){
_local2 = true;
_local8 = ((cos * _local4) + (sin * _local5));
_local9 = ((cos * fvx) + (sin * fvy));
_local6 = -(radius);
_local7 = (_local7 * stageBounce);
dampingEnabled = true;
_local4 = ((cos * _local8) - (sin * _local6));
_local5 = ((cos * _local6) + (sin * _local8));
fvx = ((cos * _local9) - (sin * _local7));
fvy = ((cos * _local7) + (sin * _local9));
x = (lineP.x + _local4);
y = (lineP.y + _local5);
};
};
return (_local2);
}
public function onEnterFrame(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
if (isMoving == true){
moveBall();
};
if (isDecaying == true){
startDecay();
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function reinit(_arg1:Number){
this.alpha = 1;
this.ballindex = _arg1;
this.isMoving = true;
this.isDecaying = false;
this.inPocketIndex = -1;
this.bringBack = false;
this.x = Constants.surface.center.x;
this.y = Constants.surface.center.y;
setInititalVel((Math.random() * 360));
this.visible = true;
}
public function checkLineOUTER(_arg1:Line):Boolean{
var _local2:*;
var _local3:Rectangle;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local2 = false;
lineP.x = (_arg1.x + Constants.surface.center.x);
lineP.y = (_arg1.y + Constants.surface.center.y);
_local3 = _arg1.getBounds(this.parent);
if ((((x > _local3.left)) && ((x < _local3.right)))){
angle = (_arg1.rotation * radian);
cos = Math.cos(angle);
sin = Math.sin(angle);
_local4 = (x - lineP.x);
_local5 = (y - lineP.y);
_local6 = ((cos * _local5) - (sin * _local4));
_local7 = ((cos * fvy) - (sin * fvx));
if ((((_local6 < radius)) && ((_local6 > _local7)))){
_local2 = true;
_local8 = ((cos * _local4) + (sin * _local5));
_local9 = ((cos * fvx) + (sin * fvy));
_local6 = radius;
_local7 = (_local7 * stageBounce);
dampingEnabled = true;
_local4 = ((cos * _local8) - (sin * _local6));
_local5 = ((cos * _local6) + (sin * _local8));
fvx = ((cos * _local9) - (sin * _local7));
fvy = ((cos * _local7) + (sin * _local9));
x = (lineP.x + _local4);
y = (lineP.y + _local5);
};
};
return (_local2);
}
public function checkReflectorCollision():Boolean{
var _local1:*;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Boolean;
var _local8:Reflector;
var _local9:Number;
_local1 = Constants.reflectorArray.length;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = (radius + Constants.reflectorRadius);
_local6 = 0;
_local7 = false;
if (_local1 == 0){
return (_local7);
};
_local9 = 0;
while (_local9 < _local1) {
_local8 = Constants.reflectorArray[_local9];
_local3 = (_local8.x - x);
_local4 = (_local8.y - y);
_local2 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
if (_local2 < _local5){
_local6 = (Math.atan2(_local4, _local3) + 180);
fvx = (Math.cos(_local6) * speed);
fvy = (Math.sin(_local6) * speed);
x = (x + (Math.cos(_local6) * _local5));
y = (y + (Math.sin(_local6) * _local5));
_local7 = true;
break;
};
_local9++;
};
return (_local7);
}
public function clearGraphics(){
graphics.clear();
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}//package
Section 39
//BallFactory (BallFactory)
package {
public class BallFactory {
public static function createBalls(_arg1:Number){
var _local2:Number;
var _local3:Number;
var _local4:Array;
Constants.ballArray = new Array(_arg1);
_local3 = 0;
_local4 = Constants.ColorCode[(Constants.currentLevel - 1)];
_local3 = 0;
while (_local3 < _arg1) {
_local2 = _local4[(_local3 % Constants.surface.NoOfEdges)];
Constants.ballArray[_local3] = createBall(_local2);
Constants.ballArray[_local3].init(_local3, _local2);
_local3++;
};
}
public static function createBall(_arg1:Number):Ball{
switch (_arg1){
case 0:
return (new BlueBall());
case 1:
return (new OrangeBall());
case 2:
return (new PinkBall());
case 3:
return (new YellowBall());
case 4:
return (new GreyBall());
case 5:
return (new GreenBall());
case 6:
return (new RedBall());
case 7:
return (new BlackBall());
default:
return (null);
};
}
}
}//package
Section 40
//BG (BG)
package {
import flash.display.*;
public class BG extends Sprite {
private static var bg:BG = null;
public static function getInstance():BG{
if (bg == null){
bg = new (BG);
};
return (bg);
}
}
}//package
Section 41
//BGSound (BGSound)
package {
import flash.media.*;
public class BGSound extends Sound {
}
}//package
Section 42
//BlackBall (BlackBall)
package {
public class BlackBall extends Ball {
}
}//package
Section 43
//BlueBall (BlueBall)
package {
public class BlueBall extends Ball {
}
}//package
Section 44
//ButtonDisplayState (ButtonDisplayState)
package {
import flash.display.*;
import flash.text.*;
public class ButtonDisplayState extends Sprite {
private var size:uint;
private var bgColor:uint;
private var level:Number;
public var levelText:TextField;
private var bname:String;
private var format:TextFormat;
public function ButtonDisplayState(_arg1:String, _arg2:uint, _arg3:uint){
format = new TextFormat();
super();
this.bgColor = _arg2;
this.size = _arg3;
this.level = level;
this.bname = _arg1;
format.font = "Yes:Union";
format.color = _arg2;
format.size = _arg3;
format.underline = false;
levelText = new TextField();
draw();
}
private function draw():void{
levelText.defaultTextFormat = format;
levelText.text = bname;
levelText.autoSize = TextFieldAutoSize.CENTER;
levelText.defaultTextFormat = format;
levelText.x = 0;
levelText.y = 0;
addChild(levelText);
}
public function remove(){
levelText.visible = false;
}
}
}//package
Section 45
//Clock (Clock)
package {
import flash.display.*;
import flash.text.*;
public class Clock extends MovieClip {
public var timeTick:TextField;
}
}//package
Section 46
//Constants (Constants)
package {
import flash.geom.*;
public class Constants {
public static var FixedSpeedBall:Array = new Array(squareBallSpeed, rectBallSpeed, squareBallSpeedLevel3, hexBallSpeed, hexBallSpeedLEVEL5, octoBallSpeed, octoBallSpeedLEVEL7);
public static var rectBallSpeed = 4.2;
public static var scoreOnPocket = 50;
public static var soundVolume:Number = 0.15;
public static var hexStageBounce = -1;
public static var bonusOnSec = 25;
public static var hexColorCode = new Array(ORANGE, PINK, RED, GREY, YELLOW, BLUE);
public static var reflectorRadius:Number = 8;
public static var squareSideLength = 540;
public static var RESULT_POCKETFAIL = 1;
public static var RESULT_TIMEOUT = 1;
public static var totalSpareBalls = 0;
public static var hexBorder = 30;
public static var rectHeight = 350;
public static var text:TextDisplay;
public static var ORANGE = 1;
public static var rectBorder = 40;
public static var paddleHeight:Number = (paddleRadius * 2);
public static var startLevel = 0;
public static var fanArea = 150;
public static var hexBallSpeedLEVEL5 = 3.1;
public static var ballCount = 4;
public static var squareColorCode = new Array(BLUE, PINK, YELLOW, ORANGE);
public static var octoStageBounce = -0.9;
public static var octoBorder = 40;
public static var rectWidth = 700;
public static var stageWidth = 750;
public static var BLUE = 0;
public static var rectColorCode = new Array(GREEN, BLUE, RED, YELLOW);
public static var octoColorCode = new Array(RED, GREY, PINK, YELLOW, BLACK, ORANGE, BLUE, GREEN);
public static var RED = 6;
public static var YELLOW = 3;
public static var PINK = 2;
public static var ballRadius = 10;
public static var paddleWidth:Number = (paddleRadius * 2);
public static var paddleMass:Number = 1;
public static var StageBounceForce:Array = new Array(squareStageBounce, rectStageBounce, squareStageBounce, hexStageBounce, hexStageBounce, octoStageBounce, octoStageBounce);
public static var currentLevel = 0;
public static var octoBallSpeedLEVEL7 = 2.5;
public static var hexRadius = 280;
public static var successMesg = "Game Complete";
public static var abstacleArea:Number = 0.3;
public static var fanRadius = 10;
public static var reflectorCount = new Array(4, 4, 4, 2, 4, 4, 4);
public static var ballArray:Array;
public static var paddleRadius:Number = 15;
public static var ballCountLEVEL1 = 8;
public static var ballCountLEVEL3 = 12;
public static var paddleForce:Number = 0;
public static var rectStageBounce = -0.95;
public static var ballCountLEVEL7 = 18;
public static var ballCountLEVEL2 = 8;
public static var ballCountLEVEL4 = 6;
public static var ballCountLEVEL5 = 12;
public static var resultMesg:Array = [successMesg, timeoutMesg, pocketFailMesg];
public static var surface:Surface = null;
public static var maxReflectorsOnBoard = 6;
public static var ballCountLEVEL6 = 16;
public static var squareBorder = 35;
public static var hexBallSpeed = 4.7;
public static var RESULT_SUCCESS = 0;
public static var maxIncorrectPockets = new Array(8, 8, 12, 6, 12, ballCountLEVEL6, ballCountLEVEL7);
public static var stageHeight = 550;
public static var fans:Array = null;
public static var pocketRadius:Number = 8;
public static var squareStageBounce = -1;
public static var fanCount = 0;
public static var octoSideLength = 220;
public static var totalDirtyPockets = 0;
public static var ballSpeedLEVEL1 = 4.2;
public static var ballSpeedLEVEL3 = 3.5;
public static var ballSpeedLEVEL5 = 3.1;
public static var ballSpeedLEVEL7 = 2.5;
public static var BLACK = 7;
public static var pocketFailMesg = "Oops!Pockets are lost";
public static var ballSpeedLEVEL6 = 2.9;
public static var paddleForceDF:Number = 0;
public static var ballSpeedLEVEL2 = 4.2;
public static var GREY = 4;
public static var ballSpeedLEVEL4 = 4.7;
public static var GREEN = 5;
public static var squareBallSpeed = 4.2;
public static var timeLimit = 90;
public static var maxDirtyPockets = 0;
public static var reflectorArray:Array;
public static var stageCenter:Point = new Point((stageWidth / 2), (stageHeight / 2));
public static var timeoutMesg = "Timeout! You Lost ";
public static var octoBallSpeed = 2.9;
public static var squareBallSpeedLevel3 = 3.5;
public static var ColorCode:Array = new Array(squareColorCode, rectColorCode, squareColorCode, hexColorCode, hexColorCode, octoColorCode, octoColorCode);
}
}//package
Section 47
//CorrectBallSound (CorrectBallSound)
package {
import flash.media.*;
public class CorrectBallSound extends Sound {
}
}//package
Section 48
//CustomButton (CustomButton)
package {
import flash.display.*;
public class CustomButton extends Sprite {
var button:AbstractButton;
public var buttonname:String;// = null
public function CustomButton(_arg1:String){
buttonname = null;
super();
this.buttonname = _arg1;
button = new AbstractButton(buttonname);
addChild(button);
}
public function draw(){
button.draw();
}
public function clearGraphics(){
button.clear();
}
}
}//package
Section 49
//Edges (Edges)
package {
import flash.geom.*;
public class Edges extends Point {
var angleMin:Number;// = 0
var angleMax:Number;// = 0
var edgeIndex:Number;// = 0
var angle:Number;// = 0
public function Edges(_arg1, _arg2, _arg3){
angleMin = 0;
angleMax = 0;
edgeIndex = 0;
angle = 0;
super();
super.x = _arg1;
super.y = _arg2;
edgeIndex = _arg3;
}
public function setAngle(){
if (edgeIndex == 4){
angleMin = -83;
angleMax = -63;
angle = ((Math.PI / 3) * -1);
} else {
if (edgeIndex == 2){
angleMin = 63;
angleMax = 83;
} else {
if (edgeIndex == 5){
} else {
if (edgeIndex == 1){
};
};
};
};
}
}
}//package
Section 50
//Eight (Eight)
package {
import flash.display.*;
public class Eight extends MovieClip {
}
}//package
Section 51
//Fan (Fan)
package {
import flash.geom.*;
import flash.display.*;
public class Fan extends Sprite {
public var p:Point;
public var fanLines:Array;
public function Fan(_arg1:Number, _arg2:Number){
fanLines = new Array(3);
p = new Point();
p.x = _arg1;
p.y = _arg2;
draw();
}
public function draw(){
var _local1:Number;
var _local2:Number;
var _local3:Array;
var _local4:Number;
var _local5:Number;
var _local6:Point;
var _local7:Number;
var _local8:*;
var _local9:*;
_local1 = 3;
_local2 = Constants.fanRadius;
_local3 = [0, 240, 120];
_local4 = 0;
_local5 = (Math.PI / 180);
_local6 = new Point();
_local7 = 0;
while (_local7 < 3) {
_local6.x = p.x;
_local6.y = p.y;
_local4 = (_local3[_local7] * _local5);
_local8 = ((Math.cos(_local4) * _local2) / 2);
_local9 = ((Math.sin(_local4) * _local2) / 2);
fanLines[_local7] = new Line(_local2, _local6.x, _local6.y, _local3[_local7], true);
addChild(fanLines[_local7]);
_local7++;
};
}
public function rotatelines(){
var _local1:Number;
_local1 = 0;
while (_local1 < fanLines.length) {
fanLines[_local1].rotation = (fanLines[_local1].rotation + 2);
_local1++;
};
}
}
}//package
Section 52
//Five (Five)
package {
import flash.display.*;
public class Five extends MovieClip {
}
}//package
Section 53
//Foul (Foul)
package {
import flash.display.*;
import flash.text.*;
public class Foul extends MovieClip {
public var foulCount:TextField;
}
}//package
Section 54
//FoulBall (FoulBall)
package {
import flash.display.*;
public class FoulBall extends MovieClip {
}
}//package
Section 55
//FoulBallPanel (FoulBallPanel)
package {
import flash.display.*;
public class FoulBallPanel extends Sprite {
private var foulBalls:Array;
private static var panel:FoulBallPanel = null;
public function FoulBallPanel(){
foulBalls = new Array(12);
super();
draw();
}
public function draw(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = 0;
_local2 = 0;
_local3 = 0;
_local4 = 0;
while (_local4 < foulBalls.length) {
foulBalls[_local4] = new FoulBall();
foulBalls[_local4].x = (_local1 + _local3);
foulBalls[_local4].y = _local2;
_local3 = (_local3 + 25);
if (_local3 == 75){
_local3 = 0;
_local2 = (_local2 + 25);
};
addChild(foulBalls[_local4]);
_local4++;
};
}
public function disapperarBall(_arg1:Number){
foulBalls[_arg1].gotoAndPlay(2);
}
public function reinit(_arg1:Number){
var _local2:Number;
_local2 = 0;
while (_local2 < _arg1) {
foulBalls[_local2].gotoAndStop(1);
_local2++;
};
_local2 = _arg1;
while (_local2 < foulBalls.length) {
foulBalls[_local2].alpha = 0.2;
_local2++;
};
}
public static function getInstance():FoulBallPanel{
if (panel == null){
panel = new (FoulBallPanel);
};
return (panel);
}
}
}//package
Section 56
//Four (Four)
package {
import flash.display.*;
public class Four extends MovieClip {
}
}//package
Section 57
//GameOver (GameOver)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class GameOver extends MovieClip {
var urlPlayMore:String;// = "http://www.flasharcade.com"
var requestPlayMore:URLRequest;// = null
public var resultBGO:MovieClip;
public var playMore:SimpleButton;
public var playAgain:MovieClip;
private static var gameOver:GameOver = null;
public function GameOver(){
urlPlayMore = "http://www.flasharcade.com";
requestPlayMore = null;
super();
addFrameScript(333, frame334);
this.playAgain.buttonMode = true;
this.playAgain.useHandOverCursor = true;
requestPlayMore = new URLRequest(urlPlayMore);
playMore.addEventListener(MouseEvent.CLICK, handleClick);
}
function frame334(){
stop();
}
public function updateScores(){
gotoAndPlay(1);
this.resultBGO.bonus.text = Constants.text.bonusPoints.toString();
this.resultBGO.totalScore.text = Constants.text.scoreValue.toString();
}
public function handleClick(_arg1:MouseEvent){
var event = _arg1;
try {
navigateToURL(requestPlayMore, "_blank");
} catch(e:Error) {
};
}
public static function getInstance():GameOver{
if (gameOver == null){
gameOver = new (GameOver);
};
return (gameOver);
}
}
}//package
Section 58
//GreenBall (GreenBall)
package {
public class GreenBall extends Ball {
}
}//package
Section 59
//GreyBall (GreyBall)
package {
public class GreyBall extends Ball {
}
}//package
Section 60
//HexSurface (HexSurface)
package {
import flash.geom.*;
public class HexSurface extends Surface {
private static var surface:HexSurface = null;
public function HexSurface(){
angles = new Array(0, 300, 240, 180, 120, 60);
lines = new Array(6);
NoOfEdges = 6;
pockets = new Array(6);
radius = Constants.hexRadius;
edges = new Array(6);
innerEdges = new Array(6);
center = new Point();
this.center.x = Constants.stageCenter.x;
this.center.y = Constants.stageCenter.y;
thickness = Constants.hexBorder;
init();
}
override public function createPockets():void{
var _local1:Array;
var _local2:Number;
_local1 = Constants.ColorCode[(Constants.currentLevel - 1)];
trace((((((" colorIndex : " + _local1) + " Constants.currentLevel : ") + Constants.currentLevel) + " innerEdges : ") + innerEdges));
_local2 = 0;
while (_local2 < innerEdges.length) {
pockets[_local2] = new Pocket(innerEdges[_local2].x, innerEdges[_local2].y);
trace((" pockets[i] : " + pockets[_local2]));
pockets[_local2].init(_local1[_local2]);
_local2++;
};
}
override public function init():void{
var _local1:Point;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:Number;
calculateEdges(0);
_local1 = new Point();
_local1.x = (innerEdges[2].x - center.x);
_local1.y = (innerEdges[2].y - center.y);
_local2 = (Math.PI / 180);
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = (radius - thickness);
_local7 = 0;
while (_local7 < angles.length) {
_local3 = (angles[_local7] * _local2);
_local4 = ((Math.cos(_local3) * _local6) / 2);
_local5 = ((Math.sin(_local3) * _local6) / 2);
lines[_local7] = new Line(_local6, (_local1.x + _local4), (_local1.y + _local5), angles[_local7]);
addChild(lines[_local7]);
_local1.x = (_local1.x + (_local4 * 2));
_local1.y = (_local1.y + (_local5 * 2));
_local7++;
};
createPockets();
}
private function checkLine(_arg1:Line, _arg2:Ball):Boolean{
var _local3:Boolean;
var _local4:Point;
var _local5:Rectangle;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local3 = false;
_local4 = new Point();
_local4.x = (_arg1.x + center.x);
_local4.y = (_arg1.y + center.y);
_local5 = _arg1.getBounds(this.parent);
if ((((_arg2.x > _local5.left)) && ((_arg2.x < _local5.right)))){
_local6 = ((_arg1.rotation * Math.PI) / 180);
_local7 = Math.cos(_local6);
_local8 = Math.sin(_local6);
_local9 = (_arg2.x - _local4.x);
_local10 = (_arg2.y - _local4.y);
_local11 = ((_local7 * _local10) - (_local8 * _local9));
_local12 = ((_local7 * _arg2.fvy) - (_local8 * _arg2.fvx));
if ((((_local11 > -(_arg2.radius))) && ((_local11 < _local12)))){
_local3 = true;
_local13 = ((_local7 * _local9) + (_local8 * _local10));
_local14 = ((_local7 * _arg2.fvx) + (_local8 * _arg2.fvy));
_local11 = -(_arg2.radius);
_local12 = (_local12 * -0.9);
_local9 = ((_local7 * _local13) - (_local8 * _local11));
_local10 = ((_local7 * _local11) + (_local8 * _local13));
_arg2.fvx = ((_local7 * _local14) - (_local8 * _local12));
_arg2.fvy = ((_local7 * _local12) + (_local8 * _local14));
_arg2.x = (_local4.x + _local9);
_arg2.y = (_local4.y + _local10);
};
};
return (_local3);
}
override public function checkBoundary(_arg1:Ball):Boolean{
var _local2:Boolean;
var _local3:Number;
_local2 = false;
_local3 = 0;
while (_local3 < lines.length) {
if (_arg1.checkLine(lines[_local3]) == true){
_local2 = true;
break;
};
_local3++;
};
return (_local2);
}
public function calculateDx(_arg1:Paddle, _arg2, _arg3:Edges, _arg4:Number, _arg5:Number):Boolean{
var _local6:*;
var _local7:*;
var _local8:*;
_local6 = (_arg3.y - _arg5);
_local7 = (_arg3.x - _arg4);
_local8 = (_local6 / Math.tan(((_arg2 * Math.PI) / 180)));
if ((Math.abs(_local8) - _arg1.radius) < Math.abs(_local7)){
_arg4 = (_arg3.x - _local8);
_arg1.x = _arg4;
_arg1.y = _arg5;
return (true);
};
_arg1.x = _arg4;
_arg1.y = _arg5;
return (false);
}
override public function checkPaddleCollision(_arg1:Paddle, _arg2:Number, _arg3:Number):Boolean{
var _local4:Point;
var _local5:Number;
var _local6:Boolean;
var _local7:Boolean;
_local6 = false;
_local7 = false;
if ((_arg2 < innerEdges[4].x)){
if (_arg3 < Constants.stageCenter.y){
if (calculateDx(_arg1, 300, innerEdges[4], _arg2, _arg3) == true){
_local6 = true;
};
} else {
if (calculateDx(_arg1, 60, innerEdges[2], _arg2, _arg3) == true){
_local6 = true;
};
};
} else {
if (_arg2 > innerEdges[5].x){
if (_arg3 < Constants.stageCenter.y){
if (calculateDx(_arg1, 240, innerEdges[5], _arg2, _arg3) == true){
_local6 = true;
};
} else {
if (calculateDx(_arg1, 120, innerEdges[1], _arg2, _arg3) == true){
_local6 = true;
};
};
} else {
_arg1.x = _arg2;
};
};
if (_arg3 < (innerEdges[4].y + _arg1.radius)){
_arg1.y = innerEdges[4].y;
if (_arg2 < innerEdges[4].x){
_arg1.x = innerEdges[4].x;
} else {
if (_arg2 > innerEdges[5].x){
_arg1.x = innerEdges[5].x;
} else {
_arg1.x = _arg2;
};
};
_local7 = true;
} else {
if (_arg3 > (innerEdges[2].y - _arg1.radius)){
_arg1.y = (innerEdges[1].y - _arg1.radius);
if (_arg2 < innerEdges[4].x){
_arg1.x = innerEdges[4].x;
} else {
if (_arg2 > innerEdges[5].x){
_arg1.x = innerEdges[5].x;
} else {
_arg1.x = _arg2;
};
};
_local7 = true;
} else {
_arg1.y = _arg3;
};
};
if ((((_local6 == true)) || ((_local7 == true)))){
return (true);
};
return (false);
}
public static function getInstance(){
if (surface == null){
surface = new (HexSurface);
};
return (surface);
}
}
}//package
Section 61
//IncorrectBallSound (IncorrectBallSound)
package {
import flash.media.*;
public class IncorrectBallSound extends Sound {
}
}//package
Section 62
//KickOffText (KickOffText)
package {
import flash.display.*;
import flash.text.*;
public class KickOffText extends Sprite {
private var mesg:String;// = "6"
private var resultMesg:TextField;
private static var kickOffText:KickOffText = null;
public function KickOffText(){
mesg = "6";
super();
draw();
}
private function draw(){
var _local1:TextFormat;
_local1 = new TextFormat();
_local1.font = "Wide Latin";
_local1.color = 0xFFFFFF;
_local1.size = 50;
_local1.underline = false;
_local1.bold = true;
resultMesg = new TextField();
resultMesg.defaultTextFormat = _local1;
resultMesg.text = mesg;
resultMesg.autoSize = TextFieldAutoSize.CENTER;
addChild(resultMesg);
}
public function updateText(_arg1:String){
resultMesg.text = _arg1.toString();
}
public static function getInstance():KickOffText{
if (kickOffText == null){
kickOffText = new (KickOffText);
};
return (kickOffText);
}
}
}//package
Section 63
//Levels (Levels)
package {
import flash.display.*;
public class Levels extends MovieClip {
var levelNum:Number;// = 1
private static var level:Levels = null;
public function Levels(){
levelNum = 1;
super();
addFrameScript(0, frame1, 2, frame3, 5, frame6, 8, frame9, 11, frame12, 14, frame15, 17, frame18, 20, frame21);
}
function frame18(){
stop();
}
function frame12(){
stop();
}
function frame3(){
stop();
}
function frame1(){
}
function frame6(){
stop();
}
function frame9(){
stop();
}
function frame21(){
stop();
}
function frame15(){
stop();
}
public static function getInstance():Levels{
if (level == null){
level = new (Levels);
};
return (level);
}
}
}//package
Section 64
//Line (Line)
package {
import flash.display.*;
public class Line extends Sprite {
public var len:Number;// = 0
private var isCenter:Boolean;// = false
private var color:Number;// = 0xFF0000
private var thickness;// = 1
public function Line(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false){
len = 0;
color = 0xFF0000;
thickness = 1;
isCenter = false;
super();
this.len = _arg1;
this.x = _arg2;
this.y = _arg3;
this.rotation = _arg4;
this.isCenter = _arg5;
draw();
}
public function draw(){
if (isCenter == false){
graphics.lineStyle(15, color, 5);
graphics.moveTo((-(len) / 2), 0);
graphics.lineTo((len / 2), 0);
visible = false;
} else {
graphics.lineStyle(5, color, 5);
graphics.moveTo(0, 0);
graphics.lineTo(len, 0);
};
}
public function setPosition(_arg1:Number, _arg2:Number, _arg3:Number){
x = _arg1;
y = _arg2;
this.rotation = _arg3;
}
}
}//package
Section 65
//LoadSoundIP (LoadSoundIP)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.net.*;
public class LoadSoundIP extends Sprite {
private var soundBGLoadedBytes:Number;// = 0
private var _soundIP:Sound;
private var soundBGTotalBytes:Number;// = 0
private var BGSoundOn:Boolean;// = false
private var _soundBG:Sound;
private var _soundCP:Sound;
private var _channel:SoundChannel;
private static var loadSoundIP:LoadSoundIP = null;
public function LoadSoundIP(){
BGSoundOn = false;
soundBGTotalBytes = 0;
soundBGLoadedBytes = 0;
super();
_soundIP = new Sound();
_soundIP.load(new URLRequest("incorrectPocket.mp3"));
_soundCP = new Sound();
_soundCP.load(new URLRequest("correctPocket.mp3"));
_soundBG = new Sound();
_soundBG.load(new URLRequest("backgroundSoundIP.mp3"));
addEventListener(Event.ENTER_FRAME, onEnterFrame);
soundBGTotalBytes = _soundBG.bytesTotal;
}
public function playBGSound(){
_soundBG.play();
}
public function completeBGHandler(_arg1:Event){
_channel.removeEventListener(Event.SOUND_COMPLETE, completeBGHandler);
_channel = _soundBG.play();
_channel.addEventListener(Event.SOUND_COMPLETE, completeBGHandler);
}
public function setBGSoundOff(){
_soundBG.close();
}
public function playIPSound(){
_soundIP.play();
}
public function onEnterFrame(_arg1:Event){
soundBGLoadedBytes = _soundBG.bytesLoaded;
soundBGTotalBytes = _soundBG.bytesTotal;
if (soundBGLoadedBytes >= soundBGTotalBytes){
_channel = _soundBG.play();
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
_channel.addEventListener(Event.SOUND_COMPLETE, completeBGHandler);
};
}
public function playCPSound(){
_soundCP.play();
}
public static function getInstance():LoadSoundIP{
if (loadSoundIP == null){
loadSoundIP = new (LoadSoundIP);
};
return (loadSoundIP);
}
}
}//package
Section 66
//Nine (Nine)
package {
import flash.display.*;
public class Nine extends MovieClip {
}
}//package
Section 67
//NumberClip (NumberClip)
package {
import flash.display.*;
public class NumberClip extends MovieClip {
public static function getInstance(_arg1:Number):MovieClip{
switch (_arg1){
case 1:
return (new One());
case 2:
return (new Two());
case 3:
return (new Three());
case 4:
return (new Four());
case 5:
return (new Five());
case 6:
return (new Six());
case 7:
return (new Seven());
case 8:
return (new Eight());
default:
return (null);
};
}
}
}//package
Section 68
//OctoSurface (OctoSurface)
package {
import flash.geom.*;
public class OctoSurface extends Surface {
private var fanEdges:Array;
var sideLength:Number;// = 0
private static var surface:OctoSurface = null;
public function OctoSurface(){
sideLength = 0;
super();
NoOfEdges = 8;
pockets = new Array(8);
edges = new Array(8);
innerEdges = new Array(8);
fanEdges = new Array(8);
center = new Point();
this.center.x = Constants.stageCenter.x;
this.center.y = Constants.stageCenter.y;
sideLength = Constants.octoSideLength;
radius = ((sideLength / 2) * (1 / Math.sin((Math.PI / 8))));
angles = new Array(0, 315, 270, 225, 180, 135, 90, 45);
lines = new Array(8);
thickness = Constants.octoBorder;
init();
}
override public function createPockets():void{
var _local1:Array;
var _local2:Number;
_local1 = Constants.ColorCode[(Constants.currentLevel - 1)];
_local2 = 0;
while (_local2 < innerEdges.length) {
pockets[_local2] = new Pocket(innerEdges[_local2].x, innerEdges[_local2].y);
pockets[_local2].init(_local1[_local2]);
_local2++;
};
}
public function calculateAngle(_arg1:Ball, _arg2, _arg3:Edges, _arg4:Number, _arg5:Number):Boolean{
var _local6:Point;
var _local7:*;
var _local8:*;
var _local9:*;
_local6 = new Point();
_local7 = (_arg3.y - _arg5);
_local8 = (_arg3.x - _arg4);
_local9 = Math.abs((_local7 / Math.tan(((_arg2 * Math.PI) / 180))));
if ((((_arg2 == 135)) || ((_arg2 == 225)))){
if ((_local9 - _arg1.radius) < Math.abs(_local8)){
_arg4 = (_arg3.x + (_local9 - _arg1.radius));
_arg1.x = _arg4;
_arg1.y = _arg5;
return (true);
};
} else {
if ((((_arg2 == 315)) || ((_arg2 == 45)))){
if ((Math.abs(_local9) - _arg1.radius) < Math.abs(_local8)){
_arg4 = (_arg3.x - (_local9 - _arg1.radius));
_arg1.x = _arg4;
_arg1.y = _arg5;
return (true);
};
};
};
return (false);
}
override public function init():void{
var _local1:Point;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
calculateEdges(((22.5 * Math.PI) / 180));
calculateFanEdges(((112.5 * Math.PI) / 180));
_local1 = new Point();
_local1.x = (innerEdges[2].x - center.x);
_local1.y = (innerEdges[2].y - center.y);
_local2 = (Math.PI / 180);
_local3 = 0;
_local4 = (innerEdges[2].x - innerEdges[1].x);
_local5 = (innerEdges[2].y - innerEdges[1].y);
sideLength = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
_local6 = 0;
while (_local6 < angles.length) {
_local3 = (angles[_local6] * _local2);
_local4 = ((Math.cos(_local3) * sideLength) / 2);
_local5 = ((Math.sin(_local3) * sideLength) / 2);
lines[_local6] = new Line(sideLength, (_local1.x + _local4), (_local1.y + _local5), angles[_local6]);
addChild(lines[_local6]);
_local1.x = (_local1.x + (_local4 * 2));
_local1.y = (_local1.y + (_local5 * 2));
_local6++;
};
createPockets();
createFan();
}
override public function checkBoundary(_arg1:Ball):Boolean{
var _local2:Boolean;
var _local3:Number;
var _local4:uint;
_local2 = false;
rotateFans();
_local3 = 0;
while (_local3 < Constants.fans.length) {
_local4 = 0;
while (_local4 < Constants.fans[_local3].fanLines.length) {
if (_arg1.checkLineINNER(Constants.fans[_local3].fanLines[_local4]) == true){
_local2 = true;
break;
};
if (_local2 == false){
if (_arg1.checkLineOUTER(Constants.fans[_local3].fanLines[_local4]) == true){
_local2 = true;
break;
};
};
_local4++;
};
if (_local2 == true){
break;
};
_local3++;
};
if (_local2 == true){
return (true);
};
_local4 = 0;
while (_local4 < lines.length) {
if (_arg1.checkLine(lines[_local4]) == true){
_local2 = true;
break;
};
_local4++;
};
return (_local2);
}
public function createFan(){
var _local1:Number;
var _local2:Number;
Constants.fans = new Array(Constants.fanCount);
trace(("Constants.fans : " + Constants.fanCount));
_local1 = 0;
while (_local1 < Constants.fanCount) {
Constants.fans[_local1] = new Fan((fanEdges[_local1].x - this.center.x), (fanEdges[_local1].y - this.center.y));
_local2 = 0;
while (_local2 < Constants.fans[_local1].fanLines.length) {
addChild(Constants.fans[_local1].fanLines[_local2]);
_local2++;
};
_local1++;
};
}
public function calculateFanEdges(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:Number;
_local2 = ((4 * Math.PI) / NoOfEdges);
_local3 = Constants.fanArea;
_local4 = 0;
while (_local4 < fanEdges.length) {
fanEdges[_local4] = new Edges(((_local3 * Math.cos(_arg1)) + center.x), ((_local3 * Math.sin(_arg1)) + center.y), _local4);
_arg1 = (_arg1 + _local2);
_local4++;
};
}
public function calculateDx(_arg1:Paddle, _arg2, _arg3:Edges, _arg4:Number, _arg5:Number):Boolean{
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
_local6 = (_arg3.y - _arg5);
_local7 = (_arg3.x - _arg4);
_local8 = ((Math.atan2(_local6, _local7) * 180) / Math.PI);
_local9 = (_local6 / Math.tan(((_arg2 * Math.PI) / 180)));
if (Math.abs(_local9) < Math.abs(_local7)){
_arg4 = (_arg3.x - _local9);
if ((((_arg2 == 135)) || ((_arg2 == 225)))){
_arg1.x = (_arg4 - _arg1.radius);
} else {
_arg1.x = (_arg4 + _arg1.radius);
};
return (true);
};
_arg1.x = _arg4;
return (false);
}
public function rotateFans(){
var _local1:uint;
var _local2:uint;
_local1 = 0;
while (_local1 < Constants.fans.length) {
_local2 = 0;
while (_local2 < Constants.fans[_local1].fanLines.length) {
Constants.fans[_local1].fanLines[_local2].rotation = (Constants.fans[_local1].fanLines[_local2].rotation - 1);
_local2++;
};
_local1++;
};
}
override public function checkPaddleCollision(_arg1:Paddle, _arg2:Number, _arg3:Number):Boolean{
var _local4:Point;
var _local5:Number;
var _local6:Boolean;
var _local7:Boolean;
_local6 = false;
_local7 = false;
if (_arg3 < (innerEdges[5].y + _arg1.radius)){
_arg1.y = (innerEdges[5].y + _arg1.radius);
_local7 = true;
} else {
if (_arg3 > (innerEdges[2].y - _arg1.radius)){
_arg1.y = (innerEdges[2].y - _arg1.radius);
_local7 = true;
} else {
_arg1.y = _arg3;
};
};
if ((((_arg2 < innerEdges[5].x)) && ((_arg3 < innerEdges[4].y)))){
if (calculateDx(_arg1, 315, innerEdges[5], _arg2, _arg3) == true){
_local6 = true;
_local7 = true;
};
};
if ((((_arg2 < innerEdges[2].x)) && ((_arg3 > innerEdges[3].y)))){
if (calculateDx(_arg1, 45.5, innerEdges[2], _arg2, _arg3) == true){
_local6 = true;
_local7 = true;
};
};
if ((((_arg2 > innerEdges[6].x)) && ((_arg3 < innerEdges[7].y)))){
if (calculateDx(_arg1, 225, innerEdges[6], _arg2, _arg3) == true){
_local6 = true;
_local7 = true;
};
};
if ((((_arg2 > innerEdges[1].x)) && ((_arg3 > innerEdges[0].y)))){
if (calculateDx(_arg1, 135, innerEdges[1], _arg2, _arg3) == true){
_local6 = true;
_local7 = true;
};
};
if ((((_local6 == true)) && ((_local7 == true)))){
return (true);
};
if (_arg2 < (innerEdges[4].x + _arg1.radius)){
_arg1.x = (innerEdges[4].x + _arg1.radius);
_local6 = true;
} else {
if (_arg2 > (innerEdges[7].x - _arg1.radius)){
_arg1.x = (innerEdges[7].x - _arg1.radius);
_local6 = true;
} else {
_arg1.x = _arg2;
};
};
if ((((_local6 == true)) || ((_local7 == true)))){
return (true);
};
return (false);
}
public static function getInstance(){
if (surface == null){
surface = new (OctoSurface);
};
return (surface);
}
}
}//package
Section 69
//One (One)
package {
import flash.display.*;
public class One extends MovieClip {
}
}//package
Section 70
//OrangeBall (OrangeBall)
package {
public class OrangeBall extends Ball {
}
}//package
Section 71
//Paddle (Paddle)
package {
import flash.geom.*;
import flash.display.*;
public class Paddle extends Sprite {
public var mass:Number;
public var prev:Point;
public var radius:Number;
public var vx:Number;// = 0
public var vy:Number;// = 0
public var force:Number;
private static var paddle:Paddle = null;
private static var ballArray:Array;
public function Paddle(){
radius = Constants.paddleRadius;
mass = Constants.paddleMass;
vx = 0;
vy = 0;
prev = new Point();
force = Constants.paddleForce;
super();
}
public function checkFanCollision(_arg1:Number, _arg2:Number):Boolean{
var _local3:Boolean;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:*;
var _local8:*;
_local3 = false;
_local4 = (Constants.surface.center.x - _arg1);
_local5 = (Constants.surface.center.y - _arg2);
_local6 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
_local7 = ((radius + Constants.fanRadius) + 5);
if (_local6 < _local7){
_local8 = Math.atan2(_local5, _local4);
x = (x - (Math.cos(_local8) * _local7));
y = (y - (Math.sin(_local8) * _local7));
_local3 = true;
};
return (_local3);
}
public function movePaddle(_arg1:Number, _arg2:Number){
var _local3:Boolean;
var _local4:Number;
_local3 = false;
if (Constants.surface.checkPaddleCollision(this, _arg1, _arg2) == false){
x = _arg1;
y = _arg2;
checkReflectorCollision(_arg1, _arg2);
};
_local4 = 0;
while (_local4 < ballArray.length) {
if (ballArray[_local4].isDecaying == false){
_local3 = checkBallCollision(ballArray[_local4]);
if (_local3 == true){
ballArray[_local4].moveBall();
};
};
_local4++;
};
this.prev.x = _arg1;
this.prev.y = _arg2;
}
private function checkBallCollision(_arg1:Ball):Boolean{
var _local2:Boolean;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local2 = false;
_local3 = (_arg1.x - x);
_local4 = (_arg1.y - y);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
if (_local5 < ((_arg1.radius + radius) + 10)){
_local6 = Math.atan2(_local4, _local3);
_local7 = Math.sin(_local6);
_local8 = Math.cos(_local6);
_local9 = (_arg1.speed + 2);
_arg1.fvx = (_local9 * Math.cos(_local6));
_arg1.fvy = (_local9 * Math.sin(_local6));
_arg1.dampingEnabled = true;
_local2 = true;
};
return (_local2);
}
public function checkReflectorCollision(_arg1:Number, _arg2:Number):Boolean{
var _local3:*;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Boolean;
var _local10:Reflector;
var _local11:Number;
_local3 = Constants.reflectorArray.length;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = ((radius + Constants.reflectorRadius) - 2);
_local8 = 0;
_local9 = false;
_local11 = 0;
while (_local11 < _local3) {
_local10 = Constants.reflectorArray[_local11];
_local5 = (_local10.x - _arg1);
_local6 = (_local10.y - _arg2);
_local4 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
if (_local4 < _local7){
_local8 = (Math.atan2(_local6, _local5) + 180);
x = (x + (Math.cos(_local8) * _local7));
y = (y + (Math.sin(_local8) * _local7));
_local9 = true;
break;
};
_local11++;
};
return (_local9);
}
public function clearGraphics(){
graphics.clear();
}
public static function getInstance():Paddle{
if (paddle == null){
paddle = new (Paddle);
};
ballArray = Constants.ballArray;
return (paddle);
}
}
}//package
Section 72
//PinkBall (PinkBall)
package {
public class PinkBall extends Ball {
}
}//package
Section 73
//Pocket (Pocket)
package {
import flash.geom.*;
public class Pocket {
public var colorIndex;// = 0
public var ballCount:Number;// = 0
public var radius:Number;// = 10
public var center:Point;
public function Pocket(_arg1:Number, _arg2:Number){
radius = 10;
center = new Point();
colorIndex = 0;
ballCount = 0;
super();
center.x = _arg1;
center.y = _arg2;
}
public function reinit(){
this.ballCount = 0;
}
public function init(_arg1:Number){
this.colorIndex = _arg1;
}
public function incrementCount():void{
this.ballCount = (this.ballCount + 1);
}
public function hasBall():Boolean{
if (ballCount > 0){
return (true);
};
return (false);
}
}
}//package
Section 74
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
public class Preloader extends MovieClip {
private var percentText:TextField;
var urlPlayMore:String;// = "http://www.flasharcade.com"
public var percent:TextField;
var requestPlayMore:URLRequest;// = null
var timer:Timer;
private var progressBar:Sprite;
public var percentbar:MovieClip;
public var logo:MovieClip;
public static const startFrame:Number = 3;
public static const mainClass:String = "AirHockey";
public function Preloader(){
requestPlayMore = null;
urlPlayMore = "http://www.flasharcade.com";
addFrameScript(2, frame3);
stop();
super();
requestPlayMore = new URLRequest(urlPlayMore);
progressBar = (getChildByName("percentbar") as Sprite);
progressBar.scaleX = 0;
percentText = (getChildByName("percent") as TextField);
percentText.text = "0";
timer = new Timer(100, 0);
timer.addEventListener(TimerEvent.TIMER, afterSecond);
timer.start();
logo.buttonMode = true;
logo.useHandCursor = true;
logo.addEventListener(MouseEvent.CLICK, handleClick);
}
private function enterFrameHandler(_arg1:Event):void{
trace(" loading complete");
if (currentFrame >= _slot1.startFrame){
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
stop();
initApp();
};
}
private function onComplete(_arg1:Event):void{
play();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
function frame3(){
stop();
}
public function handleClick(_arg1:MouseEvent){
var event = _arg1;
try {
navigateToURL(requestPlayMore, "_blank");
} catch(e:Error) {
};
}
public function afterSecond(_arg1:TimerEvent){
var _local2:uint;
var _local3:uint;
var _local4:Number;
_local2 = loaderInfo.bytesLoaded;
_local3 = loaderInfo.bytesTotal;
_local4 = (_local2 / _local3);
progressBar.scaleX = ((_local2 / _local3) * 4);
percentText.text = (Math.round((_local4 * 100)).toString() + "%");
if (_local2 >= _local3){
timer.stop();
play();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
};
}
private function showProgress(_arg1:ProgressEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:Number;
_local2 = _arg1.bytesLoaded;
_local3 = _arg1.bytesTotal;
_local4 = (_local2 / _local3);
progressBar.scaleX = ((_local2 / _local3) * 4);
percentText.text = (Math.round((_local4 * 100)).toString() + "%");
}
private function initApp():void{
var _local1:Boolean;
var _local2:Class;
var _local3:Sprite;
_local1 = loaderInfo.applicationDomain.hasDefinition(_slot1.mainClass);
trace((" definition : " + _local1));
_local2 = (loaderInfo.applicationDomain.getDefinition(_slot1.mainClass) as Class);
_local3 = (new (_local2) as Sprite);
addChild(_local3);
}
}
}//package
Section 75
//RectangleSurface (RectangleSurface)
package {
import flash.geom.*;
public class RectangleSurface extends Surface {
var sideLength:Number;// = 0
var radiusW:Number;
var radiusH:Number;
private static var surface:RectangleSurface = null;
public function RectangleSurface(){
sideLength = 0;
super();
radiusW = (Constants.rectWidth / 2);
radiusH = (Constants.rectHeight / 2);
thickness = Constants.rectBorder;
NoOfEdges = 4;
pockets = new Array(4);
edges = new Array(4);
innerEdges = new Array(4);
center = new Point();
lines = new Array(4);
angles = new Array(0, 270, 180, 90);
this.center.x = Constants.stageCenter.x;
this.center.y = Constants.stageCenter.y;
colorIndex = Constants.rectColorCode;
init();
}
override public function createPockets():void{
var _local1:Number;
_local1 = 0;
while (_local1 < NoOfEdges) {
pockets[_local1] = new Pocket(innerEdges[_local1].x, innerEdges[_local1].y);
pockets[_local1].init(colorIndex[_local1]);
_local1++;
};
}
override public function init():void{
var _local1:Point;
var _local2:Line;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
calculateEdges(((Math.PI / 180) * 315));
createPockets();
_local1 = new Point();
_local1.x = (innerEdges[2].x - center.x);
_local1.y = (innerEdges[2].y - center.y);
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = 0;
while (_local6 < angles.length) {
if ((_local6 % 2) == 1){
sideLength = ((radiusH - thickness) * 2);
} else {
sideLength = ((radiusW - thickness) * 2);
};
_local3 = ((angles[_local6] * Math.PI) / 180);
_local4 = (Math.cos(_local3) * (radiusW - thickness));
_local5 = (Math.sin(_local3) * (radiusH - thickness));
lines[_local6] = new Line(sideLength, (_local1.x + _local4), (_local1.y + _local5), angles[_local6]);
addChild(lines[_local6]);
_local1.x = (_local1.x + (_local4 * 2));
_local1.y = (_local1.y + (_local5 * 2));
_local6++;
};
}
override public function checkBoundary(_arg1:Ball):Boolean{
var _local2:Boolean;
_local2 = false;
if ((_arg1.nextX + _arg1.radius) > innerEdges[0].x){
_arg1.fvx = (_arg1.fvx * _arg1.stageBounce);
_arg1.x = (innerEdges[0].x - _arg1.radius);
_local2 = true;
} else {
if ((_arg1.nextX - _arg1.radius) < innerEdges[3].x){
_arg1.fvx = (_arg1.fvx * _arg1.stageBounce);
_local2 = true;
_arg1.x = (innerEdges[3].x + _arg1.radius);
};
};
if ((_arg1.nextY + _arg1.radius) > innerEdges[1].y){
_arg1.fvy = (_arg1.fvy * _arg1.stageBounce);
_local2 = true;
_arg1.y = (innerEdges[1].y - _arg1.radius);
} else {
if ((_arg1.nextY - _arg1.radius) < innerEdges[0].y){
_arg1.fvy = (_arg1.fvy * _arg1.stageBounce);
_local2 = true;
_arg1.y = (innerEdges[0].y + _arg1.radius);
};
};
if (_local2 == true){
_arg1.dampingEnabled = false;
};
return (_local2);
}
override public function calculateEdges(_arg1:Number):void{
edges[0] = new Edges((center.x + radiusW), (center.y - radiusH), 0);
innerEdges[0] = new Edges((edges[0].x - thickness), (edges[0].y + thickness), 0);
edges[1] = new Edges((center.x + radiusW), (center.y + radiusH), 1);
innerEdges[1] = new Edges((edges[1].x - thickness), (edges[1].y - thickness), 1);
edges[2] = new Edges((center.x - radiusW), (center.y + radiusH), 2);
innerEdges[2] = new Edges((edges[2].x + thickness), (edges[2].y - thickness), 2);
edges[3] = new Edges((center.x - radiusW), (center.y - radiusH), 3);
innerEdges[3] = new Edges((edges[3].x + thickness), (edges[3].y + thickness), 3);
}
override public function checkPaddleCollision(_arg1:Paddle, _arg2:Number, _arg3:Number):Boolean{
var _local4:Boolean;
var _local5:Boolean;
_local4 = false;
_local5 = false;
if ((_arg2 - _arg1.radius) < innerEdges[3].x){
_arg1.x = (innerEdges[3].x + _arg1.radius);
_local4 = true;
} else {
if ((_arg2 + _arg1.radius) > innerEdges[0].x){
_arg1.x = (innerEdges[0].x - _arg1.radius);
_local4 = true;
};
};
if (_local4 == false){
_arg1.x = _arg2;
};
if ((_arg3 - _arg1.radius) < innerEdges[0].y){
_arg1.y = (innerEdges[0].y + _arg1.radius);
_local5 = true;
} else {
if ((_arg3 + _arg1.radius) > innerEdges[1].y){
_arg1.y = (innerEdges[1].y - _arg1.radius);
_local5 = true;
};
};
if (_local5 == false){
_arg1.y = _arg3;
};
if ((((_local4 == true)) || ((_local5 == true)))){
return (true);
};
return (false);
}
public static function getInstance(){
if (surface == null){
surface = new (RectangleSurface);
};
return (surface);
}
}
}//package
Section 76
//RedBall (RedBall)
package {
public class RedBall extends Ball {
}
}//package
Section 77
//Reflector (Reflector)
package {
import flash.display.*;
public class Reflector extends Sprite {
public var radius:Number;
private static var reflectorArray:Array = new Array(Constants.maxReflectorsOnBoard);
public function Reflector(){
radius = Constants.reflectorRadius;
super();
}
public static function getInstance(_arg1:Number):Reflector{
if (reflectorArray[_arg1] == null){
reflectorArray[_arg1] = new (Reflector);
};
return (reflectorArray[_arg1]);
}
}
}//package
Section 78
//Result (Result)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Result extends Sprite {
var message1:Number;
var bonusLabel:TextField;
var timeleft:Number;
var scoreLabel:TextField;
private var container:AirHockey;
var bonusVal:TextField;
var score:TextField;
var resultMesg:TextField;
public var back:CustomButton;
public function Result(_arg1:AirHockey, _arg2:Number, _arg3:Number){
this.message1 = _arg2;
this.timeleft = _arg3;
this.container = _arg1;
draw();
}
public function draw(){
var _local1:TextFormat;
var _local2:TextFormat;
_local1 = new TextFormat();
_local1.font = "Starfleet BdEx BT";
_local1.color = 7733622;
_local1.size = 22;
_local1.underline = false;
_local1.bold = true;
resultMesg = new TextField();
resultMesg.defaultTextFormat = _local1;
resultMesg.text = Constants.resultMesg[message1];
resultMesg.autoSize = TextFieldAutoSize.LEFT;
resultMesg.x = 150;
resultMesg.y = 120;
_local2 = new TextFormat();
_local2.font = "Arial CYR";
_local2.color = 7733622;
_local2.size = 20;
_local2.underline = false;
_local2.bold = true;
bonusLabel = new TextField();
bonusLabel.defaultTextFormat = _local2;
bonusLabel.text = "Bonus Points";
bonusLabel.autoSize = TextFieldAutoSize.LEFT;
bonusLabel.x = 175;
bonusLabel.y = 150;
bonusVal = new TextField();
bonusVal.defaultTextFormat = _local2;
bonusVal.text = timeleft.toString();
bonusVal.autoSize = TextFieldAutoSize.LEFT;
bonusVal.x = 375;
bonusVal.y = 150;
scoreLabel = new TextField();
scoreLabel.defaultTextFormat = _local2;
scoreLabel.text = "Total Score";
scoreLabel.autoSize = TextFieldAutoSize.LEFT;
scoreLabel.x = 175;
scoreLabel.y = 200;
score = new TextField();
score.defaultTextFormat = _local2;
score.autoSize = TextFieldAutoSize.LEFT;
score.x = 375;
score.y = 200;
addChild(resultMesg);
if (message1 == Constants.RESULT_SUCCESS){
addChild(bonusLabel);
addChild(bonusVal);
addChild(scoreLabel);
addChild(score);
};
back = new CustomButton("Play Again");
back.addEventListener(MouseEvent.CLICK, onClick);
addChild(back);
back.x = 300;
back.y = 300;
}
public function onClick(_arg1:MouseEvent){
this.clearGraphics();
back.visible = false;
}
public function clearGraphics(){
bonusLabel.visible = false;
bonusVal.visible = false;
scoreLabel.visible = false;
score.visible = false;
resultMesg.visible = false;
}
}
}//package
Section 79
//Score (Score)
package {
import flash.display.*;
import flash.text.*;
public class Score extends MovieClip {
public var scoreText:TextField;
}
}//package
Section 80
//Seven (Seven)
package {
import flash.display.*;
public class Seven extends MovieClip {
}
}//package
Section 81
//Six (Six)
package {
import flash.display.*;
public class Six extends MovieClip {
}
}//package
Section 82
//SpareBall (SpareBall)
package {
import flash.display.*;
import flash.text.*;
public class SpareBall extends MovieClip {
public var spareCount:TextField;
}
}//package
Section 83
//SquareSurface (SquareSurface)
package {
import flash.geom.*;
public class SquareSurface extends Surface {
var sideLength:Number;
private static var surface:SquareSurface = null;
public function SquareSurface(){
var _local1:Number;
sideLength = Constants.squareSideLength;
super();
_local1 = Constants.squareSideLength;
radius = Math.sqrt(((_local1 * _local1) / 2));
NoOfEdges = 4;
pockets = new Array(4);
edges = new Array(4);
innerEdges = new Array(4);
center = new Point();
this.center.x = Constants.stageCenter.x;
this.center.y = Constants.stageCenter.y;
thickness = Constants.squareBorder;
abstaclesBoundary = (radius * Constants.abstacleArea);
angles = new Array(0, 270, 180, 90);
lines = new Array(4);
init();
}
override public function createPockets():void{
var _local1:Array;
var _local2:Number;
_local1 = Constants.ColorCode[(Constants.currentLevel - 1)];
_local2 = 0;
while (_local2 < NoOfEdges) {
pockets[_local2] = new Pocket(innerEdges[_local2].x, innerEdges[_local2].y);
pockets[_local2].init(_local1[_local2]);
_local2++;
};
}
override public function init():void{
var _local1:Point;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:Number;
calculateEdges(((Math.PI / 180) * 315));
createPockets();
_local1 = new Point();
_local1.x = (innerEdges[2].x - center.x);
_local1.y = (innerEdges[2].y - center.y);
_local2 = (Math.PI / 180);
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = (sideLength - (thickness * 2));
_local7 = 0;
while (_local7 < angles.length) {
_local3 = (angles[_local7] * _local2);
_local4 = ((Math.cos(_local3) * _local6) / 2);
_local5 = ((Math.sin(_local3) * _local6) / 2);
lines[_local7] = new Line(_local6, (_local1.x + _local4), (_local1.y + _local5), angles[_local7]);
addChild(lines[_local7]);
_local1.x = (_local1.x + (_local4 * 2));
_local1.y = (_local1.y + (_local5 * 2));
_local7++;
};
createPockets();
}
override public function checkBoundary(_arg1:Ball):Boolean{
var _local2:Boolean;
var _local3:Number;
_local2 = false;
_local3 = 0;
while (_local3 < lines.length) {
if (_arg1.checkLine(lines[_local3]) == true){
_local2 = true;
break;
};
_local3++;
};
return (_local2);
}
override public function calculateEdges(_arg1:Number):void{
var _local2:Number;
_local2 = (sideLength / 2);
edges[0] = new Edges((center.x + _local2), (center.y - _local2), 0);
innerEdges[0] = new Edges((edges[0].x - thickness), (edges[0].y + thickness), 0);
edges[1] = new Edges((center.x + _local2), (center.y + _local2), 1);
innerEdges[1] = new Edges((edges[1].x - thickness), (edges[1].y - thickness), 1);
edges[2] = new Edges((center.x - _local2), (center.y + _local2), 2);
innerEdges[2] = new Edges((edges[2].x + thickness), (edges[2].y - thickness), 2);
edges[3] = new Edges((center.x - _local2), (center.y - _local2), 3);
innerEdges[3] = new Edges((edges[3].x + thickness), (edges[3].y + thickness), 3);
}
override public function checkPaddleCollision(_arg1:Paddle, _arg2:Number, _arg3:Number):Boolean{
var _local4:Boolean;
var _local5:Boolean;
_local4 = false;
_local5 = false;
if ((_arg2 - _arg1.radius) < innerEdges[3].x){
_arg1.x = (innerEdges[3].x + _arg1.radius);
_local4 = true;
} else {
if ((_arg2 + _arg1.radius) > innerEdges[0].x){
_arg1.x = (innerEdges[0].x - _arg1.radius);
_local4 = true;
};
};
if (_local4 == false){
_arg1.x = _arg2;
};
if ((_arg3 - _arg1.radius) < innerEdges[0].y){
_arg1.y = (innerEdges[0].y + _arg1.radius);
_local5 = true;
} else {
if ((_arg3 + _arg1.radius) > innerEdges[1].y){
_arg1.y = (innerEdges[1].y - _arg1.radius);
_local5 = true;
};
};
if (_local5 == false){
_arg1.y = _arg3;
};
if ((((_local4 == true)) || ((_local5 == true)))){
return (true);
};
return (false);
}
public static function getInstance(){
if (surface == null){
surface = new (SquareSurface);
};
return (surface);
}
}
}//package
Section 84
//Surface (Surface)
package {
import flash.geom.*;
import flash.filters.*;
import flash.display.*;
public class Surface extends Sprite {
var abstaclesBoundary:Number;// = 100
var angles:Array;
var colorIndex:Array;
var radian:Number;// = 0.0174532925199433
var edges:Array;
var thickness:Number;// = 0
var center:Point;
var radius:Number;
public var pockets:Array;
var innerEdges:Array;
var NoOfEdges:Number;// = 0
public var lines:Array;
public function Surface(){
var _local1:BitmapFilter;
var _local2:Array;
thickness = 0;
abstaclesBoundary = 100;
NoOfEdges = 0;
radian = (Math.PI / 180);
super();
_local1 = getBitmapFilter();
_local2 = new Array();
_local2.push(_local1);
filters = _local2;
}
public function createPockets():void{
}
public function init():void{
}
public function checkBoundary(_arg1:Ball):Boolean{
return (false);
}
public function calculateEdges(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:Number;
_local2 = ((2 * Math.PI) / NoOfEdges);
_local3 = (radius * Constants.abstacleArea);
_local4 = 0;
while (_local4 < edges.length) {
edges[_local4] = new Edges(((radius * Math.cos(_arg1)) + center.x), ((radius * Math.sin(_arg1)) + center.y), _local4);
innerEdges[_local4] = new Edges((((radius - thickness) * Math.cos(_arg1)) + center.x), (((radius - thickness) * Math.sin(_arg1)) + center.y), _local4);
_arg1 = (_arg1 + _local2);
_local4++;
};
}
public function reinit(){
var _local1:Number;
if (pockets != null){
_local1 = 0;
while (_local1 < pockets.length) {
pockets[_local1].reinit();
_local1++;
};
};
}
public function checkPaddleCollision(_arg1:Paddle, _arg2:Number, _arg3:Number):Boolean{
return (false);
}
private function getBitmapFilter():BitmapFilter{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:String;
var _local12:Boolean;
_local1 = 2;
_local2 = 30;
_local3 = 16699017;
_local4 = 3;
_local5 = 6634753;
_local6 = 0.8;
_local7 = 10;
_local8 = 10;
_local9 = 5;
_local10 = BitmapFilterQuality.HIGH;
_local11 = BitmapFilterType.INNER;
_local12 = false;
return (new BevelFilter(_local1, _local2, _local3, _local4, _local5, _local6, _local7, _local8, _local9, _local10, _local11, _local12));
}
}
}//package
Section 85
//TextDisplay (TextDisplay)
package {
import flash.display.*;
public class TextDisplay extends Sprite {
private var timeval:Number;// = 0
public var bonusPoints:Number;// = 0
public var scoreValue:Number;// = 0
private static var fouls:Foul = null;
private static var scoreBoard:Score = null;
private static var textDisplay:TextDisplay = null;
private static var spareBalls:SpareBall = null;
private static var clock:Clock = null;
public function TextDisplay(){
scoreValue = 0;
bonusPoints = 0;
timeval = 0;
super();
init();
}
public function decrementTime(){
timeval = (timeval - 1);
clock.timeTick.text = timeval.toString();
}
public function init(){
scoreBoard = new Score();
clock = new Clock();
clock.timeTick.text = Constants.timeLimit.toString();
scoreBoard.scoreText.text = "0";
scoreBoard.x = 50;
scoreBoard.y = 20;
clock.x = 700;
clock.y = 20;
addChild(scoreBoard);
addChild(clock);
fouls = new Foul();
fouls.x = 50;
fouls.y = 530;
fouls.foulCount.text = "0";
spareBalls = new SpareBall();
spareBalls.x = 700;
spareBalls.y = 530;
spareBalls.spareCount.text = "0";
addChild(fouls);
addChild(spareBalls);
}
public function clearGraphics(){
}
public function updateTime(_arg1:Number):void{
this.timeval = (Constants.timeLimit - _arg1);
clock.timeTick.text = timeval.toString();
}
public function updateSpareCount(){
spareBalls.spareCount.text = Constants.maxDirtyPockets.toString();
fouls.foulCount.text = Constants.totalDirtyPockets.toString();
}
public function incrementScore(_arg1:Number){
scoreValue = (scoreValue + _arg1);
scoreBoard.scoreText.text = scoreValue.toString();
}
public function resetScore(){
scoreValue = 0;
bonusPoints = 0;
scoreBoard.scoreText.text = "0";
clock.timeTick.text = "0";
}
public function addBonusOnTime(_arg1:Number){
bonusPoints = (bonusPoints + (_arg1 * Constants.bonusOnSec));
}
public static function getInstance():TextDisplay{
if (textDisplay == null){
textDisplay = new (TextDisplay);
};
clock.timeTick.text = Constants.timeLimit.toString();
return (textDisplay);
}
}
}//package
Section 86
//Three (Three)
package {
import flash.display.*;
public class Three extends MovieClip {
}
}//package
Section 87
//Two (Two)
package {
import flash.display.*;
public class Two extends MovieClip {
}
}//package
Section 88
//Welcome (Welcome)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class Welcome extends MovieClip {
public var hs:MovieClip;
var requestAddMore:URLRequest;// = null
var urlPlayMore:String;// = "http://www.flasharcade.com"
public var ipwelcome:MovieClip;
var requestPlayMore:URLRequest;// = null
public var introframe:MovieClip;
var urlAddMoreGames:String;// = "http://www.flasharcade.com/flash-games/"
private static var welcome:Welcome = null;
public function Welcome(){
urlPlayMore = "http://www.flasharcade.com";
requestPlayMore = null;
urlAddMoreGames = "http://www.flasharcade.com/flash-games/";
requestAddMore = null;
super();
requestPlayMore = new URLRequest(urlPlayMore);
requestAddMore = new URLRequest(urlAddMoreGames);
ipwelcome.playmore.addEventListener(MouseEvent.CLICK, handleClick);
ipwelcome.addMore.addEventListener(MouseEvent.CLICK, handleClickAddMore);
ipwelcome.intro.addEventListener(MouseEvent.CLICK, gotoIntro);
introframe.backintro.addEventListener(MouseEvent.CLICK, gotoWelCome);
hs.playmorehs.addEventListener(MouseEvent.CLICK, handleClick);
hs.backhs.addEventListener(MouseEvent.CLICK, gotoWelCome);
}
public function handleClickAddMore(_arg1:MouseEvent){
var event = _arg1;
try {
navigateToURL(requestAddMore, "_blank");
} catch(e:Error) {
};
}
public function handleClick(_arg1:MouseEvent){
var event = _arg1;
try {
navigateToURL(requestPlayMore, "_blank");
} catch(e:Error) {
};
}
public function gotoWelCome(_arg1:MouseEvent){
setChildIndex(ipwelcome, 2);
}
public function gotoIntro(_arg1:MouseEvent){
setChildIndex(introframe, 2);
}
public function emptyScores(){
var _local1:String;
_local1 = "";
hs.player1.text = _local1;
hs.score1.text = _local1;
hs.date1.text = _local1;
hs.player2.text = _local1;
hs.score2.text = _local1;
hs.date2.text = _local1;
hs.player3.text = _local1;
hs.score3.text = _local1;
hs.date3.text = _local1;
hs.player4.text = _local1;
hs.score4.text = _local1;
hs.date4.text = _local1;
hs.player5.text = _local1;
hs.score5.text = _local1;
hs.date5.text = _local1;
hs.player6.text = _local1;
hs.score6.text = _local1;
hs.date6.text = _local1;
hs.player7.text = _local1;
hs.score7.text = _local1;
hs.date7.text = _local1;
hs.player8.text = _local1;
hs.score8.text = _local1;
hs.date8.text = _local1;
hs.player9.text = _local1;
hs.score9.text = _local1;
hs.date9.text = _local1;
hs.player10.text = _local1;
hs.score10.text = _local1;
hs.date10.text = _local1;
}
public static function getInstance():Welcome{
if (welcome == null){
welcome = new (Welcome);
};
return (welcome);
}
}
}//package
Section 89
//YellowBall (YellowBall)
package {
public class YellowBall extends Ball {
}
}//package
Section 90
//YouWin (YouWin)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public class YouWin extends MovieClip {
public var playAgain1:MovieClip;
public var errormesg:TextField;
var urlPlayMore:String;// = "http://www.flasharcade.com"
var requestPlayMore:URLRequest;// = null
public var submitScore:MovieClip;
public var playMore:SimpleButton;
public var resultB:MovieClip;
private static var youWin:YouWin = null;
public function YouWin(){
urlPlayMore = "http://www.flasharcade.com";
requestPlayMore = null;
super();
addFrameScript(206, frame207);
this.playAgain1.buttonMode = true;
this.playAgain1.useHandOverCursor = true;
requestPlayMore = new URLRequest(urlPlayMore);
playMore.addEventListener(MouseEvent.CLICK, handleClick);
this.submitScore.buttonMode = true;
this.submitScore.useHandOverCursor = true;
}
public function getPlayerName():String{
var _local1:String;
_local1 = this.resultB.player.text;
if (_local1 == null){
return (null);
};
this.errormesg.text = "";
return (_local1);
}
function frame207(){
stop();
}
public function handleClick(_arg1:MouseEvent){
var event = _arg1;
try {
navigateToURL(requestPlayMore, "_blank");
} catch(e:Error) {
};
}
public function updateScores(){
gotoAndPlay(1);
resultB.bonus.text = Constants.text.bonusPoints.toString();
resultB.totalScore.text = Constants.text.scoreValue.toString();
}
public function setErrorMesg(_arg1:String){
this.errormesg.text = _arg1;
}
public static function getInstance():YouWin{
if (youWin == null){
youWin = new (YouWin);
};
return (youWin);
}
}
}//package