Section 1
//Game (com.novelgames.flashgames.common.Game)
package com.novelgames.flashgames.common {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Game extends MovieClip {
public static var gameStage:Stage;
public function unpause():void{
NewTimer.unpause();
}
public function onRightMouseUp():void{
var _local1:DisplayObject;
_local1 = getMouseTarget();
if (!_local1){
return;
};
_local1.dispatchEvent(new MouseEvent("mouseRightUp"));
}
public function onMiddleMouseDown():void{
var _local1:DisplayObject;
_local1 = getMouseTarget();
if (!_local1){
return;
};
_local1.dispatchEvent(new MouseEvent("mouseMiddleDown"));
}
public function onMiddleMouseUp():void{
var _local1:DisplayObject;
_local1 = getMouseTarget();
if (!_local1){
return;
};
_local1.dispatchEvent(new MouseEvent("mouseMiddleUp"));
}
private function getMouseTarget():DisplayObject{
var _local1:Point;
var _local2:Array;
var _local3:int;
_local1 = this.localToGlobal(new Point(mouseX, mouseY));
_local2 = this.getObjectsUnderPoint(_local1);
_local3 = (_local2.length - 1);
while (_local3 >= 0) {
if (!_local2[_local3].parent.mouseEnabled){
} else {
if (((_local2[_local3].parent.parent) && (!(_local2[_local3].parent.parent.mouseChildren)))){
} else {
return (_local2[_local3]);
};
};
_local3--;
};
return (null);
}
public function onRightMouseDown():void{
var _local1:DisplayObject;
_local1 = getMouseTarget();
if (!_local1){
return;
};
_local1.dispatchEvent(new MouseEvent("mouseRightDown"));
}
public function pause():void{
NewTimer.pause();
}
}
}//package com.novelgames.flashgames.common
Section 2
//Instructions (com.novelgames.flashgames.common.Instructions)
package com.novelgames.flashgames.common {
import flash.display.*;
import flash.events.*;
public class Instructions extends MovieClip {
public var startButton:SimpleButton;
private var shownFromGame:Boolean;
public function Instructions(_arg1:Boolean=false){
this.shownFromGame = _arg1;
startButton.addEventListener(MouseEvent.CLICK, startButtonClicked);
}
private function startButtonClicked(_arg1:MouseEvent):void{
if (!shownFromGame){
Object(parent).gotoGamePage();
} else {
Object(parent).hideInstructionsFromGame();
};
}
}
}//package com.novelgames.flashgames.common
Section 3
//InstructionsButton (com.novelgames.flashgames.common.InstructionsButton)
package com.novelgames.flashgames.common {
import flash.display.*;
import flash.events.*;
public class InstructionsButton extends MovieClip {
public function InstructionsButton(){
super();
this.buttonMode = true;
this.addEventListener(MouseEvent.CLICK, function ():void{
Object(parent.parent).showInstructionsFromGame();
});
}
}
}//package com.novelgames.flashgames.common
Section 4
//MainDevelopment (com.novelgames.flashgames.common.MainDevelopment)
package com.novelgames.flashgames.common {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.net.*;
import flash.external.*;
public class MainDevelopment extends MovieClip {
private var titleX:Number;
private var titleY:Number;
private var title:Title;
private var musicGameSoundChannel:SoundChannel;
private var titleIndex:int;
private var instructions:Instructions;
private var musicGame:Sound;
private var game:Game;
public function MainDevelopment(){
super();
checkMute();
try {
ExternalInterface.addCallback("onRightMouseDown", onRightMouseDown);
ExternalInterface.addCallback("onRightMouseUp", onRightMouseUp);
ExternalInterface.addCallback("onMiddleMouseDown", onMiddleMouseDown);
ExternalInterface.addCallback("onMiddleMouseUp", onMiddleMouseUp);
} catch(e) {
};
this.addEventListener(Event.ENTER_FRAME, checkTitle);
}
public function hideInstructionsFromGame():void{
this.removeChild(instructions);
instructions = null;
game.visible = true;
game.unpause();
}
protected function getMusicGame():Sound{
return (null);
}
public function onMiddleMouseDown():void{
if (game){
game.onMiddleMouseDown();
};
}
public function onRightMouseUp():void{
if (game){
game.onRightMouseUp();
};
}
public function showInstructionsFromGame():void{
game.pause();
game.visible = false;
instructions = new Instructions(true);
instructions.x = titleX;
instructions.y = titleY;
this.addChildAt(instructions, (titleIndex + 1));
}
public function gotoGamePage():void{
Game.gameStage = stage;
removePage();
game = getGame();
game.x = titleX;
game.y = titleY;
this.addChildAt(game, titleIndex);
musicGame = getMusicGame();
musicGameSoundChannel = musicGame.play(0, int.MAX_VALUE);
}
public function onMiddleMouseUp():void{
if (game){
game.onMiddleMouseUp();
};
}
private function checkTitle(_arg1:Event):void{
if (!(title = getTitle())){
return;
};
titleX = title.x;
titleY = title.y;
this.removeEventListener(Event.ENTER_FRAME, checkTitle);
stop();
titleIndex = this.getChildIndex(title);
}
public function gotoTitlePage():void{
removePage();
title = new Title();
title.x = titleX;
title.y = titleY;
this.addChildAt(title, titleIndex);
}
private function checkMute():void{
var _local1:SharedObject;
var _local2:SoundTransform;
_local1 = SharedObject.getLocal("mute", "/");
_local1.objectEncoding = ObjectEncoding.AMF0;
if (_local1.data.isMute){
_local2 = new SoundTransform();
_local2.volume = 0;
SoundMixer.soundTransform = _local2;
};
}
public function gotoInstructionsPage():void{
removePage();
instructions = new Instructions();
instructions.x = titleX;
instructions.y = titleY;
this.addChildAt(instructions, titleIndex);
}
public function gotoMoreGamesURL():void{
navigateToURL(new URLRequest("http://www.playthem.net"), "_blank");
}
public function showHighScores():void{
trace("showHighScores()");
}
public function showEnterHighScore(_arg1:int):void{
trace((("showEnterHighScore(" + _arg1) + ")"));
}
protected function getGame():Game{
return (null);
}
private function removePage():void{
if (title){
removeChild(title);
title = null;
};
if (instructions){
removeChild(instructions);
instructions = null;
};
if (game){
removeChild(game);
game = null;
};
if (musicGame){
musicGameSoundChannel.stop();
musicGame = null;
musicGameSoundChannel = null;
};
}
protected function getTitle():Title{
return (null);
}
public function onRightMouseDown():void{
if (game){
game.onRightMouseDown();
};
}
}
}//package com.novelgames.flashgames.common
Section 5
//MuteButton (com.novelgames.flashgames.common.MuteButton)
package com.novelgames.flashgames.common {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.net.*;
public class MuteButton extends MovieClip {
public function MuteButton(){
if (SoundMixer.soundTransform.volume == 0){
showOff();
} else {
showOn();
};
this.addEventListener(MouseEvent.CLICK, buttonClicked);
this.buttonMode = true;
}
private function showOff():void{
gotoAndStop("off");
}
private function buttonClicked(_arg1:MouseEvent):void{
var _local2:SharedObject;
var _local3:SoundTransform;
_local2 = SharedObject.getLocal("mute", "/");
_local3 = new SoundTransform();
_local2.objectEncoding = ObjectEncoding.AMF0;
if (SoundMixer.soundTransform.volume == 0){
_local2.data.isMute = false;
_local3.volume = 1;
SoundMixer.soundTransform = _local3;
showOn();
} else {
_local2.data.isMute = true;
_local3.volume = 0;
SoundMixer.soundTransform = _local3;
showOff();
};
}
private function showOn():void{
gotoAndStop("on");
}
}
}//package com.novelgames.flashgames.common
Section 6
//NewTimer (com.novelgames.flashgames.common.NewTimer)
package com.novelgames.flashgames.common {
import flash.events.*;
import flash.utils.*;
public class NewTimer extends Timer {
private var adjustedStartTime:int;
private var listener:Function;
private var originalRepeatCount:int;
private var originalDelay:int;
private static var pauseTime:int;
private static var paused:Boolean = false;
private static var totalPausedTime:int = 0;
public function NewTimer(_arg1:Number, _arg2:int=0):void{
super(_arg1, _arg2);
originalDelay = _arg1;
originalRepeatCount = _arg2;
}
override public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
if (_arg1 != TimerEvent.TIMER){
super.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
return;
};
this.listener = _arg2;
super.addEventListener(_arg1, timerEventListener);
}
override public function start():void{
adjustedStartTime = NewTimer.getTimer();
super.start();
}
private function timerEventListener(_arg1:TimerEvent):void{
if (paused){
stop();
delay = Math.max((originalDelay - (NewTimer.getTimer() - adjustedStartTime)), 1);
if (originalRepeatCount > 0){
repeatCount++;
};
super.start();
return;
};
if ((NewTimer.getTimer() - adjustedStartTime) >= originalDelay){
adjustedStartTime = NewTimer.getTimer();
if (delay != originalDelay){
stop();
delay = originalDelay;
super.start();
};
listener(_arg1);
} else {
stop();
delay = Math.max((originalDelay - (NewTimer.getTimer() - adjustedStartTime)), 1);
if (originalRepeatCount > 0){
repeatCount++;
};
super.start();
};
}
public static function unpause():void{
if (!paused){
return;
};
paused = false;
totalPausedTime = (totalPausedTime + (getTimer() - pauseTime));
}
public static function getTimer():int{
if (paused){
return ((pauseTime - totalPausedTime));
};
return ((getTimer() - totalPausedTime));
}
public static function pause():void{
if (paused){
return;
};
paused = true;
pauseTime = getTimer();
}
}
}//package com.novelgames.flashgames.common
Section 7
//Title (com.novelgames.flashgames.common.Title)
package com.novelgames.flashgames.common {
import flash.display.*;
import flash.events.*;
public class Title extends MovieClip {
public var startButton:SimpleButton;
public var highScoresButton:SimpleButton;
public var moreGamesButton:SimpleButton;
public function Title(){
startButton.addEventListener(MouseEvent.CLICK, startButtonClicked);
highScoresButton.addEventListener(MouseEvent.CLICK, highScoresButtonClicked);
moreGamesButton.addEventListener(MouseEvent.CLICK, moreGamesButtonClicked);
}
private function startButtonClicked(_arg1:MouseEvent):void{
Object(parent).gotoInstructionsPage();
}
private function moreGamesButtonClicked(_arg1:MouseEvent):void{
Object(parent).gotoMoreGamesURL();
}
private function highScoresButtonClicked(_arg1:MouseEvent):void{
Object(parent).showHighScores();
}
}
}//package com.novelgames.flashgames.common
Section 8
//Config (com.novelgames.flashgames.jigsaw.Config)
package com.novelgames.flashgames.jigsaw {
public class Config {
public static var EDGEPOINTS_TOPBOTTOM:Array = [[-0.5, 0], [-0.1, 0], [-0.1, -0.075], [-0.1, -0.15], [-0.2, -0.15], [-0.2, -0.3], [0, -0.3], [0.2, -0.3], [0.2, -0.15], [0.1, -0.15], [0.1, -0.075], [0.1, 0], [0.5, 0]];
public static var THING_MINSCALE:Number = 100;
public static var TILE_NORMALBORDERCOLOUR:Number = 3491103;
public static var THING_SHADOWBLUR:Number = 10;
public static var THING_MAXSHADE:Number = 0.3;
public static var SCORE_TIME:Number = 100;
public static var DIMENSION_X:Number = 8;
public static var DIMENSION_Y:Number = 5;
public static var TILE_HIDETOLERANCE:Number = 0.1;
public static var THING_SHADOWANGLE:Number = 45;
public static var THING_SHADOWDISTANCE:Number = 10;
public static var PICTURE_BORDERBOTTOM:Number = 0;
public static var PICTURE_BOTTOM:Number = 360;
public static var THING_SHADOWALPHA:Number = 0.5;
public static var MESSAGE_WINTIME:Number = 1000;
public static var TILE_NORMALBORDERTHICKNESS:Number = 2;
public static var PICTURE_BORDERLEFT:Number = 0;
public static var EDGEPOINTS_LEFTRIGHT:Array = [[0, -0.5], [0, -0.1], [0.075, -0.1], [0.15, -0.1], [0.15, -0.2], [0.3, -0.2], [0.3, 0], [0.3, 0.2], [0.15, 0.2], [0.15, 0.1], [0.075, 0.1], [0, 0.1], [0, 0.5]];
public static var THING_MAXSCALE:Number = 100;
public static var THING_MAXBLUR:Number = 10;
public static var THING_MINNO:Number = 1;
public static var TILE_FIXEDBORDERTHICKNESS:Number = 1;
public static var PICTURE_LEFT:Number = 0;
public static var TILE_PUTTOLERANCE:Number = 0.2;
public static var THING_MAXNO:Number = 1;
public static var THING_SHADOWCOLOUR:Number = 0;
public static var PICTURE_TOP:Number = 0;
public static var PICTURE_RIGHT:Number = 600;
public static var PICTURE_BORDERTOP:Number = 0;
public static var THING_TOTAL:Number = 0;
public static var PICTURE_BORDERRIGHT:Number = 0;
public static var TILE_FIXEDBORDERCOLOUR:Number = 0x666666;
public static var SCORE_BASE:Number = 50000;
}
}//package com.novelgames.flashgames.jigsaw
Section 9
//Game (com.novelgames.flashgames.jigsaw.Game)
package com.novelgames.flashgames.jigsaw {
import flash.display.*;
import flash.events.*;
import com.novelgames.flashgames.common.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
public class Game extends Game {
public var message:Message;
private var soundDrag:Sound;
public var tileHideToleranceX:Number;
public var tileHideToleranceY:Number;
private var timer:Timer;
public var tilePutToleranceX:Number;
private var startTime:Number;
public var tileHeight:Number;
private var gameWin:Boolean;
public var tilesHolder:MovieClip;
private var soundFix:Sound;
public var timeText:TextField;
private var tiles:Array;
public var tilePutToleranceY:Number;
private var tileMouseX:Number;
private var draggingTile:Tile;
private var soundWin:Sound;
private var tileMouseY:Number;
private var state:Number;
private var __time:Number;
public var tileWidth:Number;
private var soundConnect:Sound;
public var playAgainButton:SimpleButton;
private var isDraggingTile:Boolean;
public static var STATE_PLAYING:Number = 4;
public static var STATE_FINISHEDGENERATINGTILES:Number = 3;
public static var STATE_INIT:Number = 1;
public static var STATE_SHOWINGGENERATINGMESSAGE:Number = 2;
public function Game(){
isDraggingTile = false;
state = STATE_INIT;
gameWin = false;
this.addEventListener(Event.ENTER_FRAME, onEnterFrameEvent);
playAgainButton.addEventListener(MouseEvent.CLICK, playAgainButtonClicked);
soundDrag = new SoundDrag();
soundConnect = new SoundConnect();
soundFix = new SoundFix();
soundWin = new SoundWin();
}
public function tileReleased(_arg1:Tile):void{
var _local2:Tile;
var _local3:Boolean;
var _local4:*;
var _local5:*;
var _local6:*;
if (!isDraggingTile){
return;
};
isDraggingTile = false;
this.removeEventListener(MouseEvent.MOUSE_MOVE, onMoveTile);
_local3 = false;
if (_arg1.getIsConnectedToCorner()){
if ((((Math.abs((_arg1.x - (_arg1.indexX * tileWidth))) <= tilePutToleranceX)) && ((Math.abs((_arg1.y - (_arg1.indexY * tileHeight))) <= tilePutToleranceY)))){
_local4 = 0;
while (_local4 < _arg1.connectedTiles.length) {
_arg1.connectedTiles[_local4].fixAtCorrectPosition();
_local4++;
};
_local3 = true;
soundFix.play();
};
};
if (!_local3){
_local6 = 0;
while (_local6 < _arg1.connectedTiles.length) {
_local2 = _arg1.connectedTiles[_local6];
_local4 = 0;
while (_local4 < tiles.length) {
if (tiles[_local4] == _local2){
} else {
if (_local2.getTileIsConnected(tiles[_local4])){
} else {
if (!getTileIsConnectable(tiles[_local4], _local2)){
} else {
if (tiles[_local4].fixed){
_local5 = 0;
while (_local5 < _arg1.connectedTiles.length) {
_local2.connectedTiles[_local5].fixAtCorrectPosition();
_local5++;
};
soundFix.play();
} else {
tiles[_local4].addConnectedTile(_local2);
soundConnect.play();
};
_local3 = true;
break;
};
};
};
_local4++;
};
if (_local3){
break;
};
_local6++;
};
};
if (_local3){
checkWin();
};
}
private function generateTiles():void{
var _local1:Array;
var _local2:Array;
var _local3:Array;
var _local4:Array;
var _local5:*;
var _local6:Tile;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:*;
var _local14:*;
_local1 = createThingInfos();
_local14 = ((Math.random() + 0.4) * 10);
Config.DIMENSION_X = Math.ceil(_local14);
Config.DIMENSION_Y = Math.ceil((_local14 * 0.45));
_local2 = new Array(((Config.DIMENSION_X - 1) * Config.DIMENSION_Y));
_local3 = new Array((Config.DIMENSION_X * (Config.DIMENSION_Y - 1)));
_local4 = new Array((Config.DIMENSION_X * Config.DIMENSION_Y));
_local13 = 0;
while (_local13 < _local2.length) {
_local2[_local13] = (Math.random() < 0.5);
_local13++;
};
_local13 = 0;
while (_local13 < _local3.length) {
_local3[_local13] = (Math.random() < 0.5);
_local13++;
};
_local13 = 0;
while (_local13 < _local4.length) {
_local4[_local13] = ((Config.DIMENSION_X * Config.DIMENSION_Y) * (_local13 + 1));
_local13++;
};
Util.shuffleArray(_local4);
tileWidth = ((Config.PICTURE_RIGHT - Config.PICTURE_LEFT) / Config.DIMENSION_X);
tileHeight = ((Config.PICTURE_BOTTOM - Config.PICTURE_TOP) / Config.DIMENSION_Y);
tilePutToleranceX = (tileWidth * Config.TILE_PUTTOLERANCE);
tilePutToleranceY = (tileHeight * Config.TILE_PUTTOLERANCE);
tileHideToleranceX = (tileWidth * Config.TILE_HIDETOLERANCE);
tileHideToleranceY = (tileHeight * Config.TILE_HIDETOLERANCE);
tiles = new Array();
_local13 = 0;
while (_local13 < (Config.DIMENSION_X * Config.DIMENSION_Y)) {
_local7 = (_local13 % Config.DIMENSION_X);
_local8 = Math.floor((_local13 / Config.DIMENSION_X));
_local6 = new Tile();
_local9 = ((_local7 == 0)) ? Tile.EDGE_FLAT : (_local2[((_local8 * (Config.DIMENSION_X - 1)) + _local7)]) ? Tile.EDGE_OUT : Tile.EDGE_IN;
_local10 = ((_local8 == 0)) ? Tile.EDGE_FLAT : (_local3[((_local8 * Config.DIMENSION_X) + _local7)]) ? Tile.EDGE_OUT : Tile.EDGE_IN;
_local11 = ((_local7 == (Config.DIMENSION_X - 1))) ? Tile.EDGE_FLAT : (_local2[(((_local8 * (Config.DIMENSION_X - 1)) + _local7) + 1)]) ? Tile.EDGE_IN : Tile.EDGE_OUT;
_local12 = ((_local8 == (Config.DIMENSION_Y - 1))) ? Tile.EDGE_FLAT : (_local3[(((_local8 + 1) * Config.DIMENSION_X) + _local7)]) ? Tile.EDGE_IN : Tile.EDGE_OUT;
_local6.initialize(_local1, _local7, _local8, tileWidth, tileHeight, _local9, _local10, _local11, _local12);
_local6.x = ((Config.PICTURE_LEFT - _local6.left) + (Math.random() * ((Config.PICTURE_RIGHT - Config.PICTURE_LEFT) - (_local6.right - _local6.left))));
_local6.y = ((Config.PICTURE_TOP - _local6.top) + (Math.random() * ((Config.PICTURE_BOTTOM - Config.PICTURE_TOP) - (_local6.bottom - _local6.top))));
tilesHolder.addChild(_local6);
tiles.push(_local6);
_local13++;
};
}
private function onMoveTile(_arg1:MouseEvent):void{
var _local2:Tile;
var _local3:*;
draggingTile.x = (this.mouseX - tileMouseX);
draggingTile.y = (this.mouseY - tileMouseY);
_local3 = 0;
while (_local3 < draggingTile.connectedTiles.length) {
_local2 = draggingTile.connectedTiles[_local3];
if (_local2 == draggingTile){
} else {
_local2.x = (draggingTile.x + ((_local2.indexX - draggingTile.indexX) * tileWidth));
_local2.y = (draggingTile.y + ((_local2.indexY - draggingTile.indexY) * tileHeight));
};
_local3++;
};
_arg1.updateAfterEvent();
}
private function getTileIsConnectable(_arg1:Tile, _arg2:Tile):Boolean{
var _local3:Number;
var _local4:*;
if (_arg1.indexY == _arg2.indexY){
if (Math.abs((_arg1.y - _arg2.y)) > tilePutToleranceY){
return (false);
};
if (_arg1.indexX == (_arg2.indexX - 1)){
if (Math.abs(((_arg1.x + tileWidth) - _arg2.x)) > tilePutToleranceX){
return (false);
};
} else {
if (_arg1.indexX == (_arg2.indexX + 1)){
if (Math.abs(((_arg1.x - tileWidth) - _arg2.x)) > tilePutToleranceX){
return (false);
};
} else {
return (false);
};
};
} else {
if (_arg1.indexX == _arg2.indexX){
if (Math.abs((_arg1.x - _arg2.x)) > tilePutToleranceX){
return (false);
};
if (_arg1.indexY == (_arg2.indexY - 1)){
if (Math.abs(((_arg1.y + tileHeight) - _arg2.y)) > tilePutToleranceY){
return (false);
};
} else {
if (_arg1.indexY == (_arg2.indexY + 1)){
if (Math.abs(((_arg1.y - tileHeight) - _arg2.y)) > tilePutToleranceY){
return (false);
};
} else {
return (false);
};
};
} else {
return (false);
};
};
_local3 = tilesHolder.getChildIndex(_arg1);
_local4 = 0;
while (_local4 < tiles.length) {
if (tiles[_local4] == _arg1){
} else {
if (tiles[_local4] == _arg2){
} else {
if (tilesHolder.getChildIndex(tiles[_local4]) < _local3){
} else {
if (((tiles[_local4].x + tileWidth) - tileHideToleranceX) < _arg1.x){
} else {
if (((tiles[_local4].y + tileHeight) - tileHideToleranceY) < _arg1.y){
} else {
if ((tiles[_local4].x + tileHideToleranceX) > (_arg1.x + tileWidth)){
} else {
if ((tiles[_local4].y + tileHideToleranceY) > (_arg1.y + tileHeight)){
} else {
return (false);
};
};
};
};
};
};
};
_local4++;
};
return (true);
}
private function showPlayAgain(_arg1:TimerEvent):void{
Object(parent).showEnterHighScore((Config.SCORE_BASE - (time * Config.SCORE_TIME)));
message.showPlayAgain();
}
private function createThingInfos():Array{
var _local1:Number;
var _local2:Array;
var _local3:ThingInfo;
var _local4:Class;
var _local5:MovieClip;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:*;
_local1 = (Config.THING_MINNO + Math.floor((Math.random() * ((Config.THING_MAXNO - Config.THING_MINNO) + 1))));
_local2 = new Array();
_local10 = 0;
while (_local10 < _local1) {
_local3 = new ThingInfo();
_local3.id = Math.floor((Math.random() * Config.THING_TOTAL));
_local3.scaleY = (Config.THING_MINSCALE + (Math.random() * (Config.THING_MAXSCALE - Config.THING_MINSCALE)));
_local3.scaleX = ((Math.random() < 0.5)) ? _local3.scaleY : -(_local3.scaleY);
_local4 = Class(getDefinitionByName(("com.novelgames.flashgames.jigsaw.Thing" + _local3.id)));
_local5 = new (_local4);
_local3.width = ((_local5.width * _local3.scaleY) / 100);
_local3.height = ((_local5.height * _local3.scaleY) / 100);
_local6 = (Config.PICTURE_BORDERLEFT + (_local3.width / 2));
_local7 = (((Config.PICTURE_RIGHT - Config.PICTURE_LEFT) - Config.PICTURE_BORDERRIGHT) - (_local3.width / 2));
_local8 = (Config.PICTURE_BORDERTOP + (_local3.height / 2));
_local9 = (((Config.PICTURE_BOTTOM - Config.PICTURE_TOP) - Config.PICTURE_BORDERBOTTOM) - (_local3.height / 2));
this.addChild(_local5);
this.removeChild(_local5);
_local3.x = (_local6 + (Math.random() * (_local7 - _local6)));
_local3.y = (_local8 + (Math.random() * (_local9 - _local8)));
_local2.push(_local3);
_local10++;
};
return (_local2);
}
private function onEnterFrameEvent(_arg1:Event):void{
if (gameWin){
return;
};
if (state == STATE_INIT){
message.showGenerating();
state = STATE_SHOWINGGENERATINGMESSAGE;
} else {
if (state == STATE_SHOWINGGENERATINGMESSAGE){
generateTiles();
state = STATE_FINISHEDGENERATINGTILES;
} else {
if (state == STATE_FINISHEDGENERATINGTILES){
startTime = NewTimer.getTimer();
time = 0;
message.hide();
state = STATE_PLAYING;
} else {
time = Math.floor(((NewTimer.getTimer() - startTime) / 1000));
};
};
};
}
private function playAgainButtonClicked(_arg1:MouseEvent):void{
Object(parent).gotoGamePage();
}
private function checkWin():void{
var _local1:*;
_local1 = 0;
while (_local1 < tiles.length) {
if (!tiles[_local1].fixed){
return;
};
_local1++;
};
gameWin = true;
message.showWin();
timer = new NewTimer(Config.MESSAGE_WINTIME, 1);
timer.addEventListener(TimerEvent.TIMER, showPlayAgain);
timer.start();
soundWin.play();
}
public function tilePressed(_arg1:Tile):void{
var _local2:Number;
var _local3:Tile;
var _local4:*;
if (isDraggingTile){
return;
};
isDraggingTile = true;
draggingTile = _arg1;
_local4 = 0;
while (_local4 < _arg1.connectedTiles.length) {
_local3 = _arg1.connectedTiles[_local4];
tilesHolder.setChildIndex(_local3, (tilesHolder.numChildren - 1));
_local4++;
};
tileMouseX = _arg1.mouseX;
tileMouseY = _arg1.mouseY;
this.addEventListener(MouseEvent.MOUSE_MOVE, onMoveTile);
soundDrag.play();
}
public function get time():Number{
return (__time);
}
public function set time(_arg1:Number):void{
__time = _arg1;
timeText.text = _arg1.toString();
}
}
}//package com.novelgames.flashgames.jigsaw
Section 10
//Main (com.novelgames.flashgames.jigsaw.Main)
package com.novelgames.flashgames.jigsaw {
import com.novelgames.flashgames.common.*;
import flash.media.*;
public dynamic class Main extends MainDevelopment {
public var title:Title;
override protected function getMusicGame():Sound{
return (new MusicGame());
}
override protected function getGame():Game{
return (new Game());
}
override protected function getTitle():Title{
return (title);
}
}
}//package com.novelgames.flashgames.jigsaw
Section 11
//Message (com.novelgames.flashgames.jigsaw.Message)
package com.novelgames.flashgames.jigsaw {
import flash.display.*;
import flash.events.*;
public class Message extends MovieClip {
private var messagePlayAgain:MessagePlayAgain;
public function Message(){
stop();
}
public function showPlayAgain():void{
gotoAndStop("win");
messagePlayAgain = new MessagePlayAgain();
messagePlayAgain.playAgainButton.addEventListener(MouseEvent.CLICK, playAgainButtonClicked);
messagePlayAgain.homeButton.addEventListener(MouseEvent.CLICK, homeButtonClicked);
addChild(messagePlayAgain);
}
private function playAgainButtonClicked(_arg1:MouseEvent):void{
Object(parent.parent).gotoGamePage();
}
public function hide():void{
gotoAndStop("hide");
}
public function showWin():void{
gotoAndStop("win");
}
public function showGenerating():void{
gotoAndStop("generating");
}
private function homeButtonClicked(_arg1:MouseEvent):void{
Object(parent.parent).gotoTitlePage();
}
}
}//package com.novelgames.flashgames.jigsaw
Section 12
//MessagePlayAgain (com.novelgames.flashgames.jigsaw.MessagePlayAgain)
package com.novelgames.flashgames.jigsaw {
import flash.display.*;
public dynamic class MessagePlayAgain extends MovieClip {
public var playAgainButton:SimpleButton;
public var homeButton:SimpleButton;
}
}//package com.novelgames.flashgames.jigsaw
Section 13
//MusicGame (com.novelgames.flashgames.jigsaw.MusicGame)
package com.novelgames.flashgames.jigsaw {
import flash.media.*;
public dynamic class MusicGame extends Sound {
}
}//package com.novelgames.flashgames.jigsaw
Section 14
//Picture (com.novelgames.flashgames.jigsaw.Picture)
package com.novelgames.flashgames.jigsaw {
import flash.display.*;
import flash.utils.*;
import flash.filters.*;
import flash.geom.*;
public class Picture extends MovieClip {
public function initialize(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Class;
var _local7:DropShadowFilter;
var _local8:BlurFilter;
var _local9:Array;
var _local10:Transform;
var _local11:MovieClip;
var _local12:Number;
var _local13:Number;
var _local14:*;
_local7 = new DropShadowFilter(Config.THING_SHADOWDISTANCE, Config.THING_SHADOWANGLE, Config.THING_SHADOWCOLOUR, Config.THING_SHADOWALPHA, Config.THING_SHADOWBLUR, Config.THING_SHADOWBLUR);
_local14 = 0;
while (_local14 < _arg1.length) {
_local13 = ((_arg1.length == 1)) ? 0 : (Config.THING_MAXBLUR * (1 - (_local14 / (_arg1.length - 1))));
if ((_arg1[_local14].x - ((_arg1[_local14].width - _local13) / 2)) > _arg4){
} else {
if ((_arg1[_local14].x + ((((_arg1[_local14].width + _local13) + Config.THING_SHADOWDISTANCE) + Config.THING_SHADOWBLUR) / 2)) < _arg2){
} else {
if ((_arg1[_local14].y - ((_arg1[_local14].height - _local13) / 2)) > _arg5){
} else {
if ((_arg1[_local14].y + ((((_arg1[_local14].height + _local13) + Config.THING_SHADOWDISTANCE) + Config.THING_SHADOWBLUR) / 2)) < _arg3){
} else {
_local6 = Class(getDefinitionByName(("com.novelgames.flashgames.jigsaw.Thing" + _arg1[_local14].id)));
_local11 = new (_local6);
_local11.x = _arg1[_local14].x;
_local11.y = _arg1[_local14].y;
_local11.scaleX = (_arg1[_local14].scaleX / 100);
_local11.scaleY = (_arg1[_local14].scaleY / 100);
_local12 = ((_arg1.length == 1)) ? 1 : (Config.THING_MAXSHADE + (((1 - Config.THING_MAXSHADE) * _local14) / (_arg1.length - 1)));
_local10 = new Transform(_local11);
_local10.colorTransform = new ColorTransform(_local12, _local12, _local12, 1, 0, 0, 0, 0);
_local8 = new BlurFilter(_local13, _local13);
_local9 = [_local8, _local7];
_local11.filters = _local9;
this.addChild(_local11);
};
};
};
};
_local14++;
};
}
}
}//package com.novelgames.flashgames.jigsaw
Section 15
//SoundConnect (com.novelgames.flashgames.jigsaw.SoundConnect)
package com.novelgames.flashgames.jigsaw {
import flash.media.*;
public dynamic class SoundConnect extends Sound {
}
}//package com.novelgames.flashgames.jigsaw
Section 16
//SoundDrag (com.novelgames.flashgames.jigsaw.SoundDrag)
package com.novelgames.flashgames.jigsaw {
import flash.media.*;
public dynamic class SoundDrag extends Sound {
}
}//package com.novelgames.flashgames.jigsaw
Section 17
//SoundFix (com.novelgames.flashgames.jigsaw.SoundFix)
package com.novelgames.flashgames.jigsaw {
import flash.media.*;
public dynamic class SoundFix extends Sound {
}
}//package com.novelgames.flashgames.jigsaw
Section 18
//SoundWin (com.novelgames.flashgames.jigsaw.SoundWin)
package com.novelgames.flashgames.jigsaw {
import flash.media.*;
public dynamic class SoundWin extends Sound {
}
}//package com.novelgames.flashgames.jigsaw
Section 19
//Thing0 (com.novelgames.flashgames.jigsaw.Thing0)
package com.novelgames.flashgames.jigsaw {
import flash.display.*;
public dynamic class Thing0 extends MovieClip {
}
}//package com.novelgames.flashgames.jigsaw
Section 20
//ThingInfo (com.novelgames.flashgames.jigsaw.ThingInfo)
package com.novelgames.flashgames.jigsaw {
public class ThingInfo {
public var width:Number;
public var scaleX:Number;
public var scaleY:Number;
public var x:Number;
public var y:Number;
public var id:Number;
public var height:Number;
}
}//package com.novelgames.flashgames.jigsaw
Section 21
//Tile (com.novelgames.flashgames.jigsaw.Tile)
package com.novelgames.flashgames.jigsaw {
import flash.display.*;
import flash.events.*;
public class Tile extends MovieClip {
private var picture:Picture;
public var left:Number;
public var right:Number;
public var connectedTiles:Array;
private var pictureMask:MovieClip;
public var bottom:Number;
private var border:MovieClip;
private var edgeBottom:Number;
private var edgeRight:Number;
private var edgeLeft:Number;
public var top:Number;
private var tileHeight:Number;
public var fixed:Boolean;
private var edgeTop:Number;
public var indexX:Number;
public var indexY:Number;
private var tileWidth:Number;
public static var EDGE_IN:Number = 3;
public static var EDGE_FLAT:Number = 1;
public static var EDGE_OUT:Number = 2;
public function Tile(){
connectedTiles = [this];
fixed = false;
this.addEventListener(MouseEvent.MOUSE_DOWN, tilePressed);
this.addEventListener(MouseEvent.MOUSE_UP, tileReleased);
this.buttonMode = true;
}
private function tileReleased(_arg1:MouseEvent):void{
Object(parent.parent).tileReleased(this);
}
public function addConnectedTile(_arg1:Tile):void{
var _local2:Array;
var _local3:Tile;
var _local4:*;
_local2 = _arg1.connectedTiles;
_local4 = 0;
while (_local4 < _local2.length) {
_local3 = _local2[_local4];
parent.setChildIndex(_local3, (parent.numChildren - 1));
_local3.x = (this.x + ((_local3.indexX - indexX) * tileWidth));
_local3.y = (this.y + ((_local3.indexY - indexY) * tileHeight));
_local3.connectedTiles = connectedTiles;
connectedTiles.push(_local3);
_local4++;
};
}
public function getTileIsConnected(_arg1:Tile):Boolean{
var _local2:*;
_local2 = 0;
while (_local2 < connectedTiles.length) {
if (connectedTiles[_local2] == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function fixAtCorrectPosition():void{
this.x = (indexX * tileWidth);
this.y = (indexY * tileHeight);
fixed = true;
this.removeEventListener(MouseEvent.MOUSE_DOWN, tilePressed);
this.removeEventListener(MouseEvent.MOUSE_UP, tileReleased);
this.buttonMode = false;
parent.setChildIndex(this, 0);
border.graphics.clear();
border.graphics.lineStyle(Config.TILE_FIXEDBORDERTHICKNESS, Config.TILE_FIXEDBORDERCOLOUR);
border.graphics.moveTo(0, 0);
Util.drawTopEdge(border, 0, 0, tileWidth, tileHeight, edgeTop);
Util.drawRightEdge(border, tileWidth, 0, tileWidth, tileHeight, edgeRight);
Util.drawBottomEdge(border, tileWidth, tileHeight, tileWidth, tileHeight, edgeBottom);
Util.drawLeftEdge(border, 0, tileHeight, tileWidth, tileHeight, edgeLeft);
}
public function initialize(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number):void{
var _local10:Object;
var _local11:*;
this.indexX = _arg2;
this.indexY = _arg3;
this.tileWidth = _arg4;
this.tileHeight = _arg5;
this.edgeLeft = _arg6;
this.edgeTop = _arg7;
this.edgeRight = _arg8;
this.edgeBottom = _arg9;
pictureMask = new MovieClip();
pictureMask.graphics.beginFill(0);
pictureMask.graphics.moveTo(0, 0);
Util.drawTopEdge(pictureMask, 0, 0, _arg4, _arg5, _arg7);
Util.drawRightEdge(pictureMask, _arg4, 0, _arg4, _arg5, _arg8);
Util.drawBottomEdge(pictureMask, _arg4, _arg5, _arg4, _arg5, _arg9);
Util.drawLeftEdge(pictureMask, 0, _arg5, _arg4, _arg5, _arg6);
pictureMask.graphics.endFill();
this.addChild(pictureMask);
_local10 = pictureMask.getBounds(pictureMask);
left = _local10.x;
top = _local10.y;
right = _local10.right;
bottom = _local10.bottom;
picture = new Picture();
picture.initialize(_arg1, ((_arg2 * _arg4) + left), ((_arg3 * _arg5) + top), ((_arg2 * _arg4) + right), ((_arg3 * _arg5) + bottom));
this.addChild(picture);
picture.x = (-(_arg2) * _arg4);
picture.y = (-(_arg3) * _arg5);
picture.mask = pictureMask;
border = new MovieClip();
border.graphics.lineStyle(Config.TILE_NORMALBORDERTHICKNESS, Config.TILE_NORMALBORDERCOLOUR);
border.graphics.moveTo(0, 0);
Util.drawTopEdge(border, 0, 0, _arg4, _arg5, _arg7);
Util.drawRightEdge(border, _arg4, 0, _arg4, _arg5, _arg8);
Util.drawBottomEdge(border, _arg4, _arg5, _arg4, _arg5, _arg9);
Util.drawLeftEdge(border, 0, _arg5, _arg4, _arg5, _arg6);
this.addChild(border);
this.cacheAsBitmap = true;
}
public function getIsConnectedToCorner():Boolean{
var _local1:*;
_local1 = 0;
while (_local1 < connectedTiles.length) {
if ((((connectedTiles[_local1].indexX == 0)) && ((connectedTiles[_local1].indexY == 0)))){
return (true);
};
if ((((connectedTiles[_local1].indexX == (Config.DIMENSION_X - 1))) && ((connectedTiles[_local1].indexY == 0)))){
return (true);
};
if ((((connectedTiles[_local1].indexX == 0)) && ((connectedTiles[_local1].indexY == (Config.DIMENSION_Y - 1))))){
return (true);
};
if ((((connectedTiles[_local1].indexX == (Config.DIMENSION_X - 1))) && ((connectedTiles[_local1].indexY == (Config.DIMENSION_Y - 1))))){
return (true);
};
_local1++;
};
return (false);
}
private function tilePressed(_arg1:MouseEvent):void{
Object(parent.parent).tilePressed(this);
}
}
}//package com.novelgames.flashgames.jigsaw
Section 22
//Util (com.novelgames.flashgames.jigsaw.Util)
package com.novelgames.flashgames.jigsaw {
import flash.display.*;
public class Util {
public static function drawLeftEdge(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number;
var _local8:*;
_local7 = Math.min(_arg4, _arg5);
if (_arg6 == Tile.EDGE_OUT){
_arg1.graphics.lineTo((_arg2 - (Config.EDGEPOINTS_LEFTRIGHT[0][0] * _local7)), ((_arg3 - (_arg5 / 2)) - (Config.EDGEPOINTS_LEFTRIGHT[0][1] * _local7)));
_local8 = 1;
while (_local8 < Config.EDGEPOINTS_LEFTRIGHT.length) {
_arg1.graphics.curveTo((_arg2 - (Config.EDGEPOINTS_LEFTRIGHT[_local8][0] * _local7)), ((_arg3 - (_arg5 / 2)) - (Config.EDGEPOINTS_LEFTRIGHT[_local8][1] * _local7)), (_arg2 - (Config.EDGEPOINTS_LEFTRIGHT[(_local8 + 1)][0] * _local7)), ((_arg3 - (_arg5 / 2)) - (Config.EDGEPOINTS_LEFTRIGHT[(_local8 + 1)][1] * _local7)));
_local8 = (_local8 + 2);
};
} else {
if (_arg6 == Tile.EDGE_IN){
_arg1.graphics.lineTo((_arg2 + (Config.EDGEPOINTS_LEFTRIGHT[(Config.EDGEPOINTS_LEFTRIGHT.length - 1)][0] * _local7)), ((_arg3 - (_arg5 / 2)) + (Config.EDGEPOINTS_LEFTRIGHT[(Config.EDGEPOINTS_LEFTRIGHT.length - 1)][1] * _local7)));
_local8 = (Config.EDGEPOINTS_LEFTRIGHT.length - 2);
while (_local8 >= 0) {
_arg1.graphics.curveTo((_arg2 + (Config.EDGEPOINTS_LEFTRIGHT[_local8][0] * _local7)), ((_arg3 - (_arg5 / 2)) + (Config.EDGEPOINTS_LEFTRIGHT[_local8][1] * _local7)), (_arg2 + (Config.EDGEPOINTS_LEFTRIGHT[(_local8 - 1)][0] * _local7)), ((_arg3 - (_arg5 / 2)) + (Config.EDGEPOINTS_LEFTRIGHT[(_local8 - 1)][1] * _local7)));
_local8 = (_local8 - 2);
};
};
};
_arg1.graphics.lineTo(_arg2, (_arg3 - _arg5));
}
public static function drawBottomEdge(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number;
var _local8:*;
_local7 = Math.min(_arg4, _arg5);
if (_arg6 == Tile.EDGE_OUT){
_arg1.graphics.lineTo(((_arg2 - (_arg4 / 2)) - (Config.EDGEPOINTS_TOPBOTTOM[0][0] * _local7)), (_arg3 - (Config.EDGEPOINTS_TOPBOTTOM[0][1] * _local7)));
_local8 = 1;
while (_local8 < Config.EDGEPOINTS_TOPBOTTOM.length) {
_arg1.graphics.curveTo(((_arg2 - (_arg4 / 2)) - (Config.EDGEPOINTS_TOPBOTTOM[_local8][0] * _local7)), (_arg3 - (Config.EDGEPOINTS_TOPBOTTOM[_local8][1] * _local7)), ((_arg2 - (_arg4 / 2)) - (Config.EDGEPOINTS_TOPBOTTOM[(_local8 + 1)][0] * _local7)), (_arg3 - (Config.EDGEPOINTS_TOPBOTTOM[(_local8 + 1)][1] * _local7)));
_local8 = (_local8 + 2);
};
} else {
if (_arg6 == Tile.EDGE_IN){
_arg1.graphics.lineTo(((_arg2 - (_arg4 / 2)) + (Config.EDGEPOINTS_TOPBOTTOM[(Config.EDGEPOINTS_TOPBOTTOM.length - 1)][0] * _local7)), (_arg5 + (Config.EDGEPOINTS_TOPBOTTOM[(Config.EDGEPOINTS_TOPBOTTOM.length - 1)][1] * _local7)));
_local8 = (Config.EDGEPOINTS_TOPBOTTOM.length - 2);
while (_local8 >= 0) {
_arg1.graphics.curveTo(((_arg2 - (_arg4 / 2)) + (Config.EDGEPOINTS_TOPBOTTOM[_local8][0] * _local7)), (_arg3 + (Config.EDGEPOINTS_TOPBOTTOM[_local8][1] * _local7)), ((_arg2 - (_arg4 / 2)) + (Config.EDGEPOINTS_TOPBOTTOM[(_local8 - 1)][0] * _local7)), (_arg3 + (Config.EDGEPOINTS_TOPBOTTOM[(_local8 - 1)][1] * _local7)));
_local8 = (_local8 - 2);
};
};
};
_arg1.graphics.lineTo((_arg2 - _arg4), _arg3);
}
public static function drawRightEdge(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number;
var _local8:*;
_local7 = Math.min(_arg4, _arg5);
if (_arg6 == Tile.EDGE_OUT){
_arg1.graphics.lineTo((_arg2 + (Config.EDGEPOINTS_LEFTRIGHT[0][0] * _local7)), ((_arg3 + (_arg5 / 2)) + (Config.EDGEPOINTS_LEFTRIGHT[0][1] * _local7)));
_local8 = 1;
while (_local8 < Config.EDGEPOINTS_LEFTRIGHT.length) {
_arg1.graphics.curveTo((_arg2 + (Config.EDGEPOINTS_LEFTRIGHT[_local8][0] * _local7)), ((_arg3 + (_arg5 / 2)) + (Config.EDGEPOINTS_LEFTRIGHT[_local8][1] * _local7)), (_arg2 + (Config.EDGEPOINTS_LEFTRIGHT[(_local8 + 1)][0] * _local7)), ((_arg3 + (_arg5 / 2)) + (Config.EDGEPOINTS_LEFTRIGHT[(_local8 + 1)][1] * _local7)));
_local8 = (_local8 + 2);
};
} else {
if (_arg6 == Tile.EDGE_IN){
_arg1.graphics.lineTo((_arg2 - (Config.EDGEPOINTS_LEFTRIGHT[(Config.EDGEPOINTS_LEFTRIGHT.length - 1)][0] * _local7)), ((_arg3 + (_arg5 / 2)) - (Config.EDGEPOINTS_LEFTRIGHT[(Config.EDGEPOINTS_LEFTRIGHT.length - 1)][1] * _local7)));
_local8 = (Config.EDGEPOINTS_LEFTRIGHT.length - 2);
while (_local8 >= 0) {
_arg1.graphics.curveTo((_arg2 - (Config.EDGEPOINTS_LEFTRIGHT[_local8][0] * _local7)), ((_arg3 + (_arg5 / 2)) - (Config.EDGEPOINTS_LEFTRIGHT[_local8][1] * _local7)), (_arg2 - (Config.EDGEPOINTS_LEFTRIGHT[(_local8 - 1)][0] * _local7)), ((_arg3 + (_arg5 / 2)) - (Config.EDGEPOINTS_LEFTRIGHT[(_local8 - 1)][1] * _local7)));
_local8 = (_local8 - 2);
};
};
};
_arg1.graphics.lineTo(_arg2, (_arg3 + _arg5));
}
public static function drawTopEdge(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number;
var _local8:*;
_local7 = Math.min(_arg4, _arg5);
if (_arg6 == Tile.EDGE_OUT){
_arg1.graphics.lineTo(((_arg2 + (_arg4 / 2)) + (Config.EDGEPOINTS_TOPBOTTOM[0][0] * _local7)), (_arg3 + (Config.EDGEPOINTS_TOPBOTTOM[0][1] * _local7)));
_local8 = 1;
while (_local8 < Config.EDGEPOINTS_TOPBOTTOM.length) {
_arg1.graphics.curveTo(((_arg2 + (_arg4 / 2)) + (Config.EDGEPOINTS_TOPBOTTOM[_local8][0] * _local7)), (_arg3 + (Config.EDGEPOINTS_TOPBOTTOM[_local8][1] * _local7)), ((_arg2 + (_arg4 / 2)) + (Config.EDGEPOINTS_TOPBOTTOM[(_local8 + 1)][0] * _local7)), (_arg3 + (Config.EDGEPOINTS_TOPBOTTOM[(_local8 + 1)][1] * _local7)));
_local8 = (_local8 + 2);
};
} else {
if (_arg6 == Tile.EDGE_IN){
_arg1.graphics.lineTo(((_arg2 + (_arg4 / 2)) - (Config.EDGEPOINTS_TOPBOTTOM[(Config.EDGEPOINTS_TOPBOTTOM.length - 1)][0] * _local7)), (_arg3 - (Config.EDGEPOINTS_TOPBOTTOM[(Config.EDGEPOINTS_TOPBOTTOM.length - 1)][1] * _local7)));
_local8 = (Config.EDGEPOINTS_TOPBOTTOM.length - 2);
while (_local8 >= 0) {
_arg1.graphics.curveTo(((_arg2 + (_arg4 / 2)) - (Config.EDGEPOINTS_TOPBOTTOM[_local8][0] * _local7)), (_arg3 - (Config.EDGEPOINTS_TOPBOTTOM[_local8][1] * _local7)), ((_arg2 + (_arg4 / 2)) - (Config.EDGEPOINTS_TOPBOTTOM[(_local8 - 1)][0] * _local7)), (_arg3 - (Config.EDGEPOINTS_TOPBOTTOM[(_local8 - 1)][1] * _local7)));
_local8 = (_local8 - 2);
};
};
};
_arg1.graphics.lineTo((_arg2 + _arg4), _arg3);
}
public static function shuffleArray(_arg1:Array):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = Math.floor((Math.random() * _arg1.length));
_local2 = _arg1[_local3];
_arg1[_local3] = _arg1[_local4];
_arg1[_local4] = _local2;
_local3++;
};
}
}
}//package com.novelgames.flashgames.jigsaw
Section 23
//Timeline_1 (jigsaw_fla.Timeline_1)
package jigsaw_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public dynamic class Timeline_1 extends MovieClip {
public const FRAME_RATE_ADJUST:Boolean = true;
public const LOADER_FRAME_RATE:Number = 30;
public const AUTO_PLAY:Boolean = false;
public var bar:MovieClip;
public var loadingComplete:Boolean;
public var movieFrameRate:Number;
public var initialized:Boolean;
public function Timeline_1(){
addFrameScript(0, frame1, 36, frame37);
}
public function init():void{
if (initialized){
return;
};
gotoAndStop(1);
movieFrameRate = 0;
if (((FRAME_RATE_ADJUST) && (stage))){
movieFrameRate = stage.frameRate;
stage.frameRate = LOADER_FRAME_RATE;
};
initialized = true;
stop();
if (((root) && ((root is MovieClip)))){
MovieClip(root).stop();
};
loadingComplete = false;
addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
if (meetsVersion([9, 0, 28, 0])){
addEventListener(Event.REMOVED_FROM_STAGE, cleanup, false, 0, true);
};
enterFrameHandler();
}
public function enterFrameHandler(_arg1:Event=null):void{
var _local2:Number;
if (((((!(movieFrameRate)) && (FRAME_RATE_ADJUST))) && (stage))){
movieFrameRate = stage.frameRate;
stage.frameRate = LOADER_FRAME_RATE;
};
if (!loadingComplete){
_local2 = 0;
if (loaderInfo){
_local2 = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal);
};
if (bar){
bar.scaleX = _local2;
};
if (_local2 == 1){
loadingComplete = true;
if (AUTO_PLAY){
startMovie();
} else {
gotoAndPlay("loaded");
};
};
};
}
public function meetsVersion(_arg1:Array):Boolean{
var _local2:Array;
var _local3:uint;
_local2 = String(Capabilities.version.split(" ")[1]).split(",");
_local3 = 0;
while (_local3 < _arg1.length) {
if (uint(_local2[_local3]) > _arg1[_local3]){
return (true);
};
if (uint(_local2[_local3]) < _arg1[_local3]){
return (false);
};
_local3++;
};
return (true);
}
function frame1(){
initialized = false;
init();
}
function frame37(){
startMovie();
stop();
}
public function ngButtonClickHandler(_arg1:Event):void{
navigateToURL(new URLRequest("http://www.playthem.net"), "_blank");
}
public function cleanup(_arg1:Event=null){
if (initialized){
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
if (meetsVersion([9, 0, 28, 0])){
removeEventListener(Event.REMOVED_FROM_STAGE, cleanup);
};
if (movieFrameRate){
stage.frameRate = movieFrameRate;
movieFrameRate = 0;
};
};
initialized = false;
}
public function startMovie():void{
cleanup();
if (((root) && ((root is MovieClip)))){
MovieClip(root).play();
};
dispatchEvent(new Event(Event.COMPLETE));
}
}
}//package jigsaw_fla