Section 1
//Logo (btn.Logo)
package btn {
import flash.display.*;
public dynamic class Logo extends SimpleButton {
}
}//package btn
Section 2
//Logo (framework.Logo)
package framework {
import flash.display.*;
public dynamic class Logo extends MovieClip {
}
}//package framework
Section 3
//Ball (game.engine.Ball)
package game.engine {
import org.cove.ape.*;
import flash.display.*;
public class Ball extends Particle {
public function getDisplayObject():DisplayObject{
return (this.displayObject);
}
override public function init():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = ((this.x + this.parent.x) + this.displayObject.x);
_local2 = ((this.y + this.parent.y) + this.displayObject.y);
_local3 = (((this.displayObject.width * this.scaleX) * this.parent.scaleX) / 2);
this.particle = new WheelParticle(_local1, _local2, _local3);
this.particle.fixed = false;
this.particle.elasticity = 0.1;
this.addDisplayObject();
}
public function setX(_arg1:Number):void{
this.displayObject.parent.x = _arg1;
this.particle.px = _arg1;
}
public function setY(_arg1:Number):void{
this.displayObject.parent.y = _arg1;
this.particle.py = _arg1;
}
public function setMass(_arg1:Number):void{
this.particle.mass = _arg1;
}
public function getSpeed():Vector{
return (this.particle.velocity);
}
public function getX():Number{
return (this.displayObject.parent.x);
}
public function getY():Number{
return (this.displayObject.parent.y);
}
override public function addForce(_arg1:Vector):void{
super.addForce(_arg1);
WheelParticle(this.particle).speed = _arg1.x;
}
}
}//package game.engine
Section 4
//GolfBall (game.engine.GolfBall)
package game.engine {
import org.cove.ape.*;
import flash.display.*;
import flash.events.*;
public class GolfBall extends MovieClip {
private var seat:MovieClip;
public var seatMc:MovieClip;
private var group:Group;
private var ball:Ball;
public function GolfBall(){
this.group = new Group();
this.seat = this.seatMc;
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.init();
};
}
public function show():void{
this.getDisplayObject().visible = true;
}
private function init():void{
var _local1:int;
var _local2:DisplayObject;
_local1 = 0;
while (_local1 < this.numChildren) {
_local2 = this.getChildAt(_local1);
if ((_local2 is Ball)){
this.ball = Ball(_local2);
this.ball.init();
this.group.addParticle(this.ball.getParticle());
};
_local1++;
};
}
public function getDisplayObject():DisplayObject{
return (this.ball.getDisplayObject());
}
public function setX(_arg1:Number):void{
this.ball.setX(_arg1);
}
public function setY(_arg1:Number):void{
this.ball.setY(_arg1);
}
public function hideSeat():void{
if (this.seat != null){
this.removeChild(this.seat);
this.seat = null;
};
}
public function getSpeed():Vector{
return (this.ball.getSpeed());
}
public function setMass(_arg1:Number):void{
this.ball.setMass(_arg1);
}
public function hide():void{
this.getDisplayObject().visible = false;
}
public function getX():Number{
return (this.ball.getX());
}
public function getY():Number{
return (this.ball.getY());
}
public function getGroup():Group{
return (this.group);
}
public function addForce(_arg1:Vector):void{
this.ball.addForce(_arg1);
}
}
}//package game.engine
Section 5
//Ground (game.engine.Ground)
package game.engine {
import org.cove.ape.*;
import flash.display.*;
import flash.events.*;
import game.map.*;
public class Ground extends MovieClip {
private var waters:Array;
private var startLine:StartLine;
private var ground:Group;
private var endLine:EndLine;
public function Ground(){
this.ground = new Group();
this.waters = new Array();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.init();
};
}
private function init():void{
var _local1:int;
var _local2:DisplayObject;
_local1 = 0;
while (_local1 < this.numChildren) {
_local2 = this.getChildAt(_local1);
if ((_local2 is Particle)){
Particle(_local2).init();
this.ground.addParticle(Particle(_local2).getParticle());
if ((_local2 is StartLine)){
this.startLine = StartLine(_local2);
} else {
if ((_local2 is EndLine)){
this.endLine = EndLine(_local2);
};
};
} else {
if ((_local2 is Water)){
this.waters.push(Water(_local2));
};
};
_local1++;
};
}
public function getWaters():Array{
return (this.waters);
}
public function getEndLine():EndLine{
return (this.endLine);
}
public function getGroup():Group{
return (this.ground);
}
public function getStartLine():StartLine{
return (this.startLine);
}
}
}//package game.engine
Section 6
//Ground1 (game.engine.Ground1)
package game.engine {
public class Ground1 extends Ground {
}
}//package game.engine
Section 7
//Ground10 (game.engine.Ground10)
package game.engine {
public class Ground10 extends Ground {
}
}//package game.engine
Section 8
//Ground11 (game.engine.Ground11)
package game.engine {
public class Ground11 extends Ground {
}
}//package game.engine
Section 9
//Ground12 (game.engine.Ground12)
package game.engine {
public class Ground12 extends Ground {
}
}//package game.engine
Section 10
//Ground13 (game.engine.Ground13)
package game.engine {
public class Ground13 extends Ground {
}
}//package game.engine
Section 11
//Ground14 (game.engine.Ground14)
package game.engine {
public class Ground14 extends Ground {
}
}//package game.engine
Section 12
//Ground15 (game.engine.Ground15)
package game.engine {
public class Ground15 extends Ground {
}
}//package game.engine
Section 13
//Ground16 (game.engine.Ground16)
package game.engine {
public class Ground16 extends Ground {
}
}//package game.engine
Section 14
//Ground17 (game.engine.Ground17)
package game.engine {
public class Ground17 extends Ground {
}
}//package game.engine
Section 15
//Ground18 (game.engine.Ground18)
package game.engine {
public class Ground18 extends Ground {
}
}//package game.engine
Section 16
//Ground2 (game.engine.Ground2)
package game.engine {
public class Ground2 extends Ground {
}
}//package game.engine
Section 17
//Ground3 (game.engine.Ground3)
package game.engine {
public class Ground3 extends Ground {
}
}//package game.engine
Section 18
//Ground4 (game.engine.Ground4)
package game.engine {
public class Ground4 extends Ground {
}
}//package game.engine
Section 19
//Ground5 (game.engine.Ground5)
package game.engine {
public class Ground5 extends Ground {
}
}//package game.engine
Section 20
//Ground6 (game.engine.Ground6)
package game.engine {
public class Ground6 extends Ground {
}
}//package game.engine
Section 21
//Ground7 (game.engine.Ground7)
package game.engine {
public class Ground7 extends Ground {
}
}//package game.engine
Section 22
//Ground8 (game.engine.Ground8)
package game.engine {
public class Ground8 extends Ground {
}
}//package game.engine
Section 23
//Ground9 (game.engine.Ground9)
package game.engine {
public class Ground9 extends Ground {
}
}//package game.engine
Section 24
//Particle (game.engine.Particle)
package game.engine {
import org.cove.ape.*;
import flash.display.*;
import flash.events.*;
public class Particle extends MovieClip {
protected var particle:AbstractParticle;
protected var displayObject:DisplayObject;
public function Particle(){
this.displayObject = this.getChildAt(0);
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
};
}
public function getParticle():AbstractParticle{
return (this.particle);
}
public function init():void{
}
public function addDisplayObject():void{
var _local1:DisplayObject;
_local1 = this.displayObject;
_local1.width = (_local1.width * (this.scaleX * this.parent.scaleX));
_local1.height = (_local1.height * (this.scaleY * this.parent.scaleY));
_local1.rotation = (_local1.rotation + (this.rotation + this.parent.rotation));
this.particle.setDisplay(_local1);
}
public function addForce(_arg1:Vector):void{
this.particle.velocity = _arg1;
}
}
}//package game.engine
Section 25
//Path (game.engine.Path)
package game.engine {
import org.cove.ape.*;
import flash.display.*;
public class Path extends Particle {
private var friction:Number;
private var elasticity:Number;
public function Path(){
this.friction = 0.04;
this.elasticity = 0.1;
this.displayObject.visible = false;
}
override public function init():void{
var _local1:DisplayObject;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local1 = this.displayObject;
_local2 = ((this.x + this.parent.x) + _local1.x);
_local3 = ((this.y + this.parent.y) + _local1.y);
_local4 = ((_local1.width * this.scaleX) * this.parent.scaleX);
_local5 = ((_local1.height * this.scaleY) * this.parent.scaleY);
_local6 = ((((this.rotation + this.parent.rotation) + _local1.rotation) / 180) * Math.PI);
particle = new RectangleParticle(_local2, _local3, _local4, _local5, _local6);
this.particle.fixed = true;
this.particle.friction = this.friction;
this.particle.elasticity = this.elasticity;
this.addDisplayObject();
}
public function setFriction(_arg1:Number):void{
this.friction = _arg1;
}
public function setElasticity(_arg1:Number):void{
this.elasticity = _arg1;
}
}
}//package game.engine
Section 26
//RainPath (game.engine.RainPath)
package game.engine {
public class RainPath extends Path {
public function RainPath(){
super.setFriction(0.2);
super.setElasticity(0.05);
}
}
}//package game.engine
Section 27
//AngleShow (game.map.AngleShow)
package game.map {
import flash.display.*;
import flash.text.*;
public class AngleShow extends MovieClip {
public var angleShowTf:TextField;
private var angleShow:TextField;
public function AngleShow(){
this.angleShow = this.angleShowTf;
this.angleShow.selectable = false;
}
public function get text():String{
return (this.angleShow.text);
}
public function set text(_arg1:String):void{
this.angleShow.text = _arg1;
}
}
}//package game.map
Section 28
//Bg (game.map.Bg)
package game.map {
import flash.display.*;
public class Bg extends MovieClip {
}
}//package game.map
Section 29
//DrawArea (game.map.DrawArea)
package game.map {
import flash.display.*;
public class DrawArea extends MovieClip {
}
}//package game.map
Section 30
//EndLine (game.map.EndLine)
package game.map {
import game.engine.*;
public class EndLine extends Path {
public function EndLine(){
this.visible = true;
}
}
}//package game.map
Section 31
//ForwardBg (game.map.ForwardBg)
package game.map {
import flash.display.*;
public class ForwardBg extends MovieClip {
}
}//package game.map
Section 32
//Hole (game.map.Hole)
package game.map {
import flash.display.*;
public class Hole extends MovieClip {
public function Hole(){
this.alpha = 0;
}
}
}//package game.map
Section 33
//MapInfo (game.map.MapInfo)
package game.map {
import flash.display.*;
import flash.text.*;
public class MapInfo extends MovieClip {
public var holeLengthTf:TextField;
public var parTf:TextField;
public var distToFlagTf:TextField;
private var dis:TextField;
private var par:TextField;
public var disTf:TextField;
private var holeLength:TextField;
public var hitsTf:TextField;
private var distToFlag:TextField;
private var hits:TextField;
public function MapInfo(){
this.hits = this.hitsTf;
this.dis = this.disTf;
this.par = this.parTf;
this.holeLength = this.holeLengthTf;
this.distToFlag = this.distToFlagTf;
this.setDis(0);
}
public function setHits(_arg1:int):void{
this.hits.text = ("HITS: " + _arg1);
}
public function setDis(_arg1:int):void{
this.dis.text = (("LAST HIT DIST: " + _arg1) + "m");
}
public function setHoleLength(_arg1:int):void{
this.holeLength.text = (("HOLE LENGTH: " + _arg1) + "m");
}
public function setDistToFlag(_arg1:int):void{
this.distToFlag.text = (("DIST TO FLAG: " + _arg1) + "m");
}
public function setPar(_arg1:int):void{
this.par.text = ("PAR: " + _arg1);
}
}
}//package game.map
Section 34
//Overboard (game.map.Overboard)
package game.map {
import flash.display.*;
import flash.events.*;
public class Overboard extends MovieClip {
private var mc:MovieClip;
public static const PLAY_COMPLETE:String = " play complete.";
public function Overboard(){
mc = MovieClip(this.getChildAt(0));
this.mc.gotoAndStop(1);
this.mc.addFrameScript((this.mc.totalFrames - 1), this.playComplete);
}
override public function play():void{
this.mc.gotoAndPlay(1);
}
private function playComplete():void{
this.mc.stop();
this.dispatchEvent(new Event(Overboard.PLAY_COMPLETE));
}
}
}//package game.map
Section 35
//PowerShow (game.map.PowerShow)
package game.map {
import flash.display.*;
import flash.text.*;
public class PowerShow extends MovieClip {
private var powerShow:TextField;
public var powerShowTf:TextField;
public function PowerShow(){
this.powerShow = this.powerShowTf;
this.powerShow.selectable = false;
}
public function get text():String{
return (this.powerShow.text);
}
public function set text(_arg1:String):void{
this.powerShow.text = _arg1;
}
}
}//package game.map
Section 36
//Rain (game.map.Rain)
package game.map {
import flash.display.*;
public class Rain extends MovieClip {
}
}//package game.map
Section 37
//RainBg (game.map.RainBg)
package game.map {
public class RainBg extends Bg {
}
}//package game.map
Section 38
//RainCloud (game.map.RainCloud)
package game.map {
import flash.display.*;
public class RainCloud extends MovieClip {
}
}//package game.map
Section 39
//ResultCard (game.map.ResultCard)
package game.map {
import flash.display.*;
import flash.events.*;
import mypkg.*;
import flash.text.*;
public class ResultCard extends MovieClip {
public var decMc5:MovieClip;
public var decMc3:MovieClip;
private var cups:Array;
private var cupsCount:Array;
private var pars:Array;
private var gainCupMc:MovieClip;
private var decMcs:Array;
public var cupMc2:MovieClip;
public var cupMc3:MovieClip;
public var cupMc1:MovieClip;
public var hitTf11:TextField;
public var hitTf12:TextField;
public var hitTf14:TextField;
public var hitTf15:TextField;
public var hitTf16:TextField;
public var hitTf18:TextField;
public var cupMc5:MovieClip;
public var parTf10:TextField;
public var parTf15:TextField;
public var parTf16:TextField;
public var parTf17:TextField;
public var parTf12:TextField;
public var parTf14:TextField;
public var hitTf13:TextField;
public var parTf18:TextField;
public var parTf11:TextField;
public var hitTf17:TextField;
public var hitTf10:TextField;
public var parTf13:TextField;
private var hitTotalNum:int;
private var cupMcs:Array;
public var cupMc4:MovieClip;
public var decTf1:TextField;
public var decTf3:TextField;
public var decTf5:TextField;
private var cupOvers:Array;
public var decTf2:TextField;
public var decTf4:TextField;
public var scoreTf:TextField;
private var info:Tip;
private var decs:Array;
private var score:TextField;
private var preParTotalNum:int;
public var hitTotalTf1:TextField;
public var hitTotalTf2:TextField;
public var cupTf1:TextField;
public var cupTf4:TextField;
public var cupTf5:TextField;
public var cupTf3:TextField;
public var infoMc:Tip;
private var hitTotal1:TextField;
public var cupTf2:TextField;
public var parTotalTf:TextField;
private var decsCount:Array;
private var hitTotal2:TextField;
private var gainDecMc:MovieClip;
private var parTotal:TextField;
private var decOvers:Array;
private var parTotalNum:int;
public var hitTf2:TextField;
public var hitTf3:TextField;
public var hitTf4:TextField;
public var hitTf5:TextField;
public var hitTf6:TextField;
public var hitTf7:TextField;
public var hitTf1:TextField;
private var parTotal1:TextField;
private var parTotal2:TextField;
private var hitTotal:TextField;
private var hits:Array;
public var hitTf8:TextField;
public var hitTf9:TextField;
private var level:int;
public var decOverMc1:MovieClip;
public var decOverMc3:MovieClip;
public var decOverMc5:MovieClip;
public var decOverMc4:MovieClip;
public var decOverMc2:MovieClip;
private var localSave:LocalSave;
public var parTf2:TextField;
public var parTf3:TextField;
public var parTf4:TextField;
public var parTf5:TextField;
public var parTf7:TextField;
public var parTf9:TextField;
public var parTf6:TextField;
public var parTf8:TextField;
public var parTf1:TextField;
private var preHitTotalNum:int;
public var closeMc:MovieClip;
public var hitTotalTf:TextField;
public var cupOverMc1:MovieClip;
public var cupOverMc4:MovieClip;
public var cupOverMc5:MovieClip;
public var cupOverMc2:MovieClip;
public var cupOverMc3:MovieClip;
private var scoreCount:int;
public var parTotalTf1:TextField;
public var parTotalTf2:TextField;
public var decMc1:MovieClip;
public var decMc2:MovieClip;
public var decMc4:MovieClip;
private var close:MovieClip;
public function ResultCard(){
this.init();
}
private function setInfoPos(_arg1:DisplayObject):void{
this.info.x = _arg1.x;
this.info.y = ((_arg1.y + (_arg1.height / 2)) + (this.info.height / 2));
this.info.visible = true;
}
public function setParAndHit(_arg1:int, _arg2:int):int{
var _local3:int;
this.pars[(this.level - 1)].text = _arg1;
this.pars[(this.level - 1)].textColor = 0;
this.setParTotal((this.parTotalNum + _arg1));
this.setHitTotal((this.hitTotalNum + _arg2));
if (this.level == 9){
this.parTotal1.text = this.parTotalNum.toString();
this.hitTotal1.text = this.hitTotalNum.toString();
this.preParTotalNum = this.parTotalNum;
this.preHitTotalNum = this.hitTotalNum;
} else {
if (this.level == 18){
this.parTotal2.text = ((this.parTotalNum - this.preParTotalNum) + "");
this.hitTotal2.text = ((this.hitTotalNum - this.preHitTotalNum) + "");
};
};
this.hits[(this.level - 1)].text = _arg2;
_local3 = (_arg1 - _arg2);
if (_local3 >= 0){
if (_local3 == 0){
this.hits[(this.level - 1)].textColor = 0xFF;
} else {
if (_local3 >= 5){
_local3 = 4;
} else {
this.hits[(this.level - 1)].textColor = 0xFF00;
};
};
return (this.setDec((_local3 + 1)));
};
this.hits[(this.level - 1)].textColor = 0xFF0000;
return (0);
}
public function getDP():int{
return ((this.hitTotalNum - this.parTotalNum));
}
public function controlShowOrHide():void{
if (this.visible == true){
this.hide();
} else {
if (this.visible == false){
this.show();
};
};
}
public function setLevel(_arg1:int):void{
this.level = _arg1;
}
public function addScore(_arg1:int):void{
this.scoreCount = (this.scoreCount + _arg1);
}
public function setCup(_arg1:int):int{
var _local2:Array;
if (this.localSave.getSaveInfo("bestCup") == null){
_local2 = new Array(0, 0, 0, 0, 0);
this.localSave.addSaveName("bestCup");
this.localSave.saveArray("bestCup", _local2);
} else {
_local2 = this.localSave.getSaveInfo("bestCup");
};
var _local3 = this.cupsCount;
var _local4 = (_arg1 - 1);
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
if (this.cupsCount[(_arg1 - 1)] > _local2[(_arg1 - 1)]){
this.localSave.save("bestCup", (_arg1 - 1), this.cupsCount[(_arg1 - 1)]);
};
this.localSave.save("lastCup", (_arg1 - 1), this.cupsCount[(_arg1 - 1)]);
this.addScore((_arg1 * 400));
this.cups[(_arg1 - 1)].text = ("x" + this.cupsCount[(_arg1 - 1)]);
if (this.gainCupMc != null){
this.gainCupMc.visible = false;
};
this.gainCupMc = this.cupMcs[(_arg1 - 1)];
this.gainCupMc.visible = true;
return ((_arg1 * 400));
}
public function setDec(_arg1:int):int{
var _local2:Array;
if (this.localSave.getSaveInfo("bestDec") == null){
_local2 = new Array(0, 0, 0, 0, 0);
this.localSave.addSaveName("bestDec");
this.localSave.saveArray("bestDec", _local2);
} else {
_local2 = this.localSave.getSaveInfo("bestDec");
};
var _local3 = this.decsCount;
var _local4 = (_arg1 - 1);
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
if (this.decsCount[(_arg1 - 1)] > _local2[(_arg1 - 1)]){
this.localSave.save("bestDec", (_arg1 - 1), this.decsCount[(_arg1 - 1)]);
};
this.localSave.save("lastDec", (_arg1 - 1), this.decsCount[(_arg1 - 1)]);
this.addScore((_arg1 * 500));
this.decs[(_arg1 - 1)].text = ("x" + this.decsCount[(_arg1 - 1)]);
if (gainDecMc != null){
gainDecMc.visible = false;
};
this.gainDecMc = this.decMcs[(_arg1 - 1)];
this.gainDecMc.visible = true;
return ((_arg1 * 500));
}
private function cupMouseOverEvent(_arg1:MouseEvent):void{
var _local2:DisplayObject;
var _local3:int;
var _local4:Array;
_local2 = DisplayObject(_arg1.target);
_local3 = this.cupOvers.indexOf(_local2);
if (this.localSave.getSaveInfo("bestCup") == null){
_local4 = new Array(0, 0, 0, 0, 0);
} else {
_local4 = this.localSave.getSaveInfo("bestCup");
};
if (_local3 == 0){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 20m", ("Best game result: " + _local4[_local3]));
} else {
if (_local3 == 1){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 40m", ("Best game result: " + _local4[_local3]));
} else {
if (_local3 == 2){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 60m", ("Best game result: " + _local4[_local3]));
} else {
if (_local3 == 3){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 80m", ("Best game result: " + _local4[_local3]));
} else {
if (_local3 == 4){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 100m", ("Best game result: " + _local4[_local3]));
};
};
};
};
};
this.setInfoPos(_local2);
}
public function show():void{
this.visible = true;
}
public function getHitTotal():int{
return (this.hitTotalNum);
}
public function getScore():int{
return (this.scoreCount);
}
private function init():void{
var _local1:int;
var _local2:int;
this.close = this.closeMc;
this.score = this.scoreTf;
this.scoreCount = 0;
this.hitTotal = this.hitTotalTf;
this.hitTotal1 = this.hitTotalTf1;
this.hitTotal2 = this.hitTotalTf2;
this.hits = new Array();
this.hitTotalNum = 0;
this.parTotal = this.parTotalTf;
this.parTotal1 = this.parTotalTf1;
this.parTotal2 = this.parTotalTf2;
this.pars = new Array();
this.parTotalNum = 0;
_local1 = 0;
while (_local1 < 18) {
this.hits[_local1] = this[("hitTf" + (_local1 + 1))];
this.hits[_local1].text = "0";
this.pars[_local1] = this[("parTf" + (_local1 + 1))];
this.pars[_local1].text = "0";
_local1++;
};
this.decs = new Array();
this.decMcs = new Array();
this.decOvers = new Array();
this.decsCount = new Array();
this.cups = new Array();
this.cupMcs = new Array();
this.cupOvers = new Array();
this.cupsCount = new Array();
_local2 = 0;
while (_local2 < 5) {
this.decs[_local2] = this[("decTf" + (_local2 + 1))];
this.decMcs[_local2] = this[("decMc" + (_local2 + 1))];
this.decMcs[_local2].visible = false;
this.decOvers[_local2] = this[("decOverMc" + (_local2 + 1))];
this.decOvers[_local2].addEventListener(MouseEvent.MOUSE_OVER, decMouseOverEvent);
this.decOvers[_local2].addEventListener(MouseEvent.MOUSE_OUT, hideInfoEvent);
this.decsCount[_local2] = 0;
this.cups[_local2] = this[("cupTf" + (_local2 + 1))];
this.cupMcs[_local2] = this[("cupMc" + (_local2 + 1))];
this.cupMcs[_local2].visible = false;
this.cupOvers[_local2] = this[("cupOverMc" + (_local2 + 1))];
this.cupOvers[_local2].addEventListener(MouseEvent.MOUSE_OVER, cupMouseOverEvent);
this.cupOvers[_local2].addEventListener(MouseEvent.MOUSE_OUT, hideInfoEvent);
this.cupsCount[_local2] = 0;
_local2++;
};
this.info = this.infoMc;
this.info.visible = false;
this.level = 0;
this.localSave = new LocalSave();
if (this.localSave.getSaveInfo("lastDec") == null){
this.localSave.addSaveName("lastDec");
};
if (this.localSave.getSaveInfo("lastCup") == null){
this.localSave.addSaveName("lastCup");
};
this.close.addEventListener(MouseEvent.CLICK, closeEvent);
}
public function setScore(_arg1:int):void{
this.score.text = _arg1.toString();
}
public function hide():void{
this.visible = false;
this.info.visible = false;
if (gainCupMc != null){
this.gainCupMc.visible = false;
};
if (this.gainDecMc != null){
this.gainDecMc.visible = false;
};
}
private function closeEvent(_arg1:MouseEvent):void{
this.hide();
}
private function hideInfoEvent(_arg1:MouseEvent):void{
this.info.visible = false;
}
public function setParTotal(_arg1:int):void{
this.parTotalNum = _arg1;
this.parTotal.text = this.parTotalNum.toString();
}
private function decMouseOverEvent(_arg1:MouseEvent):void{
var _local2:DisplayObject;
var _local3:int;
var _local4:Array;
_local2 = DisplayObject(_arg1.target);
_local3 = this.decOvers.indexOf(_local2);
if (this.localSave.getSaveInfo("bestDec") == null){
_local4 = new Array(0, 0, 0, 0, 0);
} else {
_local4 = this.localSave.getSaveInfo("bestDec");
};
if (_local3 == 0){
this.info.showDecIndex(_local3, "Par Award", "for getting a par result", ("Best game result: " + _local4[_local3]));
} else {
if (_local3 == 1){
this.info.showDecIndex(_local3, "Birdie Award", "for getting a birdie result", ("Best game result: " + _local4[_local3]));
} else {
if (_local3 == 2){
this.info.showDecIndex(_local3, "Eagle Award", "for getting a eagle result", ("Best game result: " + _local4[_local3]));
} else {
if (_local3 == 3){
this.info.showDecIndex(_local3, "Albatross Award", "for getting a albatross result", ("Best game result: " + _local4[_local3]));
} else {
if (_local3 == 4){
this.info.showDecIndex(_local3, "Condor Award", "for getting a condor result", ("Best game result: " + _local4[_local3]));
};
};
};
};
};
this.setInfoPos(_local2);
}
public function setDisten(_arg1:Number):int{
var _local2:int;
_local2 = Math.floor((_arg1 / 20));
if (_local2 >= 5){
return (this.setCup(5));
};
if (_local2 > 0){
return (this.setCup(_local2));
};
return (0);
}
public function setHitTotal(_arg1:int):void{
this.hitTotalNum = _arg1;
this.hitTotal.text = this.hitTotalNum.toString();
}
}
}//package game.map
Section 40
//Sand (game.map.Sand)
package game.map {
import flash.display.*;
public class Sand extends MovieClip {
public var fogMc:MovieClip;
private var fog:MovieClip;
public function Sand(){
this.visible = false;
this.fog = this.fogMc;
this.fog.visible = false;
this.fog.gotoAndStop(1);
this.fog.addFrameScript((this.fog.totalFrames - 1), playComplete);
}
private function playComplete():void{
this.fog.visible = false;
this.fog.parent.removeChild(this.fog);
this.fog.y = 5;
this.fog.gotoAndStop(1);
}
public function playFog(_arg1:Number, _arg2:Number):void{
this.fog.visible = true;
this.parent.addChild(this.fog);
this.fog.x = _arg1;
this.fog.y = _arg2;
this.fog.gotoAndPlay(1);
}
}
}//package game.map
Section 41
//SandLine (game.map.SandLine)
package game.map {
import game.engine.*;
public class SandLine extends Path {
public function SandLine(){
this.setFriction(0.3);
this.setElasticity(0.01);
}
}
}//package game.map
Section 42
//SmallMap (game.map.SmallMap)
package game.map {
import flash.display.*;
public dynamic class SmallMap extends MovieClip {
}
}//package game.map
Section 43
//SmallMapBall (game.map.SmallMapBall)
package game.map {
import flash.display.*;
public class SmallMapBall extends MovieClip {
}
}//package game.map
Section 44
//SmallMapLine (game.map.SmallMapLine)
package game.map {
import flash.display.*;
public class SmallMapLine extends MovieClip {
}
}//package game.map
Section 45
//StartArea (game.map.StartArea)
package game.map {
import flash.display.*;
import flash.text.*;
public class StartArea extends MovieClip {
public var parTf:TextField;
public var holeTf:TextField;
public var distenTf:TextField;
private var par:TextField;
private var hole:TextField;
private var disten:TextField;
public function StartArea(){
this.hole = this.holeTf;
this.par = this.parTf;
this.disten = this.distenTf;
}
public function setInfo(_arg1:int, _arg2:int, _arg3:int):void{
this.hole.text = _arg1.toString();
this.par.text = _arg2.toString();
this.disten.text = _arg3.toString();
}
}
}//package game.map
Section 46
//StartLine (game.map.StartLine)
package game.map {
import game.engine.*;
public class StartLine extends Path {
public function StartLine(){
this.visible = true;
}
}
}//package game.map
Section 47
//SunBg (game.map.SunBg)
package game.map {
public class SunBg extends Bg {
}
}//package game.map
Section 48
//SunCloud (game.map.SunCloud)
package game.map {
import flash.display.*;
public class SunCloud extends MovieClip {
}
}//package game.map
Section 49
//Tip (game.map.Tip)
package game.map {
import flash.display.*;
import flash.text.*;
public class Tip extends MovieClip {
private var best:TextField;
public var decMc2:MovieClip;
public var decMc4:MovieClip;
private var cups:Array;
public var decMc5:MovieClip;
public var cupMc2:MovieClip;
public var cupMc3:MovieClip;
public var cupMc1:MovieClip;
public var cupMc5:MovieClip;
private var title:TextField;
public var cupMc4:MovieClip;
public var bestTf:TextField;
public var decMc3:MovieClip;
private var decs:Array;
private var info:TextField;
private var showObject:DisplayObject;
public var infoTf:TextField;
public var titleTf:TextField;
public var decMc1:MovieClip;
public function Tip(){
this.title = this.titleTf;
this.title.text = "";
this.info = this.infoTf;
this.title.text = "";
this.best = this.bestTf;
this.title.text = "";
this.decs = new Array();
this.cups = new Array();
this.init();
}
private function init():void{
var _local1:int;
_local1 = 0;
while (_local1 < 5) {
this.decs[_local1] = this[("decMc" + (_local1 + 1))];
this.decs[_local1].visible = false;
this.cups[_local1] = this[("cupMc" + (_local1 + 1))];
this.cups[_local1].visible = false;
_local1++;
};
}
public function showDecIndex(_arg1:int, _arg2:String, _arg3:String, _arg4:String):void{
this.setShowObject(this.decs[_arg1]);
this.title.text = _arg2;
this.info.text = _arg3;
this.best.text = _arg4;
}
public function showCupIndex(_arg1:int, _arg2:String, _arg3:String, _arg4:String):void{
this.setShowObject(this.cups[_arg1]);
this.title.text = _arg2;
this.info.text = _arg3;
this.best.text = _arg4;
}
private function setShowObject(_arg1:DisplayObject):void{
if (this.showObject != null){
this.showObject.visible = false;
};
this.showObject = _arg1;
this.showObject.visible = true;
}
}
}//package game.map
Section 50
//Water (game.map.Water)
package game.map {
import flash.display.*;
public class Water extends MovieClip {
public function Water(){
this.visible = false;
}
}
}//package game.map
Section 51
//Map (game.maps.Map)
package game.maps {
import org.cove.ape.*;
import sound.*;
import flash.display.*;
import flash.events.*;
import mypkg.*;
import main.*;
import game.map.*;
import game.roles.*;
import game.engine.*;
import flash.ui.*;
public class Map extends MovieClip {
private var startArea:StartArea;
private var stopCount:int;
private var mapInfo:MapInfo;
private var bg:Bg;
private var sands:Array;
private var role:Role;
private var score:int;
private var overboard:Overboard;
private var par:int;
private var hole:Hole;
private var angle:Angle;
private var power:Vector;
private var gamePause:Pause;
private var drawLine:DrawLine;
private var cloudBg:MovieClip;
private var ground:Ground;
private var usePar:int;
private var rain:Rain;
private var preCloudPos:Vector;
private var preBallPos:Vector;
private var sph:int;
private var gameInfo:GameInfo;
private var drawArea:DrawArea;
private var forwardBg:ForwardBg;
private var ball:GolfBall;
public static const PASS:String = " pass game.";
public static const LOSE:String = " lose game.";
public function Map(_arg1:GameInfo, _arg2:Pause){
this.gameInfo = _arg1;
this.gamePause = _arg2;
this.init();
this.setScore(1000);
this.setSph(200);
this.addEventListener(Event.ADDED, added);
}
public function pass():void{
this.dispatchEvent(new Event(Map.PASS));
}
public function setBallMass(_arg1:Number):void{
this.ball.setMass(_arg1);
}
private function ballMoveEvent(_arg1:Event):void{
APEngine.step();
APEngine.paint();
this.mapMove();
this.hitSand();
if (this.enterHole() == true){
this.stopBallMove();
this.ball.hide();
this.pass();
} else {
if (this.hitWater() == true){
this.ball.hide();
this.stopBallMove();
this.addOverboard();
} else {
if ((((Math.abs(this.ball.getSpeed().x) < 0.2)) && ((Math.abs(this.ball.getSpeed().y) < 0.2)))){
this.stopCount++;
if (this.stopCount >= 6){
this.mapInfo.setDis((Math.abs((this.ball.getX() - this.preBallPos.x)) / 10));
this.mapInfo.setDistToFlag((Math.abs((this.ball.getX() - this.hole.x)) / 10));
this.stopBallMove();
this.startDraw();
};
} else {
this.stopCount = 0;
};
};
};
}
public function setG(_arg1:Number):void{
APEngine.addMasslessForce(new Vector(0, _arg1));
}
private function lineChangeEvent(_arg1:Event):void{
this.role.setDir(this.drawLine.getDir());
this.angle.setAngle(this.drawLine.getAngle());
this.role.setPower(this.drawLine.getlineLen());
}
public function removeRain():void{
this.parent.removeChild(this.rain);
}
private function overboardPlayComplete(_arg1:Event):void{
this.resetBall();
this.mapMove();
this.startDraw();
this.ball.show();
this.removeOverboard();
}
public function addMapInfo():void{
this.parent.addChild(this.mapInfo);
this.mapInfo.setHits(this.usePar);
this.mapInfo.setPar(this.par);
this.mapInfo.setHoleLength(((this.hole.x - this.ball.getX()) / 10));
this.mapInfo.setDistToFlag(((this.hole.x - this.ball.getX()) / 10));
}
public function setBg():void{
var _local1:int;
_local1 = this.parent.getChildIndex(this);
this.parent.addChildAt(this.bg, (_local1 - 1));
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.stopBallMove();
this.stopDraw();
this.drawLine.gc();
this.removedDrawArea();
this.removedMapInfo();
this.removedBg();
if ((this.cloudBg is RainCloud)){
this.removeRain();
};
this.removeEventListener(Event.ADDED, removed);
};
}
private function stopControlMap():void{
var _local1:KeyManager;
_local1 = KeyManager.getKeyManager();
_local1.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownEvent);
}
public function saveBallPosition():void{
this.preBallPos.setTo(this.ball.getX(), this.ball.getY());
this.preCloudPos.setTo(this.cloudBg.x, this.cloudBg.y);
}
public function stopDraw():void{
this.drawLine.stopDraw();
this.drawLine.removeEventListener(DrawLine.START_DRAW, startDrawEvent);
this.drawLine.removeEventListener(DrawLine.DRAW_COMPLETE, drawCompleteEvent);
this.drawLine.removeEventListener(DrawLine.LINE_CHANGE, lineChangeEvent);
}
public function showMapInfo():void{
this.mapInfo.visible = true;
}
private function removeOverboard():void{
this.removeChild(overboard);
this.overboard.removeEventListener(Overboard.PLAY_COMPLETE, overboardPlayComplete);
}
public function removedDrawArea():void{
this.drawArea.parent.removeChild(this.drawArea);
}
public function resetRole():void{
this.role.x = this.ball.getX();
this.role.y = this.ball.getY();
}
public function setGameInfo(_arg1:GameInfo):void{
this.gameInfo = _arg1;
}
private function strokeBallEvent(_arg1:Event):void{
var _local2:Number;
this.role.removeEventListener(Role.STROKE_BALL, strokeBallEvent);
this.setUsePar((this.getUsePar() + 1));
_local2 = Math.random();
if (_local2 < 0.3){
SoundManager.getInstance().play(SoundManager.HIT_BALL_1);
} else {
if (_local2 < 0.6){
SoundManager.getInstance().play(SoundManager.HIT_BALL_2);
} else {
SoundManager.getInstance().play(SoundManager.HIT_BALL_3);
};
};
this.startBallMove();
this.power = this.drawLine.getPower();
this.power.divEquals(7);
this.ball.addForce(this.power);
}
public function hideMapInfo():void{
this.mapInfo.visible = false;
}
public function getUsePar():int{
return (this.usePar);
}
public function setUsePar(_arg1:int):void{
this.usePar = _arg1;
this.mapInfo.setHits(this.usePar);
}
public function getFinalDisten():Number{
var _local1:Number;
_local1 = (Math.abs((this.preBallPos.x - this.hole.x)) / 10);
return (_local1);
}
public function hideAngle():void{
this.angle.visible = false;
}
public function hitSand():void{
var _local1:int;
var _local2:Sand;
_local1 = 0;
while (_local1 < this.sands.length) {
_local2 = this.sands[_local1];
if (this.ball.getDisplayObject().hitTestObject(_local2) == true){
_local2.playFog(this.ball.getX(), this.ball.getY());
return;
};
_local1++;
};
}
public function stopBallMove():void{
this.removeEventListener(Event.ENTER_FRAME, ballMoveEvent);
}
private function startControlMap():void{
var _local1:KeyManager;
_local1 = KeyManager.getKeyManager();
_local1.addEventListener(KeyboardEvent.KEY_DOWN, keyDownEvent);
}
public function removedBg():void{
this.parent.removeChild(this.bg);
}
public function startDraw():void{
this.startControlMap();
this.resetRole();
this.showAngle();
this.saveBallPosition();
this.drawLine.startDraw();
this.drawLine.addEventListener(DrawLine.START_DRAW, startDrawEvent);
this.drawLine.addEventListener(DrawLine.DRAW_COMPLETE, drawCompleteEvent);
this.drawLine.addEventListener(DrawLine.LINE_CHANGE, lineChangeEvent);
}
public function setPar(_arg1:int):void{
this.par = _arg1;
}
public function setGamePause(_arg1:Pause):void{
this.gamePause = _arg1;
}
public function getScore():int{
this.setScore((this.score - (this.usePar * this.sph)));
return (this.score);
}
private function addOverboard():void{
overboard.x = this.ball.getX();
overboard.y = this.ball.getY();
this.addChild(overboard);
this.overboard.play();
this.overboard.addEventListener(Overboard.PLAY_COMPLETE, overboardPlayComplete);
}
public function startBallMove():void{
this.stopCount = 0;
this.ball.hideSeat();
this.addEventListener(Event.ENTER_FRAME, ballMoveEvent);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.showStartArea();
this.setBg();
this.addMapInfo();
this.addDrawArea();
this.startDraw();
if ((this.cloudBg is RainCloud)){
this.addRain();
};
this.addEventListener(Event.REMOVED, removed);
};
}
private function init():void{
var _local1:int;
var _local2:DisplayObject;
this.drawLine = new DrawLine();
this.mapInfo = new MapInfo();
this.drawArea = new DrawArea();
this.overboard = new Overboard();
this.rain = new Rain();
this.par = 0;
this.usePar = 0;
this.preBallPos = new Vector();
this.preCloudPos = new Vector();
this.sands = new Array();
this.stopCount = 0;
_local1 = 0;
while (_local1 < this.numChildren) {
_local2 = this.getChildAt(_local1);
if ((_local2 is Role)){
this.role = Role(_local2);
} else {
if ((_local2 is GolfBall)){
this.ball = GolfBall(_local2);
} else {
if ((_local2 is Angle)){
this.angle = Angle(_local2);
} else {
if ((_local2 is Bg)){
this.bg = Bg(_local2);
} else {
if ((_local2 is ForwardBg)){
this.forwardBg = ForwardBg(_local2);
} else {
if ((_local2 is Ground)){
this.ground = Ground(_local2);
} else {
if ((_local2 is Hole)){
this.hole = Hole(_local2);
} else {
if ((((_local2 is SunCloud)) || ((_local2 is RainCloud)))){
this.cloudBg = MovieClip(_local2);
} else {
if ((_local2 is Sand)){
this.sands.push(Sand(_local2));
};
};
};
};
};
};
};
};
};
_local1++;
};
APEngine.init();
APEngine.addMasslessForce(new Vector(0, 10));
APEngine.container = this;
APEngine.addGroup(this.ground.getGroup());
APEngine.addGroup(this.ball.getGroup());
this.ground.getGroup().addCollidable(this.ball.getGroup());
}
public function lose():void{
this.dispatchEvent(new Event(Map.LOSE));
}
private function mapMove():void{
if (this.ball.getX() > Math.abs(((GameWorld.MAP_WIDTH / 2) - 50))){
this.x = (((GameWorld.MAP_WIDTH / 2) - 50) - this.ball.getX());
this.cloudBg.x = (this.cloudBg.x + (this.ball.getSpeed().x * 0.6));
} else {
this.x = GameWorld.MAP_X;
};
if (this.ball.getY() < (GameWorld.MAP_HEIGHT / 2)){
this.y = ((GameWorld.MAP_HEIGHT / 2) - this.ball.getY());
this.cloudBg.y = (this.cloudBg.y + (this.ball.getSpeed().y * 0.6));
};
}
public function setScore(_arg1:int):void{
if (_arg1 < 0){
_arg1 = 0;
};
this.score = _arg1;
}
private function hitWater():Boolean{
var _local1:Array;
var _local2:int;
_local1 = this.ground.getWaters();
_local2 = 0;
while (_local2 < _local1.length) {
if (this.ball.getDisplayObject().hitTestObject(_local1[_local2]) == true){
return (true);
};
_local2++;
};
return (false);
}
public function getPar():int{
return (this.par);
}
private function keyDownEvent(_arg1:KeyboardEvent):void{
var _local2:StartLine;
var _local3:EndLine;
var _local4:Number;
if (_arg1.keyCode == Keyboard.LEFT){
if ((this.x + 20) < 0){
this.x = (this.x + 20);
};
} else {
if (_arg1.keyCode == Keyboard.RIGHT){
_local2 = this.ground.getStartLine();
_local3 = this.ground.getEndLine();
_local4 = (_local3.x - _local2.x);
if (((this.x + _local4) + 20) > GameWorld.MAP_WIDTH){
this.x = (this.x - 20);
};
};
};
}
private function startDrawEvent(_arg1:Event):void{
this.stopControlMap();
this.mapMove();
this.role.startSwing();
}
public function setFriction(_arg1:Number):void{
}
public function showStartArea():void{
var _local1:int;
var _local2:int;
this.startArea = new StartArea();
this.startArea.x = this.role.x;
this.startArea.y = this.role.y;
_local1 = this.getChildIndex(this.role);
this.addChildAt(this.startArea, (_local1 - 1));
_local2 = ((this.hole.x - this.ball.x) / 10);
this.startArea.setInfo(this.gameInfo.getLevel(), this.par, _local2);
}
public function removedMapInfo():void{
this.mapInfo.parent.removeChild(this.mapInfo);
}
public function setViscosity(_arg1:Number):void{
}
public function addDrawArea():void{
this.parent.addChild(this.drawArea);
this.drawLine.setDrawArea(this.drawArea);
}
private function enterHole():Boolean{
var _local1:Number;
if (this.hole.hitTestObject(this.ball.getDisplayObject()) == true){
_local1 = Math.random();
if (_local1 < 0.5){
SoundManager.getInstance().play(SoundManager.IN_HOLE_2);
} else {
SoundManager.getInstance().play(SoundManager.IN_HOLE_1);
};
return (true);
};
return (false);
}
public function addRain():void{
this.parent.addChild(this.rain);
}
public function showAngle():void{
this.angle.visible = true;
this.angle.x = this.ball.getX();
this.angle.y = this.ball.getY();
}
public function setSph(_arg1:int):void{
this.sph = _arg1;
}
public function resetBall():void{
if (this.preBallPos != null){
this.ball.setX(this.preBallPos.x);
this.ball.setY(this.preBallPos.y);
this.cloudBg.x = this.preCloudPos.x;
this.cloudBg.y = this.preCloudPos.y;
};
}
private function drawCompleteEvent(_arg1:Event):void{
this.stopDraw();
this.hideAngle();
this.role.playStroke();
this.role.addEventListener(Role.STROKE_BALL, strokeBallEvent);
}
}
}//package game.maps
Section 52
//Map1 (game.maps.Map1)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map1 extends Map {
public var cloudBgMc:SunCloud;
public function Map1(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
this.setPar(3);
this.setScore(1000);
this.setSph(200);
}
}
}//package game.maps
Section 53
//Map10 (game.maps.Map10)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map10 extends Map {
public var cloudBgMc:SunCloud;
public function Map10(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(5);
this.setScore(5000);
this.setSph(400);
}
}
}//package game.maps
Section 54
//Map11 (game.maps.Map11)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map11 extends Map {
public var cloudBgMc:SunCloud;
public function Map11(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(4);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 55
//Map12 (game.maps.Map12)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map12 extends Map {
public var cloudBgMc:SunCloud;
public function Map12(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(5);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 56
//Map13 (game.maps.Map13)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map13 extends Map {
public var cloudBgMc:SunCloud;
public function Map13(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(6);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 57
//Map14 (game.maps.Map14)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map14 extends Map {
public var cloudBgMc:SunCloud;
public function Map14(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(6);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 58
//Map15 (game.maps.Map15)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map15 extends Map {
public var cloudBgMc:SunCloud;
public function Map15(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(7);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 59
//Map16 (game.maps.Map16)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map16 extends Map {
public var cloudBgMc:SunCloud;
public function Map16(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(4);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 60
//Map17 (game.maps.Map17)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map17 extends Map {
public var cloudBgMc:SunCloud;
public function Map17(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(6);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 61
//Map18 (game.maps.Map18)
package game.maps {
import mypkg.*;
import main.*;
public class Map18 extends Map {
public function Map18(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
this.setViscosity(0.3);
this.setFriction(0.3);
super.setPar(8);
this.setScore(8000);
this.setSph(700);
}
}
}//package game.maps
Section 62
//Map2 (game.maps.Map2)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map2 extends Map {
public var cloudBgMc:SunCloud;
public function Map2(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
this.setPar(3);
this.setScore(1000);
this.setSph(200);
}
}
}//package game.maps
Section 63
//Map3 (game.maps.Map3)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map3 extends Map {
public var cloudBgMc:SunCloud;
public function Map3(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
this.setPar(3);
this.setScore(1000);
this.setSph(200);
}
}
}//package game.maps
Section 64
//Map4 (game.maps.Map4)
package game.maps {
import mypkg.*;
import main.*;
public class Map4 extends Map {
public function Map4(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
this.setViscosity(0.3);
this.setFriction(0.3);
this.setPar(6);
this.setScore(6000);
this.setSph(500);
}
}
}//package game.maps
Section 65
//Map5 (game.maps.Map5)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map5 extends Map {
public var cloudBgMc:SunCloud;
public function Map5(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(5);
this.setScore(5000);
this.setSph(400);
}
}
}//package game.maps
Section 66
//Map6 (game.maps.Map6)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map6 extends Map {
public var cloudBgMc:SunCloud;
public function Map6(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(4);
this.setScore(5000);
this.setSph(400);
}
}
}//package game.maps
Section 67
//Map7 (game.maps.Map7)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map7 extends Map {
public var cloudBgMc:SunCloud;
public function Map7(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(4);
this.setScore(6000);
this.setSph(500);
}
}
}//package game.maps
Section 68
//Map8 (game.maps.Map8)
package game.maps {
import mypkg.*;
import main.*;
import game.map.*;
public class Map8 extends Map {
public var cloudBgMc:SunCloud;
public function Map8(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
super.setPar(4);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 69
//Map9 (game.maps.Map9)
package game.maps {
import mypkg.*;
import main.*;
public class Map9 extends Map {
public function Map9(_arg1:GameInfo, _arg2:Pause){
super(_arg1, _arg2);
this.setViscosity(0.3);
this.setFriction(0.3);
this.setBallMass(2);
super.setPar(6);
this.setScore(7000);
this.setSph(600);
}
}
}//package game.maps
Section 70
//MapsManager (game.maps.MapsManager)
package game.maps {
import flash.utils.*;
public class MapsManager {
private var maps:Array;
public function MapsManager(){
this.maps = new Array();
this.maps[0] = getQualifiedClassName(Map1);
this.maps[1] = getQualifiedClassName(Map5);
this.maps[2] = getQualifiedClassName(Map10);
this.maps[3] = getQualifiedClassName(Map4);
this.maps[4] = getQualifiedClassName(Map2);
this.maps[5] = getQualifiedClassName(Map14);
this.maps[6] = getQualifiedClassName(Map7);
this.maps[7] = getQualifiedClassName(Map8);
this.maps[8] = getQualifiedClassName(Map9);
this.maps[9] = getQualifiedClassName(Map3);
this.maps[10] = getQualifiedClassName(Map11);
this.maps[11] = getQualifiedClassName(Map12);
this.maps[12] = getQualifiedClassName(Map13);
this.maps[13] = getQualifiedClassName(Map6);
this.maps[14] = getQualifiedClassName(Map15);
this.maps[15] = getQualifiedClassName(Map16);
this.maps[16] = getQualifiedClassName(Map17);
this.maps[17] = getQualifiedClassName(Map18);
}
public function getIndexMap(_arg1:int):Class{
var _local2:Class;
_local2 = (getDefinitionByName(this.maps[_arg1]) as Class);
return (_local2);
}
public function getMapsNum():int{
return (this.maps.length);
}
}
}//package game.maps
Section 71
//Angle (game.roles.Angle)
package game.roles {
import flash.display.*;
public class Angle extends MovieClip {
public function setAngle(_arg1:Number):void{
this.rotation = _arg1;
}
}
}//package game.roles
Section 72
//DrawLine (game.roles.DrawLine)
package game.roles {
import org.cove.ape.*;
import flash.display.*;
import flash.events.*;
import game.map.*;
public class DrawLine extends EventDispatcher {
private var power:Vector;
private var lineLen:Number;
private var lenMax:Number;
private var powerShow:PowerShow;
private var startX:Number;
private var startY:Number;
private var endX:Number;
private var endY:Number;
private var angleShow:AngleShow;
private var drawArea:MovieClip;
private var k:Number;
private var r:Number;
public static const START_DRAW:String = " start draw.";
public static const DRAW_COMPLETE:String = " draw complete.";
public static const LINE_CHANGE:String = " line change.";
public function DrawLine(_arg1:MovieClip=null):void{
this.drawArea = _arg1;
this.lineLen = 0;
this.r = 0;
this.lenMax = 240;
this.k = (200 / this.lenMax);
this.power = new Vector();
this.angleShow = new AngleShow();
this.powerShow = new PowerShow();
}
public function setAngle(_arg1:Number):void{
if ((((_arg1 > 0)) && ((_arg1 <= 90)))){
_arg1 = 0;
} else {
if (_arg1 > 90){
_arg1 = -180;
};
};
this.r = _arg1;
_arg1 = (_arg1 * -1);
this.angleShow.text = _arg1.toString();
}
public function getlineLen():Number{
return (this.lineLen);
}
private function drawingEvent(_arg1:MouseEvent):void{
if ((((((((_arg1.localX > 0)) && ((_arg1.localX < this.drawArea.width)))) && ((_arg1.localY > 0)))) && ((_arg1.localY < this.drawArea.height)))){
this.endX = _arg1.localX;
this.endY = _arg1.localY;
this.drawing(this.startX, this.startY, this.endX, this.endY);
this.showAngleAndPower();
} else {
this.stopDraw();
};
}
public function getAngle():Number{
return (this.r);
}
public function drawing(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Graphics;
_local5 = (_arg1 - _arg3);
_local6 = (_arg2 - _arg4);
_local7 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
if (_local7 > this.lenMax){
_arg3 = (_arg1 - ((this.lenMax * _local5) / _local7));
_arg4 = (_arg2 - ((this.lenMax * _local6) / _local7));
_local7 = this.lenMax;
};
_local8 = ((Math.atan2(_local6, _local5) * 180) / Math.PI);
this.setAngle(_local8);
this.setLineLen(_local7);
_local9 = this.drawArea.graphics;
_local9.clear();
_local9.lineStyle(1, 0);
_local9.moveTo(_arg1, _arg2);
_local9.lineTo(_arg3, _arg4);
this.power.setTo(((_arg1 - _arg3) * this.k), ((_arg2 - _arg4) * this.k));
}
public function setLineLen(_arg1:Number):void{
this.lineLen = (_arg1 * this.k);
this.powerShow.text = this.lineLen.toString();
this.dispatchEvent(new Event(DrawLine.LINE_CHANGE));
}
public function hideAngleAndPower():void{
this.angleShow.visible = false;
this.powerShow.visible = false;
}
public function getPower():Vector{
return (this.power);
}
public function startDraw(_arg1:MovieClip=null):void{
if (_arg1 != null){
this.setDrawArea(_arg1);
};
this.drawArea.addEventListener(MouseEvent.MOUSE_DOWN, startDrawEvent);
}
public function getDir():int{
if (this.startX < this.endX){
return (1);
};
if (this.startX > this.endX){
return (-1);
};
return (1);
}
private function stopDrawEvent(_arg1:MouseEvent):void{
this.stopDraw();
this.hideAngleAndPower();
this.dispatchEvent(new Event(DrawLine.DRAW_COMPLETE));
}
public function gc():void{
this.stopDraw();
}
public function stopDraw():void{
this.drawArea.graphics.clear();
this.drawArea.removeEventListener(MouseEvent.MOUSE_DOWN, startDrawEvent);
this.drawArea.removeEventListener(MouseEvent.MOUSE_MOVE, drawingEvent);
this.drawArea.removeEventListener(MouseEvent.MOUSE_UP, stopDrawEvent);
}
public function showAngleAndPower():void{
this.powerShow.x = this.endX;
this.powerShow.y = this.endY;
this.powerShow.visible = true;
this.angleShow.x = this.startX;
this.angleShow.y = this.startY;
this.angleShow.visible = true;
}
private function startDrawEvent(_arg1:MouseEvent):void{
this.lineLen = 0;
this.startX = _arg1.localX;
this.startY = _arg1.localY;
this.dispatchEvent(new Event(DrawLine.START_DRAW));
this.drawArea.addEventListener(MouseEvent.MOUSE_MOVE, drawingEvent);
this.drawArea.addEventListener(MouseEvent.MOUSE_UP, stopDrawEvent);
}
public function setDrawArea(_arg1:MovieClip):void{
var _local2:int;
this.drawArea = _arg1;
_local2 = this.drawArea.parent.getChildIndex(this.drawArea);
this.drawArea.parent.addChildAt(this.angleShow, _local2);
this.drawArea.parent.addChildAt(this.powerShow, _local2);
this.hideAngleAndPower();
}
}
}//package game.roles
Section 73
//Role (game.roles.Role)
package game.roles {
import flash.display.*;
import flash.events.*;
import mypkg.*;
public class Role extends MovieClip {
private var swingLeft:Swing;
public var swingMc:SwingLeft;
private var swingRight:Swing;
private var showObject:Swing;
private var angle:Number;
public static const STROKE_BALL:String = " stroke ball.";
public function Role(){
this.init();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
};
}
private function playCompleteEvent(_arg1:Event):void{
this.dispatchEvent(new Event(PlayComplete.PALY_COMPLETE));
this.showObject.removeEventListener(McPlayer.PLAY_COMPLETE, playCompleteEvent);
}
private function init():void{
var _local1:int;
var _local2:DisplayObject;
_local1 = 0;
while (_local1 < this.numChildren) {
_local2 = this.getChildAt(_local1);
if ((_local2 is SwingLeft)){
this.swingLeft = Swing(_local2);
} else {
if ((_local2 is SwingRight)){
this.swingRight = Swing(_local2);
};
};
_local1++;
};
this.hideAll();
this.showObject = this.swingRight;
this.showObject.visible = true;
}
public function getPower():Number{
return (this.showObject.getPower());
}
private function strokeBallEvent(_arg1:Event):void{
this.dispatchEvent(new Event(Role.STROKE_BALL));
this.showObject.removeEventListener(Role.STROKE_BALL, strokeBallEvent);
}
public function setAngle(_arg1:Number):void{
this.angle = _arg1;
}
public function setShowObject(_arg1:Swing):void{
this.showObject.visible = false;
this.showObject = _arg1;
this.showObject.visible = true;
}
public function playStroke():void{
this.showObject.playStroke();
this.showObject.addEventListener(Role.STROKE_BALL, strokeBallEvent);
this.showObject.addEventListener(McPlayer.PLAY_COMPLETE, playCompleteEvent);
}
public function startSwing():void{
this.showObject.startSwing();
}
public function setPower(_arg1:Number):void{
this.showObject.setPower(_arg1);
}
public function setDir(_arg1:int):void{
if (_arg1 == -1){
this.setShowObject(this.swingLeft);
} else {
if (_arg1 == 1){
this.setShowObject(this.swingRight);
};
};
}
private function hideAll():void{
this.swingLeft.visible = false;
this.swingRight.visible = false;
}
}
}//package game.roles
Section 74
//Swing (game.roles.Swing)
package game.roles {
import flash.display.*;
import flash.events.*;
import mypkg.*;
public class Swing extends MovieClip {
private var swing:MovieClip;
private var powerMax:Number;
private var power:Number;
private var swingFrames:int;
private var rate:Number;
private var player:McPlayer;
public function Swing(){
this.swing = MovieClip(this.getChildAt(0));
this.swing.stop();
this.power = 0;
this.powerMax = 200;
this.swingFrames = 10;
this.player = new McPlayer(this.swing);
}
private function playCompleteEvent(_arg1:Event):void{
this.swing.stop();
this.dispatchEvent(new Event(McPlayer.PLAY_COMPLETE));
this.player.removeEventListener(McPlayer.PLAY_COMPLETE, playCompleteEvent);
}
public function getPower():Number{
return (this.power);
}
private function strokeBallEvent(_arg1:Event):void{
this.dispatchEvent(new Event(Role.STROKE_BALL));
}
public function playStroke():void{
var _local1:int;
if (this.power < 60){
this.rate = ((this.swing.totalFrames - this.swingFrames) / this.powerMax);
_local1 = ((this.power * this.rate) + this.swingFrames);
this.player.setToFrame(_local1);
this.player.setPlayTime(0.35);
} else {
this.player.setToFrame(this.swing.totalFrames);
this.player.setPlayTime(0.2);
};
this.player.setFrameEvent(this.swingFrames);
this.player.play();
this.player.addEventListener(McPlayer.PLAY_COMPLETE, playCompleteEvent);
this.player.addEventListener(McPlayer.FRAME_EVENT, strokeBallEvent);
}
public function startSwing():void{
this.swing.gotoAndStop(this.swingFrames);
}
public function setPower(_arg1:Number):void{
var _local2:int;
this.rate = (this.swingFrames / this.powerMax);
if (_arg1 > this.powerMax){
_arg1 = this.powerMax;
};
this.power = _arg1;
_local2 = (this.swingFrames - (_arg1 * this.rate));
this.swing.gotoAndStop(_local2);
}
}
}//package game.roles
Section 75
//SwingLeft (game.roles.SwingLeft)
package game.roles {
public class SwingLeft extends Swing {
}
}//package game.roles
Section 76
//SwingRight (game.roles.SwingRight)
package game.roles {
public class SwingRight extends Swing {
}
}//package game.roles
Section 77
//all_mc_12 (golfman_up_fla.all_mc_12)
package golfman_up_fla {
import flash.display.*;
public dynamic class all_mc_12 extends MovieClip {
public function all_mc_12(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package golfman_up_fla
Section 78
//BestBtnMc_362 (golfman_up_fla.BestBtnMc_362)
package golfman_up_fla {
import flash.display.*;
public dynamic class BestBtnMc_362 extends MovieClip {
public function BestBtnMc_362(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package golfman_up_fla
Section 79
//frame_15 (golfman_up_fla.frame_15)
package golfman_up_fla {
import flash.display.*;
public dynamic class frame_15 extends MovieClip {
public function frame_15(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
}
}
}//package golfman_up_fla
Section 80
//HighBtnMc_360 (golfman_up_fla.HighBtnMc_360)
package golfman_up_fla {
import flash.display.*;
public dynamic class HighBtnMc_360 extends MovieClip {
public function HighBtnMc_360(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package golfman_up_fla
Section 81
//loading_10 (golfman_up_fla.loading_10)
package golfman_up_fla {
import flash.display.*;
public dynamic class loading_10 extends MovieClip {
public function loading_10(){
addFrameScript(134, frame135);
}
function frame135(){
stop();
(root as MovieClip).play();
}
}
}//package golfman_up_fla
Section 82
//loading_3 (golfman_up_fla.loading_3)
package golfman_up_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.media.*;
import loading.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class loading_3 extends MovieClip {
public var txt:LoadingTxt;
public var loading_text_mc:MovieClip;
public function loading_3(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 38, frame39);
}
function frame3(){
this.visible = true;
}
function frame1(){
}
function frame2(){
(parent as MovieClip).checkGoNext();
}
function frame39(){
stop();
txt.onLoadComplete = (parent as MovieClip).goNext;
loading_text_mc.txt.text = "Loading...";
}
}
}//package golfman_up_fla
Section 83
//loading_8 (golfman_up_fla.loading_8)
package golfman_up_fla {
import flash.display.*;
import ui.*;
public dynamic class loading_8 extends MovieClip {
public var txt:Txt;
}
}//package golfman_up_fla
Section 84
//LowBtnMc_356 (golfman_up_fla.LowBtnMc_356)
package golfman_up_fla {
import flash.display.*;
public dynamic class LowBtnMc_356 extends MovieClip {
public function LowBtnMc_356(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package golfman_up_fla
Section 85
//MainTimeline (golfman_up_fla.MainTimeline)
package golfman_up_fla {
import flash.display.*;
import main.*;
import mochi.as3.*;
import loading.*;
import flash.utils.*;
public dynamic class MainTimeline extends MovieClip {
public var prevLoader:PrevLoader;
public var __setPropDict:Dictionary;
public var m:Main;
public function MainTimeline(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
m = Main.getInstance();
addChild(m);
stage.scaleMode = StageScaleMode.NO_SCALE;
stop();
}
function frame1(){
if ((((__setPropDict[prevLoader] == undefined)) || (!((int(__setPropDict[prevLoader]) == 1))))){
__setPropDict[prevLoader] = currentFrame;
__setProp_prevLoader__1();
};
MochiAd.showPreGameAd({clip:this, ad_finished:PrevLoader.goNext2, id:"3a06ddfff68ad743", res:"680x500", background:6845841, color:788068, outline:12695210, no_bg:false});
}
function __setProp_prevLoader__1(){
try {
prevLoader["componentInspectorSetting"] = true;
} catch(e:Error) {
};
prevLoader.protection = false;
prevLoader.skip = false;
try {
prevLoader["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package golfman_up_fla
Section 86
//map_frame_144 (golfman_up_fla.map_frame_144)
package golfman_up_fla {
import flash.display.*;
public dynamic class map_frame_144 extends MovieClip {
public function map_frame_144(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
}
}
}//package golfman_up_fla
Section 87
//MediumBtnMc_358 (golfman_up_fla.MediumBtnMc_358)
package golfman_up_fla {
import flash.display.*;
public dynamic class MediumBtnMc_358 extends MovieClip {
public function MediumBtnMc_358(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package golfman_up_fla
Section 88
//MusicBtnMc_370 (golfman_up_fla.MusicBtnMc_370)
package golfman_up_fla {
import flash.display.*;
public dynamic class MusicBtnMc_370 extends MovieClip {
public function MusicBtnMc_370(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package golfman_up_fla
Section 89
//PauseBtnMc_366 (golfman_up_fla.PauseBtnMc_366)
package golfman_up_fla {
import flash.display.*;
public dynamic class PauseBtnMc_366 extends MovieClip {
public function PauseBtnMc_366(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package golfman_up_fla
Section 90
//playBtn_308 (golfman_up_fla.playBtn_308)
package golfman_up_fla {
import flash.display.*;
public dynamic class playBtn_308 extends MovieClip {
public function playBtn_308(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package golfman_up_fla
Section 91
//pqsmmFrame_365 (golfman_up_fla.pqsmmFrame_365)
package golfman_up_fla {
import flash.display.*;
public dynamic class pqsmmFrame_365 extends MovieClip {
public var qualityMc:MovieClip;
public var soundMc:MovieClip;
public var remainMc:MovieClip;
public var pauseMc:MovieClip;
public var musicMc:MovieClip;
}
}//package golfman_up_fla
Section 92
//result_card_mouse_over_area_77 (golfman_up_fla.result_card_mouse_over_area_77)
package golfman_up_fla {
import flash.display.*;
public dynamic class result_card_mouse_over_area_77 extends MovieClip {
public function result_card_mouse_over_area_77(){
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package golfman_up_fla
Section 93
//shouye_318 (golfman_up_fla.shouye_318)
package golfman_up_fla {
import flash.display.*;
import flash.events.*;
public dynamic class shouye_318 extends MovieClip {
public function shouye_318(){
addFrameScript(141, frame142);
}
function frame142(){
stop();
this.dispatchEvent(new Event(" play complete."));
}
}
}//package golfman_up_fla
Section 94
//shuihua_87 (golfman_up_fla.shuihua_87)
package golfman_up_fla {
import flash.display.*;
public dynamic class shuihua_87 extends MovieClip {
public function shuihua_87(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package golfman_up_fla
Section 95
//SoundBtnMc_367 (golfman_up_fla.SoundBtnMc_367)
package golfman_up_fla {
import flash.display.*;
public dynamic class SoundBtnMc_367 extends MovieClip {
public function SoundBtnMc_367(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package golfman_up_fla
Section 96
//stage_Frame_14 (golfman_up_fla.stage_Frame_14)
package golfman_up_fla {
import flash.display.*;
public dynamic class stage_Frame_14 extends MovieClip {
public function stage_Frame_14(){
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package golfman_up_fla
Section 97
//Version_329 (golfman_up_fla.Version_329)
package golfman_up_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Version_329 extends MovieClip {
public var version:TextField;
}
}//package golfman_up_fla
Section 98
//LoadingTxt (loading.LoadingTxt)
package loading {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class LoadingTxt extends Sprite {
private var txt;
public var onLoadComplete:Function;
public function LoadingTxt(){
onLoadComplete = function ():void{
};
super();
txt = this.getChildAt(0);
txt.autoSize = "center";
this.addEventListener(Event.ENTER_FRAME, run);
this.addEventListener(Event.ADDED_TO_STAGE, added);
}
private function added(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, added);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
}
private function removed(_arg1:Event):void{
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
onLoadComplete = null;
}
private function run(_arg1:Event):void{
var _local2:int;
_local2 = ((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100);
txt.text = (_local2 + "%");
if (_local2 == 100){
this.removeEventListener(Event.ENTER_FRAME, run);
onLoadComplete();
};
}
}
}//package loading
Section 99
//PrevLoader (loading.PrevLoader)
package loading {
import flash.display.*;
import ui.*;
public class PrevLoader extends MovieClip {
public var protection:Boolean;// = true
public var maskRect:MaskRect;
public static var prevLoader:PrevLoader;
public function PrevLoader(){
protection = true;
super();
prevLoader = this;
stage.showDefaultContextMenu = false;
stop();
(root as MovieClip).stop();
MaskRect.setPos(maskRect, setPos);
__setProp_maskRect_loading_1();
}
public function set skip(_arg1:Boolean):void{
if (_arg1){
Common.stopAll(this);
(root as MovieClip).play();
trace("skip");
this.visible = false;
};
}
private function isInUrlFront(_arg1:String):Boolean{
var _local2:String;
_local2 = this.loaderInfo.url;
_local2.toLowerCase();
_arg1.toLowerCase();
return ((_local2.indexOf(_arg1) == 0));
}
public function checkGoNext():void{
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
goNext();
};
}
public function goNext():void{
if (((root as MovieClip)._mochiad is MovieClip)){
} else {
goNext2();
};
}
public function goNext2():void{
if (protection){
if (((isIn("freeworldgroup.com")) || (isIn("ifungames.com")))){
this.gotoAndStop(3);
} else {
this.gotoAndStop(2);
};
} else {
this.gotoAndStop(3);
};
prevLoader = null;
}
private function setPos(_arg1:int, _arg2:int):void{
this.x = (_arg1 / 2);
this.y = (_arg2 / 2);
}
function __setProp_maskRect_loading_1(){
try {
maskRect["componentInspectorSetting"] = true;
} catch(e:Error) {
};
maskRect.align = "center-middle";
try {
maskRect["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
private function isIn(_arg1:String):Boolean{
return (((((((isInUrlFront(_arg1)) || (isInUrlFront(("http://" + _arg1))))) || (isInUrlFront(("http://www." + _arg1))))) || (isInUrlFront(("www." + _arg1)))));
}
public static function goNext():void{
if (prevLoader){
prevLoader.goNext();
};
}
public static function goNext2():void{
prevLoader.goNext2();
}
}
}//package loading
Section 100
//GameInfo (main.GameInfo)
package main {
import flash.events.*;
public class GameInfo extends EventDispatcher {
private var level:int;
private var money:int;
private var score:int;
private var mapIndex:int;
public static const LEVEL_CHANGE:String = " level change.";
public static const SCORE_CHANGE:String = " score change.";
public static const MONEY_CHANGE:String = " money change.";
public function GameInfo(){
this.init();
}
public function setLevel(_arg1:int):void{
this.level = _arg1;
this.dispatchEvent(new Event(GameInfo.LEVEL_CHANGE));
}
public function getMapIndex():int{
return (this.mapIndex);
}
private function init():void{
this.setMapIndex(0);
this.setScore(0);
this.setMoney(0);
this.setLevel(0);
}
public function setScore(_arg1:int):void{
if (_arg1 < 0){
_arg1 = 0;
};
this.score = _arg1;
this.dispatchEvent(new Event(GameInfo.SCORE_CHANGE));
}
public function getMoney():int{
return (this.money);
}
public function getScore():int{
return (this.score);
}
public function getLevel():int{
return (this.level);
}
public function addMoney(_arg1:int):void{
this.setMoney((this.getMoney() + _arg1));
}
public function setMapIndex(_arg1:int):void{
this.mapIndex = _arg1;
}
public function addScore(_arg1:int):void{
this.setScore((this.getScore() + _arg1));
}
public function setMoney(_arg1:int):void{
if (_arg1 < 0){
_arg1 = 0;
};
this.money = _arg1;
this.dispatchEvent(new Event(GameInfo.MONEY_CHANGE));
}
public function levelUp():void{
this.setLevel((this.getLevel() + 1));
}
}
}//package main
Section 101
//GameWorld (main.GameWorld)
package main {
import sound.*;
import flash.display.*;
import flash.events.*;
import mypkg.*;
import game.map.*;
import game.maps.*;
import flash.text.*;
import menu.*;
import flash.utils.*;
public class GameWorld extends MovieClip {
private var endPage:EndPage;
public var middleMc:MovieClip;
private var bottom:MovieClip;
private var score:TextField;
public var scoreTf:TextField;
private var upper:MovieClip;
private var resultCard:ResultCard;
private var testLose:MovieClip;
private var money:TextField;
public var showResultCardMc:MovieClip;
private var passLevelPage:PassLevelPage;
public var levelTf:TextField;
public var bottomMc:MovieClip;
private var endTimer:Timer;
private var mapsManager:MapsManager;
private var choosePage:ChoosePage;
private var losePage:LosePage;
private var map:Map;
private var showResult:MovieClip;
private var level:TextField;
public var passMc:MovieClip;
public var loseMc:MovieClip;
private var middle:MovieClip;
private var pqsmm:PQSMM;
private var testPass:MovieClip;
private var gameInfo:GameInfo;
public var upperMc:MovieClip;
private var pause:Pause;
public static const MAP_WIDTH:Number = 680;
public static const NORMAL:int = 2;
public static const RETRY:String = " retry game.";
public static const EASY:int = 1;
public static const HARD:int = 3;
public static const MAP_HEIGHT:Number = 500;
public static const MAP_X:Number = 0;
public static const MAP_Y:Number = 0;
public static var DIFFICULTY:int = 1;
public function GameWorld(){
this.init();
this.addEventListener(Event.ADDED, added);
}
private function showLoseEvent(_arg1:Event):void{
this.removeMap();
this.showLosePage();
this.stopLose();
}
private function testLoseEvent(_arg1:MouseEvent):void{
this.startLose();
}
public function pass():void{
this.setResult();
this.gameInfo.addScore(this.map.getScore());
this.gameInfo.addScore(((this.map.getPar() - this.map.getUsePar()) * 100));
if ((this.gameInfo.getMapIndex() + 1) < this.mapsManager.getMapsNum()){
this.startShowPassLevelPage();
} else {
this.startShowEndPage();
};
}
private function chooseCompleteEvent(_arg1:Event):void{
this.hideChoosePage();
this.gameInfo.setLevel(1);
this.showMap(this.gameInfo.getMapIndex());
}
public function showChoosePage():void{
this.hideText();
if (this.choosePage == null){
this.choosePage = new ChoosePage();
this.choosePage.setGameInfo(this.gameInfo);
this.addChildToDepth(this.choosePage, 3);
this.choosePage.addEventListener(ChoosePage.CHOOSE_COMPLETE, chooseCompleteEvent);
};
}
private function toNextLevelEvent(_arg1:Event):void{
this.removeMap();
this.goNextLevel();
this.hidePassLevelPage();
}
public function hideChoosePage():void{
if (this.choosePage != null){
this.removeChildFromDepth(this.choosePage, 3);
this.choosePage.removeEventListener(ChoosePage.CHOOSE_COMPLETE, chooseCompleteEvent);
this.choosePage = null;
};
}
public function stopLose():void{
this.endTimer.stop();
this.endTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, showLoseEvent);
this.pause.removeEventListener(Pause.PAUSE, endPauseEvent);
this.pause.removeEventListener(Pause.RUN, endRunEvent);
}
public function removeMap():void{
if (this.map != null){
this.removeChildFromDepth(this.map, 2);
this.map.removeEventListener(Map.PASS, passEvent);
this.map.removeEventListener(Map.LOSE, loseEvent);
this.map = null;
this.pqsmm.hide();
this.hideText();
this.hideTest();
};
}
public function goNextLevel():void{
this.gameInfo.levelUp();
this.gameInfo.setMapIndex((this.gameInfo.getMapIndex() + 1));
this.showMap(this.gameInfo.getMapIndex());
}
public function showEndPage():void{
this.hideMap();
this.resultCard.show();
this.resultCard.setScore(this.gameInfo.getScore());
if (this.endPage == null){
this.endPage = new EndPage();
this.endPage.setScore(this.gameInfo.getScore());
this.endPage.setCardScore(this.resultCard.getHitTotal());
this.endPage.setResult(this.resultCard.getDP());
this.addChildToDepth(this.endPage, 2);
this.endPage.addEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.endPage.addEventListener(EndPage.SHOW_RESULT_CARD, showResultCardEvent);
};
}
public function addResultCard():void{
this.addChildToDepth(this.resultCard, 3);
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.removeMap();
this.hideLosePage();
this.hideEndPage();
this.gameInfo.removeEventListener(GameInfo.SCORE_CHANGE, scoreChangeEvent);
this.gameInfo.removeEventListener(GameInfo.LEVEL_CHANGE, levelChangeEvent);
this.pqsmm.removeEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.stopShowEndPage();
this.stopLose();
this.removeEventListener(Event.ADDED, added);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
public function hideEndPage():void{
if (this.endPage != null){
this.removeChildFromDepth(this.endPage, 2);
this.endPage.removeEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.endPage.removeEventListener(EndPage.SHOW_RESULT_CARD, showResultCardEvent);
this.endPage = null;
};
}
private function showPassLevelPageEvent(_arg1:TimerEvent):void{
SoundManager.getInstance().play(SoundManager.SUCCESS);
this.showPassLevelPage();
this.stopShowPassLevelPage();
}
public function setLevel(_arg1:int):void{
this.level.text = ("HOLE: " + _arg1);
}
private function showEndPageEvent(_arg1:TimerEvent):void{
SoundManager.getInstance().play(SoundManager.SUCCESS);
this.showEndPage();
this.stopShowEndPage();
}
private function showResultBtn():void{
this.showResult.visible = true;
this.showResult.addEventListener(MouseEvent.CLICK, showResultCardEvent);
}
private function loseEvent(_arg1:Event):void{
this.startLose();
}
public function startLose():void{
this.endTimer.reset();
this.endTimer.start();
this.endTimer.addEventListener(TimerEvent.TIMER_COMPLETE, showLoseEvent);
this.pause.addEventListener(Pause.PAUSE, endPauseEvent);
}
public function startShowEndPage():void{
this.endTimer.reset();
this.endTimer.start();
this.endTimer.addEventListener(TimerEvent.TIMER_COMPLETE, showEndPageEvent);
this.pause.addEventListener(Pause.PAUSE, endPauseEvent);
}
private function levelChangeEvent(_arg1:Event):void{
this.setLevel(this.gameInfo.getLevel());
}
public function hideLosePage():void{
if (this.losePage != null){
this.removeChildFromDepth(this.losePage, 2);
this.losePage.removeEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.losePage.removeEventListener(GameWorld.RETRY, retryEvent);
this.losePage = null;
};
}
private function testPassEvent(_arg1:MouseEvent):void{
this.pass();
}
public function hideMap():void{
this.map.visible = false;
this.map.hideMapInfo();
this.pqsmm.hide();
this.hideText();
}
public function createMap():void{
var _local1:Class;
_local1 = this.mapsManager.getIndexMap(this.gameInfo.getMapIndex());
this.map = new _local1(this.gameInfo, this.pause);
}
private function endRunEvent(_arg1:Event):void{
this.endTimer.start();
this.pause.removeEventListener(Pause.RUN, endRunEvent);
}
private function retryEvent(_arg1:Event):void{
this.createMap();
this.addMap();
this.hideLosePage();
}
private function scoreChangeEvent(_arg1:Event):void{
this.setScore(this.gameInfo.getScore());
}
public function startShowPassLevelPage():void{
this.endTimer.reset();
this.endTimer.start();
this.endTimer.addEventListener(TimerEvent.TIMER_COMPLETE, showPassLevelPageEvent);
this.pause.addEventListener(Pause.PAUSE, endPauseEvent);
}
public function stopShowEndPage():void{
this.endTimer.stop();
this.endTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, showEndPageEvent);
this.pause.removeEventListener(Pause.PAUSE, endPauseEvent);
this.pause.removeEventListener(Pause.RUN, endRunEvent);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.setScore(this.gameInfo.getScore());
this.setLevel(this.gameInfo.getLevel());
this.gameInfo.addEventListener(GameInfo.SCORE_CHANGE, scoreChangeEvent);
this.gameInfo.addEventListener(GameInfo.LEVEL_CHANGE, levelChangeEvent);
this.gameInfo.setLevel(1);
this.showMap(this.gameInfo.getMapIndex());
this.pause.setState(Pause.RUN);
this.hideTest();
this.addResultCard();
this.resultCard.hide();
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function showFirstPageEvent(_arg1:Event):void{
this.hideMap();
this.dispatchEvent(new Event(Main.SHOW_FIRST_PAGE));
this.dispatchEvent(new Event(Main.DEL_GAME));
}
private function passEvent(_arg1:Event):void{
this.pass();
}
private function moneyChanageEvent(_arg1:Event):void{
this.setMoney(this.gameInfo.getMoney());
}
private function init():void{
this.bottom = this.bottomMc;
this.middle = this.middleMc;
this.upper = this.upperMc;
this.gameInfo = new GameInfo();
this.pause = new Pause();
this.score = this.scoreTf;
this.score.selectable = false;
this.level = this.levelTf;
this.level.selectable = false;
this.mapsManager = new MapsManager();
this.map = null;
this.choosePage = null;
this.pqsmm = new PQSMM(this.pause);
this.losePage = null;
this.passLevelPage = null;
this.endPage = null;
this.resultCard = new ResultCard();
this.showResult = this.showResultCardMc;
this.endTimer = new Timer(500, 2);
this.testLose = this.loseMc;
this.testPass = this.passMc;
}
public function addMap():void{
if (this.map != null){
this.addChildToDepth(this.map, 2);
this.map.x = GameWorld.MAP_X;
this.map.y = GameWorld.MAP_Y;
this.map.addEventListener(Map.PASS, passEvent);
this.map.addEventListener(Map.LOSE, loseEvent);
this.pqsmm.show();
this.showText();
if (Main.TEST == true){
};
};
}
private function showResultCardEvent(_arg1:MouseEvent):void{
this.resultCard.show();
}
public function showMap(_arg1:int):void{
this.setMapNum(_arg1);
this.createMap();
this.addPqsmm();
this.addMap();
this.showText();
this.map.showMapInfo();
}
public function showPassLevelPage():void{
this.hideMap();
this.resultCard.show();
this.resultCard.setScore(this.gameInfo.getScore());
if (this.passLevelPage == null){
this.passLevelPage = new PassLevelPage();
this.passLevelPage.setScore(this.gameInfo.getScore());
this.addChildToDepth(this.passLevelPage, 2);
this.passLevelPage.addEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.passLevelPage.addEventListener(Map.PASS, toNextLevelEvent);
};
}
public function hidePassLevelPage():void{
if (this.passLevelPage != null){
this.removeChildFromDepth(this.passLevelPage, 2);
this.passLevelPage.removeEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.passLevelPage.removeEventListener(Map.PASS, toNextLevelEvent);
this.passLevelPage = null;
};
}
public function showTest():void{
this.testLose.visible = true;
this.testPass.visible = true;
this.testLose.addEventListener(MouseEvent.CLICK, testLoseEvent);
this.testPass.addEventListener(MouseEvent.CLICK, testPassEvent);
}
public function removeChildFromDepth(_arg1:DisplayObject, _arg2:int):void{
if (_arg2 == 1){
this.bottom.removeChild(_arg1);
} else {
if (_arg2 == 2){
this.middle.removeChild(_arg1);
} else {
if (_arg2 == 3){
this.upper.removeChild(_arg1);
};
};
};
}
public function hideTest():void{
this.testLose.visible = false;
this.testPass.visible = false;
this.testLose.removeEventListener(MouseEvent.CLICK, testLoseEvent);
this.testPass.removeEventListener(MouseEvent.CLICK, testPassEvent);
}
public function stopShowPassLevelPage():void{
this.endTimer.stop();
this.endTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, showPassLevelPageEvent);
this.pause.removeEventListener(Pause.PAUSE, endPauseEvent);
this.pause.removeEventListener(Pause.RUN, endRunEvent);
}
public function setResult():void{
this.resultCard.setLevel(this.gameInfo.getLevel());
this.gameInfo.addScore(this.resultCard.setParAndHit(this.map.getPar(), this.map.getUsePar()));
this.gameInfo.addScore(this.resultCard.setDisten(this.map.getFinalDisten()));
}
public function setScore(_arg1:int):void{
this.score.text = ("SCORE: " + _arg1);
}
public function showLosePage():void{
if (this.losePage == null){
this.hideMap();
this.losePage = new LosePage();
this.losePage.setScore(this.gameInfo.getScore());
this.addChildToDepth(this.losePage, 2);
this.losePage.addEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.losePage.addEventListener(GameWorld.RETRY, retryEvent);
};
}
private function endPauseEvent(_arg1:Event):void{
this.endTimer.stop();
this.pause.addEventListener(Pause.RUN, endRunEvent);
}
public function setMoney(_arg1:int):void{
this.money.text = ("MONEY: " + _arg1);
}
public function addPqsmm():void{
this.addChildToDepth(this.pqsmm, 3);
this.pqsmm.addEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
}
public function setMapNum(_arg1:int):void{
this.gameInfo.setMapIndex(_arg1);
}
public function addChildToDepth(_arg1:DisplayObject, _arg2:int):void{
if (_arg2 == 1){
this.bottom.addChild(_arg1);
} else {
if (_arg2 == 2){
this.middle.addChild(_arg1);
} else {
if (_arg2 == 3){
this.upper.addChild(_arg1);
};
};
};
}
public function setMap(_arg1:Map):void{
this.map = _arg1;
}
public function hideText():void{
this.score.visible = false;
this.level.visible = false;
this.hideResultBtn();
}
public function showText():void{
this.score.visible = true;
this.level.visible = true;
this.showResultBtn();
}
private function hideResultBtn():void{
this.showResult.visible = false;
this.showResult.removeEventListener(MouseEvent.CLICK, showResultCardEvent);
}
}
}//package main
Section 102
//Main (main.Main)
package main {
import sound.*;
import flash.display.*;
import flash.events.*;
import mypkg.*;
import menu.*;
public class Main extends Sprite {
private var firstPlay:Boolean;
private var creditsPage:CreditsPage;
private var firstPage:FirstPage;
private var keyManager:KeyManager;
private var msg:Message;
private var mc:Sprite;
private var maskMc:Sprite;
private var soundManager:SoundManager;
private var instrPage:InstructionPage;
private var logo:Logo;
private var bgMc:Sprite;
private var gameWorld:GameWorld;
private var bgMusic:MusicManager;
public static const HIDE_FIRST_PAGE:String = " hide first page";
public static const STAGE_WIDTH:Number = 680;
public static const DEL_GAME:String = " delete game";
public static const RETRY_GAME:String = " retry game";
public static const STAGE_FRAMERATE:int = 32;
public static const HIDE_CREDIT:String = " hide credit";
public static const PLAY_GAME:String = " play game";
public static const SHOW_FIRST_PAGE:String = " show first page";
public static const STAGE_HEIGHT:Number = 500;
public static const HIDE_INSTRUCTION:String = " hide instruction";
public static const SHOW_INSTRUCTION:String = " show instruction";
public static const VERSION:String = "v 0.14";
public static const SHOW_CREDIT:String = " show credit";
public static const GAME_NAME:String = "golfman";
public static var TEST:Boolean = false;
private static var singleFlag:Boolean = true;
public static var STAGE:Stage;
private static var game:Main;
public function Main(){
if (Main.singleFlag == true){
throw (new Error("Main不能用构造函数实例化。"));
};
this.addEventListener(Event.ADDED, this.added);
Main.singleFlag = true;
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
Main.STAGE = this.stage;
this.init();
this.layout();
this.showFirstPage();
this.stage.focus = this.stage;
this.keyManager.setStage(this.stage);
this.addChildToDepth(this.msg, 3);
if (Main.TEST == true){
this.msg.startShow("THIS IS TEST VERSION.");
} else {
this.msg.hide();
};
this.addEventListener(Event.REMOVED, this.removed);
};
}
private function hideInstructionEvent(_arg1:Event):void{
this.hideInstruction();
}
private function init():void{
this.logo = new Logo();
this.bgMusic = MusicManager.getInstance();
this.soundManager = SoundManager.getInstance();
this.firstPlay = true;
this.bgMc = new Sprite();
this.mc = new Sprite();
this.maskMc = new Sprite();
this.gameWorld = null;
this.firstPage = new FirstPage();
this.instrPage = null;
this.creditsPage = null;
this.keyManager = KeyManager.getKeyManager();
this.msg = Message.getInstace();
}
public function hideInstruction():void{
if (this.instrPage != null){
this.instrPage.removeEventListener(Main.PLAY_GAME, playGameEvent);
this.instrPage.removeEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.instrPage.removeEventListener(Main.HIDE_INSTRUCTION, hideInstructionEvent);
this.removeChildFromDepth(this.instrPage, 2);
this.instrPage = null;
};
}
private function retryGameEvent(_arg1:Event):void{
this.playGame();
}
private function addLogo():void{
this.addChildToDepth(this.logo, 3);
this.logo.x = (Main.STAGE_WIDTH - this.logo.width);
this.logo.y = 0;
}
private function playGameEvent(_arg1:Event):void{
if (this.firstPlay == false){
this.playGame();
} else {
if (this.firstPlay == true){
this.showInstruction();
this.firstPlay = false;
};
};
}
private function layout():void{
this.addChild(this.bgMc);
this.addChild(this.mc);
this.addChild(this.maskMc);
this.addLogo();
}
public function removeChildFromDepth(_arg1:DisplayObject, _arg2:int):void{
if (_arg2 == 1){
this.bgMc.removeChild(_arg1);
} else {
if (_arg2 == 2){
this.mc.removeChild(_arg1);
} else {
if (_arg2 == 3){
this.maskMc.removeChild(_arg1);
};
};
};
}
public function hideFirstPage():void{
if (this.firstPage != null){
this.firstPage.removeEventListener(Main.PLAY_GAME, playGameEvent);
this.firstPage.removeEventListener(Main.SHOW_CREDIT, showCreditEvent);
this.firstPage.removeEventListener(Main.SHOW_INSTRUCTION, showInstructionEvent);
this.firstPage.removeEventListener(Main.HIDE_INSTRUCTION, hideFirstPageEvent);
this.firstPage.visible = false;
};
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.bgMusic = null;
this.soundManager = null;
this.removeEventListener(Event.REMOVED, this.removed);
};
}
public function showInstruction():void{
this.hideInstruction();
this.instrPage = new InstructionPage();
this.addChildToDepth(this.instrPage, 2);
this.instrPage.addEventListener(Main.PLAY_GAME, playGameEvent);
this.instrPage.addEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.instrPage.addEventListener(Main.HIDE_INSTRUCTION, hideInstructionEvent);
}
public function showCredit():void{
this.hideCredit();
this.creditsPage = new CreditsPage();
this.addChildToDepth(this.creditsPage, 2);
this.creditsPage.addEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.creditsPage.addEventListener(Main.HIDE_CREDIT, hideCreditEvent);
}
public function getFirstPlay():Boolean{
return (this.firstPlay);
}
private function hideFirstPageEvent(_arg1:Event):void{
this.hideFirstPage();
}
private function hideCreditEvent(_arg1:Event):void{
this.hideCredit();
}
public function playGame():void{
this.delGame();
this.gameWorld = new GameWorld();
this.addChildToDepth(this.gameWorld, 2);
this.gameWorld.addEventListener(Main.DEL_GAME, delGameEvent);
this.gameWorld.addEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.gameWorld.addEventListener(Main.RETRY_GAME, retryGameEvent);
}
public function delGame():void{
if (this.gameWorld != null){
this.gameWorld.removeEventListener(Main.DEL_GAME, delGameEvent);
this.gameWorld.removeEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.gameWorld.removeEventListener(Main.RETRY_GAME, retryGameEvent);
this.removeChildFromDepth(this.gameWorld, 2);
this.gameWorld = null;
};
}
public function addChildToDepth(_arg1:DisplayObject, _arg2:int):void{
if (_arg2 == 1){
this.bgMc.addChild(_arg1);
} else {
if (_arg2 == 2){
this.mc.addChild(_arg1);
} else {
if (_arg2 == 3){
this.maskMc.addChild(_arg1);
};
};
};
}
public function setFirstPlay(_arg1:Boolean):void{
this.firstPlay = _arg1;
}
private function showInstructionEvent(_arg1:Event):void{
this.showInstruction();
}
public function hideCredit():void{
if (this.creditsPage != null){
this.creditsPage.removeEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.creditsPage.removeEventListener(Main.HIDE_CREDIT, hideCreditEvent);
this.removeChildFromDepth(this.creditsPage, 2);
this.creditsPage = null;
};
}
public function showFirstPage():void{
this.addChildToDepth(this.firstPage, 2);
this.firstPage.visible = true;
this.firstPage.addEventListener(Main.PLAY_GAME, playGameEvent);
this.firstPage.addEventListener(Main.SHOW_CREDIT, showCreditEvent);
this.firstPage.addEventListener(Main.SHOW_INSTRUCTION, showInstructionEvent);
this.firstPage.addEventListener(Main.HIDE_FIRST_PAGE, hideFirstPageEvent);
this.addLogo();
}
private function showCreditEvent(_arg1:Event):void{
this.showCredit();
}
private function showFirstPageEvent(_arg1:Event):void{
this.showFirstPage();
}
private function delGameEvent(_arg1:Event):void{
this.delGame();
}
public static function getInstance():Main{
if (Main.game == null){
Main.singleFlag = false;
Main.game = new (Main);
};
return (Main.game);
}
}
}//package main
Section 103
//Message (main.Message)
package main {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
public class Message extends MovieClip {
private var message:TextField;
private var timer:Timer;
public var messageTf:TextField;
private static var single:Boolean = true;
private static var msg:Message;
public function Message(){
if (Message.single == true){
throw (new Error("不能使用构造函数。"));
};
Message.single = true;
this.timer = new Timer(1000, 2);
this.message = this.messageTf;
this.message.selectable = false;
}
public function hide():void{
this.visible = false;
}
public function startShow(_arg1:String):void{
this.show(_arg1);
this.timer.reset();
this.timer.start();
this.timer.addEventListener(TimerEvent.TIMER_COMPLETE, hideEvent);
}
private function hideEvent(_arg1:TimerEvent):void{
this.hide();
}
public function show(_arg1:String):void{
this.message.text = _arg1;
this.visible = true;
}
public static function getInstace():Message{
if (Message.msg == null){
Message.single = false;
Message.msg = new (Message);
};
return (Message.msg);
}
}
}//package main
Section 104
//BadgePage (menu.BadgePage)
package menu {
import flash.display.*;
import flash.events.*;
import mypkg.*;
import game.map.*;
import flash.text.*;
public class BadgePage extends MovieClip {
private var lastDecs:Array;
private var cupOvers:Array;
private var info:Tip;
private var bestDecs:Array;
public var infoMc:Tip;
public var decBestTf2:TextField;
public var decBestTf3:TextField;
public var decBestTf4:TextField;
public var decBestTf1:TextField;
public var decLastTf3:TextField;
public var decLastTf4:TextField;
public var decLastTf5:TextField;
public var decBestTf5:TextField;
public var decLastTf1:TextField;
public var decLastTf2:TextField;
private var decOvers:Array;
public var cupBestTf1:TextField;
public var cupBestTf3:TextField;
public var cupBestTf2:TextField;
public var cupLastTf1:TextField;
public var cupLastTf3:TextField;
public var cupLastTf4:TextField;
public var cupLastTf5:TextField;
public var cupBestTf5:TextField;
public var cupLastTf2:TextField;
public var cupBestTf4:TextField;
public var decOverMc1:MovieClip;
public var decOverMc3:MovieClip;
public var decOverMc5:MovieClip;
public var decOverMc4:MovieClip;
public var decOverMc2:MovieClip;
private var localSave:LocalSave;
private var lastCups:Array;
public var closeMc:MovieClip;
public var cupOverMc1:MovieClip;
public var cupOverMc2:MovieClip;
public var cupOverMc4:MovieClip;
public var cupOverMc5:MovieClip;
public var cupOverMc3:MovieClip;
private var close:MovieClip;
private var bestCups:Array;
public function BadgePage(){
this.close = this.closeMc;
this.info = this.infoMc;
this.info.visible = false;
this.localSave = new LocalSave();
this.lastDecs = new Array();
this.bestDecs = new Array();
this.decOvers = new Array();
this.lastCups = new Array();
this.bestCups = new Array();
this.cupOvers = new Array();
if (this.localSave.getSaveInfo("lastDec") == null){
this.localSave.addSaveName("lastDec");
this.localSave.saveArray("lastDec", new Array(0, 0, 0, 0, 0));
};
if (this.localSave.getSaveInfo("lastCup") == null){
this.localSave.addSaveName("lastCup");
this.localSave.saveArray("lastCup", new Array(0, 0, 0, 0, 0));
};
if (this.localSave.getSaveInfo("bestDec") == null){
this.localSave.addSaveName("bestDec");
this.localSave.saveArray("bestDec", new Array(0, 0, 0, 0, 0));
};
if (this.localSave.getSaveInfo("bestCup") == null){
this.localSave.addSaveName("bestCup");
this.localSave.saveArray("bestCup", new Array(0, 0, 0, 0, 0));
};
this.init();
this.close.addEventListener(MouseEvent.CLICK, closeEvent);
}
private function setInfoPos(_arg1:DisplayObject):void{
this.info.x = _arg1.x;
this.info.y = (_arg1.y + (_arg1.height / 2));
this.info.visible = true;
}
private function decOverEvent(_arg1:MouseEvent):void{
var _local2:DisplayObject;
var _local3:int;
_local2 = DisplayObject(_arg1.target);
_local3 = this.decOvers.indexOf(_local2);
if (_local3 == 0){
this.info.showDecIndex(_local3, "Par Award", "for getting a par result.", "");
} else {
if (_local3 == 1){
this.info.showDecIndex(_local3, "Birdie Award", "for getting a birdie result.", "");
} else {
if (_local3 == 2){
this.info.showDecIndex(_local3, "Eagle Award", "for getting a eagle result.", "");
} else {
if (_local3 == 3){
this.info.showDecIndex(_local3, "Albatross Award", "for getting a albatross result.", "");
} else {
if (_local3 == 4){
this.info.showDecIndex(_local3, "Condor Award", "for getting a condor result.", "");
};
};
};
};
};
this.setInfoPos(_local2);
}
public function show():void{
this.visible = true;
this.init();
}
private function init():void{
var _local1:Array;
var _local2:Array;
var _local3:Array;
var _local4:Array;
var _local5:int;
_local1 = this.localSave.getSaveInfo("lastDec");
_local2 = this.localSave.getSaveInfo("bestDec");
_local3 = this.localSave.getSaveInfo("lastCup");
_local4 = this.localSave.getSaveInfo("bestCup");
_local5 = 0;
while (_local5 < 5) {
this.decOvers[_local5] = this[("decOverMc" + (_local5 + 1))];
this.decOvers[_local5].addEventListener(MouseEvent.MOUSE_OVER, decOverEvent);
this.decOvers[_local5].addEventListener(MouseEvent.MOUSE_OUT, outEvent);
this.lastDecs[_local5] = this[("decLastTf" + (_local5 + 1))];
this.lastDecs[_local5].text = ("x" + _local1[_local5]);
this.bestDecs[_local5] = this[("decBestTf" + (_local5 + 1))];
this.bestDecs[_local5].text = ("x" + _local2[_local5]);
this.cupOvers[_local5] = this[("cupOverMc" + (_local5 + 1))];
this.cupOvers[_local5].addEventListener(MouseEvent.MOUSE_OVER, cupOverEvent);
this.cupOvers[_local5].addEventListener(MouseEvent.MOUSE_OUT, outEvent);
this.lastCups[_local5] = this[("cupLastTf" + (_local5 + 1))];
this.lastCups[_local5].text = ("x" + _local3[_local5]);
this.bestCups[_local5] = this[("cupBestTf" + (_local5 + 1))];
this.bestCups[_local5].text = ("x" + _local4[_local5]);
_local5++;
};
}
public function hide():void{
this.visible = false;
}
private function closeEvent(_arg1:MouseEvent):void{
this.hide();
}
private function cupOverEvent(_arg1:MouseEvent):void{
var _local2:DisplayObject;
var _local3:int;
_local2 = DisplayObject(_arg1.target);
_local3 = this.cupOvers.indexOf(_local2);
if (_local3 == 0){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 20m", "");
} else {
if (_local3 == 1){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 40m", "");
} else {
if (_local3 == 2){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 60m", "");
} else {
if (_local3 == 3){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 80m", "");
} else {
if (_local3 == 4){
this.info.showCupIndex(_local3, "Hot Shot Trophy", "for sinking a ball over 100m", "");
};
};
};
};
};
this.setInfoPos(_local2);
}
private function outEvent(_arg1:MouseEvent):void{
this.info.visible = false;
}
}
}//package menu
Section 105
//ChoosePage (menu.ChoosePage)
package menu {
import flash.display.*;
import flash.events.*;
import main.*;
public class ChoosePage extends MovieClip {
private var playGame:MovieClip;
private var gameInfo:GameInfo;
public var playMc:MovieClip;
public static const CHOOSE_COMPLETE:String = " choose complete.";
public function ChoosePage(){
this.playGame = this.playMc;
this.playGame.addEventListener(MouseEvent.CLICK, playGameEvent);
}
private function playGameEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(ChoosePage.CHOOSE_COMPLETE));
}
public function setGameInfo(_arg1:GameInfo):void{
this.gameInfo = _arg1;
}
}
}//package menu
Section 106
//CreditsPage (menu.CreditsPage)
package menu {
import flash.display.*;
import flash.events.*;
import main.*;
public class CreditsPage extends MovieClip {
public var remainMc:MovieClip;
private var remain:MovieClip;
public function CreditsPage(){
this.remain = this.remainMc;
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.remain.addEventListener(MouseEvent.CLICK, remainEvent);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function remainEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.SHOW_FIRST_PAGE));
this.dispatchEvent(new Event(Main.HIDE_CREDIT));
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.remain.removeEventListener(MouseEvent.CLICK, remainEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
}
}//package menu
Section 107
//EndPage (menu.EndPage)
package menu {
import flash.display.*;
import flash.events.*;
import main.*;
import flash.net.*;
import flash.text.*;
public class EndPage extends MovieClip {
public var playGolfmanXtremeMc:MovieClip;
private var playGolfmanXtreme:MovieClip;
public var ratingMc:TextField;
public var remainMc:MovieClip;
public var addGameMc:MovieClip;
private var result:TextField;
private var submit:MovieClip;
private var addGame:MovieClip;
private var badges:MovieClip;
private var cardScore:TextField;
public var resultTf:TextField;
public var cardScoreTf:TextField;
private var remain:MovieClip;
public var submitBoxMc:SubmitBox;
private var submitBox:SubmitBox;
private var score:TextField;
private var rating:TextField;
private var scoreCard:MovieClip;
public var submitMc:MovieClip;
public var scoreMc:TextField;
private var badgePage:BadgePage;
public var badgesMc:MovieClip;
public var scoreCardMc:MovieClip;
public static const SHOW_RESULT_CARD:String = " show result card.";
public function EndPage(){
this.init();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.addBadgePage();
this.score.selectable = false;
this.rating.selectable = false;
this.submitBox.hide();
this.scoreCard.addEventListener(MouseEvent.CLICK, showCardEvent);
this.submit.addEventListener(MouseEvent.CLICK, submitEvent);
this.remain.addEventListener(MouseEvent.CLICK, toMain);
this.playGolfmanXtreme.addEventListener(MouseEvent.CLICK, playGolfmanXtremeEvent);
this.badges.addEventListener(MouseEvent.CLICK, badgesEvent);
this.addGame.addEventListener(MouseEvent.CLICK, addGameEvent);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function viewEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/score/index.asp");
_local2.data = ("game=" + Main.GAME_NAME);
navigateToURL(_local2, "_blank");
}
private function init():void{
this.submit = this.submitMc;
this.remain = this.remainMc;
this.submitBox = this.submitBoxMc;
this.playGolfmanXtreme = this.playGolfmanXtremeMc;
this.badges = this.badgesMc;
this.addGame = this.addGameMc;
this.scoreCard = this.scoreCardMc;
this.score = this.scoreMc;
this.cardScore = this.cardScoreTf;
this.result = this.resultTf;
this.rating = this.ratingMc;
this.badgePage = new BadgePage();
}
private function sendFinishEvent(_arg1:Event):void{
this.submit.visible = false;
}
public function addBadgePage():void{
this.addChild(this.badgePage);
this.badgePage.hide();
}
private function addGameEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/koalafiles.htm");
navigateToURL(_local2, "_blank");
}
public function setCardScore(_arg1:int):void{
this.cardScore.text = (_arg1 + "");
}
public function setResult(_arg1:int):void{
if (_arg1 <= 0){
this.result.text = (-(_arg1) + " under par.");
} else {
this.result.text = (_arg1 + " over par.");
};
}
public function setScore(_arg1:int):void{
this.score.text = ("SCORE: " + _arg1);
this.submitBox.setScore(_arg1);
if (_arg1 > 30000){
this.rating.text = "Rating: Legend";
} else {
if (_arg1 > 20000){
this.rating.text = "Rating: Chalk Master";
} else {
if (_arg1 > 10000){
this.rating.text = "Rating: Skilled Drawer";
} else {
if (_arg1 > 8000){
this.rating.text = "Rating: Mr Mediocre";
} else {
if (_arg1 > 5000){
this.rating.text = "Rating: Newbie Doobie";
} else {
this.rating.text = "Rating: Crapolishesh beginner";
};
};
};
};
};
}
private function submitEvent(_arg1:MouseEvent):void{
this.submitBox.show();
this.submitBox.addEventListener(SubmitBox.SEND_FINISH, sendFinishEvent);
}
private function badgesEvent(_arg1:MouseEvent):void{
this.badgePage.show();
}
private function playGolfmanXtremeEvent(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.freeworldgroup.com/games8/gameindex/golfmanxtreme.htm"));
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.scoreCard.removeEventListener(MouseEvent.CLICK, showCardEvent);
this.submit.removeEventListener(MouseEvent.CLICK, submitEvent);
this.remain.removeEventListener(MouseEvent.CLICK, toMain);
this.playGolfmanXtreme.removeEventListener(MouseEvent.CLICK, playGolfmanXtremeEvent);
this.badges.removeEventListener(MouseEvent.CLICK, badgesEvent);
this.addGame.removeEventListener(MouseEvent.CLICK, addGameEvent);
this.submitBox.removeEventListener(SubmitBox.SEND_FINISH, sendFinishEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function toMain(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.SHOW_FIRST_PAGE));
}
private function retryEvent(_arg1:Event):void{
this.dispatchEvent(new Event(Main.RETRY_GAME));
}
private function showCardEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new MouseEvent(EndPage.SHOW_RESULT_CARD));
}
}
}//package menu
Section 108
//FirstPage (menu.FirstPage)
package menu {
import sound.*;
import flash.display.*;
import flash.events.*;
import main.*;
import flash.net.*;
public class FirstPage extends MovieClip {
public var playGolfmanXtremeMc:MovieClip;
private var playGolfmanXtreme:MovieClip;
public var addGameMc:MovieClip;
private var version:MovieClip;
private var badges:MovieClip;
private var downloadGames:MovieClip;
private var addGame:MovieClip;
private var bg:MovieClip;
public var skipMc:MovieClip;
public var playGameMc:MovieClip;
private var playGame:MovieClip;
public var versionMc:MovieClip;
private var credits:MovieClip;
private var instruction:MovieClip;
private var skip:MovieClip;
public var downloadGamesMc:MovieClip;
public var viewHighScoresMc:MovieClip;
public var bgMc:MovieClip;
public var copyrightMc:MovieClip;
private var copyright:MovieClip;
public var creditsMc:MovieClip;
private var badgePage:BadgePage;
public var instructionMc:MovieClip;
public var badgesMc:MovieClip;
private var viewHighScores:MovieClip;
public static const PLAY_COMPLETE:String = " play complete.";
public function FirstPage(){
this.init();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.hideBtn();
this.addBadgePage();
this.skip.addEventListener(MouseEvent.CLICK, skipPlayEvent);
this.bg.addEventListener(FirstPage.PLAY_COMPLETE, playCompleteEvent);
this.playGame.addEventListener(MouseEvent.CLICK, playGameEvent);
this.playGolfmanXtreme.addEventListener(MouseEvent.CLICK, playGolfmanXtremeEvent);
this.badges.addEventListener(MouseEvent.CLICK, badgesEvent);
this.instruction.addEventListener(MouseEvent.CLICK, instructionEvent);
this.downloadGames.addEventListener(MouseEvent.CLICK, downloadEvent);
this.addGame.addEventListener(MouseEvent.CLICK, addGameEvent);
this.viewHighScores.addEventListener(MouseEvent.CLICK, viewEvent);
this.copyright.addEventListener(MouseEvent.CLICK, copyrightEvent);
this.credits.addEventListener(MouseEvent.CLICK, creditsEvent);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function viewEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/score/index.asp");
_local2.data = ("game=" + Main.GAME_NAME);
navigateToURL(_local2, "_blank");
}
private function playCompleteEvent(_arg1:Event):void{
this.showBtn();
MusicManager.getInstance().stop();
MusicManager.getInstance().setMusic(MusicManager.GARDEN);
MusicManager.getInstance().play();
}
private function skipPlayEvent(_arg1:MouseEvent):void{
this.bg.gotoAndStop(this.bg.totalFrames);
}
private function init():void{
this.badgePage = new BadgePage();
this.playGame = this.playGameMc;
this.playGolfmanXtreme = this.playGolfmanXtremeMc;
this.badges = this.badgesMc;
this.instruction = this.instructionMc;
this.downloadGames = this.downloadGamesMc;
this.addGame = this.addGameMc;
this.viewHighScores = this.viewHighScoresMc;
this.skip = this.skipMc;
this.bg = this.bgMc;
this.version = this.versionMc;
this.copyright = this.copyrightMc;
this.credits = this.creditsMc;
this.version.version.selectable = false;
this.version.version.text = Main.VERSION;
}
private function copyrightEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/");
navigateToURL(_local2, "_blank");
}
private function playGameEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.PLAY_GAME));
this.dispatchEvent(new Event(Main.HIDE_FIRST_PAGE));
}
private function addGameEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/koalafiles.htm");
navigateToURL(_local2, "_blank");
}
private function creditsEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.SHOW_CREDIT));
this.dispatchEvent(new Event(Main.HIDE_FIRST_PAGE));
}
public function showBtn():void{
this.playGame.visible = true;
this.playGolfmanXtreme.visible = true;
this.instruction.visible = true;
this.downloadGames.visible = true;
this.badges.visible = true;
this.addGame.visible = true;
this.viewHighScores.visible = true;
this.skip.visible = false;
}
private function playGolfmanXtremeEvent(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.freeworldgroup.com/games8/gameindex/golfmanxtreme.htm"));
}
private function badgesEvent(_arg1:MouseEvent):void{
this.badgePage.show();
}
private function instructionEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.SHOW_INSTRUCTION));
this.dispatchEvent(new Event(Main.HIDE_FIRST_PAGE));
}
public function addBadgePage():void{
this.addChild(this.badgePage);
this.badgePage.hide();
}
public function hideBtn():void{
this.playGame.visible = false;
this.playGolfmanXtreme.visible = false;
this.instruction.visible = false;
this.downloadGames.visible = false;
this.badges.visible = false;
this.addGame.visible = false;
this.viewHighScores.visible = false;
this.skip.visible = true;
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.skip.removeEventListener(MouseEvent.CLICK, skipPlayEvent);
this.bg.removeEventListener(FirstPage.PLAY_COMPLETE, playCompleteEvent);
this.playGame.removeEventListener(MouseEvent.CLICK, playGameEvent);
this.playGolfmanXtreme.removeEventListener(MouseEvent.CLICK, playGolfmanXtremeEvent);
this.badges.removeEventListener(MouseEvent.CLICK, badgesEvent);
this.instruction.removeEventListener(MouseEvent.CLICK, instructionEvent);
this.downloadGames.removeEventListener(MouseEvent.CLICK, downloadEvent);
this.addGame.removeEventListener(MouseEvent.CLICK, addGameEvent);
this.viewHighScores.removeEventListener(MouseEvent.CLICK, viewEvent);
this.copyright.removeEventListener(MouseEvent.CLICK, copyrightEvent);
this.credits.removeEventListener(MouseEvent.CLICK, creditsEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function downloadEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.ifungames.com");
navigateToURL(_local2, "_blank");
}
}
}//package menu
Section 109
//GameMask (menu.GameMask)
package menu {
import flash.display.*;
import main.*;
public class GameMask extends MovieClip {
public function GameMask(){
this.width = Main.STAGE_WIDTH;
this.height = Main.STAGE_HEIGHT;
this.alpha = 0.5;
}
public function hide():void{
this.visible = false;
}
public function show():void{
this.visible = true;
}
}
}//package menu
Section 110
//InstructionPage (menu.InstructionPage)
package menu {
import flash.display.*;
import flash.events.*;
import main.*;
public class InstructionPage extends MovieClip {
private var next:MovieClip;
public var remainMc:MovieClip;
public var skipMc:MovieClip;
private var remain:MovieClip;
private var skip:MovieClip;
public var backMc:MovieClip;
public var nextMc:MovieClip;
private var back:MovieClip;
public function InstructionPage(){
addFrameScript(0, frame1);
super();
this.init();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.back.visible = false;
this.skip.gotoAndStop(1);
if (this.totalFrames == 1){
this.next.visible = false;
this.skip.gotoAndStop(2);
};
this.remain.addEventListener(MouseEvent.CLICK, remainEvent);
this.back.addEventListener(MouseEvent.CLICK, backEvent);
this.next.addEventListener(MouseEvent.CLICK, nextEvent);
this.skip.addEventListener(MouseEvent.CLICK, skipEvent);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function init():void{
this.remain = this.remainMc;
this.back = this.backMc;
this.next = this.nextMc;
this.skip = this.skipMc;
}
private function backEvent(_arg1:MouseEvent):void{
if (this.currentFrame > 1){
this.goPrevPage();
};
}
public function goNextPage():void{
this.nextFrame();
this.back.visible = true;
if (this.currentFrame == this.totalFrames){
this.skip.gotoAndStop(2);
this.next.visible = false;
};
}
private function skipEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.PLAY_GAME));
this.dispatchEvent(new Event(Main.HIDE_INSTRUCTION));
}
public function goPrevPage():void{
this.prevFrame();
this.next.visible = true;
this.skip.gotoAndStop(1);
if (this.currentFrame == 1){
this.back.visible = false;
};
}
function frame1(){
stop();
}
private function nextEvent(_arg1:MouseEvent):void{
if (this.currentFrame < this.totalFrames){
this.goNextPage();
};
}
private function remainEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.SHOW_FIRST_PAGE));
this.dispatchEvent(new Event(Main.HIDE_INSTRUCTION));
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.remain.removeEventListener(MouseEvent.CLICK, remainEvent);
this.back.removeEventListener(MouseEvent.CLICK, backEvent);
this.next.removeEventListener(MouseEvent.CLICK, nextEvent);
this.skip.removeEventListener(MouseEvent.CLICK, skipEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
}
}//package menu
Section 111
//Logo (menu.Logo)
package menu {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class Logo extends MovieClip {
public function Logo(){
this.addEventListener(MouseEvent.CLICK, clickEvent);
this.buttonMode = true;
this.useHandCursor = true;
}
private function clickEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/");
navigateToURL(_local2, "_blank");
}
}
}//package menu
Section 112
//LosePage (menu.LosePage)
package menu {
import flash.display.*;
import flash.events.*;
import main.*;
import flash.net.*;
import flash.text.*;
public class LosePage extends MovieClip {
public var playGolfmanXtremeMc:MovieClip;
private var playGolfmanXtreme:MovieClip;
public var ratingMc:TextField;
public var viewMc:MovieClip;
public var remainMc:MovieClip;
public var addGameMc:MovieClip;
private var submit:MovieClip;
private var addGame:MovieClip;
private var badges:MovieClip;
public var retryMc:MovieClip;
private var remain:MovieClip;
public var submitBoxMc:SubmitBox;
private var submitBox:SubmitBox;
private var rating:TextField;
private var score:TextField;
private var retry:MovieClip;
private var view:MovieClip;
public var submitMc:MovieClip;
public var scoreMc:TextField;
private var badgePage:BadgePage;
public var badgesMc:MovieClip;
public function LosePage(){
this.init();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.addBadgePage();
this.score.selectable = false;
this.rating.selectable = false;
this.submitBox.hide();
this.submit.addEventListener(MouseEvent.CLICK, submitEvent);
this.retry.addEventListener(MouseEvent.CLICK, retryEvent);
this.remain.addEventListener(MouseEvent.CLICK, toMain);
this.playGolfmanXtreme.addEventListener(MouseEvent.CLICK, playGolfmanXtremeEvent);
this.badges.addEventListener(MouseEvent.CLICK, badgesEvent);
this.addGame.addEventListener(MouseEvent.CLICK, addGameEvent);
this.view.addEventListener(MouseEvent.CLICK, viewEvent);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function viewEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/score/index.asp");
_local2.data = ("game=" + Main.GAME_NAME);
navigateToURL(_local2, "_blank");
}
private function init():void{
this.submit = this.submitMc;
this.retry = this.retryMc;
this.remain = this.remainMc;
this.submitBox = this.submitBoxMc;
this.playGolfmanXtreme = this.playGolfmanXtremeMc;
this.badges = this.badgesMc;
this.addGame = this.addGameMc;
this.view = this.viewMc;
this.score = this.scoreMc;
this.rating = this.ratingMc;
this.badgePage = new BadgePage();
}
private function sendFinishEvent(_arg1:Event):void{
this.submit.visible = false;
}
public function addBadgePage():void{
this.addChild(this.badgePage);
this.badgePage.hide();
}
public function setScore(_arg1:int):void{
this.score.text = ("SCORE: " + _arg1);
this.submitBox.setScore(_arg1);
if (_arg1 > 30000){
this.rating.text = "Rating: Legend";
} else {
if (_arg1 > 20000){
this.rating.text = "Rating: Chalk Master";
} else {
if (_arg1 > 10000){
this.rating.text = "Rating: Skilled Drawer";
} else {
if (_arg1 > 8000){
this.rating.text = "Rating: Mr Mediocre";
} else {
if (_arg1 > 5000){
this.rating.text = "Rating: Newbie Doobie";
} else {
this.rating.text = "Rating: Crapolishesh beginner";
};
};
};
};
};
}
private function submitEvent(_arg1:MouseEvent):void{
this.submitBox.show();
this.submitBox.addEventListener(SubmitBox.SEND_FINISH, sendFinishEvent);
}
private function playGolfmanXtremeEvent(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.freeworldgroup.com/games8/gameindex/golfmanxtreme.htm"));
}
private function badgesEvent(_arg1:MouseEvent):void{
this.badgePage.show();
}
private function addGameEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/koalafiles.htm");
navigateToURL(_local2, "_blank");
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.submit.removeEventListener(MouseEvent.CLICK, submitEvent);
this.retry.removeEventListener(MouseEvent.CLICK, retryEvent);
this.remain.removeEventListener(MouseEvent.CLICK, toMain);
this.submitBox.removeEventListener(SubmitBox.SEND_FINISH, sendFinishEvent);
this.playGolfmanXtreme.removeEventListener(MouseEvent.CLICK, playGolfmanXtremeEvent);
this.badges.removeEventListener(MouseEvent.CLICK, badgesEvent);
this.addGame.removeEventListener(MouseEvent.CLICK, addGameEvent);
this.view.removeEventListener(MouseEvent.CLICK, viewEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function toMain(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.SHOW_FIRST_PAGE));
}
private function retryEvent(_arg1:Event):void{
this.dispatchEvent(new Event(GameWorld.RETRY));
}
}
}//package menu
Section 113
//PassLevelPage (menu.PassLevelPage)
package menu {
import flash.display.*;
import flash.events.*;
import main.*;
import game.maps.*;
import flash.text.*;
public class PassLevelPage extends MovieClip {
public var ratingMc:TextField;
public var remainMc:MovieClip;
private var submit:MovieClip;
private var nextLevel:MovieClip;
private var remain:MovieClip;
public var submitBoxMc:SubmitBox;
private var score:TextField;
private var submitBox:SubmitBox;
public var nextLevelMc:MovieClip;
public var scoreMc:TextField;
public var submitMc:MovieClip;
public function PassLevelPage(){
this.init();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.score.selectable = false;
this.submitBox.hide();
this.submit.addEventListener(MouseEvent.CLICK, submitEvent);
this.nextLevel.addEventListener(MouseEvent.CLICK, nextLevelEvent);
this.remain.addEventListener(MouseEvent.CLICK, toMain);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function init():void{
this.submit = this.submitMc;
this.nextLevel = this.nextLevelMc;
this.remain = this.remainMc;
this.submitBox = this.submitBoxMc;
this.score = this.scoreMc;
}
private function sendFinishEvent(_arg1:Event):void{
this.submit.visible = false;
}
public function setScore(_arg1:int):void{
this.score.text = ("SCORE: " + _arg1);
this.submitBox.setScore(_arg1);
}
private function submitEvent(_arg1:MouseEvent):void{
this.submitBox.show();
this.submitBox.addEventListener(SubmitBox.SEND_FINISH, sendFinishEvent);
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.submit.removeEventListener(MouseEvent.CLICK, submitEvent);
this.nextLevel.removeEventListener(MouseEvent.CLICK, nextLevelEvent);
this.remain.removeEventListener(MouseEvent.CLICK, toMain);
this.submitBox.removeEventListener(SubmitBox.SEND_FINISH, sendFinishEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function nextLevelEvent(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Map.PASS));
}
private function toMain(_arg1:MouseEvent):void{
this.dispatchEvent(new Event(Main.SHOW_FIRST_PAGE));
}
}
}//package menu
Section 114
//PQSMM (menu.PQSMM)
package menu {
import sound.*;
import flash.display.*;
import flash.events.*;
import mypkg.*;
import main.*;
public class PQSMM extends MovieClip {
public var qualityBoxMc:QualityBox;
private var gameMask:GameMask;
public var showBtnMc:MovieClip;
private var sound:MovieClip;
private var gamePause:Pause;
private var music:MovieClip;
private var showBtn:MovieClip;
public var pqsmmBoxMc:MovieClip;
public var gameMaskMc:GameMask;
private var qualityBox:QualityBox;
private var remain:MovieClip;
public var remainBoxMc:RemainBox;
private var pqsmmBox:MovieClip;
private var remainBox:RemainBox;
private var pause:MovieClip;
private var quality:MovieClip;
public static const HIDE_BOX:String = " hide box.";
public function PQSMM(_arg1:Pause){
this.gamePause = _arg1;
this.init();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.gamePause.addEventListener(Pause.PAUSE, gamePausedEvent);
this.gamePause.addEventListener(Pause.RUN, gameRunEvent);
this.setMusic();
this.setSound();
this.setPause();
this.hideQualityBox();
this.hideRemainBox();
this.pause.addEventListener(MouseEvent.CLICK, pauseEvent);
this.quality.addEventListener(MouseEvent.CLICK, qualityEvent);
this.sound.addEventListener(MouseEvent.CLICK, soundEvent);
this.music.addEventListener(MouseEvent.CLICK, musicEvent);
this.remain.addEventListener(MouseEvent.CLICK, remainEvent);
this.showShowBtn();
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function init():void{
this.pqsmmBox = this.pqsmmBoxMc;
this.remainBox = this.remainBoxMc;
this.qualityBox = this.qualityBoxMc;
this.pause = this.pqsmmBox.pauseMc;
this.quality = this.pqsmmBox.qualityMc;
this.sound = this.pqsmmBox.soundMc;
this.music = this.pqsmmBox.musicMc;
this.remain = this.pqsmmBox.remainMc;
this.gameMask = this.gameMaskMc;
this.showBtn = this.showBtnMc;
}
private function hidePqsmmEvent(_arg1:MouseEvent):void{
if ((((((((this.pqsmmBox.mouseX < 0)) || ((this.pqsmmBox.mouseX > this.pqsmmBox.width)))) || ((this.pqsmmBox.mouseY < 0)))) || ((this.pqsmmBox.mouseY > this.pqsmmBox.height)))){
this.showShowBtn();
};
}
private function hideQualityBoxEvent(_arg1:Event):void{
this.hideQualityBox();
}
private function showQualityBox():void{
this.gamePause.setState(Pause.PAUSE);
this.qualityBox.show();
this.qualityBox.addEventListener(PQSMM.HIDE_BOX, hideQualityBoxEvent);
}
private function setMusic():void{
if (MusicManager.getInstance().getState() == MusicManager.MUTE){
this.music.gotoAndStop(2);
} else {
if (MusicManager.getInstance().getState() == MusicManager.PLAY){
this.music.gotoAndStop(1);
};
};
}
private function hideQualityBox():void{
if (this.gamePause.getState() == Pause.PAUSE){
this.gamePause.setState(Pause.RUN);
};
this.qualityBox.hide();
this.qualityBox.addEventListener(PQSMM.HIDE_BOX, hideQualityBoxEvent);
}
public function show():void{
this.visible = true;
KeyManager.getKeyManager().addEventListener(KeyboardEvent.KEY_DOWN, keyEvent);
}
private function pauseEvent(_arg1:MouseEvent):void{
this.gamePause.control();
}
private function clickMaskEvent(_arg1:MouseEvent):void{
this.gamePause.setState(Pause.RUN);
}
private function showShowBtn():void{
this.showBtn.visible = true;
this.showBtn.addEventListener(MouseEvent.CLICK, showPqsmmEvent);
this.hidePqsmm();
}
private function musicEvent(_arg1:MouseEvent):void{
MusicManager.getInstance().muteControl();
this.setMusic();
}
private function hideShowBtn():void{
this.showBtn.visible = false;
this.showBtn.removeEventListener(MouseEvent.CLICK, showPqsmmEvent);
this.showPqsmm();
}
private function hidePqsmm():void{
this.pqsmmBox.visible = false;
this.pqsmmBox.removeEventListener(MouseEvent.MOUSE_OUT, hidePqsmmEvent);
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
KeyManager.getKeyManager().removeEventListener(KeyboardEvent.KEY_DOWN, keyEvent);
this.gamePause.removeEventListener(Pause.PAUSE, gamePausedEvent);
this.gamePause.removeEventListener(Pause.RUN, gameRunEvent);
this.pause.removeEventListener(MouseEvent.CLICK, pauseEvent);
this.quality.removeEventListener(MouseEvent.CLICK, qualityEvent);
this.sound.removeEventListener(MouseEvent.CLICK, soundEvent);
this.music.removeEventListener(MouseEvent.CLICK, musicEvent);
this.remain.removeEventListener(MouseEvent.CLICK, remainEvent);
this.showBtn.removeEventListener(MouseEvent.CLICK, showPqsmmEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function hideRemainBox():void{
if (this.gamePause.getState() == Pause.PAUSE){
this.gamePause.setState(Pause.RUN);
};
this.remainBox.hide();
this.remainBox.removeEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.remainBox.removeEventListener(PQSMM.HIDE_BOX, hideBoxEvent);
}
private function remainEvent(_arg1:MouseEvent):void{
this.showRemainBox();
}
private function showRemainBox():void{
this.gamePause.setState(Pause.PAUSE);
this.remainBox.show();
this.remainBox.addEventListener(Main.SHOW_FIRST_PAGE, showFirstPageEvent);
this.remainBox.addEventListener(PQSMM.HIDE_BOX, hideBoxEvent);
}
private function keyEvent(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 80){
this.gamePause.control();
};
}
private function gamePausedEvent(_arg1:Event):void{
this.setPause();
}
private function setPause():void{
if (this.gamePause.getState() == Pause.PAUSE){
this.pause.gotoAndStop(2);
this.gameMask.show();
this.gameMask.addEventListener(MouseEvent.CLICK, clickMaskEvent);
} else {
if (this.gamePause.getState() == Pause.RUN){
this.pause.gotoAndStop(1);
this.gameMask.hide();
this.gameMask.removeEventListener(MouseEvent.CLICK, clickMaskEvent);
};
};
}
public function hide():void{
this.visible = false;
KeyManager.getKeyManager().removeEventListener(KeyboardEvent.KEY_DOWN, keyEvent);
}
private function setSound():void{
if (SoundManager.getInstance().getMute() == SoundManager.MUTE){
this.sound.gotoAndStop(2);
} else {
if (SoundManager.getInstance().getMute() == SoundManager.PLAY){
this.sound.gotoAndStop(1);
};
};
}
private function soundEvent(_arg1:MouseEvent):void{
SoundManager.getInstance().muteControl();
this.setSound();
}
private function hidePause():void{
this.pause.visible = false;
}
private function showFirstPageEvent(_arg1:Event):void{
this.dispatchEvent(new Event(Main.SHOW_FIRST_PAGE));
}
private function qualityEvent(_arg1:MouseEvent):void{
this.showQualityBox();
}
private function gameRunEvent(_arg1:Event):void{
this.setPause();
this.hideRemainBox();
this.hideQualityBox();
}
private function showPqsmmEvent(_arg1:MouseEvent):void{
this.hideShowBtn();
}
public function setGamePause(_arg1:Pause):void{
this.gamePause = _arg1;
}
private function showPqsmm():void{
this.pqsmmBox.visible = true;
this.pqsmmBox.addEventListener(MouseEvent.MOUSE_OUT, hidePqsmmEvent);
}
private function hideBoxEvent(_arg1:Event):void{
this.hideRemainBox();
}
private function showPause():void{
this.pause.visible = true;
}
}
}//package menu
Section 115
//QualityBox (menu.QualityBox)
package menu {
import flash.display.*;
import flash.events.*;
public class QualityBox extends MovieClip {
public var highMc:MovieClip;
private var best:MovieClip;
public var mediumMc:MovieClip;
public var lowMc:MovieClip;
private var low:MovieClip;
private var medium:MovieClip;
private var currentQuality:String;
public var bestMc:MovieClip;
private var high:MovieClip;
private var currentMc:MovieClip;
public static const BEST:String = "best";
public static const LOW:String = "LOW";
public static const MEDIUM:String = "MEDIUM";
public static const HIGH:String = "HIGH";
public function QualityBox(){
this.low = this.lowMc;
this.low.gotoAndStop(1);
this.medium = this.mediumMc;
this.medium.gotoAndStop(1);
this.high = this.highMc;
this.high.gotoAndStop(1);
this.best = this.bestMc;
this.best.gotoAndStop(1);
this.currentQuality = QualityBox.HIGH.toLowerCase();
this.currentMc = this.high;
this.addEventListener(Event.ADDED, added);
this.addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.low.addEventListener(MouseEvent.CLICK, this.chooseLow);
this.medium.addEventListener(MouseEvent.CLICK, this.chooseMedium);
this.high.addEventListener(MouseEvent.CLICK, this.chooseHigh);
this.best.addEventListener(MouseEvent.CLICK, this.chooseBest);
this.addEventListener(MouseEvent.CLICK, hideEvent);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function addedToStage(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.setQuality(stage.quality);
};
}
public function setQuality(_arg1:String):void{
this.currentMc.gotoAndStop(1);
this.stage.quality = _arg1;
this.currentQuality = _arg1.toLowerCase();
this.currentMc = this[this.currentQuality];
this.currentMc.gotoAndStop(2);
}
private function chooseHigh(_arg1:MouseEvent):void{
this.setQuality(QualityBox.HIGH);
}
private function chooseMedium(_arg1:MouseEvent):void{
this.setQuality(QualityBox.MEDIUM);
}
private function hideEvent(_arg1:MouseEvent):void{
this.hide();
this.dispatchEvent(new Event(PQSMM.HIDE_BOX));
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.low.removeEventListener(MouseEvent.CLICK, this.chooseLow);
this.medium.removeEventListener(MouseEvent.CLICK, this.chooseMedium);
this.high.removeEventListener(MouseEvent.CLICK, this.chooseHigh);
this.best.removeEventListener(MouseEvent.CLICK, this.chooseBest);
this.removeEventListener(MouseEvent.CLICK, hideEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function chooseBest(_arg1:MouseEvent):void{
this.setQuality(QualityBox.BEST);
}
public function hide():void{
this.visible = false;
}
private function chooseLow(_arg1:MouseEvent):void{
this.setQuality(QualityBox.LOW);
}
public function show():void{
this.visible = true;
}
}
}//package menu
Section 116
//RemainBox (menu.RemainBox)
package menu {
import flash.display.*;
import flash.events.*;
import main.*;
public class RemainBox extends MovieClip {
public var noMc:MovieClip;
private var no:MovieClip;
public var yesMc:MovieClip;
private var yes:MovieClip;
public static const CHOOSENO:String = "choose no";
public function RemainBox(){
this.yes = this.yesMc;
this.no = this.noMc;
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.yes.addEventListener(MouseEvent.CLICK, chooseYesEvent);
this.no.addEventListener(MouseEvent.CLICK, chooseNoEvent);
this.addEventListener(MouseEvent.CLICK, hideEvent);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
private function chooseYesEvent(_arg1:MouseEvent):void{
this.visible = false;
this.dispatchEvent(new Event(Main.SHOW_FIRST_PAGE));
}
private function chooseNoEvent(_arg1:MouseEvent):void{
this.visible = false;
this.dispatchEvent(new Event(RemainBox.CHOOSENO));
}
private function hideEvent(_arg1:MouseEvent):void{
this.hide();
this.dispatchEvent(new Event(PQSMM.HIDE_BOX));
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.yes.removeEventListener(MouseEvent.CLICK, chooseYesEvent);
this.no.removeEventListener(MouseEvent.CLICK, chooseNoEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
public function hide():void{
this.visible = false;
}
public function show():void{
this.visible = true;
}
}
}//package menu
Section 117
//SubmitBox (menu.SubmitBox)
package menu {
import flash.display.*;
import flash.events.*;
import main.*;
import flash.net.*;
import flash.text.*;
public class SubmitBox extends MovieClip {
public var enterNameBoxMc:MovieClip;
public var userNameMc:TextField;
private var submit:MovieClip;
private var enterNameBox:MovieClip;
public var viewScoreMc:MovieClip;
private var score:TextField;
public var closeMc:MovieClip;
private var send:URLLoader;
public var submitMc:MovieClip;
public var scoreMc:TextField;
private var viewScore:MovieClip;
private var userName:TextField;
private var close:MovieClip;
public static const SEND_FINISH:String = " send finish.";
public function SubmitBox(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
super();
this.init();
this.addEventListener(Event.ADDED, added);
}
private function added(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.submit.addEventListener(MouseEvent.CLICK, submitEvent);
this.close.addEventListener(MouseEvent.CLICK, closeEvent);
this.viewScore.addEventListener(MouseEvent.CLICK, viewEvent);
this.hideViewScore();
this.hideEnterNameBox();
this.send.addEventListener(Event.COMPLETE, sendEvent);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
public function hideSubmit():void{
this.submit.visible = false;
}
private function viewEvent(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/score/index.asp");
_local2.data = ("game=" + Main.GAME_NAME);
navigateToURL(_local2, "_blank");
}
private function init():void{
this.submit = this.submitMc;
this.viewScore = this.viewScoreMc;
this.enterNameBox = this.enterNameBoxMc;
this.close = this.closeMc;
this.userName = this.userNameMc;
this.userName.text = "";
this.score = this.scoreMc;
this.send = new URLLoader();
}
public function show():void{
this.visible = true;
}
public function setScore(_arg1:int):void{
this.score.text = _arg1.toString();
}
function frame3(){
stop();
}
private function submitEvent(_arg1:MouseEvent):void{
this.submitScore();
}
function frame1(){
stop();
}
public function showViewScore():void{
this.viewScore.visible = true;
}
public function showSubmit():void{
this.submit.visible = true;
}
public function hide():void{
this.visible = false;
}
public function submitScore():void{
var _local1:URLRequest;
var _local2:URLVariables;
if (this.userName.text != ""){
_local1 = new URLRequest("http://www.freeworldgroup.com/score/score.asp");
_local2 = new URLVariables();
_local2.game = Main.GAME_NAME;
_local2.score = this.score.text;
_local2.name = this.userName.text;
_local1.method = URLRequestMethod.POST;
_local1.data = _local2;
this.send.load(_local1);
this.gotoAndStop(2);
this.hideSubmit();
} else {
this.showEnterNameBox();
};
}
function frame2(){
stop();
}
private function closeEvent(_arg1:MouseEvent):void{
this.hide();
}
private function removed(_arg1:Event):void{
if (_arg1.target == _arg1.currentTarget){
this.submit.removeEventListener(MouseEvent.CLICK, submitEvent);
this.close.removeEventListener(MouseEvent.CLICK, closeEvent);
this.viewScore.removeEventListener(MouseEvent.CLICK, viewEvent);
this.send.removeEventListener(Event.COMPLETE, sendEvent);
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
};
}
public function hideEnterNameBox():void{
this.enterNameBox.visible = false;
}
public function hideViewScore():void{
this.viewScore.visible = false;
}
public function showEnterNameBox():void{
this.enterNameBox.visible = true;
}
private function sendEvent(_arg1:Event):void{
this.gotoAndStop(3);
this.showViewScore();
this.dispatchEvent(new Event(SubmitBox.SEND_FINISH));
}
}
}//package menu
Section 118
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("3.0 as3");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 119
//KeyManager (mypkg.KeyManager)
package mypkg {
import flash.display.*;
import flash.events.*;
public class KeyManager extends EventDispatcher {
private var stage:Stage;
public static const D:uint = 68;
public static const U:uint = 85;
public static const NUM_1:uint = 49;
public static const NUM_2:uint = 50;
public static const NUM_3:uint = 51;
public static const NUM_4:uint = 52;
private static var keyManager:KeyManager;
private static var single:Boolean = true;
public function KeyManager(){
if (KeyManager.single == true){
throw (new Error("KeyManager不能用构造函数实例化。"));
};
KeyManager.single = true;
}
public function setStage(_arg1:Stage):void{
this.stage = _arg1;
this.stage.focus = this.stage;
}
override public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
this.stage.removeEventListener(_arg1, _arg2, _arg3);
}
override public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
this.stage.focus = this.stage;
this.stage.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public static function getKeyManager():KeyManager{
if (KeyManager.keyManager == null){
KeyManager.single = false;
KeyManager.keyManager = new (KeyManager);
};
return (KeyManager.keyManager);
}
}
}//package mypkg
Section 120
//LocalSave (mypkg.LocalSave)
package mypkg {
import main.*;
import flash.net.*;
public class LocalSave {
private var saveNames:Array;
private var sharaObject:SharedObject;
public function LocalSave(){
this.sharaObject = SharedObject.getLocal(Main.GAME_NAME);
this.saveNames = new Array();
}
public function getSaveInfo(_arg1:String):Array{
var _local2:Array;
_local2 = this.sharaObject.data[_arg1];
return (_local2);
}
public function addSaveName(_arg1:String):void{
this.saveNames.push(_arg1);
this.sharaObject.data[_arg1] = new Array();
}
public function saveArray(_arg1:String, _arg2:Array):void{
this.sharaObject.data[_arg1] = _arg2;
}
public function save(_arg1:String, _arg2:int, _arg3:Object):void{
var _local4:Array;
_local4 = this.getSaveInfo(_arg1);
_local4[_arg2] = _arg3;
this.sharaObject.data[_arg1] = _local4;
}
public function getSaveIndex(_arg1:String, _arg2:int):Object{
var _local3:Array;
_local3 = this.getSaveInfo(_arg1);
return (_local3[_arg2]);
}
}
}//package mypkg
Section 121
//McPlayer (mypkg.McPlayer)
package mypkg {
import flash.display.*;
import flash.events.*;
import main.*;
public class McPlayer extends EventDispatcher {
private var speed:Number;
private var time:Number;
private var mc:MovieClip;
private var toFrame:int;
private var eventFrame:int;
private var stageRate:uint;
public static const PLAY_COMPLETE:String = " play complete.";
public static const FRAME_EVENT:String = " frame event.";
public function McPlayer(_arg1:MovieClip){
this.mc = _arg1;
this.stageRate = Main.STAGE.frameRate;
this.toFrame = this.mc.totalFrames;
this.setPlayTime((this.mc.totalFrames / this.stageRate));
this.eventFrame = -1;
}
public function stop():void{
this.mc.stop();
this.mc.removeEventListener(Event.ENTER_FRAME, playingEvent);
}
public function play():void{
this.stop();
this.mc.addEventListener(Event.ENTER_FRAME, playingEvent);
}
public function continuePlay():void{
this.mc.play();
this.mc.removeEventListener(Event.ENTER_FRAME, playingEvent);
}
private function playingEvent(_arg1:Event):void{
var _local2:int;
if (this.mc.currentFrame < this.toFrame){
_local2 = (this.speed + this.mc.currentFrame);
this.mc.gotoAndStop(_local2);
} else {
this.stop();
this.dispatchEvent(new Event(McPlayer.PLAY_COMPLETE));
};
if ((((this.mc.currentFrame >= this.eventFrame)) && (!((this.eventFrame == -1))))){
this.dispatchEvent(new Event(McPlayer.FRAME_EVENT));
this.eventFrame = -1;
};
}
public function setPlayTime(_arg1:Number):void{
this.time = _arg1;
this.speed = (this.mc.totalFrames / (_arg1 * this.stageRate));
}
public function gc():void{
this.mc.removeEventListener(Event.ENTER_FRAME, playingEvent);
this.mc = null;
}
public function setFrameEvent(_arg1:int):void{
this.eventFrame = _arg1;
}
public function setToFrame(_arg1:int):void{
this.toFrame = _arg1;
}
}
}//package mypkg
Section 122
//Pause (mypkg.Pause)
package mypkg {
import flash.events.*;
public class Pause extends EventDispatcher {
private var state:String;
public static const RUN:String = " run";
public static const PAUSE:String = " pause";
public function Pause(){
this.state = Pause.RUN;
}
public function getState():String{
return (this.state);
}
public function setState(_arg1:String):void{
this.state = _arg1;
if (this.state == Pause.PAUSE){
this.dispatchEvent(new Event(Pause.PAUSE));
} else {
if (this.state == Pause.RUN){
this.dispatchEvent(new Event(Pause.RUN));
};
};
}
public function control():void{
if (this.getState() == Pause.RUN){
this.setState(Pause.PAUSE);
} else {
if (this.getState() == Pause.PAUSE){
this.setState(Pause.RUN);
};
};
}
}
}//package mypkg
Section 123
//PlayComplete (mypkg.PlayComplete)
package mypkg {
import flash.display.*;
import flash.events.*;
public class PlayComplete extends EventDispatcher {
private var mc:MovieClip;
private var playSpeed:int;
public static const PALY_COMPLETE:String = " play complete.";
public function PlayComplete(_arg1:MovieClip){
this.mc = _arg1;
this.endFrame();
}
private function run():void{
this.dispatchEvent(new Event(PALY_COMPLETE));
}
private function endFrame():void{
this.mc.addFrameScript((this.mc.totalFrames - 1), run);
}
public function setSpeed(_arg1:int):void{
this.playSpeed = _arg1;
}
}
}//package mypkg
Section 124
//AbstractCollection (org.cove.ape.AbstractCollection)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractCollection {
private var _sprite:Sprite;
private var _isParented:Boolean;
private var _particles:Array;
private var _constraints:Array;
public function AbstractCollection(){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractCollection"){
throw (new ArgumentError("AbstractCollection can't be instantiated directly"));
};
_isParented = false;
_particles = new Array();
_constraints = new Array();
}
public function getAll():Array{
return (particles.concat(constraints));
}
function checkCollisionsVsCollection(_arg1:AbstractCollection):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:AbstractParticle;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:AbstractParticle;
var _local10:SpringConstraint;
var _local11:SpringConstraint;
var _local12:int;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = _particles[_local3];
if (!_local5.collidable){
} else {
_local6 = _arg1.particles.length;
_local7 = 0;
while (_local7 < _local6) {
_local9 = _arg1.particles[_local7];
if (_local9.collidable){
CollisionDetector.test(_local5, _local9);
};
_local7++;
};
_local8 = _arg1.constraints.length;
_local7 = 0;
while (_local7 < _local8) {
_local10 = _arg1.constraints[_local7];
if (((_local10.collidable) && (!(_local10.isConnectedTo(_local5))))){
_local10.scp.updatePosition();
CollisionDetector.test(_local5, _local10.scp);
};
_local7++;
};
};
_local3++;
};
_local4 = _constraints.length;
_local3 = 0;
while (_local3 < _local4) {
_local11 = _constraints[_local3];
if (!_local11.collidable){
} else {
_local6 = _arg1.particles.length;
_local12 = 0;
while (_local12 < _local6) {
_local9 = _arg1.particles[_local12];
if (((_local9.collidable) && (!(_local11.isConnectedTo(_local9))))){
_local11.scp.updatePosition();
CollisionDetector.test(_local9, _local11.scp);
};
_local12++;
};
};
_local3++;
};
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
function checkInternalCollisions():void{
var _local1:int;
var _local2:int;
var _local3:AbstractParticle;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:AbstractParticle;
var _local8:SpringConstraint;
_local1 = _particles.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _particles[_local2];
if (!_local3.collidable){
} else {
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local7 = _particles[_local4];
if (_local7.collidable){
CollisionDetector.test(_local3, _local7);
};
_local4++;
};
_local5 = _constraints.length;
_local6 = 0;
while (_local6 < _local5) {
_local8 = _constraints[_local6];
if (((_local8.collidable) && (!(_local8.isConnectedTo(_local3))))){
_local8.scp.updatePosition();
CollisionDetector.test(_local3, _local8.scp);
};
_local6++;
};
};
_local2++;
};
}
public function addParticle(_arg1:AbstractParticle):void{
particles.push(_arg1);
if (isParented){
_arg1.init();
};
}
public function removeConstraint(_arg1:AbstractConstraint):void{
var _local2:int;
_local2 = constraints.indexOf(_arg1);
if (_local2 == -1){
return;
};
constraints.splice(_local2, 1);
_arg1.cleanup();
}
function get isParented():Boolean{
return (_isParented);
}
public function init():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].init();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].init();
_local1++;
};
}
function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:AbstractConstraint;
_local1 = _constraints.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _constraints[_local2];
_local3.resolve();
_local2++;
};
}
public function paint():void{
var _local1:AbstractParticle;
var _local2:int;
var _local3:int;
var _local4:SpringConstraint;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = _particles[_local3];
if (((!(_local1.fixed)) || (_local1.alwaysRepaint))){
_local1.paint();
};
_local3++;
};
_local2 = _constraints.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _constraints[_local3];
if (((!(_local4.fixed)) || (_local4.alwaysRepaint))){
_local4.paint();
};
_local3++;
};
}
public function addConstraint(_arg1:AbstractConstraint):void{
constraints.push(_arg1);
if (isParented){
_arg1.init();
};
}
function set isParented(_arg1:Boolean):void{
_isParented = _arg1;
}
public function removeParticle(_arg1:AbstractParticle):void{
var _local2:int;
_local2 = particles.indexOf(_arg1);
if (_local2 == -1){
return;
};
particles.splice(_local2, 1);
_arg1.cleanup();
}
public function cleanup():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].cleanup();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].cleanup();
_local1++;
};
}
public function get particles():Array{
return (_particles);
}
function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:AbstractParticle;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _particles[_local3];
_local4.update(_arg1);
_local3++;
};
}
public function get constraints():Array{
return (_constraints);
}
}
}//package org.cove.ape
Section 125
//AbstractConstraint (org.cove.ape.AbstractConstraint)
package org.cove.ape {
import flash.utils.*;
public class AbstractConstraint extends AbstractItem {
private var _stiffness:Number;
public function AbstractConstraint(_arg1:Number){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractConstraint"){
throw (new ArgumentError("AbstractConstraint can't be instantiated directly"));
};
this.stiffness = _arg1;
setStyle();
}
public function get stiffness():Number{
return (_stiffness);
}
public function set stiffness(_arg1:Number):void{
_stiffness = _arg1;
}
function resolve():void{
}
}
}//package org.cove.ape
Section 126
//AbstractItem (org.cove.ape.AbstractItem)
package org.cove.ape {
import flash.display.*;
public class AbstractItem {
var lineAlpha:Number;
var lineColor:uint;
var displayObjectOffset:Vector;
var lineThickness:Number;
var displayObject:DisplayObject;
var fillAlpha:Number;
private var _sprite:Sprite;
var fillColor:uint;
private var _visible:Boolean;
private var _alwaysRepaint:Boolean;
var displayObjectRotation:Number;
public function AbstractItem(){
_visible = true;
_alwaysRepaint = false;
}
public function setLine(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1):void{
lineThickness = _arg1;
lineColor = _arg2;
lineAlpha = _arg3;
}
public function set visible(_arg1:Boolean):void{
_visible = _arg1;
sprite.visible = _arg1;
}
public function setFill(_arg1:uint=0xFFFFFF, _arg2:Number=1):void{
fillColor = _arg1;
fillAlpha = _arg2;
}
public function init():void{
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
public function paint():void{
}
public function cleanup():void{
var _local1:int;
sprite.graphics.clear();
_local1 = 0;
while (_local1 < sprite.numChildren) {
sprite.removeChildAt(_local1);
_local1++;
};
}
public function setStyle(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1, _arg4:uint=0xFFFFFF, _arg5:Number=1):void{
setLine(_arg1, _arg2, _arg3);
setFill(_arg4, _arg5);
}
public function get visible():Boolean{
return (_visible);
}
final public function set alwaysRepaint(_arg1:Boolean):void{
_alwaysRepaint = _arg1;
}
final public function get alwaysRepaint():Boolean{
return (_alwaysRepaint);
}
}
}//package org.cove.ape
Section 127
//AbstractParticle (org.cove.ape.AbstractParticle)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractParticle extends AbstractItem {
private var _collidable:Boolean;
private var _multisample:int;
private var collision:Collision;
var prev:Vector;
private var _kfr:Number;
var curr:Vector;
private var _invMass:Number;
var interval:Interval;
private var _mass:Number;
private var temp:Vector;
private var _friction:Number;
private var forces:Vector;
var samp:Vector;
private var _center:Vector;
private var _fixed:Boolean;
public function AbstractParticle(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Number, _arg5:Number, _arg6:Number){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractParticle"){
throw (new ArgumentError("AbstractParticle can't be instantiated directly"));
};
interval = new Interval(0, 0);
curr = new Vector(_arg1, _arg2);
prev = new Vector(_arg1, _arg2);
samp = new Vector();
temp = new Vector();
fixed = _arg3;
forces = new Vector();
collision = new Collision(new Vector(), new Vector());
collidable = true;
this.mass = _arg4;
this.elasticity = _arg5;
this.friction = _arg6;
setStyle();
_center = new Vector();
_multisample = 0;
}
public function set friction(_arg1:Number):void{
if ((((_arg1 < 0)) || ((_arg1 > 1)))){
throw (new ArgumentError("Legal friction must be >= 0 and <=1"));
};
_friction = _arg1;
}
public function get px():Number{
return (curr.x);
}
public function get py():Number{
return (curr.y);
}
public function set py(_arg1:Number):void{
curr.y = _arg1;
prev.y = _arg1;
}
function getComponents(_arg1:Vector):Collision{
var _local2:Vector;
var _local3:Number;
_local2 = velocity;
_local3 = _arg1.dot(_local2);
collision.vn = _arg1.mult(_local3);
collision.vt = _local2.minus(collision.vn);
return (collision);
}
public function set mass(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("mass may not be set <= 0"));
};
_mass = _arg1;
_invMass = (1 / _mass);
}
public function get fixed():Boolean{
return (_fixed);
}
public function set px(_arg1:Number):void{
curr.x = _arg1;
prev.x = _arg1;
}
function initDisplay():void{
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
}
function get invMass():Number{
return ((fixed) ? 0 : _invMass);
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
}
public function get position():Vector{
return (new Vector(curr.x, curr.y));
}
public function get multisample():int{
return (_multisample);
}
function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
curr.plusEquals(_arg1);
velocity = _arg2;
}
public function set fixed(_arg1:Boolean):void{
_fixed = _arg1;
}
public function addMasslessForce(_arg1:Vector):void{
forces.plusEquals(_arg1);
}
public function set velocity(_arg1:Vector):void{
prev = curr.minus(_arg1);
}
public function set multisample(_arg1:int):void{
_multisample = _arg1;
}
public function get elasticity():Number{
return (_kfr);
}
public function set position(_arg1:Vector):void{
curr.copy(_arg1);
prev.copy(_arg1);
}
public function get center():Vector{
_center.setTo(px, py);
return (_center);
}
public function update(_arg1:Number):void{
var _local2:Vector;
if (fixed){
return;
};
addForce(APEngine.force);
addMasslessForce(APEngine.masslessForce);
temp.copy(curr);
_local2 = velocity.plus(forces.multEquals(_arg1));
curr.plusEquals(_local2.multEquals(APEngine.damping));
prev.copy(temp);
forces.setTo(0, 0);
}
public function set collidable(_arg1:Boolean):void{
_collidable = _arg1;
}
public function get velocity():Vector{
return (curr.minus(prev));
}
public function get collidable():Boolean{
return (_collidable);
}
public function addForce(_arg1:Vector):void{
forces.plusEquals(_arg1.mult(invMass));
}
public function set elasticity(_arg1:Number):void{
_kfr = _arg1;
}
public function get friction():Number{
return (_friction);
}
public function get mass():Number{
return (_mass);
}
}
}//package org.cove.ape
Section 128
//APEngine (org.cove.ape.APEngine)
package org.cove.ape {
import flash.display.*;
public final class APEngine {
private static var _container:DisplayObjectContainer;
private static var _damping:Number;
private static var _constraintCollisionCycles:int;
private static var groups:Array;
static var masslessForce:Vector;
private static var _constraintCycles:int;
static var force:Vector;
private static var timeStep:Number;
private static var numGroups:int;
public static function get container():DisplayObjectContainer{
return (_container);
}
public static function get constraintCollisionCycles():int{
return (_constraintCollisionCycles);
}
public static function set damping(_arg1:Number):void{
_damping = _arg1;
}
public static function step():void{
var _local1:int;
var _local2:int;
integrate();
_local1 = 0;
while (_local1 < _constraintCycles) {
satisfyConstraints();
_local1++;
};
_local2 = 0;
while (_local2 < _constraintCollisionCycles) {
satisfyConstraints();
checkCollisions();
_local2++;
};
}
public static function init(_arg1:Number=0.25):void{
timeStep = (_arg1 * _arg1);
numGroups = 0;
groups = new Array();
force = new Vector(0, 0);
masslessForce = new Vector(0, 0);
damping = 1;
_constraintCycles = 0;
_constraintCollisionCycles = 1;
}
public static function get constraintCycles():int{
return (_constraintCycles);
}
public static function set constraintCollisionCycles(_arg1:int):void{
_constraintCollisionCycles = _arg1;
}
public static function set constraintCycles(_arg1:int):void{
_constraintCycles = _arg1;
}
public static function addForce(_arg1:Vector):void{
force.plusEquals(_arg1);
}
public static function get damping():Number{
return (_damping);
}
public static function set container(_arg1:DisplayObjectContainer):void{
_container = _arg1;
}
public static function addGroup(_arg1:Group):void{
groups.push(_arg1);
_arg1.isParented = true;
numGroups++;
_arg1.init();
}
public static function removeGroup(_arg1:Group):void{
var _local2:int;
_local2 = groups.indexOf(_arg1);
if (_local2 == -1){
return;
};
groups.splice(_local2, 1);
_arg1.isParented = false;
numGroups--;
_arg1.cleanup();
}
public static function paint():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.paint();
_local1++;
};
}
private static function checkCollisions():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.checkCollisions();
_local1++;
};
}
private static function integrate():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.integrate(timeStep);
_local1++;
};
}
private static function satisfyConstraints():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.satisfyConstraints();
_local1++;
};
}
public static function addMasslessForce(_arg1:Vector):void{
masslessForce.plusEquals(_arg1);
}
}
}//package org.cove.ape
Section 129
//CircleParticle (org.cove.ape.CircleParticle)
package org.cove.ape {
public class CircleParticle extends AbstractParticle {
private var _radius:Number;
public function CircleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0.3, _arg7:Number=0){
super(_arg1, _arg2, _arg4, _arg5, _arg6, _arg7);
_radius = _arg3;
}
function getIntervalX():Interval{
interval.min = (curr.x - _radius);
interval.max = (curr.x + _radius);
return (interval);
}
function getIntervalY():Interval{
interval.min = (curr.y - _radius);
interval.max = (curr.y + _radius);
return (interval);
}
override public function init():void{
cleanup();
if (displayObject != null){
initDisplay();
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawCircle(0, 0, radius);
sprite.graphics.endFill();
};
paint();
}
public function set radius(_arg1:Number):void{
_radius = _arg1;
}
public function get radius():Number{
return (_radius);
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
_local2 = samp.dot(_arg1);
interval.min = (_local2 - _radius);
interval.max = (_local2 + _radius);
return (interval);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
}
}
}//package org.cove.ape
Section 130
//Collision (org.cove.ape.Collision)
package org.cove.ape {
import org.cove.ape.*;
final class Collision {
var vn:Vector;
var vt:Vector;
function Collision(_arg1:Vector, _arg2:Vector){
this.vn = _arg1;
this.vt = _arg2;
}
}
}//package org.cove.ape
Section 131
//CollisionDetector (org.cove.ape.CollisionDetector)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionDetector {
private static function testOBBvsCircle(_arg1:RectangleParticle, _arg2:CircleParticle):Boolean{
var _local3:Vector;
var _local4:Number;
var _local5:Array;
var _local6:int;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
var _local10:Vector;
var _local11:Number;
_local4 = Number.POSITIVE_INFINITY;
_local5 = new Array(2);
_local6 = 0;
while (_local6 < 2) {
_local8 = _arg1.axes[_local6];
_local9 = testIntervals(_arg1.getProjection(_local8), _arg2.getProjection(_local8));
if (_local9 == 0){
return (false);
};
if (Math.abs(_local9) < Math.abs(_local4)){
_local3 = _local8;
_local4 = _local9;
};
_local5[_local6] = _local9;
_local6++;
};
_local7 = _arg2.radius;
if ((((Math.abs(_local5[0]) < _local7)) && ((Math.abs(_local5[1]) < _local7)))){
_local10 = closestVertexOnOBB(_arg2.samp, _arg1);
_local3 = _local10.minus(_arg2.samp);
_local11 = _local3.magnitude();
_local4 = (_local7 - _local11);
if (_local4 > 0){
_local3.divEquals(_local11);
} else {
return (false);
};
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local3, _local4);
return (true);
}
static function test(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
if (((_arg1.fixed) && (_arg2.fixed))){
return;
};
if ((((_arg1.multisample == 0)) && ((_arg2.multisample == 0)))){
normVsNorm(_arg1, _arg2);
} else {
if ((((_arg1.multisample > 0)) && ((_arg2.multisample == 0)))){
sampVsNorm(_arg1, _arg2);
} else {
if ((((_arg2.multisample > 0)) && ((_arg1.multisample == 0)))){
sampVsNorm(_arg2, _arg1);
} else {
if (_arg1.multisample == _arg2.multisample){
sampVsSamp(_arg1, _arg2);
} else {
normVsNorm(_arg1, _arg2);
};
};
};
};
}
private static function testIntervals(_arg1:Interval, _arg2:Interval):Number{
var _local3:Number;
var _local4:Number;
if (_arg1.max < _arg2.min){
return (0);
};
if (_arg2.max < _arg1.min){
return (0);
};
_local3 = (_arg2.max - _arg1.min);
_local4 = (_arg2.min - _arg1.max);
return (((Math.abs(_local3))<Math.abs(_local4)) ? _local3 : _local4);
}
private static function normVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
_arg1.samp.copy(_arg1.curr);
_arg2.samp.copy(_arg2.curr);
testTypes(_arg1, _arg2);
}
private static function testCirclevsCircle(_arg1:CircleParticle, _arg2:CircleParticle):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Vector;
var _local6:Number;
var _local7:Number;
_local3 = testIntervals(_arg1.getIntervalX(), _arg2.getIntervalX());
if (_local3 == 0){
return (false);
};
_local4 = testIntervals(_arg1.getIntervalY(), _arg2.getIntervalY());
if (_local4 == 0){
return (false);
};
_local5 = _arg1.samp.minus(_arg2.samp);
_local6 = _local5.magnitude();
_local7 = ((_arg1.radius + _arg2.radius) - _local6);
if (_local7 > 0){
_local5.divEquals(_local6);
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local5, _local7);
return (true);
};
return (false);
}
private static function testTypes(_arg1:AbstractParticle, _arg2:AbstractParticle):Boolean{
if ((((_arg1 is RectangleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsOBB((_arg1 as RectangleParticle), (_arg2 as RectangleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is CircleParticle)))){
return (testCirclevsCircle((_arg1 as CircleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is RectangleParticle)) && ((_arg2 is CircleParticle)))){
return (testOBBvsCircle((_arg1 as RectangleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsCircle((_arg2 as RectangleParticle), (_arg1 as CircleParticle)));
};
return (false);
}
private static function sampVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_arg2.samp.copy(_arg2.curr);
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
private static function closestVertexOnOBB(_arg1:Vector, _arg2:RectangleParticle):Vector{
var _local3:Vector;
var _local4:Vector;
var _local5:int;
var _local6:Number;
_local3 = _arg1.minus(_arg2.samp);
_local4 = new Vector(_arg2.samp.x, _arg2.samp.y);
_local5 = 0;
while (_local5 < 2) {
_local6 = _local3.dot(_arg2.axes[_local5]);
if (_local6 >= 0){
_local6 = _arg2.extents[_local5];
} else {
if (_local6 < 0){
_local6 = -(_arg2.extents[_local5]);
};
};
_local4.plusEquals(_arg2.axes[_local5].mult(_local6));
_local5++;
};
return (_local4);
}
private static function testOBBvsOBB(_arg1:RectangleParticle, _arg2:RectangleParticle):Boolean{
var _local3:Vector;
var _local4:Number;
var _local5:int;
var _local6:Vector;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Boolean;
_local4 = Number.POSITIVE_INFINITY;
_local5 = 0;
while (_local5 < 2) {
_local6 = _arg1.axes[_local5];
_local7 = testIntervals(_arg1.getProjection(_local6), _arg2.getProjection(_local6));
if (_local7 == 0){
return (false);
};
_local8 = _arg2.axes[_local5];
_local9 = testIntervals(_arg1.getProjection(_local8), _arg2.getProjection(_local8));
if (_local9 == 0){
return (false);
};
_local10 = Math.abs(_local7);
_local11 = Math.abs(_local9);
if ((((_local10 < Math.abs(_local4))) || ((_local11 < Math.abs(_local4))))){
_local12 = (_local10 < _local11);
_local3 = (_local12) ? _local6 : _local8;
_local4 = (_local12) ? _local7 : _local9;
};
_local5++;
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, _local3, _local4);
return (true);
}
private static function sampVsSamp(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
_arg2.samp.setTo((_arg2.prev.x + (_local4 * (_arg2.curr.x - _arg2.prev.x))), (_arg2.prev.y + (_local4 * (_arg2.curr.y - _arg2.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
}
}//package org.cove.ape
Section 132
//CollisionResolver (org.cove.ape.CollisionResolver)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionResolver {
static function resolveParticleParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Vector, _arg4:Number):void{
var _local5:Vector;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Collision;
var _local10:Collision;
var _local11:Vector;
var _local12:Vector;
var _local13:Vector;
var _local14:Vector;
_arg1.curr.copy(_arg1.samp);
_arg2.curr.copy(_arg2.samp);
_local5 = _arg3.mult(_arg4);
_local6 = (_arg1.elasticity + _arg2.elasticity);
_local7 = (_arg1.invMass + _arg2.invMass);
_local8 = clamp((1 - (_arg1.friction + _arg2.friction)), 0, 1);
_local9 = _arg1.getComponents(_arg3);
_local10 = _arg2.getComponents(_arg3);
_local11 = _local10.vn.mult(((_local6 + 1) * _arg1.invMass)).plus(_local9.vn.mult((_arg2.invMass - (_local6 * _arg1.invMass)))).divEquals(_local7);
_local12 = _local9.vn.mult(((_local6 + 1) * _arg2.invMass)).plus(_local10.vn.mult((_arg1.invMass - (_local6 * _arg2.invMass)))).divEquals(_local7);
_local9.vt.multEquals(_local8);
_local10.vt.multEquals(_local8);
_local13 = _local5.mult((_arg1.invMass / _local7));
_local14 = _local5.mult((-(_arg2.invMass) / _local7));
_local11.plusEquals(_local9.vt);
_local12.plusEquals(_local10.vt);
if (!_arg1.fixed){
_arg1.resolveCollision(_local13, _local11, _arg3, _arg4, -1, _arg2);
};
if (!_arg2.fixed){
_arg2.resolveCollision(_local14, _local12, _arg3, _arg4, 1, _arg1);
};
}
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 > _arg3){
return (_arg3);
};
if (_arg1 < _arg2){
return (_arg2);
};
return (_arg1);
}
}
}//package org.cove.ape
Section 133
//Composite (org.cove.ape.Composite)
package org.cove.ape {
public class Composite extends AbstractCollection {
private var delta:Vector;
public function Composite(){
delta = new Vector();
}
private function getRelativeAngle(_arg1:Vector, _arg2:Vector):Number{
delta.setTo((_arg2.x - _arg1.x), (_arg2.y - _arg1.y));
return (Math.atan2(delta.y, delta.x));
}
public function rotateByRadian(_arg1:Number, _arg2:Vector):void{
var _local3:AbstractParticle;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Number;
_local4 = particles;
_local5 = _local4.length;
_local6 = 0;
while (_local6 < _local5) {
_local3 = _local4[_local6];
_local7 = _local3.center.distance(_arg2);
_local8 = (getRelativeAngle(_arg2, _local3.center) + _arg1);
_local3.px = ((Math.cos(_local8) * _local7) + _arg2.x);
_local3.py = ((Math.sin(_local8) * _local7) + _arg2.y);
_local6++;
};
}
public function rotateByAngle(_arg1:Number, _arg2:Vector):void{
var _local3:Number;
_local3 = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
rotateByRadian(_local3, _arg2);
}
public function set fixed(_arg1:Boolean):void{
var _local2:int;
_local2 = 0;
while (_local2 < particles.length) {
particles[_local2].fixed = _arg1;
_local2++;
};
}
public function get fixed():Boolean{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
if (!particles[_local1].fixed){
return (false);
};
_local1++;
};
return (true);
}
}
}//package org.cove.ape
Section 134
//Group (org.cove.ape.Group)
package org.cove.ape {
public class Group extends AbstractCollection {
private var _collideInternal:Boolean;
private var _composites:Array;
private var _collisionList:Array;
public function Group(_arg1:Boolean=false){
_composites = new Array();
_collisionList = new Array();
this.collideInternal = _arg1;
}
function checkCollisions():void{
var _local1:int;
var _local2:int;
var _local3:Group;
if (collideInternal){
checkCollisionGroupInternal();
};
_local1 = collisionList.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = collisionList[_local2];
checkCollisionVsGroup(_local3);
_local2++;
};
}
public function get composites():Array{
return (_composites);
}
override public function init():void{
var _local1:int;
super.init();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].init();
_local1++;
};
}
public function removeCollidable(_arg1:Group):void{
var _local2:int;
_local2 = collisionList.indexOf(_arg1);
if (_local2 == -1){
return;
};
collisionList.splice(_local2, 1);
}
private function checkCollisionVsGroup(_arg1:Group):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Composite;
var _local6:int;
var _local7:Composite;
checkCollisionsVsCollection(_arg1);
_local2 = _composites.length;
_local3 = _arg1.composites.length;
_local4 = 0;
while (_local4 < _local2) {
_local5 = _composites[_local4];
_local5.checkCollisionsVsCollection(_arg1);
_local6 = 0;
while (_local6 < _local3) {
_local7 = _arg1.composites[_local6];
_local5.checkCollisionsVsCollection(_local7);
_local6++;
};
_local4++;
};
_local6 = 0;
while (_local6 < _local3) {
_local7 = _arg1.composites[_local6];
checkCollisionsVsCollection(_local7);
_local6++;
};
}
override function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.satisfyConstraints();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.satisfyConstraints();
_local2++;
};
}
public function get collideInternal():Boolean{
return (_collideInternal);
}
public function addCollidableList(_arg1:Array):void{
var _local2:int;
var _local3:Group;
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1[_local2];
collisionList.push(_local3);
_local2++;
};
}
public function removeComposite(_arg1:Composite):void{
var _local2:int;
_local2 = composites.indexOf(_arg1);
if (_local2 == -1){
return;
};
composites.splice(_local2, 1);
_arg1.isParented = false;
_arg1.cleanup();
}
override public function cleanup():void{
var _local1:int;
super.cleanup();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].cleanup();
_local1++;
};
}
override public function paint():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.paint();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.paint();
_local2++;
};
}
public function addCollidable(_arg1:Group):void{
collisionList.push(_arg1);
}
override public function getAll():Array{
return (particles.concat(constraints).concat(composites));
}
public function get collisionList():Array{
return (_collisionList);
}
override function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:Composite;
super.integrate(_arg1);
_local2 = _composites.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _composites[_local3];
_local4.integrate(_arg1);
_local3++;
};
}
public function addComposite(_arg1:Composite):void{
composites.push(_arg1);
_arg1.isParented = true;
if (isParented){
_arg1.init();
};
}
private function checkCollisionGroupInternal():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
var _local4:int;
var _local5:Composite;
checkInternalCollisions();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.checkCollisionsVsCollection(this);
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local5 = _composites[_local4];
_local3.checkCollisionsVsCollection(_local5);
_local4++;
};
_local2++;
};
}
public function set collideInternal(_arg1:Boolean):void{
_collideInternal = _arg1;
}
}
}//package org.cove.ape
Section 135
//Interval (org.cove.ape.Interval)
package org.cove.ape {
final class Interval {
var min:Number;
var max:Number;
function Interval(_arg1:Number, _arg2:Number){
this.min = _arg1;
this.max = _arg2;
}
function toString():String{
return (((min + " : ") + max));
}
}
}//package org.cove.ape
Section 136
//MathUtil (org.cove.ape.MathUtil)
package org.cove.ape {
final class MathUtil {
static var ONE_EIGHTY_OVER_PI:Number = 57.2957795130823;
static var PI_OVER_ONE_EIGHTY:Number = 0.0174532925199433;
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
return (_arg2);
};
if (_arg1 > _arg3){
return (_arg3);
};
return (_arg1);
}
static function sign(_arg1:Number):int{
if (_arg1 < 0){
return (-1);
};
return (1);
}
}
}//package org.cove.ape
Section 137
//RectangleParticle (org.cove.ape.RectangleParticle)
package org.cove.ape {
public class RectangleParticle extends AbstractParticle {
private var _axes:Array;
private var _radian:Number;
private var _extents:Array;
public function RectangleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0.3, _arg9:Number=0){
super(_arg1, _arg2, _arg6, _arg7, _arg8, _arg9);
_extents = new Array((_arg3 / 2), (_arg4 / 2));
_axes = new Array(new Vector(0, 0), new Vector(0, 0));
radian = _arg5;
}
override public function init():void{
var _local1:Number;
var _local2:Number;
cleanup();
if (displayObject != null){
initDisplay();
} else {
_local1 = (extents[0] * 2);
_local2 = (extents[1] * 2);
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawRect((-(_local1) / 2), (-(_local2) / 2), _local1, _local2);
sprite.graphics.endFill();
};
paint();
}
public function set width(_arg1:Number):void{
_extents[0] = (_arg1 / 2);
}
function get axes():Array{
return (_axes);
}
public function get height():Number{
return ((_extents[1] * 2));
}
function get extents():Array{
return (_extents);
}
public function set angle(_arg1:Number):void{
radian = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
}
private function setAxes(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.sin(_arg1);
_local3 = Math.cos(_arg1);
axes[0].x = _local3;
axes[0].y = _local2;
axes[1].x = -(_local2);
axes[1].y = _local3;
}
public function get radian():Number{
return (_radian);
}
public function get width():Number{
return ((_extents[0] * 2));
}
public function set height(_arg1:Number):void{
_extents[1] = (_arg1 / 2);
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
var _local3:Number;
_local2 = ((extents[0] * Math.abs(_arg1.dot(axes[0]))) + (extents[1] * Math.abs(_arg1.dot(axes[1]))));
_local3 = samp.dot(_arg1);
interval.min = (_local3 - _local2);
interval.max = (_local3 + _local2);
return (interval);
}
public function set radian(_arg1:Number):void{
_radian = _arg1;
setAxes(_arg1);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
}
}//package org.cove.ape
Section 138
//RimParticle (org.cove.ape.RimParticle)
package org.cove.ape {
import org.cove.ape.*;
class RimParticle {
private var maxTorque:Number;
var curr:Vector;
var prev:Vector;
private var av:Number;
private var wr:Number;
private var sp:Number;
function RimParticle(_arg1:Number, _arg2:Number){
curr = new Vector(_arg1, 0);
prev = new Vector(0, 0);
sp = 0;
av = 0;
maxTorque = _arg2;
wr = _arg1;
}
function update(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
sp = Math.max(-(maxTorque), Math.min(maxTorque, (sp + av)));
_local2 = -(curr.y);
_local3 = curr.x;
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
_local2 = (_local2 / _local4);
_local3 = (_local3 / _local4);
curr.x = (curr.x + (sp * _local2));
curr.y = (curr.y + (sp * _local3));
_local5 = prev.x;
_local6 = prev.y;
_local7 = (prev.x = curr.x);
_local8 = (prev.y = curr.y);
curr.x = (curr.x + (APEngine.damping * (_local7 - _local5)));
curr.y = (curr.y + (APEngine.damping * (_local8 - _local6)));
_local9 = Math.sqrt(((curr.x * curr.x) + (curr.y * curr.y)));
_local10 = ((_local9 - wr) / _local9);
curr.x = (curr.x - (curr.x * _local10));
curr.y = (curr.y - (curr.y * _local10));
}
function set speed(_arg1:Number):void{
sp = _arg1;
}
function get angularVelocity():Number{
return (av);
}
function set angularVelocity(_arg1:Number):void{
av = _arg1;
}
function get speed():Number{
return (sp);
}
}
}//package org.cove.ape
Section 139
//SpringConstraint (org.cove.ape.SpringConstraint)
package org.cove.ape {
import flash.display.*;
public class SpringConstraint extends AbstractConstraint {
private var _collidable:Boolean;
private var _restLength:Number;
private var p1:AbstractParticle;
private var p2:AbstractParticle;
private var _scp:SpringConstraintParticle;
public function SpringConstraint(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Number=0.5, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=1, _arg7:Boolean=false){
super(_arg3);
this.p1 = _arg1;
this.p2 = _arg2;
checkParticlesLocation();
_restLength = currLength;
setCollidable(_arg4, _arg5, _arg6, _arg7);
}
public function set rectScale(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectScale = _arg1;
}
override public function init():void{
cleanup();
if (collidable){
scp.init();
} else {
if (displayObject != null){
initDisplay();
};
};
paint();
}
function initDisplay():void{
if (collidable){
scp.initDisplay();
} else {
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
};
}
private function checkParticlesLocation():void{
if ((((p1.curr.x == p2.curr.x)) && ((p1.curr.y == p2.curr.y)))){
p2.curr.x = (p2.curr.x + 0.0001);
};
}
public function get radian():Number{
var _local1:Vector;
_local1 = delta;
return (Math.atan2(_local1.y, _local1.x));
}
function get scp():SpringConstraintParticle{
return (_scp);
}
public function get rectHeight():Number{
return (scp.rectHeight);
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
if (collidable){
scp.setDisplay(_arg1, _arg2, _arg3, _arg4);
} else {
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
};
}
public function set restLength(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("restLength must be greater than 0"));
};
_restLength = _arg1;
}
public function get currLength():Number{
return (p1.curr.distance(p2.curr));
}
public function get fixedEndLimit():Number{
return (scp.fixedEndLimit);
}
public function get rectScale():Number{
return (scp.rectScale);
}
function get delta():Vector{
return (p1.curr.minus(p2.curr));
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
public function get center():Vector{
return (p1.curr.plus(p2.curr).divEquals(2));
}
public function set rectHeight(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectHeight = _arg1;
}
public function get restLength():Number{
return (_restLength);
}
override public function paint():void{
var _local1:Vector;
if (collidable){
scp.paint();
} else {
if (displayObject != null){
_local1 = center;
sprite.x = _local1.x;
sprite.y = _local1.y;
sprite.rotation = angle;
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.moveTo(p1.px, p1.py);
sprite.graphics.lineTo(p2.px, p2.py);
};
};
}
public function setCollidable(_arg1:Boolean, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
_collidable = _arg1;
_scp = null;
if (_collidable){
_scp = new SpringConstraintParticle(p1, p2, this, _arg2, _arg3, _arg4);
};
}
public function get collidable():Boolean{
return (_collidable);
}
public function isConnectedTo(_arg1:AbstractParticle):Boolean{
return ((((_arg1 == p1)) || ((_arg1 == p2))));
}
override function resolve():void{
var _local1:Number;
var _local2:Number;
var _local3:Vector;
if (((p1.fixed) && (p2.fixed))){
return;
};
_local1 = currLength;
_local2 = ((_local1 - restLength) / (_local1 * (p1.invMass + p2.invMass)));
_local3 = delta.mult((_local2 * stiffness));
p1.curr.minusEquals(_local3.mult(p1.invMass));
p2.curr.plusEquals(_local3.mult(p2.invMass));
}
public function get fixed():Boolean{
return (((p1.fixed) && (p2.fixed)));
}
public function set fixedEndLimit(_arg1:Number):void{
if (scp == null){
return;
};
scp.fixedEndLimit = _arg1;
}
}
}//package org.cove.ape
Section 140
//SpringConstraintParticle (org.cove.ape.SpringConstraintParticle)
package org.cove.ape {
import org.cove.ape.*;
import flash.display.*;
class SpringConstraintParticle extends RectangleParticle {
private var _fixedEndLimit:Number;
private var _rectScale:Number;
private var rca:Vector;
private var rcb:Vector;
private var s:Number;
private var parent:SpringConstraint;
private var scaleToLength:Boolean;
private var p1:AbstractParticle;
private var p2:AbstractParticle;
private var lambda:Vector;
private var avgVelocity:Vector;
private var _rectHeight:Number;
function SpringConstraintParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:SpringConstraint, _arg4:Number, _arg5:Number, _arg6:Boolean){
super(0, 0, 0, 0, 0, false);
this.p1 = _arg1;
this.p2 = _arg2;
lambda = new Vector(0, 0);
avgVelocity = new Vector(0, 0);
parent = _arg3;
this.rectScale = _arg5;
this.rectHeight = _arg4;
this.scaleToLength = _arg6;
fixedEndLimit = 0;
rca = new Vector();
rcb = new Vector();
}
private function setCorners(_arg1:RectangleParticle, _arg2:int):void{
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Array;
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 = _arg1.curr.x;
_local4 = _arg1.curr.y;
_local5 = _arg1.axes;
_local6 = _arg1.extents;
_local7 = (_local5[0].x * _local6[0]);
_local8 = (_local5[0].y * _local6[0]);
_local9 = (_local5[1].x * _local6[1]);
_local10 = (_local5[1].y * _local6[1]);
_local11 = (_local7 - _local9);
_local12 = (_local8 - _local10);
_local13 = (_local7 + _local9);
_local14 = (_local8 + _local10);
if (_arg2 == 0){
rca.x = (_local3 - _local13);
rca.y = (_local4 - _local14);
rcb.x = (_local3 + _local11);
rcb.y = (_local4 + _local12);
} else {
if (_arg2 == 1){
rca.x = (_local3 + _local11);
rca.y = (_local4 + _local12);
rcb.x = (_local3 + _local13);
rcb.y = (_local4 + _local14);
} else {
if (_arg2 == 2){
rca.x = (_local3 + _local13);
rca.y = (_local4 + _local14);
rcb.x = (_local3 - _local11);
rcb.y = (_local4 - _local12);
} else {
if (_arg2 == 3){
rca.x = (_local3 - _local11);
rca.y = (_local4 - _local12);
rcb.x = (_local3 - _local13);
rcb.y = (_local4 - _local14);
};
};
};
};
}
override public function init():void{
var _local1:Sprite;
var _local2:Number;
var _local3:Number;
if (displayObject != null){
initDisplay();
} else {
_local1 = new Sprite();
parent.sprite.addChild(_local1);
_local1.name = "inner";
_local2 = (parent.currLength * rectScale);
_local3 = rectHeight;
_local1.graphics.clear();
_local1.graphics.lineStyle(parent.lineThickness, parent.lineColor, parent.lineAlpha);
_local1.graphics.beginFill(parent.fillColor, parent.fillAlpha);
_local1.graphics.drawRect((-(_local2) / 2), (-(_local3) / 2), _local2, _local3);
_local1.graphics.endFill();
};
paint();
}
function updatePosition():void{
var _local1:Vector;
_local1 = parent.center;
curr.setTo(_local1.x, _local1.y);
width = (scaleToLength) ? (parent.currLength * rectScale) : (parent.restLength * rectScale);
height = rectHeight;
radian = parent.radian;
}
private function closestPtSegmentSegment():Number{
var _local1:Vector;
var _local2:Vector;
var _local3:Vector;
var _local4:Vector;
var _local5:Vector;
var _local6:Vector;
var _local7:Vector;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Vector;
var _local16:Vector;
var _local17:Vector;
_local1 = p1.curr;
_local2 = p2.curr;
_local3 = rca;
_local4 = rcb;
_local5 = _local2.minus(_local1);
_local6 = _local4.minus(_local3);
_local7 = _local1.minus(_local3);
_local9 = _local5.dot(_local5);
_local10 = _local6.dot(_local6);
_local11 = _local6.dot(_local7);
_local12 = _local5.dot(_local7);
_local13 = _local5.dot(_local6);
_local14 = ((_local9 * _local10) - (_local13 * _local13));
if (_local14 != 0){
s = MathUtil.clamp((((_local13 * _local11) - (_local12 * _local10)) / _local14), 0, 1);
} else {
s = 0.5;
};
_local8 = (((_local13 * s) + _local11) / _local10);
if (_local8 < 0){
_local8 = 0;
s = MathUtil.clamp((-(_local12) / _local9), 0, 1);
} else {
if (_local8 > 0){
_local8 = 1;
s = MathUtil.clamp(((_local13 - _local12) / _local9), 0, 1);
};
};
_local15 = _local1.plus(_local5.mult(s));
_local16 = _local3.plus(_local6.mult(_local8));
_local17 = _local15.minus(_local16);
return (_local15.minus(_local16).dot(_local17));
}
function get rectHeight():Number{
return (_rectHeight);
}
function get fixedEndLimit():Number{
return (_fixedEndLimit);
}
private function closestParamPoint(_arg1:Vector):Number{
var _local2:Vector;
var _local3:Number;
_local2 = p2.curr.minus(p1.curr);
_local3 = (_local2.dot(_arg1.minus(p1.curr)) / _local2.dot(_local2));
return (MathUtil.clamp(_local3, 0, 1));
}
function set rectHeight(_arg1:Number):void{
_rectHeight = _arg1;
}
override public function paint():void{
var _local1:Vector;
var _local2:Sprite;
_local1 = parent.center;
_local2 = parent.sprite;
if (scaleToLength){
_local2.getChildByName("inner").width = (parent.currLength * rectScale);
} else {
if (displayObject != null){
_local2.getChildByName("inner").width = (parent.restLength * rectScale);
};
};
_local2.x = _local1.x;
_local2.y = _local1.y;
_local2.rotation = parent.angle;
}
private function getContactPointParam(_arg1:AbstractParticle):Number{
var _local2:Number;
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:int;
var _local7:Number;
if ((_arg1 is CircleParticle)){
_local2 = closestParamPoint(_arg1.curr);
} else {
if ((_arg1 is RectangleParticle)){
_local4 = new Array(4);
_local5 = Number.POSITIVE_INFINITY;
_local6 = 0;
while (_local6 < 4) {
setCorners((_arg1 as RectangleParticle), _local6);
_local7 = closestPtSegmentSegment();
if (_local7 < _local5){
_local5 = _local7;
_local3 = _local6;
_local4[_local6] = s;
};
_local6++;
};
_local2 = _local4[_local3];
};
};
return (_local2);
}
function set fixedEndLimit(_arg1:Number):void{
_fixedEndLimit = _arg1;
}
override function get invMass():Number{
if (((p1.fixed) && (p2.fixed))){
return (0);
};
return ((1 / ((p1.mass + p2.mass) / 2)));
}
override function initDisplay():void{
var _local1:Sprite;
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
_local1 = new Sprite();
_local1.name = "inner";
_local1.addChild(displayObject);
parent.sprite.addChild(_local1);
}
function set rectScale(_arg1:Number):void{
_rectScale = _arg1;
}
override function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:AbstractParticle;
_local7 = getContactPointParam(_arg6);
_local8 = (1 - _local7);
_local9 = _local7;
if (p1.fixed){
if (_local9 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local9), (_arg1.y / _local9));
p2.curr.plusEquals(lambda);
p2.velocity = _arg2;
} else {
if (p2.fixed){
if (_local8 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local8), (_arg1.y / _local8));
p1.curr.plusEquals(lambda);
p1.velocity = _arg2;
} else {
_local10 = ((_local8 * _local8) + (_local9 * _local9));
if (_local10 == 0){
return;
};
lambda.setTo((_arg1.x / _local10), (_arg1.y / _local10));
p1.curr.plusEquals(lambda.mult(_local8));
p2.curr.plusEquals(lambda.mult(_local9));
if (_local7 == 0.5){
p1.velocity = _arg2;
p2.velocity = _arg2;
} else {
_local11 = ((_local7)<0.5) ? p1 : p2;
_local11.velocity = _arg2;
};
};
};
}
override public function get elasticity():Number{
return (((p1.elasticity + p2.elasticity) / 2));
}
function get rectScale():Number{
return (_rectScale);
}
override public function get velocity():Vector{
var _local1:Vector;
var _local2:Vector;
_local1 = p1.velocity;
_local2 = p2.velocity;
avgVelocity.setTo(((_local1.x + _local2.x) / 2), ((_local1.y + _local2.y) / 2));
return (avgVelocity);
}
override public function get friction():Number{
return (((p1.friction + p2.friction) / 2));
}
override public function get mass():Number{
return (((p1.mass + p2.mass) / 2));
}
}
}//package org.cove.ape
Section 141
//Vector (org.cove.ape.Vector)
package org.cove.ape {
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
}
public function cross(_arg1:Vector):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function magnitude():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function divEquals(_arg1:Number):Vector{
if (_arg1 == 0){
_arg1 = 0.0001;
};
x = (x / _arg1);
y = (y / _arg1);
return (this);
}
public function times(_arg1:Vector):Vector{
return (new Vector((x * _arg1.x), (y * _arg1.y)));
}
public function plusEquals(_arg1:Vector):Vector{
x = (x + _arg1.x);
y = (y + _arg1.y);
return (this);
}
public function dot(_arg1:Vector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function toString():String{
return (((x + " : ") + y));
}
public function normalize():Vector{
var _local1:Number;
_local1 = magnitude();
if (_local1 == 0){
_local1 = 0.0001;
};
return (mult((1 / _local1)));
}
public function copy(_arg1:Vector):void{
x = _arg1.x;
y = _arg1.y;
}
public function minusEquals(_arg1:Vector):Vector{
x = (x - _arg1.x);
y = (y - _arg1.y);
return (this);
}
public function minus(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function plus(_arg1:Vector):Vector{
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function distance(_arg1:Vector):Number{
var _local2:Vector;
_local2 = this.minus(_arg1);
return (_local2.magnitude());
}
public function setTo(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
}
public function multEquals(_arg1:Number):Vector{
x = (x * _arg1);
y = (y * _arg1);
return (this);
}
public function mult(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
}
}//package org.cove.ape
Section 142
//WheelParticle (org.cove.ape.WheelParticle)
package org.cove.ape {
public class WheelParticle extends CircleParticle {
private var _traction:Number;
private var normSlip:Vector;
private var tan:Vector;
private var rp:RimParticle;
private var orientation:Vector;
public function WheelParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0.3, _arg7:Number=0, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
tan = new Vector(0, 0);
normSlip = new Vector(0, 0);
rp = new RimParticle(_arg3, 2);
this.traction = _arg8;
orientation = new Vector();
}
override public function init():void{
cleanup();
if (displayObject != null){
initDisplay();
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawCircle(0, 0, radius);
sprite.graphics.endFill();
sprite.graphics.moveTo(-(radius), 0);
sprite.graphics.lineTo(radius, 0);
sprite.graphics.moveTo(0, -(radius));
sprite.graphics.lineTo(0, radius);
};
paint();
}
public function set speed(_arg1:Number):void{
rp.speed = _arg1;
}
override function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
super.resolveCollision(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
resolve(_arg3.mult(MathUtil.sign((_arg4 * _arg5))));
}
public function get traction():Number{
return ((1 - _traction));
}
public function get radian():Number{
orientation.setTo(rp.curr.x, rp.curr.y);
return ((Math.atan2(orientation.y, orientation.x) + Math.PI));
}
public function set angularVelocity(_arg1:Number):void{
rp.angularVelocity = _arg1;
}
public function get speed():Number{
return (rp.speed);
}
override public function update(_arg1:Number):void{
super.update(_arg1);
rp.update(_arg1);
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
public function get angularVelocity():Number{
return (rp.angularVelocity);
}
private function resolve(_arg1:Vector):void{
var _local2:Vector;
var _local3:Vector;
var _local4:Number;
var _local5:Number;
tan.setTo(-(rp.curr.y), rp.curr.x);
tan = tan.normalize();
_local2 = tan.mult(rp.speed);
_local3 = velocity.plusEquals(_local2);
_local4 = _local3.cross(_arg1);
tan.multEquals(_local4);
rp.prev.copy(rp.curr.minus(tan));
_local5 = ((1 - _traction) * rp.speed);
normSlip.setTo((_local5 * _arg1.y), (_local5 * _arg1.x));
curr.plusEquals(normSlip);
rp.speed = (rp.speed * _traction);
}
public function set traction(_arg1:Number):void{
_traction = (1 - _arg1);
}
}
}//package org.cove.ape
Section 143
//MusicManager (sound.MusicManager)
package sound {
import flash.events.*;
import flash.media.*;
public class MusicManager {
private var music:Sound;
private var state:int;
private var soundChannel:SoundChannel;
public static const MUSIC:String = " music.";
public static const PLAY:int = 0;
public static const GARDEN:String = " garden.";
public static const MUTE:int = 1;
private static var musicManager:MusicManager;
private static var singleFlag:Boolean = true;
public function MusicManager(){
if (MusicManager.singleFlag == true){
throw (new Error("MusicManager不能用构造函数实例化。"));
};
MusicManager.singleFlag = true;
this.music = new Music();
}
public function setMusic(_arg1:String):void{
if (_arg1 == MusicManager.GARDEN){
this.music = new Garden();
} else {
if (_arg1 == MusicManager.MUSIC){
this.music = new Music();
};
};
}
public function returnPlay(_arg1:Event):void{
this.stop();
this.play();
}
public function stop():void{
if (this.soundChannel != null){
this.soundChannel.stop();
this.soundChannel.removeEventListener(Event.SOUND_COMPLETE, returnPlay);
};
}
public function muteControl():void{
if (this.getState() == MusicManager.MUTE){
this.setState(MusicManager.PLAY);
} else {
if (this.getState() == MusicManager.PLAY){
this.setState(MusicManager.MUTE);
};
};
}
public function setState(_arg1:int):void{
var _local2:SoundTransform;
this.state = _arg1;
if (this.state == MusicManager.PLAY){
_local2 = new SoundTransform(1);
} else {
if (this.state == MusicManager.MUTE){
_local2 = new SoundTransform(0);
};
};
if (this.soundChannel != null){
this.soundChannel.soundTransform = _local2;
};
}
public function play():void{
this.soundChannel = this.music.play();
this.setState(this.getState());
this.soundChannel.addEventListener(Event.SOUND_COMPLETE, returnPlay);
}
public function getState():int{
return (this.state);
}
public static function getInstance():MusicManager{
if (MusicManager.musicManager == null){
MusicManager.singleFlag = false;
MusicManager.musicManager = new (MusicManager);
};
return (MusicManager.musicManager);
}
}
}//package sound
Section 144
//SoundManager (sound.SoundManager)
package sound {
import flash.media.*;
public class SoundManager {
private var soundChannel:SoundChannel;
private var currentSound:Sound;
private var mute:Boolean;
public static const SUCCESS:String = " success.";
public static const HIT_BALL_2:String = " hit ball2.";
public static const IN_HOLE_1:String = " in hole1.";
public static const IN_HOLE_2:String = " in hole2.";
public static const PLAY:Boolean = false;
public static const GARDEN:String = " garden.";
public static const MUTE:Boolean = true;
public static const HIT_BALL_1:String = " hit ball1.";
public static const HIT_BALL_3:String = " hit ball3.";
private static var soundManager:SoundManager;
private static var singleFlag:Boolean = true;
public function SoundManager(){
if (SoundManager.singleFlag == true){
throw (new Error("SoundManager不能用构造函数实例化。"));
};
SoundManager.singleFlag = true;
this.init();
}
public function setMute(_arg1:Boolean):void{
this.mute = _arg1;
if (this.soundChannel != null){
this.soundChannel.stop();
};
}
public function muteControl():void{
if (this.getMute() == SoundManager.PLAY){
this.setMute(SoundManager.MUTE);
} else {
if (this.getMute() == SoundManager.MUTE){
this.setMute(SoundManager.PLAY);
};
};
}
private function init():void{
this.currentSound = null;
this.soundChannel = null;
this.setMute(SoundManager.PLAY);
}
public function play(_arg1:String):void{
if (this.getMute() == SoundManager.PLAY){
if (_arg1 == SoundManager.IN_HOLE_1){
this.currentSound = new InHole1();
} else {
if (_arg1 == SoundManager.IN_HOLE_2){
this.currentSound = new InHole2();
} else {
if (_arg1 == SoundManager.HIT_BALL_1){
this.currentSound = new HitBall1();
} else {
if (_arg1 == SoundManager.HIT_BALL_2){
this.currentSound = new HitBall2();
} else {
if (_arg1 == SoundManager.HIT_BALL_3){
this.currentSound = new HitBall3();
} else {
if (_arg1 == SoundManager.SUCCESS){
this.currentSound = new SuccessSound();
};
};
};
};
};
};
this.soundChannel = this.currentSound.play(0);
};
}
public function getMute():Boolean{
return (this.mute);
}
public static function getInstance():SoundManager{
if (soundManager == null){
SoundManager.singleFlag = false;
soundManager = new (SoundManager);
};
return (soundManager);
}
}
}//package sound
Section 145
//MaskRect (ui.MaskRect)
package ui {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class MaskRect extends Sprite {
public var onSetWH:Function;
private var __align:String;// = "left-top"
public static var wid:int = 0;
public static var hei0:int;
public static var hei:int = 0;
public static var wid0:int;
public function MaskRect(){
onSetWH = function ():void{
};
__align = "left-top";
super();
if ((((wid > 0)) && ((hei > 0)))){
setWH();
} else {
this.addEventListener(Event.ADDED_TO_STAGE, added);
};
}
private function added(_arg1:Event):void{
var event = _arg1;
this.removeEventListener(Event.ADDED_TO_STAGE, added);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
try {
getStageWH();
} catch(e:Error) {
this.loaderInfo.addEventListener(Event.INIT, loadInit);
};
}
private function getStageWH():void{
var _local1:*;
_local1 = this.getChildAt(0);
wid0 = _local1.width;
hei0 = _local1.height;
wid = this.loaderInfo.width;
hei = this.loaderInfo.height;
setWH();
}
public function set align(_arg1:String):void{
var _local2:*;
var _local3:Rectangle;
__align = _arg1;
if ((((wid > 0)) && ((hei > 0)))){
_local2 = this.getChildAt(0);
_local3 = _local2.getBounds(this);
switch (__align.charAt(0).toLowerCase()){
case "c":
case "m":
_local2.x = (_local2.x + (((wid0 - wid) / 2) - _local3.x));
_local2.y = (_local2.y + (((hei0 - hei) / 2) - _local3.y));
break;
case "r":
case "b":
_local2.x = (_local2.x + ((wid0 - wid) - _local3.x));
_local2.y = (_local2.y + ((hei0 - hei) - _local3.y));
break;
default:
_local2.x = (_local2.x + -(_local3.x));
_local2.y = (_local2.y + -(_local3.y));
break;
};
};
}
private function loadInit(_arg1:Event):void{
this.loaderInfo.removeEventListener(Event.INIT, loadInit);
getStageWH();
}
private function removed(_arg1:Event):void{
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
onSetWH = null;
}
private function setWH():void{
var _local1:*;
_local1 = this.getChildAt(0);
_local1.width = wid;
_local1.height = hei;
onSetWH(wid, hei);
if (__align){
align = __align;
};
}
public static function setPos(_arg1:MaskRect, _arg2:Function):void{
if ((((wid > 0)) && ((hei > 0)))){
_arg2(wid, hei);
} else {
_arg1.onSetWH = _arg2;
};
}
}
}//package ui
Section 146
//Txt (ui.Txt)
package ui {
import flash.display.*;
import flash.text.*;
public class Txt extends Sprite {
private var __text:String;
public var txt:TextField;
public function Txt(){
__text = "";
autoSize = "left";
}
public function get text(){
if (txt.selectable){
__text = txt.text;
};
return (__text);
}
public function get type():String{
return (txt.type);
}
public function get autoSize():String{
return (txt.autoSize);
}
public function get selectable():Boolean{
return (txt.selectable);
}
public function set text(_arg1):void{
txt.text = (__text = _arg1);
}
public function set type(_arg1:String):void{
txt.type = _arg1;
}
public function set autoSize(_arg1:String):void{
txt.autoSize = _arg1;
}
public function set selectable(_arg1:Boolean):void{
txt.selectable = _arg1;
}
public function set maxChars(_arg1:int):void{
txt.maxChars = _arg1;
}
public function get maxChars():int{
return (txt.maxChars);
}
}
}//package ui
Section 147
//Common (Common)
package {
import flash.display.*;
import flash.utils.*;
public final class Common {
public static function deepCopy(_arg1:Object){
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeObject(_arg1);
_local2.position = 0;
return (_local2.readObject());
}
public static function removeChildren(_arg1:DisplayObjectContainer):void{
while (_arg1.numChildren > 0) {
_arg1.removeChildAt(0);
};
}
public static function playAll(_arg1:DisplayObject, _arg2:Boolean=true){
var _local3:DisplayObjectContainer;
var _local4:int;
if ((_arg1 is DisplayObjectContainer)){
_local3 = (_arg1 as DisplayObjectContainer);
_local4 = _local3.numChildren;
while (--_local4 >= 0) {
playAll(_local3.getChildAt(_local4), true);
};
if (((_arg2) && ((_arg1 is MovieClip)))){
(_arg1 as MovieClip).play();
};
};
}
public static function stopAll(_arg1:DisplayObject, _arg2:Boolean=true){
var _local3:DisplayObjectContainer;
var _local4:int;
if ((_arg1 is DisplayObjectContainer)){
_local3 = (_arg1 as DisplayObjectContainer);
_local4 = _local3.numChildren;
while (--_local4 >= 0) {
stopAll(_local3.getChildAt(_local4), true);
};
if (((_arg2) && ((_arg1 is MovieClip)))){
(_arg1 as MovieClip).stop();
};
};
}
}
}//package
Section 148
//Garden (Garden)
package {
import flash.media.*;
public dynamic class Garden extends Sound {
}
}//package
Section 149
//HitBall1 (HitBall1)
package {
import flash.media.*;
public dynamic class HitBall1 extends Sound {
}
}//package
Section 150
//HitBall2 (HitBall2)
package {
import flash.media.*;
public dynamic class HitBall2 extends Sound {
}
}//package
Section 151
//HitBall3 (HitBall3)
package {
import flash.media.*;
public dynamic class HitBall3 extends Sound {
}
}//package
Section 152
//InHole1 (InHole1)
package {
import flash.media.*;
public dynamic class InHole1 extends Sound {
}
}//package
Section 153
//InHole2 (InHole2)
package {
import flash.media.*;
public dynamic class InHole2 extends Sound {
}
}//package
Section 154
//Music (Music)
package {
import flash.media.*;
public dynamic class Music extends Sound {
}
}//package
Section 155
//SuccessSound (SuccessSound)
package {
import flash.media.*;
public dynamic class SuccessSound extends Sound {
}
}//package