Section 1
//DocumentClass (Game.DocumentClass)
package Game {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class DocumentClass extends MovieClip {
public var HidePreviewButton:SimpleButton;
public var StartButton:SimpleButton;
public var NextButton:SimpleButton;
public var PreviousButton:SimpleButton;
public var keys:Array;
public var KoalaFunButton:SimpleButton;
public var SolveButton:SimpleButton;
public var JumbleButton:SimpleButton;
public var ExampleMc:MovieClip;
public var ScrollerMc:MovieClip;
public var ImageGallery:Gallery;
public var difficulties:Array;
public var ReturnButton:SimpleButton;
public var PuzzleImage:String;// = ""
public var ToggleButton:SimpleButton;
public var dIndex:Number;
public var pressKeys:Array;
public var GamePuzzle:Puzzle;
public function DocumentClass(){
keys = new Array(0x0100);
pressKeys = new Array(0x0100);
GamePuzzle = new Puzzle();
PuzzleImage = "";
ImageGallery = new Gallery();
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
this.addEventListener(Event.ENTER_FRAME, OnEnterFrame);
stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp);
}
public function Previous(e:MouseEvent){
MovieClip(root).ImageGallery.Previous();
}
public function Next(e:MouseEvent){
MovieClip(root).ImageGallery.Next();
}
public function ToggleBkg(e:MouseEvent){
MovieClip(root).GamePuzzle.ShowBackgroundImage = !(MovieClip(root).GamePuzzle.ShowBackgroundImage);
}
public function JumblePuzzle(){
var i:*;
var chld:*;
var rNum:Number;
var tempX:*;
var tempY:*;
if (MovieClip(root).getChildByName("Success") != null){
chld = MovieClip(root).getChildByName("Success");
chld.stop();
removeChild(chld);
};
i = 0;
while (i < Piece.Pieces.length) {
rNum = Math.floor((Math.random() * (Piece.Pieces.length - 1)));
Piece.Pieces[i].Solving = false;
Piece.Pieces[i].scaleX = Piece.Pieces[i].MinScale.x;
Piece.Pieces[i].scaleY = Piece.Pieces[i].MinScale.y;
Piece.Pieces[i].x = Piece.Pieces[i].OriginalCoordinate.x;
Piece.Pieces[i].y = Piece.Pieces[i].OriginalCoordinate.y;
Piece.Pieces[i].Solved = false;
i++;
};
i = 0;
while (i < Piece.Pieces.length) {
rNum = Math.floor((Math.random() * (Piece.Pieces.length - 1)));
tempX = Piece.Pieces[i].x;
tempY = Piece.Pieces[i].y;
Piece.Pieces[i].x = Piece.Pieces[rNum].x;
Piece.Pieces[i].y = Piece.Pieces[rNum].y;
Piece.Pieces[rNum].x = tempX;
Piece.Pieces[rNum].y = tempY;
i++;
};
Piece.SolvingPuzzle = false;
Piece.PuzzleSolved = false;
}
public function StartGame(){
addChild(ImageGallery);
GamePuzzle = new Puzzle();
addChild(GamePuzzle);
}
public function SolvePuzzle(){
var chld:*;
if (MovieClip(root).getChildByName("Success") != null){
chld = MovieClip(root).getChildByName("Success");
chld.stop();
removeChild(chld);
};
Piece.SolvingPuzzle = true;
Puzzle.Started = false;
}
function frame3(){
ReturnButton.addEventListener(MouseEvent.CLICK, ReturnToGallery);
HidePreviewButton.addEventListener(MouseEvent.CLICK, ToggleBkg);
ReturnButton.addEventListener(MouseEvent.CLICK, ReturnToGallery);
JumbleButton.addEventListener(MouseEvent.CLICK, Jumble);
SolveButton.addEventListener(MouseEvent.CLICK, Solve);
}
function frame1(){
stop();
}
public function Start(e:MouseEvent){
var Size:Object;
if (MovieClip(root).ImageGallery.GalleryImages.Images.length > 0){
gotoAndStop(2);
Size = {x:0, y:0};
Size.x = (dIndex + 3);
Size.y = (dIndex + 3);
if ((Size.x % 2) == 0){
Size.x++;
};
if ((Size.y % 2) == 0){
Size.y++;
};
MovieClip(root).ImageGallery.Start(Size);
};
}
public function Toggle(e:MouseEvent){
dIndex++;
if (dIndex >= difficulties.length){
dIndex = 0;
};
ExampleMc.gotoAndStop((dIndex + 1));
}
public function KoalaFun(e:MouseEvent){
var Request:URLRequest;
Request = new URLRequest("http://www.koalafun.com");
navigateToURL(Request, "_blank");
}
public function Solve(e:MouseEvent){
MovieClip(root).SolvePuzzle();
}
public function KeyDown(e:KeyboardEvent){
pressKeys[e.keyCode] = (keys[e.keyCode] == false);
keys[e.keyCode] = true;
}
public function KeyUp(e:KeyboardEvent){
pressKeys[e.keyCode] = false;
keys[e.keyCode] = false;
}
public function Jumble(e:MouseEvent){
MovieClip(root).JumblePuzzle();
}
public function OnEnterFrame(e:Event){
}
public function EndPuzzle(){
var i:*;
var chld:*;
if (MovieClip(root).getChildByName("Success") != null){
chld = MovieClip(root).getChildByName("Success");
chld.stop();
removeChild(chld);
};
Piece.SolvingPuzzle = false;
i = 0;
while (i < Piece.Pieces.length) {
Piece.Pieces[i].Kill();
i++;
};
Piece.Pieces = new Array();
MovieClip(root).GamePuzzle.Kill();
MovieClip(root).GamePuzzle.Started = false;
}
function frame2(){
stop();
dIndex = 0;
difficulties = new Array("Super Easy", "Easy", "Medium", "Hard", "Impossible");
KoalaFunButton.addEventListener(MouseEvent.CLICK, KoalaFun);
ToggleButton.addEventListener(MouseEvent.CLICK, Toggle);
NextButton.addEventListener(MouseEvent.CLICK, Next);
PreviousButton.addEventListener(MouseEvent.CLICK, Previous);
StartButton.addEventListener(MouseEvent.CLICK, Start);
}
public function ReturnToGallery(e:MouseEvent){
EndPuzzle();
MovieClip(root).gotoAndStop(1);
}
}
}//package Game
Section 2
//Gallery (Game.Gallery)
package Game {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.filters.*;
public class Gallery extends MovieClip {
public var xmlFile:String;// = "http://members.lycos.co.uk/flashgamemaker/Images.xml"
public var Fader:Sprite;
public var Scroller:Bitmap;
public var xmlData:XML;
public var GalleryImages:Object;
public var FadeSprite:Object;
public var Loaders:Object;
static const PreviewCoordinate:Object = {x:30.8, y:148.2, width:179.2, height:165.7};
static const ScrollerCoordinate:Object = {x:240, y:131, width:380, height:276};
public function Gallery(){
xmlData = new XML();
xmlFile = "http://members.lycos.co.uk/flashgamemaker/Images.xml";
Loaders = {Image:new Loader(), XML:new URLLoader(), Index:0};
GalleryImages = {GalleryXML:new XMLList(), LoadedImages:new Array(), NotLoadedImages:new Array(), Images:new Array()};
Scroller = new Bitmap();
Fader = new Sprite();
FadeSprite = {Alpha:0, Dir:1, Enabled:false, Index:0, NextIndex:0};
super();
this.addChild(Scroller);
this.addChild(Fader);
this.addEventListener(Event.ADDED_TO_STAGE, OnAddedToStage);
}
public function LoadImage(){
Loaders.Index++;
if (Loaders.Index < GalleryImages.GalleryXML.length()){
Loaders.Image.load(new URLRequest(GalleryImages.GalleryXML[(Loaders.Index - 1)].toString()));
};
}
public function Previous(){
if (!MovieClip(root).GamePuzzle.Started){
if (FadeSprite.NextIndex == FadeSprite.Index){
if (FadeSprite.NextIndex > 0){
FadeSprite.NextIndex--;
} else {
FadeSprite.NextIndex = (GalleryImages.Images.length - 1);
};
FadeSprite.Enabled = true;
};
};
}
public function Next(){
if (!MovieClip(root).GamePuzzle.Started){
if (FadeSprite.NextIndex == FadeSprite.Index){
if ((FadeSprite.NextIndex + 1) < GalleryImages.Images.length){
FadeSprite.NextIndex++;
} else {
FadeSprite.NextIndex = 0;
};
FadeSprite.Enabled = true;
};
};
}
public function Start(Size:Object){
if (!MovieClip(root).GamePuzzle.Started){
MovieClip(root).GamePuzzle.MakePuzzle(GetImage(), Size);
Scroller.visible = false;
};
}
public function GetImage():Bitmap{
var bData:BitmapData;
bData = new BitmapData(GalleryImages.Images[FadeSprite.Index].width, GalleryImages.Images[FadeSprite.Index].height);
bData.draw(GalleryImages.Images[FadeSprite.Index]);
return (new Bitmap(bData));
}
public function OnAddedToStage(e:Event){
LoadPreloadedImges();
this.addEventListener(Event.ENTER_FRAME, OnEnterFrame);
}
public function LoadPreloadedImges(){
var newMc:TheCutestKitten;
var i:*;
var bData:BitmapData;
var bMap:Bitmap;
newMc = new TheCutestKitten();
i = 0;
while (i < newMc.framesLoaded) {
newMc.gotoAndStop((i + 1));
bData = new BitmapData(newMc.width, newMc.height);
bData.draw(newMc);
bMap = new Bitmap(bData);
GalleryImages.Images.push(bMap);
i++;
};
}
public function OnEnterFrame(e:Event){
var f:GlowFilter;
if (((!((MovieClip(root).ExampleMc == null))) && (!((MovieClip(root).ScrollerMc == null))))){
ScrollerCoordinate.x = (MovieClip(root).ScrollerMc.x - (MovieClip(root).ScrollerMc.width / 2));
ScrollerCoordinate.y = (MovieClip(root).ScrollerMc.y - (MovieClip(root).ScrollerMc.height / 2));
ScrollerCoordinate.width = MovieClip(root).ScrollerMc.width;
ScrollerCoordinate.height = MovieClip(root).ScrollerMc.height;
PreviewCoordinate.x = (MovieClip(root).ExampleMc.x - (MovieClip(root).ExampleMc.width / 2));
PreviewCoordinate.y = (MovieClip(root).ExampleMc.y - (MovieClip(root).ExampleMc.height / 2));
PreviewCoordinate.width = MovieClip(root).ExampleMc.width;
PreviewCoordinate.height = MovieClip(root).ExampleMc.height;
};
Scroller.visible = !(MovieClip(root).GamePuzzle.Started);
if (!MovieClip(root).GamePuzzle.Started){
Fader.graphics.clear();
Fader.graphics.beginFill(0, FadeSprite.Alpha);
Fader.graphics.drawRect(ScrollerCoordinate.x, ScrollerCoordinate.y, ScrollerCoordinate.width, ScrollerCoordinate.height);
Fader.graphics.beginFill(0x333333, 0.5);
if (GalleryImages.Images.length > 0){
Scroller.bitmapData = GalleryImages.Images[FadeSprite.Index].bitmapData;
Scroller.scaleX = (Scroller.scaleX / (Scroller.width / ScrollerCoordinate.width));
Scroller.x = ScrollerCoordinate.x;
Scroller.scaleY = (Scroller.scaleY / (Scroller.height / ScrollerCoordinate.height));
Scroller.y = ScrollerCoordinate.y;
f = new GlowFilter();
f.blurX = 5;
f.blurY = 5;
f.strength = 1000;
f.color = 0;
Scroller.filters = [f];
};
};
if (FadeSprite.Enabled){
FadeSprite.Alpha = (FadeSprite.Alpha + (FadeSprite.Dir * 0.1));
if ((((FadeSprite.Alpha > 1)) && ((FadeSprite.Dir == 1)))){
FadeSprite.Index = FadeSprite.NextIndex;
FadeSprite.Dir = -1;
};
if ((((FadeSprite.Alpha < 0)) && ((FadeSprite.Dir == -1)))){
FadeSprite.Index = FadeSprite.NextIndex;
FadeSprite.Dir = 1;
FadeSprite.Enabled = false;
};
};
}
public function LoadUserImage(){
Loaders.Image.load(new URLRequest(MovieClip(root).PuzzleImage));
}
}
}//package Game
Section 3
//Piece (Game.Piece)
package Game {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.ui.*;
public class Piece extends Sprite {
public var PieceMc:MovieClip;
public var Solving:Boolean;// = false
public var Solved:Boolean;// = false
public var Solve:Point;
public var MinScale:Point;
public var Image:MovieClip;
public var OriginalCoordinate:Object;
public var Drag:Boolean;// = false
public var OutlineMc:MovieClip;
public var Index:Number;
public var CurrentIndex:Object;
static var SolvingPuzzle:Boolean = false;
static var SelectedPiece = null;
static var Pieces:Array = new Array();
public static var ScoreHandler:Object = {Score:0, Timer:0, Chain:0, Max:50};
public static var PuzzleSolved:Boolean = true;
public function Piece(){
OriginalCoordinate = {x:0, y:0};
Drag = false;
MinScale = new Point(1, 1);
Solving = false;
Solve = new Point();
Solved = false;
super();
this.addEventListener(Event.ADDED_TO_STAGE, OnAddedToStage);
this.addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown);
this.addEventListener(MouseEvent.MOUSE_UP, OnMouseUp);
this.addEventListener(Event.ENTER_FRAME, OnEnterFrame);
}
public function OnMouseUp(e:MouseEvent){
if (!Solving){
this.stopDrag();
Drag = false;
MoveToSpot();
Puzzle.Started = true;
if (SelectedPiece == this){
SelectedPiece = null;
};
};
}
public function OnSolving(){
var xd:Number;
var yd:Number;
var distance:Number;
xd = (Solve.x - this.x);
yd = (Solve.y - this.y);
distance = Math.sqrt(((xd * xd) + (yd * yd)));
if (distance < 1){
this.x = Solve.x;
this.y = Solve.y;
Solving = false;
scaleX = 1;
scaleY = 1;
} else {
this.x = (this.x + (xd / 2));
this.y = (this.y + (yd / 2));
scaleX = (scaleX + ((1 - scaleX) / 10));
scaleY = (scaleY + ((1 - scaleY) / 10));
};
}
public function MoveToSpot(){
var sizeX:*;
var sizeY:*;
var Remainder:Point;
var Remainder2:Point;
var Destination:Object;
var xd:Number;
var yd:Number;
var Bounds:Object;
var point:Point;
var Multiplier:Number;
sizeX = ((64 * PieceMc.scaleX) * scaleX);
sizeY = ((64 * PieceMc.scaleY) * scaleY);
Remainder = new Point((Gallery.ScrollerCoordinate.x % sizeX), (Gallery.ScrollerCoordinate.y % sizeY));
Remainder2 = new Point((Gallery.PreviewCoordinate.x % sizeX), (Gallery.PreviewCoordinate.y % sizeY));
Destination = {x:Math.floor((x / sizeX)), y:Math.floor((y / sizeY))};
xd = (OriginalCoordinate.x - this.x);
yd = (OriginalCoordinate.y - this.y);
Bounds = {Left:Gallery.ScrollerCoordinate.x, Top:Gallery.ScrollerCoordinate.y, Right:(Gallery.ScrollerCoordinate.x + Gallery.ScrollerCoordinate.width), Right:(Gallery.ScrollerCoordinate.y + Gallery.ScrollerCoordinate.height)};
if ((((((((((MovieClip(parent).mouseX >= Bounds.Left)) && ((MovieClip(parent).mouseX <= Bounds.Right)))) && ((MovieClip(parent).mouseY >= Bounds.Top)))) && ((MovieClip(parent).mouseY <= Bounds.Bottom)))) || (((scaleX == scaleY) == 1)))){
if (MovieClip(root).GamePuzzle.Snapping){
this.x = (Remainder.x + (Destination.x * sizeX));
this.y = (Remainder.y + (Destination.y * sizeY));
point = new Point(x, y);
if (Point.distance(point, Solve) <= 1){
Effect();
if ((((PuzzleSolved == false)) && ((Solved == false)))){
Multiplier = (5 * ScoreHandler.Chain);
if (ScoreHandler.Timer > 0){
ScoreHandler.Chain++;
Multiplier = (5 * ScoreHandler.Chain);
} else {
ScoreHandler.Chain = 0;
Multiplier = 0;
};
ScoreHandler.Score = (ScoreHandler.Score + (5 + (5 * Multiplier)));
ScoreHandler.Timer = ScoreHandler.Max;
Solved = true;
};
} else {
if (PuzzleSolved == false){
ScoreHandler.Chain = 0;
Multiplier = 0;
};
};
};
} else {
if (MovieClip(root).GamePuzzle.Snapping){
this.x = (Remainder2.x + (Destination.x * sizeX));
this.y = (Remainder2.y + (Destination.y * sizeY));
};
};
}
public function Kill(){
this.removeEventListener(Event.ADDED_TO_STAGE, OnAddedToStage);
this.removeEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown);
this.removeEventListener(MouseEvent.MOUSE_UP, OnMouseUp);
this.removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
MovieClip(parent).removeChild(this);
}
public function OnMouseDown(e:MouseEvent){
MovieClip(parent).swapChildren(this, MovieClip(parent).getChildAt((MovieClip(parent).numChildren - 1)));
if (!Solving){
this.startDrag(false);
Drag = true;
SelectedPiece = this;
};
}
public function Effect(){
var newEffect:StarEffect;
var w:*;
var ExtraX:*;
var ExtraY:*;
newEffect = new StarEffect();
w = PieceMc.width;
ExtraX = PieceMc.scaleX;
ExtraY = PieceMc.scaleY;
newEffect.x = (this.x + (32 * ExtraX));
newEffect.y = (this.y + (32 * ExtraY));
MovieClip(root).addChild(newEffect);
}
public function OnAddedToStage(e:Event){
Index = Pieces.length;
Pieces.push(this);
OriginalCoordinate.x = this.x;
OriginalCoordinate.y = this.y;
}
public function OnEnterFrame(e:Event){
var Bounds:Object;
if (ScoreHandler.Timer > 0){
ScoreHandler.Timer = (ScoreHandler.Timer - 0.03);
};
if (Drag){
Bounds = {Left:Gallery.ScrollerCoordinate.x, Top:Gallery.ScrollerCoordinate.y, Right:(Gallery.ScrollerCoordinate.x + Gallery.ScrollerCoordinate.width), Bottom:(Gallery.ScrollerCoordinate.y + Gallery.ScrollerCoordinate.height)};
if ((((((((MovieClip(parent).mouseX >= Bounds.Left)) && ((MovieClip(parent).mouseX <= Bounds.Right)))) && ((MovieClip(parent).mouseY >= Bounds.Top)))) && ((MovieClip(parent).mouseY <= Bounds.Bottom)))){
if ((scaleX * 1.3) < 1){
scaleX = (scaleX * 1.3);
} else {
scaleX = 1;
};
if ((scaleY * 1.3) < 1){
scaleY = (scaleY * 1.3);
} else {
scaleY = 1;
};
} else {
if ((scaleX * 0.6) > MinScale.x){
scaleX = (scaleX * 0.6);
} else {
scaleX = MinScale.x;
};
if ((scaleY * 0.6) > MinScale.y){
scaleY = (scaleY * 0.6);
} else {
scaleY = MinScale.y;
};
};
x = (MovieClip(parent).mouseX - ((PieceMc.width * scaleX) / 2));
y = (MovieClip(parent).mouseY - ((PieceMc.height * scaleY) / 2));
};
if (MovieClip(root) != null){
this.visible = ((!(MovieClip(root).keys[Keyboard.SHIFT])) || (((MovieClip(root).keys[Keyboard.SHIFT]) && (Drag))));
if (Solving){
OnSolving();
};
};
if (((SolvingPuzzle) && (!(Solving)))){
Solving = true;
};
}
}
}//package Game
Section 4
//Puzzle (Game.Puzzle)
package Game {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.ui.*;
public class Puzzle extends MovieClip {
public var PuzzlePieces:Array;
public var Snapping:Boolean;// = true
public var Started:Boolean;// = false
public var BitmapObject:Bitmap;
public var Container:MovieClip;
public var Preview:Bitmap;
public var ShowBackgroundImage:Boolean;// = true
static var Started:Boolean = false;
public function Puzzle(){
Started = false;
Container = new MovieClip();
PuzzlePieces = new Array();
Snapping = true;
Preview = new Bitmap();
ShowBackgroundImage = true;
super();
this.addChild(Container);
this.Container.addChild(Preview);
this.addEventListener(Event.ADDED_TO_STAGE, OnAddedToStage);
}
public function MakePuzzle(bMap:Bitmap, Size:Object){
var i:*;
var j:*;
var Section:String;
var Suffix:String;
var Prefix:String;
var newPiece:JigsawPiece;
var bmp:Bitmap;
var W:*;
var H:*;
var xScale:*;
var yScale:*;
var xS2:*;
var yS2:*;
var W2:*;
var H2:*;
Started = true;
Preview.bitmapData = bMap.bitmapData;
Preview.scaleX = (Preview.scaleX / (Preview.width / Gallery.ScrollerCoordinate.width));
Preview.scaleY = (Preview.scaleY / (Preview.height / Gallery.ScrollerCoordinate.height));
Preview.alpha = 0.4;
i = 0;
while (i < Size.x) {
j = 0;
while (j < Size.y) {
Section = "";
Suffix = "";
Prefix = "1";
if ((i + 1) >= Size.x){
Suffix = "4";
} else {
if (i == 0){
Suffix = "1";
} else {
if ((i % 2) != 0){
Suffix = "2";
} else {
if ((i % 2) == 0){
Suffix = "3";
};
};
};
};
if ((j + 1) >= Size.y){
Section = "Bottom";
} else {
if (j == 0){
Section = "Top";
} else {
if (((!(((j % 2) == 0))) || (((((j % 2) == 0)) && ((j == 0)))))){
Section = "Mid1";
} else {
if (((((j % 2) == 0)) || (((!(((j % 2) == 0))) && (((j + 1) >= Size.y)))))){
Section = "Mid2";
};
};
};
};
newPiece = new JigsawPiece();
newPiece.PieceMc.gotoAndStop(((Section + "_Piece") + Suffix));
newPiece.OutlineMc.gotoAndStop(((Section + "_Piece") + Suffix));
bmp = new Bitmap(bMap.bitmapData);
bmp.bitmapData = bMap.bitmapData;
bmp.scaleX = (bmp.scaleX / (bmp.width / Gallery.ScrollerCoordinate.width));
bmp.scaleY = (bmp.scaleY / (bmp.height / Gallery.ScrollerCoordinate.height));
newPiece.Image.addChild(bmp);
W = bmp.width;
H = bmp.height;
xScale = ((W / Size.x) / 64);
yScale = ((H / Size.y) / 64);
xS2 = (Gallery.PreviewCoordinate.width / W);
yS2 = (Gallery.PreviewCoordinate.height / H);
W2 = (xScale * xS2);
H2 = (yScale * yS2);
newPiece.scaleX = (Gallery.PreviewCoordinate.width / W);
newPiece.scaleY = (Gallery.PreviewCoordinate.height / H);
newPiece.x = (Gallery.PreviewCoordinate.x + ((64 * W2) * i));
newPiece.y = (Gallery.PreviewCoordinate.y + ((64 * H2) * j));
newPiece.Solve.x = (Gallery.ScrollerCoordinate.x + ((64 * xScale) * i));
newPiece.Solve.y = (Gallery.ScrollerCoordinate.y + ((64 * yScale) * j));
newPiece.Image.x = (newPiece.Image.x - ((64 * xScale) * i));
newPiece.Image.y = (newPiece.Image.y - ((64 * yScale) * j));
newPiece.OriginalCoordinate.x = ((64 * xScale) * i);
newPiece.OriginalCoordinate.y = ((64 * yScale) * j);
newPiece.MinScale = new Point((Gallery.PreviewCoordinate.width / W), (Gallery.PreviewCoordinate.height / H));
newPiece.PieceMc.scaleX = xScale;
newPiece.PieceMc.scaleY = yScale;
newPiece.OutlineMc.scaleX = xScale;
newPiece.OutlineMc.scaleY = yScale;
newPiece.Index = PuzzlePieces.length;
Container.addChild(newPiece);
PuzzlePieces.push(newPiece);
j++;
};
i++;
};
}
public function Kill(){
var i:*;
i = 1;
while (i < Container.numChildren) {
Container.removeChild(Container.getChildAt(i));
i++;
};
Container = new MovieClip();
Container.x = 0;
Container.y = 0;
Container.scaleX = 1;
Container.scaleY = 1;
addChild(Container);
this.PuzzlePieces = new Array();
}
public function OnAddedToStage(e:Event){
this.removeEventListener(Event.ADDED_TO_STAGE, OnAddedToStage);
this.addEventListener(Event.ENTER_FRAME, OnEnterFrame);
}
public function OnEnterFrame(e:Event){
var found:*;
var i:*;
var success:SuccessMc;
this.Preview.x = Gallery.ScrollerCoordinate.x;
this.Preview.y = Gallery.ScrollerCoordinate.y;
this.Preview.visible = ((ShowBackgroundImage) && ((MovieClip(root).currentFrame == 2)));
if (((!((Container == null))) && (!((MovieClip(root) == null))))){
if (MovieClip(root).keys[Keyboard.RIGHT]){
Container.x++;
};
if (MovieClip(root).keys[Keyboard.LEFT]){
Container.x--;
};
if (MovieClip(root).keys[Keyboard.UP]){
Container.y--;
};
if (MovieClip(root).keys[Keyboard.DOWN]){
Container.y++;
};
if (MovieClip(root).keys[65]){
Container.scaleX = (Container.scaleX + 0.1);
Container.scaleY = (Container.scaleY + 0.1);
};
if (MovieClip(root).keys[83]){
Container.scaleX = (Container.scaleX - 0.1);
Container.scaleY = (Container.scaleY - 0.1);
};
if (MovieClip(root).keys[68]){
Container.scaleX = 1;
Container.scaleY = 1;
};
};
if (Piece.SolvingPuzzle == false){
found = false;
i = 0;
while (i < Piece.Pieces.length) {
if ((((Piece.Pieces[i].x == Piece.Pieces[i].Solve.x)) || ((Piece.Pieces[i].y == Piece.Pieces[i].Solve.y)))){
Piece.Pieces[i].stopDrag();
found = true;
} else {
found = false;
break;
};
i++;
};
if (found){
Piece.SolvingPuzzle = true;
success = new SuccessMc();
success.name = "Success";
success.x = (Gallery.ScrollerCoordinate.x + (Gallery.ScrollerCoordinate.width / 2));
success.y = (Gallery.ScrollerCoordinate.y + (Gallery.ScrollerCoordinate.height / 2));
MovieClip(root).addChild(success);
};
};
}
}
}//package Game
Section 5
//Star (Game.Star)
package Game {
import flash.events.*;
import flash.display.*;
public class Star extends MovieClip {
public const Speed:Number = 50;
public const Lifetime:Number = 50;
public var Dying:Number;// = 1
public var Direction:Number;
public var Num:Number;
public var Age:Number;// = 0
static var Count:Number = 0;
public function Star(){
Age = 0;
Dying = 1;
super();
alpha = 0;
this.addEventListener(Event.ADDED_TO_STAGE, OnAddedToStage);
}
public function OnAddedToStage(e:Event){
Count++;
Num = Count;
this.removeEventListener(Event.ADDED_TO_STAGE, OnAddedToStage);
this.addEventListener(Event.ENTER_FRAME, OnEnterFrame);
}
public function OnEnterFrame(e:Event){
var percent:Number;
percent = (Age / Lifetime);
if (percent > 1){
percent = 1;
};
if ((((Age >= 0)) && (!((Dying == 3))))){
this.x = (Math.cos((Direction * (Math.PI / 180))) * (Speed * percent));
this.y = (Math.sin((Direction * (Math.PI / 180))) * (Speed * percent));
} else {
if ((((Age >= 0)) && ((Dying == 3)))){
this.x = (this.x + (Math.cos((Direction * (Math.PI / 180))) * 3));
this.y = (this.y + (Math.sin((Direction * (Math.PI / 180))) * 3));
} else {
if (Dying != 3){
this.x = 0;
this.y = 0;
};
};
};
if (Dying == 3){
Age = (Age - 5);
if (Age > 0){
alpha = percent;
} else {
if (Age <= 0){
if (MovieClip(parent).numChildren == 1){
MovieClip(root).removeChild(MovieClip(parent));
};
MovieClip(parent).removeChild(this);
this.removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
};
};
};
if (Dying != 3){
if (Dying == 1){
Age = (Age + 5);
};
if (Age >= 0){
scaleX = percent;
scaleY = percent;
alpha = percent;
} else {
scaleX = 0;
scaleY = 0;
alpha = 0;
this.x = 0;
this.y = 0;
};
if (percent >= 1){
Dying = 3;
};
};
}
}
}//package Game
Section 6
//ButtonHighlight_10 (TheCutestKitten_fla.ButtonHighlight_10)
package TheCutestKitten_fla {
import flash.display.*;
public dynamic class ButtonHighlight_10 extends MovieClip {
public function ButtonHighlight_10(){
super();
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package TheCutestKitten_fla
Section 7
//ExampleMc_11 (TheCutestKitten_fla.ExampleMc_11)
package TheCutestKitten_fla {
import flash.display.*;
public dynamic class ExampleMc_11 extends MovieClip {
public function ExampleMc_11(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package TheCutestKitten_fla
Section 8
//gamesgames_intro_animatie_1 (TheCutestKitten_fla.gamesgames_intro_animatie_1)
package TheCutestKitten_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.media.*;
import flash.printing.*;
import flash.system.*;
import flash.text.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class gamesgames_intro_animatie_1 extends MovieClip {
public var btn:SimpleButton;
public function gamesgames_intro_animatie_1(){
super();
addFrameScript(0, frame1, 89, frame90);
}
public function OnRelease(e:MouseEvent){
var newRequest:URLRequest;
newRequest = new URLRequest("http://www.gamesgames.com/moregames/");
navigateToURL(newRequest, "_blank");
}
function frame90(){
MovieClip(root).nextFrame();
MovieClip(root).StartGame();
}
function frame1(){
btn.addEventListener(MouseEvent.CLICK, OnRelease);
}
}
}//package TheCutestKitten_fla
Section 9
//ImagesMc_22 (TheCutestKitten_fla.ImagesMc_22)
package TheCutestKitten_fla {
import flash.display.*;
public dynamic class ImagesMc_22 extends MovieClip {
public function ImagesMc_22(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package TheCutestKitten_fla
Section 10
//AroundTheWorld (AroundTheWorld)
package {
import flash.display.*;
public dynamic class AroundTheWorld extends MovieClip {
public function AroundTheWorld(){
super();
}
}
}//package
Section 11
//BaseTheme (BaseTheme)
package {
import flash.display.*;
public dynamic class BaseTheme extends MovieClip {
public function BaseTheme(){
super();
}
}
}//package
Section 12
//JigsawPiece (JigsawPiece)
package {
import Game.*;
public dynamic class JigsawPiece extends Piece {
public function JigsawPiece(){
super();
}
}
}//package
Section 13
//StarEffect (StarEffect)
package {
import flash.display.*;
public dynamic class StarEffect extends MovieClip {
public var newStar:StarMc;
public var Num;
public var i;
public var increment:Number;
public function StarEffect(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
Num = 30;
i = 0;
while (i < Num) {
increment = (1080 / Num);
newStar = new StarMc();
newStar.Direction = (increment * i);
newStar.x = 0;
newStar.y = 0;
newStar.Age = (-(i) * 4);
addChild(newStar);
i++;
};
}
}
}//package
Section 14
//StarMc (StarMc)
package {
import Game.*;
public dynamic class StarMc extends Star {
public function StarMc(){
super();
}
}
}//package
Section 15
//SuccessMc (SuccessMc)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class SuccessMc extends MovieClip {
public var ScrollerMc:MovieClip;
public var moreButton:SimpleButton;
public function SuccessMc(){
super();
addFrameScript(9, frame10);
}
public function Link(e:MouseEvent){
var newRequest:URLRequest;
newRequest = new URLRequest("http://Koalafun.com");
navigateToURL(newRequest, "_blank");
}
function frame10(){
stop();
moreButton.addEventListener(MouseEvent.CLICK, Link);
}
}
}//package
Section 16
//TheCutestKitten (TheCutestKitten)
package {
import flash.display.*;
public dynamic class TheCutestKitten extends MovieClip {
public function TheCutestKitten(){
super();
}
}
}//package