Section 1
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "2.0.1.0";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 2
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "2.0.1.0";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 3
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "2.0.1.0";
}
}//package mx.core
Section 4
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 5
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function set height(_arg1:Number):void;
function get scaleY():Number;
function move(_arg1:Number, _arg2:Number):void;
function get scaleX():Number;
function set mask(_arg1:DisplayObject):void;
function set scaleX(_arg1:Number):void;
function set name(_arg1:String):void;
function set scaleY(_arg1:Number):void;
function get visible():Boolean;
function get measuredWidth():Number;
function set visible(_arg1:Boolean):void;
function get alpha():Number;
function get height():Number;
function get width():Number;
function get parent():DisplayObjectContainer;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set y(_arg1:Number):void;
function get x():Number;
function get y():Number;
function set alpha(_arg1:Number):void;
}
}//package mx.core
Section 6
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function get repeaters():Array;
function get instanceIndices():Array;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 7
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 8
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "2.0.1.0";
}
}//package mx.core
Section 9
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "2.0.1.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local3:DisplayObject;
var _local4:String;
var _local5:Array;
_local3 = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
var _local2:String;
var _local3:int;
var _local4:int;
if (!_arg1){
return (null);
};
_local2 = getQualifiedClassName(_arg1);
_local3 = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
_local4 = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 10
//BitmapUtil (smileygamer.util.BitmapUtil)
package smileygamer.util {
import flash.display.*;
import flash.geom.*;
public class BitmapUtil {
public static function splitImage(_arg1:Bitmap, _arg2:int, _arg3:int, _arg4:int=0, _arg5:Array=null):Array{
var _local6:Array;
var _local7:Rectangle;
var _local8:Point;
var _local9:Point;
var _local10:BitmapData;
var _local11:int;
_local6 = new Array();
_local7 = new Rectangle(0, 0, _arg2, _arg3);
_local8 = new Point(0, 0);
_local9 = new Point(_arg4, _arg4);
_local7.y = 0;
while (_local7.y < _arg1.height) {
_local7.x = 0;
while (_local7.x < _arg1.width) {
_local10 = new BitmapData((_arg2 + (2 * _arg4)), (_arg3 + (2 * _arg4)), true, 0);
_local10.copyPixels(_arg1.bitmapData, _local7, _local9);
if (_arg5 != null){
_local11 = 0;
while (_local11 < _arg5.length) {
_local10.applyFilter(_local10, _local10.rect, _local8, _arg5[_local11]);
_local11++;
};
};
_local6.push(new Bitmap(_local10));
_local7.x = (_local7.x + _arg2);
};
_local7.y = (_local7.y + _arg3);
};
return (_local6);
}
public static function createMaskedBitmap(_arg1:Bitmap, _arg2:Bitmap, _arg3:Array=null):Bitmap{
var _local4:Bitmap;
var _local5:Rectangle;
var _local6:Point;
var _local7:int;
_local4 = new Bitmap(new BitmapData(_arg1.width, _arg1.height, true, 0));
_local4.bitmapData.draw(_arg1);
_local5 = new Rectangle(0, 0, _local4.width, _local4.height);
_local6 = new Point(0, 0);
_local4.bitmapData.copyChannel(_arg2.bitmapData, _local5, _local6, BitmapDataChannel.BLUE, BitmapDataChannel.ALPHA);
if (_arg3 != null){
_local7 = 0;
while (_local7 < _arg3.length) {
_local4.bitmapData.applyFilter(_local4.bitmapData, _local5, _local6, _arg3[_local7]);
_local7++;
};
};
return (_local4);
}
}
}//package smileygamer.util
Section 11
//GeometryUtil (smileygamer.util.GeometryUtil)
package smileygamer.util {
import flash.display.*;
public class GeometryUtil {
public static function hits(_arg1:DisplayObject, _arg2:DisplayObject):Boolean{
return (((overlaps(_arg1, _arg2)) && (!(inside(_arg1, _arg2)))));
}
public static function inside(_arg1:DisplayObject, _arg2:DisplayObject):Boolean{
return ((((((((_arg1.x >= _arg2.x)) && ((_arg1.y >= _arg2.y)))) && (((_arg1.x + _arg1.width) <= (_arg2.x + _arg2.width))))) && (((_arg1.y + _arg1.height) <= (_arg2.y + _arg2.height)))));
}
public static function outside(_arg1:DisplayObject, _arg2:DisplayObject):Boolean{
return (!(overlaps(_arg1, _arg2)));
}
public static function distance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.sqrt((Math.pow((_arg1 - _arg3), 2) + Math.pow((_arg2 - _arg4), 2))));
}
public static function overlaps(_arg1:DisplayObject, _arg2:DisplayObject):Boolean{
return (((((((((_arg1.x + _arg1.width) >= _arg2.x)) && (((_arg1.y + _arg1.height) >= _arg2.y)))) && ((_arg1.x <= (_arg2.x + _arg2.width))))) && ((_arg1.y <= (_arg2.y + _arg2.height)))));
}
public static function contains(_arg1:DisplayObject, _arg2:Number, _arg3:Number):Boolean{
return ((((((((_arg2 >= _arg1.x)) && ((_arg3 >= _arg1.y)))) && ((_arg2 < (_arg1.x + _arg1.width))))) && ((_arg3 < (_arg1.y + _arg1.height)))));
}
}
}//package smileygamer.util
Section 12
//InterpolationUtil (smileygamer.util.InterpolationUtil)
package smileygamer.util {
public class InterpolationUtil {
public static const TYPE_LINEAR:int = 0;
public static const TYPE_ACOS:int = 2;
public static const TYPE_COSINE:int = 1;
public static function createValues(_arg1:int, _arg2:Number, _arg3:Number, _arg4:int):Array{
var _local5:Array;
var _local6:int;
var _local7:int;
_local5 = new Array(_arg4);
_local6 = (_arg4 - 1);
_local7 = 0;
while (_local7 < _arg4) {
if (_arg1 == TYPE_COSINE){
_local5[_local7] = (_arg2 + (((_arg3 - _arg2) * Number((1 - Math.cos(((_local7 * Math.PI) / _local6))))) / 2));
} else {
if (_arg1 == TYPE_ACOS){
_local5[_local7] = (_arg2 + ((_arg3 - _arg2) * Number((Math.acos((1 - ((2 * Number(_local7)) / _local6))) / Math.PI))));
} else {
_local5[_local7] = (_arg2 + (((_arg3 - _arg2) * Number(_local7)) / _local6));
};
};
_local7++;
};
return (_local5);
}
}
}//package smileygamer.util
Section 13
//NetworkUtil (smileygamer.util.NetworkUtil)
package smileygamer.util {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public class NetworkUtil {
public static const HOME:String = "http://www.smileygamer.com";
private static var sGame:String;
private static var sReferer:String;
private static var sStage:Stage;
private static var sID:int;
private static var sWidth:int;
private static var sHeight:int;
public static function isDomainAllowed(_arg1:Array):Boolean{
var _local2:Boolean;
var _local3:int;
_local2 = false;
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = ((_local2) || (isDomain(_arg1[_local3])));
_local3++;
};
if (!_local2){
showNotAllowedWarning();
};
return (_local2);
}
public static function getReferer():String{
var _local1:String;
_local1 = sStage.loaderInfo.loaderURL.toLowerCase();
if (_local1.indexOf("file://") == 0){
_local1 = "local";
} else {
_local1 = _local1.split("/")[2];
};
return (_local1);
}
public static function showGamesForSite():void{
showURL(((HOME + "/freecontent.html?gameref=") + sID));
}
public static function init(_arg1:Stage, _arg2:int, _arg3:String, _arg4:int=400, _arg5:int=400):void{
sStage = _arg1;
sID = _arg2;
sGame = _arg3;
sWidth = _arg4;
sHeight = _arg5;
sReferer = getReferer();
}
private static function showNotAllowedWarning():void{
var _local1:String;
var _local2:String;
_local1 = sGame.toLowerCase();
_local1 = _local1.replace(/\s/g, "-");
_local2 = (((((HOME + "/play/") + sID) + "/") + _local1) + ".html");
showWarning(((((((((((("WARNING!\n\n" + sGame) + " can not be played on this site (") + sReferer) + "), because ") + "this site has not obtained the necessary license to host this version of the game.\n\n") + "Please inform the webmaster of this site, and click to play ") + sGame) + " on the developer's site:\n\n") + _local2) + "\n\n") + "Thank you for helping to keep the Flash games business fair..."), true);
}
public static function isDomain(_arg1:String):Boolean{
return ((((sReferer.indexOf(_arg1) == 0)) || ((sReferer.indexOf(("." + _arg1)) == ((sReferer.length - _arg1.length) - 1)))));
}
private static function showBlacklistedWarning():void{
var _local1:String;
var _local2:String;
_local1 = sGame.toLowerCase();
_local1 = _local1.replace(/\s/g, "-");
_local2 = (((((HOME + "/games/") + sID) + "/") + _local1) + ".html");
showWarning(((((((((((("WARNING!\n\n" + sGame) + " can not be played on this site (") + sReferer) + "), because ") + "this site is in violation with the SmileyGamer.com license agreement (www.smileygamer.com/license-agreement.txt).\n\n") + "Please inform the webmaster of this site, and go play ") + sGame) + " on the developer's site:\n\n") + _local2) + "\n\n") + "Thank you for helping to keep the Flash games business fair..."));
}
public static function showHighscores():void{
var _local1:String;
_local1 = sGame.toLowerCase();
_local1 = _local1.replace(/\s/g, "-");
showURL(((((HOME + "/highscores/") + _local1) + ".html?gameref=") + sID));
}
public static function showGameAtHome():void{
var _local1:String;
_local1 = sGame.toLowerCase();
_local1 = _local1.replace(/\s/g, "-");
showURL(((((((HOME + "/play/") + sID) + "/") + _local1) + ".html?gameref=") + sID));
}
public static function isHome():Boolean{
return (isDomain("smileygamer.com"));
}
private static function showWarning(_arg1:String, _arg2:Boolean=false):void{
var bg:Shape;
var tf:TextField;
var format:TextFormat;
var clicked:Function;
var aText = _arg1;
var aClickable = _arg2;
bg = new Shape();
bg.graphics.beginFill(16777168);
bg.graphics.drawRect(0, 0, sWidth, sHeight);
bg.graphics.endFill();
sStage.addChild(bg);
tf = new TextField();
tf.autoSize = TextFieldAutoSize.NONE;
tf.textColor = 0xD00000;
tf.multiline = true;
tf.wordWrap = true;
format = new TextFormat();
format.size = 16;
format.bold = true;
format.align = TextFormatAlign.CENTER;
tf.defaultTextFormat = format;
tf.width = Math.min((sWidth - 20), 400);
tf.x = ((sWidth - tf.width) / 2);
tf.y = 20;
tf.height = (sHeight - 40);
tf.text = aText;
sStage.addChild(tf);
if (aClickable){
clicked = function (_arg1:Event):void{
showGameAtHome();
};
tf.mouseEnabled = false;
sStage.addEventListener(MouseEvent.CLICK, clicked);
};
}
public static function showURL(_arg1:String):void{
var aURL = _arg1;
try {
navigateToURL(new URLRequest(aURL), "_blank");
} catch(e:SecurityError) {
sendToURL(new URLRequest(((HOME + "/scripts/blacklist.php?domain=") + sReferer)));
};
}
public static function tracking(_arg1:Boolean=true):void{
var req:URLRequest;
var loader:URLLoader;
var error:Function;
var securityError:Function;
var infoReceived:Function;
var aWaitForResponse = _arg1;
req = new URLRequest(((((HOME + "/scripts/tracking.php?id=") + sID) + "&referer=") + sReferer));
if (aWaitForResponse){
try {
error = function (_arg1:Event):void{
};
securityError = function (_arg1:Event):void{
sendToURL(new URLRequest(((HOME + "/scripts/blacklist.php?domain=") + sReferer)));
showBlacklistedWarning();
};
infoReceived = function (_arg1:Event):void{
var _local2:int;
_local2 = int(loader.data);
if (_local2 == -1){
showBlacklistedWarning();
};
};
loader = new URLLoader(req);
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
loader.addEventListener(Event.COMPLETE, infoReceived);
} catch(e:SecurityError) {
sendToURL(new URLRequest(((HOME + "/scripts/blacklist.php?domain=") + sReferer)));
showBlacklistedWarning();
};
} else {
try {
sendToURL(req);
} catch(e:SecurityError) {
};
};
}
public static function showHome():void{
showURL(((HOME + "?gameref=") + sID));
}
}
}//package smileygamer.util
Section 14
//RandomUtil (smileygamer.util.RandomUtil)
package smileygamer.util {
public class RandomUtil {
public static function generateRandom(_arg1:int, _arg2:int):int{
return (((randomInt() % (_arg2 - _arg1)) + _arg1));
}
public static function generateRandomArray(_arg1:int):Array{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = new Array(_arg1);
_local3 = 0;
while (_local3 < _arg1) {
_local2[_local3] = _local3;
_local3++;
};
_local3 = 0;
while (_local3 < _arg1) {
_local4 = (randomInt() % _arg1);
_local5 = _local2[_local3];
_local2[_local3] = _local2[_local4];
_local2[_local4] = _local5;
_local3++;
};
return (_local2);
}
public static function randomInt():int{
return (Math.round((Math.random() * int.MAX_VALUE)));
}
public static function chance(_arg1:int):Boolean{
var _local2:int;
if (_arg1 < 2){
return (true);
};
_local2 = (randomInt() % _arg1);
return ((_local2 == 0));
}
public static function randomBoolean():Boolean{
return (((randomInt() % 2) == 0));
}
}
}//package smileygamer.util
Section 15
//AAnimation (smileygamer.AAnimation)
package smileygamer {
import flash.events.*;
import flash.display.*;
public class AAnimation implements IAnimation {
private var fCallbacks:Array;
private var fStopped:Boolean;
private var fDisplayObject:DisplayObject;
private var fFrame:int;// = 0
private var fLooping:Boolean;
public function AAnimation(_arg1:DisplayObject){
fFrame = 0;
super();
fDisplayObject = _arg1;
looping = true;
fCallbacks = new Array();
reset();
}
public function stop():void{
fStopped = true;
}
private function doCallbacks():void{
var _local1:int;
var _local2:Function;
_local1 = 0;
while (_local1 < fCallbacks.length) {
_local2 = (fCallbacks[_local1] as Function);
_local2.call(this);
_local1++;
};
}
public function get looping():Boolean{
return (fLooping);
}
public function addCallback(_arg1:Function):void{
if (_arg1 != null){
fCallbacks.push(_arg1);
};
}
public function update():void{
}
public function reset():void{
fFrame = 0;
fStopped = false;
displayObject.removeEventListener(Event.ENTER_FRAME, next);
displayObject.addEventListener(Event.ENTER_FRAME, next);
update();
}
public function get displayObject():DisplayObject{
return (fDisplayObject);
}
protected function get frameCount():int{
return (1);
}
public function removeCallback(_arg1:Function):void{
var _local2:int;
_local2 = 0;
while (_local2 < fCallbacks.length) {
if (fCallbacks[_local2] == _arg1){
fCallbacks.splice(_local2, 1);
};
_local2++;
};
}
protected function get frame():int{
return (fFrame);
}
public function get finished():Boolean{
return ((((fFrame == frameCount)) || (fStopped)));
}
private function next(_arg1:Event):void{
if (displayObject.stage != null){
update();
fFrame++;
if (fLooping){
fFrame = (fFrame % frameCount);
};
if (finished){
displayObject.removeEventListener(Event.ENTER_FRAME, next);
doCallbacks();
};
} else {
displayObject.removeEventListener(Event.ENTER_FRAME, next);
};
}
public function set looping(_arg1:Boolean):void{
fLooping = _arg1;
}
}
}//package smileygamer
Section 16
//AGame (smileygamer.AGame)
package smileygamer {
import flash.events.*;
import flash.display.*;
public class AGame extends Sprite {
public function AGame(){
addEventListener(Event.ENTER_FRAME, mainLoop);
}
public function mainLoop(_arg1:Event):void{
var _local2:int;
var _local3:ILogic;
_local2 = 0;
while (_local2 < numChildren) {
if ((getChildAt(_local2) is ILogic)){
_local3 = (getChildAt(_local2) as ILogic);
_local3.doLogic();
};
_local2++;
};
}
}
}//package smileygamer
Section 17
//AProgressBar (smileygamer.AProgressBar)
package smileygamer {
import flash.display.*;
public class AProgressBar extends Shape {
private var fValueChanged:Boolean;
private var fWidth:Number;
private var fValue:Number;
private var fHeight:Number;
private var fHorizontal:Boolean;
private var fMaxValue:Number;
public function AProgressBar(_arg1:Number=1, _arg2:Number=0, _arg3:Boolean=true){
fMaxValue = _arg1;
fValue = _arg2;
fHorizontal = _arg3;
fValueChanged = true;
}
protected function get valueChanged():Boolean{
return (fValueChanged);
}
override public function set width(_arg1:Number):void{
fWidth = _arg1;
}
public function set maxValue(_arg1:Number):void{
fMaxValue = _arg1;
if (fValue > fMaxValue){
fValue = fMaxValue;
};
}
public function set value(_arg1:Number):void{
if (fValue != _arg1){
fValueChanged = true;
};
fValue = _arg1;
if (fValue < 0){
fValue = 0;
};
if (fValue > fMaxValue){
fValue = fMaxValue;
};
}
override public function get height():Number{
return (fHeight);
}
protected function get progress():Number{
fValueChanged = false;
if (fHorizontal){
return (((width * fValue) / fMaxValue));
};
return (((height * fValue) / fMaxValue));
}
override public function set height(_arg1:Number):void{
fHeight = _arg1;
}
override public function get width():Number{
return (fWidth);
}
public function get maxValue():Number{
return (fMaxValue);
}
public function get value():Number{
return (fValue);
}
}
}//package smileygamer
Section 18
//CircularMoveAnimation (smileygamer.CircularMoveAnimation)
package smileygamer {
import flash.display.*;
import flash.geom.*;
public class CircularMoveAnimation extends AAnimation {
private var fXs:Array;
private var fCenter:Point;
private var fYs:Array;
private var fSteps:int;
private var fDistance:Number;
public function CircularMoveAnimation(_arg1:DisplayObject, _arg2:Point, _arg3:Number, _arg4:int, _arg5:int=0, _arg6:Boolean=false){
var _local7:int;
fCenter = _arg2;
fDistance = _arg3;
fSteps = _arg4;
fXs = new Array(fSteps);
fYs = new Array(fSteps);
_local7 = 0;
while (_local7 < fSteps) {
if (_arg6){
fXs[(((fSteps - _local7) + _arg5) % fSteps)] = Math.sin((((2 * Math.PI) * _local7) / fSteps));
fYs[(((fSteps - _local7) + _arg5) % fSteps)] = Math.cos((((2 * Math.PI) * _local7) / fSteps));
} else {
fXs[(((_local7 + fSteps) - _arg5) % fSteps)] = Math.sin((((2 * Math.PI) * _local7) / fSteps));
fYs[(((_local7 + fSteps) - _arg5) % fSteps)] = Math.cos((((2 * Math.PI) * _local7) / fSteps));
};
_local7++;
};
super(_arg1);
}
public function set centerX(_arg1:int):void{
fCenter.x = _arg1;
}
override public function update():void{
displayObject.x = (((fXs[frame] * fDistance) + fCenter.x) - (displayObject.width / 2));
displayObject.y = (((fYs[frame] * fDistance) + fCenter.y) - (displayObject.height / 2));
}
public function set centerY(_arg1:int):void{
fCenter.y = _arg1;
}
override protected function get frameCount():int{
return (fSteps);
}
public function set distance(_arg1:int):void{
fDistance = _arg1;
}
}
}//package smileygamer
Section 19
//FadeAnimation (smileygamer.FadeAnimation)
package smileygamer {
import flash.display.*;
import smileygamer.util.*;
public class FadeAnimation extends AAnimation {
private var fSteps:int;
private var fMode:int;
private var fValues:Array;
private var fDelay:int;
public static const MODE_FADE_IN:int = 0;
public static const MODE_FADE_OUT:int = 1;
public static const MODE_FADE_OUT_REMOVE:int = 2;
public function FadeAnimation(_arg1:DisplayObject, _arg2:int, _arg3:int, _arg4:int=0){
fSteps = _arg2;
fMode = _arg3;
fDelay = _arg4;
if (fMode == MODE_FADE_IN){
fValues = InterpolationUtil.createValues(InterpolationUtil.TYPE_COSINE, 0, 1, fSteps);
} else {
fValues = InterpolationUtil.createValues(InterpolationUtil.TYPE_COSINE, 1, 0, fSteps);
};
super(_arg1);
looping = false;
}
public function setFadeValues(_arg1:Number, _arg2:Number):void{
fValues = InterpolationUtil.createValues(InterpolationUtil.TYPE_COSINE, _arg1, _arg2, fSteps);
}
override public function update():void{
if (frame >= fDelay){
displayObject.alpha = fValues[(frame - fDelay)];
if (fValues[(frame - fDelay)] > 0){
displayObject.visible = true;
} else {
displayObject.visible = false;
};
};
}
override protected function get frameCount():int{
return ((fSteps + fDelay));
}
override public function get finished():Boolean{
var _local1:Boolean;
_local1 = super.finished;
if (((_local1) && ((fMode == MODE_FADE_OUT_REMOVE)))){
displayObject.parent.removeChild(displayObject);
};
return (_local1);
}
}
}//package smileygamer
Section 20
//IAnimation (smileygamer.IAnimation)
package smileygamer {
public interface IAnimation {
function get finished():Boolean;
function update():void;
function get looping():Boolean;
}
}//package smileygamer
Section 21
//ILogic (smileygamer.ILogic)
package smileygamer {
public interface ILogic {
function doLogic():void;
}
}//package smileygamer
Section 22
//ImageAnimation (smileygamer.ImageAnimation)
package smileygamer {
import flash.display.*;
public class ImageAnimation extends AAnimation {
public function ImageAnimation(_arg1:DisplayObject){
super(_arg1);
}
}
}//package smileygamer
Section 23
//ImageArrayAnimation (smileygamer.ImageArrayAnimation)
package smileygamer {
import flash.display.*;
import flash.geom.*;
public class ImageArrayAnimation extends AAnimation {
private var fLastIndex:int;
private var fIndices:Array;
private var fRect:Rectangle;
private var fDest:Bitmap;
private var fOrigin:Point;
private var fImages:Array;
public function ImageArrayAnimation(_arg1:Array, _arg2:Array, _arg3:int=1, _arg4:Boolean=true, _arg5:Boolean=false){
var _local6:int;
fImages = _arg1;
fIndices = new Array((_arg2.length * _arg3));
_local6 = 0;
while (_local6 < fIndices.length) {
if (_arg5){
fIndices[((fIndices.length - _local6) - 1)] = _arg2[int((_local6 / _arg3))];
} else {
fIndices[_local6] = _arg2[int((_local6 / _arg3))];
};
_local6++;
};
fLastIndex = -1;
fDest = new Bitmap(new BitmapData(fImages[0].width, fImages[0].height, true, 0));
fRect = new Rectangle(0, 0, fDest.width, fDest.height);
fOrigin = new Point(0, 0);
super(fDest);
looping = _arg4;
}
override public function reset():void{
fLastIndex = -1;
super.reset();
}
override public function update():void{
var _local1:Bitmap;
if (fLastIndex != fIndices[frame]){
fLastIndex = fIndices[frame];
_local1 = (fImages[fLastIndex] as Bitmap);
fDest.bitmapData.copyPixels(_local1.bitmapData, fRect, fOrigin);
};
}
public function setImages(_arg1:Array):void{
if (_arg1.length == fImages.length){
fImages = _arg1;
fLastIndex = -1;
};
}
override protected function get frameCount():int{
return (fIndices.length);
}
}
}//package smileygamer
Section 24
//ImageStrip (smileygamer.ImageStrip)
package smileygamer {
import flash.display.*;
import flash.geom.*;
public class ImageStrip {
private var fWidth:int;
private var fOrigin:Point;
private var fHeight:int;
private var fTempRect:Rectangle;
private var fImageData:BitmapData;
public function ImageStrip(_arg1:Bitmap, _arg2:int, _arg3:int){
fOrigin = new Point(0, 0);
super();
fImageData = _arg1.bitmapData;
fWidth = _arg2;
fHeight = _arg3;
fTempRect = new Rectangle(0, 0, fWidth, fHeight);
}
public function get width():int{
return (fWidth);
}
public function get height():int{
return (fHeight);
}
public function copyImage(_arg1:int, _arg2:Bitmap):void{
fTempRect.x = (_arg1 * fWidth);
fTempRect.y = 0;
_arg2.bitmapData.copyPixels(fImageData, fTempRect, fOrigin);
}
public function createImage(_arg1:int):Bitmap{
var _local2:BitmapData;
_local2 = new BitmapData(fWidth, fHeight, true, 0);
fTempRect.x = (_arg1 * fWidth);
fTempRect.y = 0;
_local2.copyPixels(fImageData, fTempRect, fOrigin);
return (new Bitmap(_local2));
}
}
}//package smileygamer
Section 25
//MoveAnimation (smileygamer.MoveAnimation)
package smileygamer {
import flash.display.*;
import flash.geom.*;
import smileygamer.util.*;
public class MoveAnimation extends AAnimation {
private var fRemove:Boolean;
private var fSteps:int;
private var fXCoords:Array;
private var fYCoords:Array;
public function MoveAnimation(_arg1:DisplayObject, _arg2:Point, _arg3:Point, _arg4:int, _arg5:int=0, _arg6:int=0, _arg7:Boolean=false, _arg8:Boolean=false){
var _local9:int;
var _local10:Array;
var _local11:Array;
fSteps = (_arg4 + _arg6);
fXCoords = new Array();
fYCoords = new Array();
_local9 = 0;
while (_local9 < _arg6) {
fXCoords.push(_arg2.x);
fYCoords.push(_arg2.y);
_local9++;
};
_local10 = InterpolationUtil.createValues(_arg5, _arg2.x, _arg3.x, _arg4);
_local11 = InterpolationUtil.createValues(_arg5, _arg2.y, _arg3.y, _arg4);
fXCoords.push(Math.round(_local10[0]));
fYCoords.push(Math.round(_local11[0]));
_local9 = 1;
while (_local9 < (_local10.length - 1)) {
fXCoords.push(_local10[_local9]);
fYCoords.push(_local11[_local9]);
_local9++;
};
fXCoords.push(Math.round(_local10[(_local10.length - 1)]));
fYCoords.push(Math.round(_local11[(_local10.length - 1)]));
if (_arg8){
fSteps = ((_arg4 * 2) + _arg6);
_local9 = (_local10.length - 1);
while (_local9 >= 0) {
fXCoords.push(fXCoords[_local9]);
fYCoords.push(fYCoords[_local9]);
_local9--;
};
};
fRemove = _arg7;
super(_arg1);
looping = false;
}
override public function update():void{
displayObject.x = fXCoords[frame];
displayObject.y = fYCoords[frame];
}
override protected function get frameCount():int{
return (fSteps);
}
override public function get finished():Boolean{
var _local1:Boolean;
_local1 = super.finished;
if (((_local1) && (fRemove))){
displayObject.parent.removeChild(displayObject);
};
return (_local1);
}
}
}//package smileygamer
Section 26
//SGSprite (smileygamer.SGSprite)
package smileygamer {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class SGSprite extends Sprite {
private var fClonePos:Point;// = null
private var fSpriteClone:DisplayObject;// = null
private var fAnimations:Object;
private var fState:String;// = "default"
public static const STATE_DEFAULT:String = "default";
public function SGSprite(){
fState = STATE_DEFAULT;
fAnimations = new Object();
fClonePos = null;
fSpriteClone = null;
super();
addEventListener(Event.ENTER_FRAME, update);
}
public function addAnimation(_arg1:String, _arg2:AAnimation):void{
fAnimations[_arg1] = _arg2;
if (state == _arg1){
state = _arg1;
};
}
public function set state(_arg1:String):void{
var _local2:int;
var _local3:AAnimation;
fState = _arg1;
_local2 = (numChildren - 1);
while (_local2 >= 0) {
removeChildAt(_local2);
_local2--;
};
_local3 = (fAnimations[fState] as AAnimation);
_local3.reset();
addChild(_local3.displayObject);
if (fClonePos != null){
fSpriteClone = clone(_local3.displayObject);
fSpriteClone.x = fClonePos.x;
fSpriteClone.y = fClonePos.y;
addChild(fSpriteClone);
};
}
private function clone(_arg1:DisplayObject):DisplayObject{
var _local2:DisplayObject;
var _local3:Sprite;
var _local4:Bitmap;
var _local5:Class;
if ((_arg1 is Bitmap)){
_local4 = (_arg1 as Bitmap);
_local2 = new Bitmap(_local4.bitmapData);
} else {
_local5 = (getDefinitionByName(getQualifiedClassName(_arg1)) as Class);
_local2 = new (_local5);
};
_local2.x = _arg1.x;
_local2.y = _arg1.y;
_local2.transform = _arg1.transform;
_local2.filters = _arg1.filters;
_local2.cacheAsBitmap = _arg1.cacheAsBitmap;
_local2.opaqueBackground = _arg1.opaqueBackground;
_local3 = new Sprite();
_local3.addChild(_local2);
return (_local3);
}
public function set clonePos(_arg1:Point):void{
var _local2:AAnimation;
fClonePos = _arg1;
if (fClonePos == null){
if (fSpriteClone != null){
removeChild(fSpriteClone);
};
fSpriteClone = null;
} else {
if (fSpriteClone == null){
_local2 = (fAnimations[fState] as AAnimation);
fSpriteClone = clone(_local2.displayObject);
addChild(fSpriteClone);
};
fSpriteClone.x = fClonePos.x;
fSpriteClone.y = fClonePos.y;
};
}
protected function nextState():String{
return (STATE_DEFAULT);
}
public function get finished():Boolean{
return (false);
}
public function get state():String{
return (fState);
}
public function get clonePos():Point{
return (fClonePos);
}
public function update(_arg1:Event):void{
var _local2:AAnimation;
if (((!((fState == null))) && (!((fAnimations[fState] == null))))){
_local2 = (fAnimations[fState] as AAnimation);
if (_local2.finished){
state = nextState();
};
};
}
}
}//package smileygamer
Section 27
//Background (smileymatcher.Background)
package smileymatcher {
import flash.display.*;
import flash.geom.*;
public class Background extends Shape {
public function Background(){
var _local1:Matrix;
super();
_local1 = new Matrix();
_local1.createGradientBox(540, 540, (Math.PI / 4));
graphics.beginGradientFill(GradientType.LINEAR, new Array(13019930, 0xFFD800, 13019930), new Array(1, 1, 1), new Array(0, 127, 0xFF), _local1);
graphics.drawRect(0, 0, 540, 400);
cacheAsBitmap = true;
}
}
}//package smileymatcher
Section 28
//Board (smileymatcher.Board)
package smileymatcher {
import smileygamer.util.*;
public class Board {
private var fTypes:Array;
private var fMatchResult:MatchPositions;
private var fTempMoveArray:Array;
private var fMatchCount:int;
private var fMatches:Array;
public static const SIZE:int = 6;
public function Board(){
var _local1:int;
super();
fTypes = new Array(SIZE);
fMatches = new Array(SIZE);
_local1 = 0;
while (_local1 < SIZE) {
fTypes[_local1] = new Array(SIZE);
fMatches[_local1] = new Array(SIZE);
_local1++;
};
fTempMoveArray = new Array(SIZE);
fMatchResult = new MatchPositions();
}
public function findMatchesRow(_arg1:int):MatchPositions{
var _local2:int;
fMatchResult.reset();
_local2 = 0;
while (_local2 < SIZE) {
if ((((_local2 == 0)) || (!((fTypes[_arg1][_local2] == fTypes[_arg1][(_local2 - 1)]))))){
clearMatches();
findMatches(_arg1, _local2);
if (fMatchCount > 2){
fMatchResult.newMatch();
addPositions();
};
};
_local2++;
};
return (fMatchResult);
}
public function printMatches():void{
var _local1:int;
trace("Matches:");
_local1 = 0;
while (_local1 < SIZE) {
trace(fMatches[_local1]);
_local1++;
};
}
public function moveRow(_arg1:int, _arg2:int):void{
var _local3:int;
_local3 = 0;
while (_local3 < SIZE) {
fTempMoveArray[(((_local3 - _arg2) + SIZE) % SIZE)] = fTypes[_arg1][_local3];
_local3++;
};
_local3 = 0;
while (_local3 < SIZE) {
fTypes[_arg1][_local3] = fTempMoveArray[_local3];
_local3++;
};
}
public function init(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Boolean;
clearMatches();
_local2 = 0;
while (_local2 < SIZE) {
_local3 = 0;
while (_local3 < SIZE) {
_local4 = 0;
_local5 = false;
do {
_local4 = RandomUtil.generateRandom(0, _arg1);
_local5 = false;
if (_local3 > 1){
_local5 = (((_local4 == fTypes[_local2][(_local3 - 1)])) && ((_local4 == fTypes[_local2][(_local3 - 2)])));
};
if (_local2 > 1){
_local5 = ((_local5) || ((((_local4 == fTypes[(_local2 - 1)][_local3])) && ((_local4 == fTypes[(_local2 - 2)][_local3])))));
};
if (_local2 > 0){
if (_local3 < 5){
_local5 = ((_local5) || ((((_local4 == fTypes[(_local2 - 1)][_local3])) && ((_local4 == fTypes[(_local2 - 1)][(_local3 + 1)])))));
};
if (_local3 > 0){
_local5 = ((((_local5) || ((((_local4 == fTypes[(_local2 - 1)][_local3])) && ((((_local4 == fTypes[_local2][(_local3 - 1)])) || ((_local4 == fTypes[(_local2 - 1)][(_local3 - 1)])))))))) || ((((_local4 == fTypes[_local2][(_local3 - 1)])) && ((_local4 == fTypes[(_local2 - 1)][(_local3 - 1)])))));
};
};
} while (_local5);
fTypes[_local2][_local3] = _local4;
_local3++;
};
_local2++;
};
}
private function addPositions():void{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < SIZE) {
_local2 = 0;
while (_local2 < SIZE) {
if (fMatches[_local1][_local2]){
fMatchResult.addPosition(_local1, _local2);
};
_local2++;
};
_local1++;
};
}
private function rowContains(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = 0;
while (_local3 < (SIZE - 1)) {
if (fTypes[_arg1][_local3] == _arg2){
return (_local3);
};
_local3++;
};
return (-1);
}
public function findPossibleMatch(_arg1:Object):int{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
_local2 = 0;
while (_local2 < SIZE) {
_local3 = 0;
while (_local3 < SIZE) {
_local4 = fTypes[_local2][_local3];
if ((((_local3 < (SIZE - 1))) && ((_local4 == fTypes[_local2][(_local3 + 1)])))){
if ((((_local2 < (SIZE - 1))) && ((_arg1.rows.indexOf((_local2 + 1)) == -1)))){
_local5 = rowContains((_local2 + 1), _local4);
if (_local5 != -1){
return (((_local5 > _local3)) ? (_local2 + 11) : (_local2 + 1));
};
};
if ((((_local2 > 0)) && ((_arg1.rows.indexOf((_local2 - 1)) == -1)))){
_local5 = rowContains((_local2 - 1), _local4);
if (_local5 != -1){
return (((_local5 > _local3)) ? (_local2 + 9) : (_local2 - 1));
};
};
if ((((_local3 > 0)) && ((_arg1.cols.indexOf((_local3 - 1)) == -1)))){
_local6 = colContains((_local3 - 1), _local4);
if (_local6 != -1){
return (((_local6 < _local2)) ? (_local3 + 19) : (_local3 + 29));
};
};
if ((((_local3 < (SIZE - 2))) && ((_arg1.cols.indexOf((_local3 + 2)) == -1)))){
_local6 = colContains((_local3 + 2), _local4);
if (_local6 != -1){
return (((_local6 < _local2)) ? (_local3 + 22) : (_local3 + 32));
};
};
if ((((((_local3 == 0)) && ((_local4 == fTypes[_local2][(SIZE - 1)])))) && ((_arg1.rows.indexOf(_local2) == -1)))){
return (_local2);
};
if ((((((_local3 == (SIZE - 2))) && ((_local4 == fTypes[_local2][0])))) && ((_arg1.rows.indexOf(_local2) == -1)))){
return ((_local2 + 10));
};
};
if ((((((_local3 < (SIZE - 2))) && ((_local4 == fTypes[_local2][(_local3 + 2)])))) && ((_arg1.cols.indexOf((_local3 + 1)) == -1)))){
_local6 = colContains((_local3 + 1), _local4);
if (_local6 != -1){
return (((_local6 < _local2)) ? (_local3 + 21) : (_local3 + 31));
};
};
if ((((_local2 < (SIZE - 1))) && ((_local4 == fTypes[(_local2 + 1)][_local3])))){
if ((((_local3 > 0)) && ((_arg1.cols.indexOf((_local3 - 1)) == -1)))){
_local6 = colContains((_local3 - 1), _local4);
if (_local6 != -1){
return (((_local6 < _local2)) ? (_local3 + 19) : (_local3 + 29));
};
};
if ((((_local3 < (SIZE - 1))) && ((_arg1.cols.indexOf((_local3 + 1)) == -1)))){
_local6 = colContains((_local3 + 1), _local4);
if (_local6 != -1){
return (((_local6 < _local2)) ? (_local3 + 21) : (_local3 + 31));
};
};
if ((((_local2 < (SIZE - 2))) && ((_arg1.rows.indexOf((_local2 + 2)) == -1)))){
_local5 = rowContains((_local2 + 2), _local4);
if (_local5 != -1){
return (((_local5 > _local3)) ? (_local2 + 12) : (_local2 + 2));
};
};
if ((((_local2 > 0)) && ((_arg1.rows.indexOf((_local2 - 1)) == -1)))){
_local5 = rowContains((_local2 - 1), _local4);
if (_local5 != -1){
return (((_local5 > _local3)) ? (_local2 + 9) : (_local2 - 1));
};
};
if ((((((_local2 == 0)) && ((_local4 == fTypes[(SIZE - 1)][_local3])))) && ((_arg1.cols.indexOf(_local3) == -1)))){
return ((_local3 + 20));
};
if ((((((_local2 == (SIZE - 2))) && ((_local4 == fTypes[0][_local3])))) && ((_arg1.cols.indexOf(_local3) == -1)))){
return ((_local3 + 30));
};
};
if ((((((_local2 < (SIZE - 2))) && ((_local4 == fTypes[(_local2 + 2)][_local3])))) && ((_arg1.rows.indexOf((_local2 + 1)) == -1)))){
_local5 = rowContains((_local2 + 1), _local4);
if (_local5 != -1){
return (((_local5 > _local3)) ? (_local2 + 11) : (_local2 + 1));
};
};
_local3++;
};
_local2++;
};
return (-1);
}
public function findAllMatches():MatchPositions{
var _local1:int;
var _local2:int;
fMatchResult.reset();
_local1 = 0;
while (_local1 < SIZE) {
_local2 = 0;
while (_local2 < SIZE) {
if ((((_local2 == 0)) || (!((fTypes[_local1][_local2] == fTypes[_local1][(_local2 - 1)]))))){
clearMatches();
findMatches(_local1, _local2);
if (fMatchCount > 2){
fMatchResult.newMatch();
addPositions();
};
};
_local2++;
};
_local1++;
};
return (fMatchResult);
}
public function findMatchesFor(_arg1:Array):MatchPositions{
var _local2:int;
var _local3:Array;
var _local4:int;
fMatchResult.reset();
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = (_arg1[_local2] as Array);
_local4 = 0;
while (_local4 < _local3.length) {
clearMatches();
findMatches(_local3[_local4].row, _local3[_local4].col);
if (fMatchCount > 2){
fMatchResult.newMatch();
addPositions();
};
_local4++;
};
_local2++;
};
return (fMatchResult);
}
public function getType(_arg1:int, _arg2:int):int{
return (fTypes[_arg1][_arg2]);
}
private function clearMatches():void{
var _local1:int;
var _local2:int;
fMatchCount = 0;
_local1 = 0;
while (_local1 < SIZE) {
_local2 = 0;
while (_local2 < SIZE) {
fMatches[_local1][_local2] = false;
_local2++;
};
_local1++;
};
}
public function moveCol(_arg1:int, _arg2:int):void{
var _local3:int;
_local3 = 0;
while (_local3 < SIZE) {
fTempMoveArray[(((_local3 - _arg2) + SIZE) % SIZE)] = fTypes[_local3][_arg1];
_local3++;
};
_local3 = 0;
while (_local3 < SIZE) {
fTypes[_local3][_arg1] = fTempMoveArray[_local3];
_local3++;
};
}
public function findMatchingType(_arg1:int, _arg2:int):int{
if ((((_arg2 > 1)) && ((fTypes[_arg1][(_arg2 - 2)] == fTypes[_arg1][(_arg2 - 1)])))){
return (fTypes[_arg1][(_arg2 - 1)]);
};
if ((((_arg2 < (SIZE - 2))) && ((fTypes[_arg1][(_arg2 + 1)] == fTypes[_arg1][(_arg2 + 2)])))){
return (fTypes[_arg1][(_arg2 + 1)]);
};
if ((((_arg1 > 1)) && ((fTypes[(_arg1 - 2)][_arg2] == fTypes[(_arg1 - 1)][_arg2])))){
return (fTypes[(_arg1 - 1)][_arg2]);
};
if ((((_arg1 < (SIZE - 2))) && ((fTypes[(_arg1 + 1)][_arg2] == fTypes[(_arg1 + 2)][_arg2])))){
return (fTypes[(_arg1 + 1)][_arg2]);
};
if ((((((_arg2 > 0)) && ((_arg2 < (SIZE - 1))))) && ((fTypes[_arg1][(_arg2 - 1)] == fTypes[_arg1][(_arg2 + 1)])))){
return (fTypes[_arg1][(_arg2 - 1)]);
};
if ((((((_arg2 > 0)) && ((_arg1 > 0)))) && ((((fTypes[_arg1][(_arg2 - 1)] == fTypes[(_arg1 - 1)][(_arg2 - 1)])) || ((fTypes[(_arg1 - 1)][(_arg2 - 1)] == fTypes[(_arg1 - 1)][_arg2])))))){
return (fTypes[(_arg1 - 1)][(_arg2 - 1)]);
};
if ((((((_arg2 > 0)) && ((_arg1 > 0)))) && ((fTypes[_arg1][(_arg2 - 1)] == fTypes[(_arg1 - 1)][_arg2])))){
return (fTypes[_arg1][(_arg2 - 1)]);
};
if ((((((_arg2 > 0)) && ((_arg1 < (SIZE - 1))))) && ((((fTypes[_arg1][(_arg2 - 1)] == fTypes[(_arg1 + 1)][(_arg2 - 1)])) || ((fTypes[(_arg1 + 1)][(_arg2 - 1)] == fTypes[(_arg1 + 1)][_arg2])))))){
return (fTypes[(_arg1 + 1)][(_arg2 - 1)]);
};
if ((((((_arg2 > 0)) && ((_arg1 < (SIZE - 1))))) && ((fTypes[_arg1][(_arg2 - 1)] == fTypes[(_arg1 + 1)][_arg2])))){
return (fTypes[(_arg1 + 1)][_arg2]);
};
if ((((((_arg2 < (SIZE - 1))) && ((_arg1 > 0)))) && ((((fTypes[_arg1][(_arg2 + 1)] == fTypes[(_arg1 - 1)][(_arg2 + 1)])) || ((fTypes[(_arg1 - 1)][(_arg2 + 1)] == fTypes[(_arg1 - 1)][_arg2])))))){
return (fTypes[(_arg1 - 1)][(_arg2 + 1)]);
};
if ((((((_arg2 < (SIZE - 1))) && ((_arg1 > 0)))) && ((fTypes[_arg1][(_arg2 + 1)] == fTypes[(_arg1 - 1)][_arg2])))){
return (fTypes[_arg1][(_arg2 + 1)]);
};
if ((((((_arg2 < (SIZE - 1))) && ((_arg1 < (SIZE - 1))))) && ((((fTypes[_arg1][(_arg2 + 1)] == fTypes[(_arg1 + 1)][(_arg2 + 1)])) || ((fTypes[(_arg1 + 1)][(_arg2 + 1)] == fTypes[(_arg1 + 1)][_arg2])))))){
return (fTypes[(_arg1 + 1)][(_arg2 + 1)]);
};
if ((((((_arg2 < (SIZE - 1))) && ((_arg1 < (SIZE - 1))))) && ((fTypes[_arg1][(_arg2 + 1)] == fTypes[(_arg1 + 1)][_arg2])))){
return (fTypes[_arg1][(_arg2 + 1)]);
};
if ((((((_arg1 > 0)) && ((_arg1 < (SIZE - 1))))) && ((fTypes[(_arg1 - 1)][_arg2] == fTypes[(_arg1 + 1)][_arg2])))){
return (fTypes[(_arg1 - 1)][_arg2]);
};
return (-1);
}
public function printBoard():void{
var _local1:int;
trace("Board:");
_local1 = 0;
while (_local1 < SIZE) {
trace(fTypes[_local1]);
_local1++;
};
}
private function findMatches(_arg1:int, _arg2:int):void{
fMatches[_arg1][_arg2] = true;
fMatchCount++;
if ((((((_arg1 > 0)) && (!(fMatches[(_arg1 - 1)][_arg2])))) && ((fTypes[_arg1][_arg2] == fTypes[(_arg1 - 1)][_arg2])))){
findMatches((_arg1 - 1), _arg2);
};
if ((((((_arg2 > 0)) && (!(fMatches[_arg1][(_arg2 - 1)])))) && ((fTypes[_arg1][_arg2] == fTypes[_arg1][(_arg2 - 1)])))){
findMatches(_arg1, (_arg2 - 1));
};
if ((((((_arg2 < 5)) && (!(fMatches[_arg1][(_arg2 + 1)])))) && ((fTypes[_arg1][_arg2] == fTypes[_arg1][(_arg2 + 1)])))){
findMatches(_arg1, (_arg2 + 1));
};
if ((((((_arg1 < 5)) && (!(fMatches[(_arg1 + 1)][_arg2])))) && ((fTypes[_arg1][_arg2] == fTypes[(_arg1 + 1)][_arg2])))){
findMatches((_arg1 + 1), _arg2);
};
}
public function setType(_arg1:int, _arg2:int, _arg3:int):void{
fTypes[_arg1][_arg2] = _arg3;
}
public function findMatchesCol(_arg1:int):MatchPositions{
var _local2:int;
fMatchResult.reset();
_local2 = 0;
while (_local2 < SIZE) {
if ((((_local2 == 0)) || (!((fTypes[_local2][_arg1] == fTypes[(_local2 - 1)][_arg1]))))){
clearMatches();
findMatches(_local2, _arg1);
if (fMatchCount > 2){
fMatchResult.newMatch();
addPositions();
};
};
_local2++;
};
return (fMatchResult);
}
private function colContains(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = 0;
while (_local3 < (SIZE - 1)) {
if (fTypes[_local3][_arg1] == _arg2){
return (_local3);
};
_local3++;
};
return (-1);
}
}
}//package smileymatcher
Section 29
//BoardFrame (smileymatcher.BoardFrame)
package smileymatcher {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class BoardFrame extends Shape {
public static const COLOR:int = 3891199;
public static const TIMEBAR_RECT:Rectangle = new Rectangle(510, 20, 15, 360);
public static const BOARD_RECT:Rectangle = new Rectangle(140, 20, 360, 360);
public function BoardFrame(_arg1:Boolean){
var _local2:BevelFilter;
var _local3:DropShadowFilter;
super();
graphics.beginFill(COLOR);
graphics.drawRect(0, 0, 540, 400);
graphics.drawRoundRect(BOARD_RECT.x, BOARD_RECT.y, BOARD_RECT.width, BOARD_RECT.height, 20, 20);
if (_arg1){
graphics.drawRoundRect(TIMEBAR_RECT.x, TIMEBAR_RECT.y, TIMEBAR_RECT.width, TIMEBAR_RECT.height, 6, 6);
};
graphics.endFill();
_local2 = new BevelFilter(8, 45, 0xFFFFFF, 1, 0, 0.8, 8, 8, 0.7, BitmapFilterQuality.HIGH);
_local3 = new DropShadowFilter(4);
_local3.alpha = 0.5;
_local3.quality = BitmapFilterQuality.HIGH;
filters = [_local2, _local3];
cacheAsBitmap = true;
}
}
}//package smileymatcher
Section 30
//BoardLayer (smileymatcher.BoardLayer)
package smileymatcher {
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
public class BoardLayer extends Sprite {
private var fLockPlayed:Boolean;// = false
private var fGrabbing:Boolean;
private var fMatchResult:MatchResult;
private var fBoard:Board;
private var fTypeCount:int;
private var fStartCol:int;
private var fLockedCol:int;
private var fPointingHand:PointingHand;// = null
private var fBonusCol:int;// = -1
private var fGrabbedCol:int;
private var fBonusSprite:TextField;// = null
private var fNewMatches:MatchPositions;// = null
private var fStartRow:int;
private var fLockedRow:int;
private var fSmileysSprite:Sprite;
private var fBonusRow:int;// = -1
private var fGrabbedX:int;
private var fGrabbedY:int;
private var fGrabbedSmiley:SmileySprite;
private var fTempMoveArray:Array;
private var fSmileys:Array;
private var fGrabbedRow:int;
public static const SIZE:int = 6;
private static const START_MOVING_OFFSET:int = 10;
public static const BOARDSIZE:int = 360;
private static const BOARD_BOUNDS:Rectangle = new Rectangle(0, 0, 360, 360);
public function BoardLayer(){
fBonusSprite = null;
fPointingHand = null;
fNewMatches = null;
fBonusRow = -1;
fBonusCol = -1;
fMatchResult = new MatchResult();
fLockPlayed = false;
super();
fBoard = new Board();
}
private function getLocks():Object{
var _local1:Object;
var _local2:int;
var _local3:SmileySprite;
_local1 = new Object();
_local1.rows = new Array();
_local1.cols = new Array();
_local2 = 0;
while (_local2 < fSmileys.length) {
_local3 = (fSmileys[_local2] as SmileySprite);
if (_local3.locked){
_local1.rows.push(_local3.row);
_local1.cols.push(_local3.column);
};
_local2++;
};
return (_local1);
}
private function slideInPosition():void{
var _local1:int;
var _local2:SmileySprite;
if (fLockedRow != -1){
_local1 = 0;
while (_local1 < SIZE) {
_local2 = (fSmileys[((fLockedRow * SIZE) + _local1)] as SmileySprite);
_local2.slideInPosition();
_local1++;
};
};
if (fLockedCol != -1){
_local1 = 0;
while (_local1 < SIZE) {
_local2 = (fSmileys[(fLockedCol + (_local1 * SIZE))] as SmileySprite);
_local2.slideInPosition();
_local1++;
};
};
}
public function init(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:Sprite;
var _local5:int;
var _local6:int;
fTypeCount = _arg1;
_local2 = (numChildren - 1);
while (_local2 >= 0) {
removeChildAt(_local2);
_local2--;
};
fSmileys = new Array((SIZE * SIZE));
fSmileysSprite = new Sprite();
fBoard.init(fTypeCount);
_local3 = 0;
while (_local3 < SIZE) {
_local5 = 0;
while (_local5 < SIZE) {
_local6 = ((_local3 * SIZE) + _local5);
fSmileys[_local6] = SmileySprite.createSmileySprite(fBoard.getType(_local3, _local5));
fSmileys[_local6].x = (_local5 * SmileySprite.SIZE);
fSmileys[_local6].y = (_local3 * SmileySprite.SIZE);
fSmileysSprite.addChild(fSmileys[_local6]);
_local5++;
};
_local3++;
};
addChild(fSmileysSprite);
_local4 = new Sprite();
_local4.graphics.beginFill(0xFF0000);
_local4.graphics.drawRect(-1, -1, (BOARD_BOUNDS.width + 2), (BOARD_BOUNDS.height + 2));
addChild(_local4);
mask = _local4;
fGrabbing = false;
fLockedRow = -1;
fLockedCol = -1;
fGrabbedRow = -1;
fGrabbedCol = -1;
fGrabbedX = -1;
fGrabbedY = -1;
fGrabbedSmiley = null;
fTempMoveArray = new Array(SIZE);
fLockPlayed = false;
}
private function movedRow():MatchPositions{
updateRow((fGrabbedCol - fGrabbedSmiley.column));
fBoard.moveRow(fGrabbedRow, (fGrabbedCol - fGrabbedSmiley.column));
fGrabbedCol = fGrabbedSmiley.column;
return (fBoard.findMatchesRow(fGrabbedRow));
}
private function drag(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:SmileySprite;
var _local5:int;
if ((((fLockedCol == -1)) && ((fLockedRow == -1)))){
if ((((Math.abs((fGrabbedX - _arg1)) > START_MOVING_OFFSET)) && (!(isRowLocked((fGrabbedY / SmileySprite.SIZE)))))){
fLockedRow = (fGrabbedY / SmileySprite.SIZE);
} else {
if ((((Math.abs((fGrabbedY - _arg2)) > START_MOVING_OFFSET)) && (!(isColumnLocked((fGrabbedX / SmileySprite.SIZE)))))){
fLockedCol = (fGrabbedX / SmileySprite.SIZE);
};
};
_local3 = 0;
while (_local3 < fSmileys.length) {
_local4 = (fSmileys[_local3] as SmileySprite);
if (_local4.containsPoint(fGrabbedX, fGrabbedY)){
fGrabbedSmiley = _local4;
fGrabbedRow = fGrabbedSmiley.row;
fGrabbedCol = fGrabbedSmiley.column;
fStartRow = fGrabbedRow;
fStartCol = fGrabbedCol;
};
_local3++;
};
if (fGrabbedSmiley == null){
trace(((("no smileys contain " + fGrabbedX) + ", ") + fGrabbedY));
trace(fSmileys);
trace(fBoard.printBoard());
};
};
if (fLockedCol > -1){
_local5 = (_arg2 - fGrabbedY);
moveColumn(_local5);
fGrabbedY = _arg2;
if (fGrabbedRow != fGrabbedSmiley.row){
highlight(movedColumn());
};
};
if (fLockedRow > -1){
_local5 = (_arg1 - fGrabbedX);
moveRow(_local5);
fGrabbedX = _arg1;
if (fGrabbedCol != fGrabbedSmiley.column){
highlight(movedRow());
};
};
}
private function slideBack():void{
var _local1:int;
var _local2:SmileySprite;
if ((((fGrabbedRow == fStartRow)) && (!((fGrabbedCol == fStartCol))))){
updateRow((fGrabbedCol - fStartCol));
fBoard.moveRow(fGrabbedRow, (fGrabbedCol - fStartCol));
_local1 = 0;
while (_local1 < SIZE) {
_local2 = (fSmileys[((fGrabbedRow * SIZE) + _local1)] as SmileySprite);
_local2.slideBack(0, (fGrabbedCol - fStartCol));
_local1++;
};
};
if ((((fGrabbedCol == fStartCol)) && (!((fGrabbedRow == fStartRow))))){
updateCol((fGrabbedRow - fStartRow));
fBoard.moveCol(fGrabbedCol, (fGrabbedRow - fStartRow));
_local1 = 0;
while (_local1 < SIZE) {
_local2 = (fSmileys[(fGrabbedCol + (_local1 * SIZE))] as SmileySprite);
_local2.slideBack((fGrabbedRow - fStartRow), 0);
_local1++;
};
};
}
private function moveRow(_arg1:int):void{
var _local2:int;
var _local3:SmileySprite;
_local2 = 0;
while (_local2 < fSmileys.length) {
_local3 = (fSmileys[_local2] as SmileySprite);
if (_local3.row == fLockedRow){
_local3.x = (_local3.x + _arg1);
_local3.locationChanged();
};
_local2++;
};
}
public function grab(_arg1:int, _arg2:int):Boolean{
if ((((((((_arg1 < 0)) || ((_arg1 >= BOARDSIZE)))) || ((_arg2 < 0)))) || ((_arg2 >= BOARDSIZE)))){
return (false);
};
if ((((fGrabbedX == -1)) && ((fGrabbedY == -1)))){
fGrabbedX = _arg1;
fGrabbedY = _arg2;
return (true);
};
return (false);
}
public function showHint():Boolean{
var _local1:int;
if (fPointingHand == null){
_local1 = fBoard.findPossibleMatch(getLocks());
if (_local1 != -1){
fPointingHand = new PointingHand(int((_local1 / 10)));
if (_local1 < 20){
fPointingHand.y = ((_local1 % 10) * SmileySprite.SIZE);
fPointingHand.x = ((int((_local1 / 10)) * SmileySprite.SIZE) * 5);
} else {
fPointingHand.x = ((_local1 % 10) * SmileySprite.SIZE);
fPointingHand.y = ((_local1 < 30)) ? 0 : (SmileySprite.SIZE * 5);
};
addChild(fPointingHand);
SoundManager.playPing();
} else {
return (true);
};
};
return (false);
}
public function createLock():void{
var _local1:int;
var _local2:int;
_local1 = RandomUtil.generateRandom(0, SIZE);
_local2 = RandomUtil.generateRandom(0, SIZE);
while (((((SmileySprite(fSmileys[((_local1 * SIZE) + _local2)]).locked) && (!((_local1 == fBonusRow))))) && (!((_local2 == fBonusCol))))) {
_local1 = RandomUtil.generateRandom(0, SIZE);
_local2 = RandomUtil.generateRandom(0, SIZE);
};
SmileySprite(fSmileys[((_local1 * SIZE) + _local2)]).lock();
if (fPointingHand != null){
removeChild(fPointingHand);
fPointingHand = null;
showHint();
};
}
private function updateRow(_arg1:int):void{
var _local2:int;
var _local3:SmileySprite;
_local2 = 0;
while (_local2 < SIZE) {
_local3 = (fSmileys[((fGrabbedRow * SIZE) + _local2)] as SmileySprite);
fTempMoveArray[(((_local2 - _arg1) + SIZE) % SIZE)] = _local3;
_local2++;
};
_local2 = 0;
while (_local2 < SIZE) {
fSmileys[((fGrabbedRow * SIZE) + _local2)] = fTempMoveArray[_local2];
_local2++;
};
}
public function clickRecolor(_arg1:int, _arg2:int):MatchResult{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:MatchPositions;
fMatchResult.reset();
fGrabbing = false;
if (fPointingHand != null){
removeChild(fPointingHand);
fPointingHand = null;
};
_local3 = int((_arg2 / SmileySprite.SIZE));
_local4 = int((_arg1 / SmileySprite.SIZE));
_local5 = fBoard.findMatchingType(_local3, _local4);
if (_local5 == -1){
_local5 = RandomUtil.generateRandom(0, fTypeCount);
};
SmileySprite(fSmileys[((_local3 * SIZE) + _local4)]).type = _local5;
fBoard.setType(_local3, _local4, _local5);
_local6 = fBoard.findMatchesRow(_local3);
if (_local6.matchCount > 0){
processMatches(_local6);
};
return (fMatchResult);
}
public function get dragging():Boolean{
return (((!((fLockedCol == -1))) || (!((fLockedRow == -1)))));
}
private function isColumnLocked(_arg1:int):Boolean{
var _local2:int;
var _local3:SmileySprite;
_local2 = 0;
while (_local2 < SIZE) {
_local3 = (fSmileys[((_local2 * SIZE) + _arg1)] as SmileySprite);
if (_local3.locked){
_local3.glowLock();
if (!fLockPlayed){
SoundManager.playLock();
};
fLockPlayed = true;
return (true);
};
_local2++;
};
return (false);
}
public function createBonus():void{
fBonusRow = RandomUtil.generateRandom(0, SIZE);
fBonusCol = RandomUtil.generateRandom(0, SIZE);
while (SmileySprite(fSmileys[((fBonusRow * SIZE) + fBonusCol)]).locked) {
fBonusRow = RandomUtil.generateRandom(0, SIZE);
fBonusCol = RandomUtil.generateRandom(0, SIZE);
};
if (fBonusSprite == null){
fBonusSprite = TextFactory.createGameText();
addChild(fBonusSprite);
};
fBonusSprite.text = "X10";
fBonusSprite.x = (fBonusCol * SmileySprite.SIZE);
fBonusSprite.y = ((fBonusRow * SmileySprite.SIZE) + 15);
}
private function moveColumn(_arg1:int):void{
var _local2:int;
var _local3:SmileySprite;
_local2 = 0;
while (_local2 < fSmileys.length) {
_local3 = (fSmileys[_local2] as SmileySprite);
if (_local3.column == fLockedCol){
_local3.y = (_local3.y + _arg1);
_local3.locationChanged();
};
_local2++;
};
}
public function get animating():Boolean{
var _local1:Boolean;
var _local2:int;
var _local3:SmileySprite;
_local1 = false;
_local2 = 0;
while (_local2 < fSmileys.length) {
_local3 = (fSmileys[_local2] as SmileySprite);
_local1 = ((_local1) || (_local3.moving));
_local2++;
};
return (_local1);
}
private function isRowLocked(_arg1:int):Boolean{
var _local2:int;
var _local3:SmileySprite;
_local2 = 0;
while (_local2 < SIZE) {
_local3 = (fSmileys[((_arg1 * SIZE) + _local2)] as SmileySprite);
if (_local3.locked){
_local3.glowLock();
if (!fLockPlayed){
SoundManager.playLock();
};
fLockPlayed = true;
return (true);
};
_local2++;
};
return (false);
}
public function finish():void{
fGrabbing = false;
drop();
}
public function transferAllSmileys():Array{
var _local1:int;
var _local2:SmileySprite;
_local1 = 0;
while (_local1 < fSmileys.length) {
_local2 = (fSmileys[_local1] as SmileySprite);
_local2.x = (((_local2.x + BoardLayer.BOARDSIZE) % BoardLayer.BOARDSIZE) + x);
_local2.y = (((_local2.y + BoardLayer.BOARDSIZE) % BoardLayer.BOARDSIZE) + y);
_local2.clonePos = null;
_local2.selected = false;
_local2.unlock();
fSmileysSprite.removeChild(_local2);
_local1++;
};
return (fSmileys);
}
private function highlight(_arg1:MatchPositions):void{
var _local2:int;
var _local3:int;
var _local4:SmileySprite;
var _local5:int;
var _local6:int;
_local2 = 0;
while (_local2 < fSmileys.length) {
_local4 = (fSmileys[_local2] as SmileySprite);
_local4.selected = false;
_local2++;
};
_local3 = 0;
while (_local3 < _arg1.matchCount) {
_local5 = 0;
while (_local5 < _arg1.positionCount(_local3)) {
_local6 = ((_arg1.positionRow(_local3, _local5) * SIZE) + _arg1.positionColumn(_local3, _local5));
SmileySprite(fSmileys[_local6]).selected = true;
_local5++;
};
_local3++;
};
}
public function doLogic():MatchResult{
var _local1:int;
var _local2:SmileySprite;
fMatchResult.reset();
_local1 = 0;
while (_local1 < fSmileys.length) {
_local2 = (fSmileys[_local1] as SmileySprite);
_local2.doLogic();
_local1++;
};
if (fNewMatches != null){
if (!animating){
processMatches(fNewMatches);
};
};
return (fMatchResult);
}
public function clickRemover(_arg1:int, _arg2:int):MatchResult{
var _local3:MatchPositions;
fMatchResult.reset();
fGrabbing = false;
if (fPointingHand != null){
removeChild(fPointingHand);
fPointingHand = null;
};
_local3 = new MatchPositions();
_local3.newMatch();
_local3.addPosition((_arg2 / SmileySprite.SIZE), (_arg1 / SmileySprite.SIZE));
processMatches(_local3);
return (fMatchResult);
}
private function processMatches(_arg1:MatchPositions):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:SmileySprite;
var _local8:int;
var _local9:int;
var _local10:int;
fMatchResult.reset();
_local2 = 0;
while (_local2 < _arg1.matchCount) {
fMatchResult.newMatch();
_local4 = 0;
while (_local4 < _arg1.positionCount(_local2)) {
_local5 = _arg1.positionRow(_local2, _local4);
_local3 = _arg1.positionColumn(_local2, _local4);
_local6 = ((_local5 * SIZE) + _local3);
if (fSmileys[_local6] != null){
_local7 = (fSmileys[_local6] as SmileySprite);
(fSmileys[_local6] as SmileySprite).x = (((_local7.x + BoardLayer.BOARDSIZE) % BoardLayer.BOARDSIZE) + x);
_local7.y = (((_local7.y + BoardLayer.BOARDSIZE) % BoardLayer.BOARDSIZE) + y);
_local7.clonePos = null;
_local7.selected = false;
fMatchResult.addSmiley(_local7);
if (_local7.locked){
_local7.unlock();
fMatchResult.addLock();
};
fSmileysSprite.removeChild(_local7);
fSmileys[_local6] = null;
} else {
break;
};
if ((((_local5 == fBonusRow)) && ((_local3 == fBonusCol)))){
fMatchResult.setBonus(fBonusSprite);
if (contains(fBonusSprite)){
removeChild(fBonusSprite);
};
fBonusSprite.x = (fBonusSprite.x + x);
fBonusSprite.y = (fBonusSprite.y + y);
fBonusRow = -1;
fBonusCol = -1;
fBonusSprite = null;
};
_local4++;
};
_local2++;
};
_local3 = 0;
while (_local3 < SIZE) {
_local8 = 0;
_local5 = (SIZE - 1);
while (_local5 >= 0) {
_local6 = ((_local5 * SIZE) + _local3);
if (fSmileys[_local6] == null){
_local8++;
} else {
if (_local8 > 0){
SmileySprite(fSmileys[_local6]).drop(_local8);
fSmileys[(_local6 + (_local8 * SIZE))] = fSmileys[_local6];
fBoard.setType((_local5 + _local8), _local3, fBoard.getType(_local5, _local3));
};
};
_local5--;
};
_local9 = _local8;
while (_local8 > 0) {
--_local8;
_local6 = ((_local8 * SIZE) + _local3);
_local10 = RandomUtil.generateRandom(0, fTypeCount);
while ((((((_local8 < (SIZE - 1))) && ((_local10 == fBoard.getType((_local8 + 1), _local3))))) || ((((_local3 > 0)) && ((_local10 == fBoard.getType(_local8, (_local3 - 1)))))))) {
_local10 = RandomUtil.generateRandom(0, fTypeCount);
};
fSmileys[_local6] = SmileySprite.createSmileySprite(_local10);
fSmileys[_local6].x = (_local3 * SmileySprite.SIZE);
fSmileys[_local6].y = ((_local8 - _local9) * SmileySprite.SIZE);
fSmileys[_local6].drop(_local9);
fSmileysSprite.addChild(fSmileys[_local6]);
fBoard.setType(_local8, _local3, fSmileys[_local6].type);
};
_local3++;
};
fNewMatches = fBoard.findAllMatches();
if (fNewMatches.matchCount == 0){
fNewMatches = null;
};
}
public function mouseUpdate(_arg1:int, _arg2:int, _arg3:Boolean):MatchResult{
fMatchResult.reset();
if (animating){
return (fMatchResult);
};
if (_arg3){
if (fGrabbing){
drag(_arg1, _arg2);
} else {
if (grab(_arg1, _arg2)){
fGrabbing = _arg3;
};
};
} else {
if (fGrabbing){
fGrabbing = _arg3;
drag(_arg1, _arg2);
drop();
};
};
return (fMatchResult);
}
private function movedColumn():MatchPositions{
updateCol((fGrabbedRow - fGrabbedSmiley.row));
fBoard.moveCol(fGrabbedCol, (fGrabbedRow - fGrabbedSmiley.row));
fGrabbedRow = fGrabbedSmiley.row;
return (fBoard.findMatchesCol(fGrabbedCol));
}
public function drop():void{
var _local1:MatchPositions;
if (fGrabbedSmiley == null){
return;
};
slideInPosition();
_local1 = null;
if (fLockedCol > -1){
_local1 = movedColumn();
} else {
if (fLockedRow > -1){
_local1 = movedRow();
};
};
if (((!((_local1 == null))) && ((_local1.matchCount > 0)))){
if (fPointingHand != null){
removeChild(fPointingHand);
fPointingHand = null;
};
processMatches(_local1);
} else {
slideBack();
};
fLockedCol = -1;
fLockedRow = -1;
fGrabbedRow = -1;
fGrabbedCol = -1;
fStartRow = -1;
fStartCol = -1;
fGrabbedX = -1;
fGrabbedY = -1;
fGrabbedSmiley = null;
fLockPlayed = false;
}
private function updateCol(_arg1:int):void{
var _local2:int;
var _local3:SmileySprite;
_local2 = 0;
while (_local2 < SIZE) {
_local3 = (fSmileys[(fGrabbedCol + (_local2 * SIZE))] as SmileySprite);
fTempMoveArray[(((_local2 - _arg1) + SIZE) % SIZE)] = _local3;
_local2++;
};
_local2 = 0;
while (_local2 < SIZE) {
fSmileys[(fGrabbedCol + (_local2 * SIZE))] = fTempMoveArray[_local2];
_local2++;
};
}
}
}//package smileymatcher
Section 31
//GameButton (smileymatcher.GameButton)
package smileymatcher {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class GameButton extends SimpleButton {
private static const COLOR:int = 3891199;
private static const HEIGHT:int = 36;
private static const COLOR_SEL:int = 5275903;
public function GameButton(_arg1:String){
var normal:Sprite;
var tf:TextField;
var background:Shape;
var selected:Sprite;
var tfsel:TextField;
var bevel:BevelFilter;
var shadow:DropShadowFilter;
var playSound:Function;
var aTitle = _arg1;
playSound = function (_arg1:Event):void{
SoundManager.playButton();
};
normal = new Sprite();
tf = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_DEFAULT);
tf.text = aTitle;
background = createBackground(tf.width);
normal.addChild(background);
tf.x = ((normal.width - tf.width) / 2);
tf.y = (((normal.height - tf.height) / 2) + 1);
normal.addChild(tf);
normal.cacheAsBitmap = true;
selected = new Sprite();
selected.addChild(createBackground(tf.width, true));
tfsel = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_SELECTED);
tfsel.text = aTitle;
tfsel.x = ((selected.width - tfsel.width) / 2);
tfsel.y = (((selected.height - tfsel.height) / 2) + 1);
selected.addChild(tfsel);
selected.cacheAsBitmap = true;
super(normal, selected, selected, background);
bevel = new BevelFilter(8, 45, 0xFFFFFF, 1, 0, 0.8, 8, 8, 0.7, BitmapFilterQuality.HIGH);
shadow = new DropShadowFilter(4);
shadow.alpha = 0.8;
shadow.quality = BitmapFilterQuality.HIGH;
filters = [bevel, shadow];
addEventListener(MouseEvent.MOUSE_OVER, playSound);
}
private function createBackground(_arg1:int, _arg2:Boolean=false):Shape{
var _local3:Shape;
var _local4:int;
_local3 = new Shape();
_local4 = (HEIGHT / 2);
_local3.graphics.beginFill((_arg2) ? COLOR_SEL : COLOR);
_local3.graphics.drawCircle(_local4, _local4, _local4);
_local3.graphics.endFill();
_local3.graphics.beginFill((_arg2) ? COLOR_SEL : COLOR);
_local3.graphics.drawRect(_local4, 0, _arg1, HEIGHT);
_local3.graphics.endFill();
_local3.graphics.beginFill((_arg2) ? COLOR_SEL : COLOR);
_local3.graphics.drawCircle((_arg1 + _local4), _local4, _local4);
_local3.graphics.endFill();
return (_local3);
}
}
}//package smileymatcher
Section 32
//GameCompleteAnimation (smileymatcher.GameCompleteAnimation)
package smileymatcher {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
public class GameCompleteAnimation extends AAnimation {
private var fCongrats:TextField;
private var fLevelField:TextField;
private var fScoreField:TextField;
public function GameCompleteAnimation(_arg1:DisplayObjectContainer, _arg2:int){
var _local3:Sprite;
_local3 = new Sprite();
fCongrats = TextFactory.createTextField(TextFactory.SIZE_LARGER);
fCongrats.text = "You did it!";
_local3.addChild(fCongrats);
fScoreField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_SELECTED);
fScoreField.text = ("Total score: " + _arg2);
_local3.addChild(fScoreField);
super(_local3);
looping = true;
new MoveAnimation(fCongrats, new Point((320 - (fCongrats.width / 2)), -50), new Point((320 - (fCongrats.width / 2)), 50), 20, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(fScoreField, new Point(550, 130), new Point((320 - (fScoreField.width / 2)), 130), 20, InterpolationUtil.TYPE_COSINE, 5);
_arg1.addChild(_local3);
}
override public function update():void{
if ((frame % 10) == 0){
if (fCongrats.textColor == TextFactory.COLOR_DEFAULT){
fCongrats.textColor = TextFactory.COLOR_SELECTED;
} else {
fCongrats.textColor = TextFactory.COLOR_DEFAULT;
};
};
}
override protected function get frameCount():int{
return (20);
}
public function endAnimation():void{
new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
}
}
}//package smileymatcher
Section 33
//GameOverAnimation (smileymatcher.GameOverAnimation)
package smileymatcher {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
public class GameOverAnimation extends AAnimation {
private var fLevelField:TextField;
private var fScoreField:TextField;
public function GameOverAnimation(_arg1:DisplayObjectContainer, _arg2:int, _arg3:int, _arg4:int){
var _local5:Sprite;
var _local6:TextField;
_local5 = new Sprite();
_local6 = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_SELECTED);
_local6.text = "Game Over";
_local5.addChild(_local6);
fLevelField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_SELECTED);
fLevelField.text = ((("Reached level " + _arg3) + " of ") + _arg4);
fLevelField.x = 550;
fLevelField.y = 130;
_local5.addChild(fLevelField);
fScoreField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_SELECTED);
fScoreField.text = ("Total score: " + _arg2);
fScoreField.x = 550;
fScoreField.y = 180;
_local5.addChild(fScoreField);
super(_local5);
looping = false;
new MoveAnimation(_local6, new Point((320 - (_local6.width / 2)), -50), new Point((320 - (_local6.width / 2)), 50), 20, InterpolationUtil.TYPE_COSINE);
_arg1.addChild(_local5);
}
override public function update():void{
if (frame == 20){
new MoveAnimation(fLevelField, new Point(fLevelField.x, fLevelField.y), new Point((320 - (fLevelField.width / 2)), fLevelField.y), 20, InterpolationUtil.TYPE_COSINE);
};
if (frame == 30){
new MoveAnimation(fScoreField, new Point(fScoreField.x, fScoreField.y), new Point((320 - (fScoreField.width / 2)), fScoreField.y), 20, InterpolationUtil.TYPE_COSINE);
};
}
override protected function get frameCount():int{
return (50);
}
public function endAnimation():void{
new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
}
}
}//package smileymatcher
Section 34
//GamePlay (smileymatcher.GamePlay)
package smileymatcher {
public class GamePlay {
private var fLevel:int;
private static const MAXLOCKS:Array = new Array(0, 1, 2, 3, 3, 4, 5, 5, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2, 3, 3, 4, 4, 5, 5);
private static const SMILEYCOUNT:Array = new Array(100, 150, 175, 200, 225, 250, 275, 300, 100, 125, 150, 175, 200, 225, 250, 275, 100, 125, 150, 175, 200, 225, 250, 250);
private static const LEVELS:int = 24;
public function GamePlay(_arg1:int=1){
fLevel = _arg1;
}
public function get level():int{
return (fLevel);
}
public function get maxLocks():int{
if (fLevel > LEVELS){
return (MAXLOCKS[(LEVELS - 1)]);
};
return (MAXLOCKS[(fLevel - 1)]);
}
public function get levelCount():int{
return (LEVELS);
}
public function get time():int{
return (120);
}
public function nextLevel():void{
fLevel++;
}
public function get specialChance():int{
return (1100);
}
public function get typeCount():int{
if (fLevel > 16){
return (8);
};
if (fLevel > 8){
return (7);
};
return (6);
}
public function get bonusChance():int{
return (600);
}
public function get smileyCount():int{
if (fLevel > LEVELS){
return ((SMILEYCOUNT[(LEVELS - 1)] + ((fLevel - LEVELS) * 10)));
};
return (SMILEYCOUNT[(fLevel - 1)]);
}
public function get lockChance():int{
return (200);
}
}
}//package smileymatcher
Section 35
//GameScreen (smileymatcher.GameScreen)
package smileymatcher {
import flash.events.*;
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import smileygamer.util.*;
import flash.net.*;
import flash.filters.*;
import flash.ui.*;
public class GameScreen extends Sprite implements ILogic {
private var fHelpScreen:HelpScreen;
private var fCreateBonus:Boolean;
private var fTime:int;
private var fSubmitSprite:Sprite;
private var fPausedLayer:Sprite;
private var fLastSpecialItemTime:int;
private var fMessageField:TextField;
private var fTimeBar:TimeBar;
private var fGamePlay:GamePlay;
private var fLastBonusTime:int;
private var fLastLockTime:int;
private var fStuck:Boolean;
private var fSmileyCount:int;
private var fLockCount:int;
private var fPoints:int;
private var fCreateSpecialItem:Boolean;
private var fBoardLayer:BoardLayer;
private var fSpecialItem:SpecialItem;
private var fBoardFrame:BoardFrame;
private var fComboCount:int;
private var fRemover:Boolean;
private var fMouseDown:Boolean;
private var fLevelCompleteAnimation:LevelCompleteAnimation;
private var fGameMode:int;
private var fCreateLock:Boolean;
private var fClickField:TextField;
private var fNameField:TextField;
private var fBoardBackground:Sprite;
private var fLastMatchTime:int;
private var fGame:SmileyMatcher;
private var fPointsField:TextField;
private var fShowButton:SimpleButton;
private var fRecolor:Boolean;
private var fState:int;// = 0
private var fSmileyProgress:SmileyProgress;
private var fTickTimer:Timer;
private static const STATE_LEVEL_COMPLETE:int = 6;
private static const STATE_INTRO:int = 1;
private static const STATE_INVALID:int = 0;
private static const STATE_HELP:int = 2;
private static const STATE_RUNNING:int = 3;
private static const STATE_GAME_OVER_COMPLETING:int = 8;
private static const STATE_OUTRO:int = 10;
public static const MODE_CHALLENGE:int = 0;
public static const MODE_RELAXED:int = 1;
private static const STATE_GAME_WON:int = 9;
private static const STATE_GAME_OVER:int = 7;
private static const STATE_PAUSED:int = 4;
private static const STATE_LEVEL_COMPLETING:int = 5;
private static var sHelpShown:Boolean = false;
private static var sLastAd:int = getTimer();
public function GameScreen(_arg1:SmileyMatcher, _arg2:int, _arg3:int=1, _arg4:int=0){
fState = STATE_INVALID;
super();
fGame = _arg1;
fGameMode = _arg2;
fGamePlay = new GamePlay(_arg3);
fPoints = _arg4;
addEventListener(Event.ENTER_FRAME, added);
}
private function enableRecolor(_arg1:Event):void{
if (fState == STATE_RUNNING){
fRecolor = true;
fSpecialItem.removeEventListener(MouseEvent.CLICK, enableRecolor);
fSpecialItem.hideHand();
fGame.getHand().enableRecolor();
};
}
private function showHelpInit():void{
fState = STATE_HELP;
x = -540;
fHelpScreen = new HelpScreen(hideHelpInit);
addChild(fHelpScreen);
new MoveAnimation(fHelpScreen, new Point(0, 0), new Point(540, 0), 20, InterpolationUtil.TYPE_LINEAR);
}
private function levelFinished():void{
fTickTimer.stop();
fState = STATE_LEVEL_COMPLETING;
fBoardLayer.finish();
fLevelCompleteAnimation = new LevelCompleteAnimation(this, fGamePlay.level);
fGame.getHand().disableSpecial();
fSpecialItem.hideHand();
fSpecialItem.removeEventListener(MouseEvent.CLICK, enableRemover);
fSpecialItem.removeEventListener(MouseEvent.CLICK, enableRecolor);
SoundManager.playLevelComplete();
}
private function createPausedLayer():Sprite{
var _local1:Sprite;
var _local2:TextField;
var _local3:SimpleButton;
var _local4:SimpleButton;
var _local5:SimpleButton;
_local1 = new Sprite();
_local2 = TextFactory.createTextField(TextFactory.SIZE_LARGEST, TextFactory.COLOR_SELECTED);
_local2.text = "PAUSED";
_local2.x = (320 - (_local2.width / 2));
_local2.y = 80;
_local1.addChild(_local2);
_local3 = new GameButton("RESUME GAME");
_local3.x = (320 - (_local3.width / 2));
_local3.y = 190;
_local1.addChild(_local3);
_local3.addEventListener(MouseEvent.CLICK, unpauseGame);
_local4 = new GameButton("INSTRUCTIONS");
_local4.x = (320 - (_local4.width / 2));
_local4.y = 250;
_local1.addChild(_local4);
_local4.addEventListener(MouseEvent.CLICK, showHelp);
_local5 = new GameButton("SAVE & END GAME");
_local5.x = (320 - (_local5.width / 2));
_local5.y = 310;
_local1.addChild(_local5);
_local5.addEventListener(MouseEvent.CLICK, endGame);
return (_local1);
}
private function startLevel():void{
fState = STATE_RUNNING;
fSmileyCount = 0;
fSmileyProgress.progress = 0;
fLockCount = 0;
fCreateBonus = false;
fCreateLock = false;
fCreateSpecialItem = false;
fRemover = false;
fRecolor = false;
fStuck = false;
fSpecialItem.hideHand();
fSpecialItem.removeEventListener(MouseEvent.CLICK, enableRemover);
fSpecialItem.removeEventListener(MouseEvent.CLICK, enableRecolor);
fTimeBar.maxValue = fGamePlay.time;
fTimeBar.value = fGamePlay.time;
fLastMatchTime = getTimer();
fLastBonusTime = fTimeBar.value;
fLastLockTime = fTimeBar.value;
fLastSpecialItemTime = fTimeBar.value;
fTickTimer.start();
}
private function unpauseGame(_arg1:Event):void{
fState = STATE_RUNNING;
fTickTimer.start();
new MoveAnimation(fPausedLayer, new Point(0, 0), new Point(0, -360), 15, InterpolationUtil.TYPE_COSINE, 0, true);
}
private function updateSmileyCount(_arg1:int):void{
if (fState == STATE_RUNNING){
fSmileyCount = (fSmileyCount + _arg1);
fSmileyProgress.progress = Math.min(1, (fSmileyCount / fGamePlay.smileyCount));
if (fSmileyCount >= fGamePlay.smileyCount){
levelFinished();
};
};
}
private function addPoints(_arg1:int):void{
fPoints = (fPoints + _arg1);
fPointsField.text = ("" + fPoints);
}
public function added(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, added);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseUpdate);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpdate);
stage.addEventListener(MouseEvent.CLICK, mouseUpdate);
fMouseDown = false;
showHelpInit();
}
private function pauseGame(_arg1:Event):void{
if (fState == STATE_RUNNING){
fState = STATE_PAUSED;
fTickTimer.stop();
fPausedLayer = createPausedLayer();
new MoveAnimation(fPausedLayer, new Point(0, -360), new Point(0, 0), 15, InterpolationUtil.TYPE_COSINE);
addChild(fPausedLayer);
} else {
if (fState == STATE_PAUSED){
unpauseGame(_arg1);
};
};
}
private function init():void{
var _local1:SimpleButton;
var _local2:MoveAnimation;
fBoardFrame = new BoardFrame((fGameMode == MODE_CHALLENGE));
fBoardLayer = new BoardLayer();
fBoardLayer.init(fGamePlay.typeCount);
fBoardLayer.x = BoardFrame.BOARD_RECT.x;
fBoardLayer.y = BoardFrame.BOARD_RECT.y;
addChild(fBoardLayer);
addChild(fBoardFrame);
fPointsField = TextFactory.createScoreText();
fPointsField.x = 115;
fPointsField.y = 25;
fPointsField.text = " ";
addChild(fPointsField);
fSmileyProgress = new SmileyProgress();
fSmileyProgress.x = 15;
fSmileyProgress.y = 75;
addChild(fSmileyProgress);
fSpecialItem = new SpecialItem();
fSpecialItem.x = 20;
fSpecialItem.y = 205;
addChild(fSpecialItem);
fTimeBar = new TimeBar();
fTimeBar.maxValue = fGamePlay.time;
fTimeBar.value = fGamePlay.time;
fTimeBar.x = BoardFrame.TIMEBAR_RECT.x;
fTimeBar.y = BoardFrame.TIMEBAR_RECT.y;
fTimeBar.width = BoardFrame.TIMEBAR_RECT.width;
fTimeBar.height = BoardFrame.TIMEBAR_RECT.height;
if (fGameMode == MODE_CHALLENGE){
addChild(fTimeBar);
};
_local1 = TextFactory.createTextButton("PAUSE");
_local1.x = (70 - (_local1.width / 2));
_local1.y = 350;
addChild(_local1);
_local1.addEventListener(MouseEvent.CLICK, pauseGame);
fClickField = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_SELECTED);
fClickField.autoSize = TextFieldAutoSize.CENTER;
fClickField.x = (fBoardLayer.x + (BoardLayer.BOARDSIZE / 2));
fClickField.y = 320;
fClickField.text = "Click to continue...";
fState = STATE_INTRO;
_local2 = new MoveAnimation(this, new Point(-540, 0), new Point(0, 0), 20, InterpolationUtil.TYPE_LINEAR);
_local2.addCallback(startGame);
}
private function showHighscores(_arg1:Event):void{
fGame.showHighscoresPage();
}
private function hideHelpInit(_arg1:Event):void{
init();
}
private function submitScore(_arg1:Event):void{
var name:String;
var score:int;
var req:URLRequest;
var loader:URLLoader;
var error:Function;
var infoReceived:Function;
var e = _arg1;
error = function (_arg1:Event):void{
fMessageField.text = "Not submitted";
};
infoReceived = function (_arg1:Event):void{
var _local2:int;
_local2 = int(loader.data);
if (_local2 < 0){
fMessageField.text = "Not submitted";
} else {
fMessageField.text = ("Rank: " + _local2);
};
};
fSubmitSprite.visible = false;
fMessageField.visible = true;
fMessageField.text = "Submitting...";
fShowButton.visible = true;
name = fNameField.text;
SaveData.name = name;
score = ((fPoints * 100) + (fPoints % 97));
req = new URLRequest(((((((("http://www.smileygamer.com/scripts/highscores.php?id=" + SmileyMatcher.GAMEID) + "&mode=") + fGameMode) + "&score=") + score) + "&player=") + name));
loader = new URLLoader(req);
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, error);
loader.addEventListener(Event.COMPLETE, infoReceived);
}
private function enableRemover(_arg1:Event):void{
if (fState == STATE_RUNNING){
fRemover = true;
fSpecialItem.removeEventListener(MouseEvent.CLICK, enableRemover);
fSpecialItem.hideHand();
fGame.getHand().enableRemover();
};
}
private function endGame(_arg1:Event):void{
var anim:MoveAnimation;
var showTitle:Function;
var showAd:Function;
var e = _arg1;
showTitle = function ():void{
Mouse.hide();
fGame.showTitleScreen();
};
showAd = function ():void{
sLastAd = getTimer();
Mouse.show();
MochiAd.showInterLevelAd({id:"c67a0f8a00139ff4", res:"540x400", clip:fGame, ad_started:function ():void{
}, ad_finished:showTitle, no_bg:true});
};
fState = STATE_OUTRO;
anim = new MoveAnimation(this, new Point(0, 0), new Point(0, 360), 15, InterpolationUtil.TYPE_LINEAR, 0, true);
if (((((((SmileyMatcher.SPONSORED) || (NetworkUtil.isHome()))) || (NetworkUtil.isDomain("agame.com")))) || (((getTimer() - sLastAd) < 300000)))){
anim.addCallback(showTitle);
} else {
anim.addCallback(showAd);
};
}
private function startGame():void{
var _local1:AAnimation;
if (fHelpScreen != null){
removeChild(fHelpScreen);
fHelpScreen = null;
};
fPointsField.text = ("" + fPoints);
_local1 = new LevelAnimation(this, fGamePlay.level);
_local1.addCallback(startLevel);
fTickTimer = new Timer(100);
fTickTimer.addEventListener(TimerEvent.TIMER, tick);
}
public function doLogic():void{
var _local1:Sprite;
switch (fState){
case STATE_HELP:
fHelpScreen.doLogic();
break;
case STATE_RUNNING:
handleMatches(fBoardLayer.mouseUpdate((stage.mouseX - BoardFrame.BOARD_RECT.x), (stage.mouseY - BoardFrame.BOARD_RECT.y), fMouseDown));
handleMatches(fBoardLayer.doLogic(), true);
if (((((fCreateBonus) && (!(fBoardLayer.dragging)))) && (!(fBoardLayer.animating)))){
fBoardLayer.createBonus();
fCreateBonus = false;
SoundManager.playPing();
};
if (((((fCreateLock) && (!(fBoardLayer.dragging)))) && (!(fBoardLayer.animating)))){
fBoardLayer.createLock();
fCreateLock = false;
SoundManager.playLock();
};
if (((((((!(fStuck)) && (((getTimer() - fLastMatchTime) > 6000)))) && (!(fBoardLayer.dragging)))) && (!(fBoardLayer.animating)))){
fStuck = fBoardLayer.showHint();
if (fStuck){
fCreateSpecialItem = true;
fLastSpecialItemTime = fTimeBar.value;
};
};
if (((((((fCreateSpecialItem) && (!(fSpecialItem.armed)))) && (!(fRemover)))) && (!(fRecolor)))){
if (RandomUtil.chance(2)){
fSpecialItem.showHand(SpecialItem.REMOVER_HAND);
fSpecialItem.addEventListener(MouseEvent.CLICK, enableRemover);
} else {
fSpecialItem.showHand(SpecialItem.RECOLOR_HAND);
fSpecialItem.addEventListener(MouseEvent.CLICK, enableRecolor);
};
fCreateSpecialItem = false;
SoundManager.playSpecial();
};
break;
case STATE_LEVEL_COMPLETING:
handleMatches(fBoardLayer.doLogic(), true);
if (fGameMode == MODE_RELAXED){
fTimeBar.value = 0;
};
if (((fLevelCompleteAnimation.finished) && ((fTimeBar.value > 0)))){
fTimeBar.value--;
addPoints(10);
};
if ((((fTimeBar.value == 0)) && (!(fBoardLayer.animating)))){
fState = STATE_LEVEL_COMPLETE;
addChild(fClickField);
new TextBlinkAnimation(fClickField, TextFactory.COLOR_DEFAULT, TextFactory.COLOR_SELECTED, 15);
if (fGamePlay.level < fGamePlay.levelCount){
SaveData.saveGame(fGameMode, (fGamePlay.level + 1), fPoints);
};
};
break;
case STATE_GAME_OVER_COMPLETING:
fBoardLayer.doLogic();
if (!fBoardLayer.animating){
fState = STATE_GAME_OVER;
_local1 = createEndGameButtonLayer();
new MoveAnimation(_local1, new Point(550, 30), new Point((270 - (_local1.width / 2)), 30), 20, InterpolationUtil.TYPE_COSINE);
addChild(_local1);
};
break;
};
}
private function tick(_arg1:TimerEvent):void{
if (RandomUtil.chance((fGamePlay.bonusChance - ((fLastBonusTime - fTimeBar.value) * 10)))){
fCreateBonus = true;
fLastBonusTime = fTimeBar.value;
};
if (((RandomUtil.chance((fGamePlay.lockChance - ((fLastLockTime - fTimeBar.value) * 10)))) && ((fLockCount < fGamePlay.maxLocks)))){
fCreateLock = true;
fLastLockTime = fTimeBar.value;
fLockCount++;
};
if (((RandomUtil.chance((fGamePlay.specialChance - ((fLastSpecialItemTime - fTimeBar.value) * 10)))) && (!(fSpecialItem.armed)))){
fCreateSpecialItem = true;
fLastSpecialItemTime = fTimeBar.value;
};
fTimeBar.value = (fTimeBar.value - 0.1);
if (fGameMode == MODE_CHALLENGE){
checkBars();
};
}
private function hideHelp(_arg1:Event):void{
var anim:MoveAnimation;
var removeHelp:Function;
var e = _arg1;
removeHelp = function ():void{
removeChild(fHelpScreen);
fHelpScreen = null;
};
fState = STATE_PAUSED;
anim = new MoveAnimation(this, new Point(-540, 0), new Point(0, 0), 20, InterpolationUtil.TYPE_LINEAR);
anim.addCallback(removeHelp);
}
private function createEndGameButtonLayer():Sprite{
var layer:Sprite;
var submitButton:SimpleButton;
var bg:Shape;
var menuButton:SimpleButton;
var otherButton:SimpleButton;
var other:Function;
layer = new Sprite();
if (SmileyMatcher.SPONSORED){
menuButton = new GameButton("BACK TO MENU");
menuButton.x = (442 - menuButton.width);
menuButton.y = 260;
layer.addChild(menuButton);
menuButton.addEventListener(MouseEvent.CLICK, endGame);
} else {
other = function (_arg1:Event):void{
NetworkUtil.showHome();
};
menuButton = new GameButton("MENU");
menuButton.x = 0;
menuButton.y = 260;
layer.addChild(menuButton);
menuButton.addEventListener(MouseEvent.CLICK, endGame);
otherButton = new GameButton("PLAY ANOTHER GAME");
otherButton.x = (menuButton.width + 20);
otherButton.y = 260;
layer.addChild(otherButton);
otherButton.addEventListener(MouseEvent.CLICK, other);
};
fSubmitSprite = new Sprite();
submitButton = new GameButton("SUBMIT");
submitButton.x = (442 - submitButton.width);
submitButton.y = 210;
fSubmitSprite.addChild(submitButton);
submitButton.addEventListener(MouseEvent.CLICK, submitScore);
bg = new Shape();
bg.graphics.lineStyle(1, TextFactory.COLOR_DEFAULT);
bg.graphics.beginFill(BoardFrame.COLOR);
bg.graphics.drawRect(0, 0, (422 - submitButton.width), 36);
bg.graphics.endFill();
bg.filters = [new BevelFilter(2, 45, 0xFFFFFF, 1, 0, 0.8, 4, 4, 1, BitmapFilterQuality.HIGH), new DropShadowFilter(4, 45, 0, 0.8, 4, 4, 1, BitmapFilterQuality.HIGH)];
bg.x = 0;
bg.y = 210;
layer.addChild(bg);
fNameField = TextFactory.createEditableTextField();
fNameField.maxChars = 16;
fNameField.x = 0;
fNameField.y = 215;
fNameField.width = bg.width;
fNameField.height = 36;
fSubmitSprite.addChild(fNameField);
if (SaveData.name != null){
fNameField.text = SaveData.name;
};
layer.addChild(fSubmitSprite);
fShowButton = new GameButton("SHOW");
fShowButton.x = (bg.width + 20);
fShowButton.y = 210;
fShowButton.visible = false;
layer.addChild(fShowButton);
fShowButton.addEventListener(MouseEvent.CLICK, showHighscores);
fMessageField = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_SELECTED);
fMessageField.autoSize = TextFieldAutoSize.CENTER;
fMessageField.x = (bg.width / 2);
fMessageField.y = 215;
fMessageField.text = " ";
fMessageField.visible = false;
layer.addChild(fMessageField);
return (layer);
}
public function mouseUpdate(_arg1:MouseEvent):void{
var _local2:Array;
var _local3:int;
var _local4:AAnimation;
var _local5:DisplayObject;
var _local6:Sprite;
switch (fState){
case STATE_RUNNING:
if (fRemover){
if ((((((_arg1.type == MouseEvent.CLICK)) && (BoardFrame.BOARD_RECT.contains(_arg1.stageX, _arg1.stageY)))) && (!(fBoardLayer.animating)))){
fRemover = false;
fGame.getHand().disableSpecial();
handleMatches(fBoardLayer.clickRemover((_arg1.stageX - BoardFrame.BOARD_RECT.x), (_arg1.stageY - BoardFrame.BOARD_RECT.y)));
fStuck = false;
};
} else {
if (fRecolor){
if ((((((_arg1.type == MouseEvent.CLICK)) && (BoardFrame.BOARD_RECT.contains(_arg1.stageX, _arg1.stageY)))) && (!(fBoardLayer.animating)))){
fRecolor = false;
fGame.getHand().disableSpecial();
handleMatches(fBoardLayer.clickRecolor((_arg1.stageX - BoardFrame.BOARD_RECT.x), (_arg1.stageY - BoardFrame.BOARD_RECT.y)));
fStuck = false;
};
} else {
if (_arg1.type == MouseEvent.MOUSE_UP){
fMouseDown = false;
handleMatches(fBoardLayer.mouseUpdate((_arg1.stageX - BoardFrame.BOARD_RECT.x), (_arg1.stageY - BoardFrame.BOARD_RECT.y), _arg1.buttonDown));
} else {
if (_arg1.type == MouseEvent.MOUSE_DOWN){
fMouseDown = true;
handleMatches(fBoardLayer.mouseUpdate((_arg1.stageX - BoardFrame.BOARD_RECT.x), (_arg1.stageY - BoardFrame.BOARD_RECT.y), _arg1.buttonDown));
};
};
};
};
break;
case STATE_LEVEL_COMPLETE:
if ((((_arg1.type == MouseEvent.CLICK)) && (!((fClickField.stage == null))))){
fLevelCompleteAnimation.endAnimation();
removeChild(fClickField);
if (fGamePlay.level < fGamePlay.levelCount){
fGamePlay.nextLevel();
_local2 = fBoardLayer.transferAllSmileys();
_local3 = 0;
while (_local3 < _local2.length) {
_local5 = (_local2[_local3] as DisplayObject);
addChildAt(_local5, (numChildren - 2));
new SmileyJumpAnimation(_local5);
_local3++;
};
new MoveAnimation(fBoardLayer, new Point(BoardFrame.BOARD_RECT.x, -340), new Point(BoardFrame.BOARD_RECT.x, BoardFrame.BOARD_RECT.y), 20, InterpolationUtil.TYPE_LINEAR);
fBoardLayer.init(fGamePlay.typeCount);
_local4 = new LevelAnimation(this, fGamePlay.level);
_local4.addCallback(startLevel);
} else {
_local6 = createEndGameButtonLayer();
new MoveAnimation(_local6, new Point(550, 30), new Point((270 - (_local6.width / 2)), 30), 20, InterpolationUtil.TYPE_COSINE);
addChild(_local6);
new GameCompleteAnimation(this, fPoints);
SaveData.endGame(fGamePlay.level, fPoints);
SaveData.clearSavedGame(fGameMode);
fState = STATE_GAME_WON;
SoundManager.playGameWon();
};
};
break;
};
}
private function showHelp(_arg1:Event):void{
fState = STATE_HELP;
fHelpScreen = new HelpScreen(hideHelp);
fHelpScreen.x = 540;
addChild(fHelpScreen);
new MoveAnimation(this, new Point(0, 0), new Point(-540, 0), 20, InterpolationUtil.TYPE_LINEAR);
}
private function checkBars():void{
if (fTimeBar.value <= 0){
fTickTimer.stop();
fBoardLayer.finish();
fState = STATE_GAME_OVER_COMPLETING;
fGame.getHand().disableSpecial();
fSpecialItem.hideHand();
fSpecialItem.removeEventListener(MouseEvent.CLICK, enableRemover);
fSpecialItem.removeEventListener(MouseEvent.CLICK, enableRecolor);
new GameOverAnimation(this, fPoints, fGamePlay.level, fGamePlay.levelCount);
SoundManager.playGameOver();
SaveData.endGame(fGamePlay.level, fPoints);
SaveData.saveGame(fGameMode, fGamePlay.level, 0);
};
}
private function handleMatches(_arg1:MatchResult, _arg2:Boolean=false):void{
var _local3:int;
var _local4:Boolean;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:SmileySprite;
var _local13:DisplayObject;
if (_arg1.matchCount > 0){
if (!_arg2){
fComboCount = 1;
};
_local3 = 0;
_local4 = false;
_local5 = 0;
while (_local5 < _arg1.matchCount) {
_local3 = (_local3 + _arg1.smileyCount(_local5));
_local6 = (((_arg1.smileyCount(_local5) - 1) * 10) * fComboCount);
if (fGamePlay.typeCount == 7){
_local6 = (_local6 * 2);
};
if (fGamePlay.typeCount == 8){
_local6 = (_local6 * 3);
};
if (_local6 < 0){
_local6 = 0;
};
if (_arg1.bonus(_local5) != null){
_local6 = (_local6 * 10);
};
addPoints(_local6);
_local7 = 500;
_local8 = 0;
_local9 = 400;
_local10 = 0;
_local11 = 0;
while (_local11 < _arg1.smileyCount(_local5)) {
_local12 = _arg1.smiley(_local5, _local11);
addChild(_local12);
new SmileyJumpAnimation(_local12);
_local7 = Math.min(_local7, _local12.x);
_local8 = Math.max(_local8, (_local12.x + _local12.width));
_local9 = Math.min(_local9, _local12.y);
_local10 = Math.max(_local10, (_local12.y + _local12.height));
_local11++;
};
if (fComboCount > 1){
new GameTextAnimation(this, ("COMBO X" + fComboCount), ((_local7 + _local8) / 2), ((_local9 + _local10) / 2));
};
if (_arg1.bonus(_local5) != null){
_local4 = true;
SoundManager.playBonus();
_local13 = _arg1.bonus(_local5);
new MoveAnimation(_local13, new Point(_local13.x, _local13.y), new Point(_local13.x, (_local13.y - 30)), 30, InterpolationUtil.TYPE_LINEAR, 0, true);
new FadeAnimation(_local13, 15, FadeAnimation.MODE_FADE_OUT, 15);
addChild(_local13);
};
fLockCount = (fLockCount - _arg1.locks(_local5));
if ((((fComboCount < 2)) && (!(_local4)))){
SoundManager.playMatch();
};
fComboCount++;
_local5++;
};
if ((((fComboCount > 2)) && (!(_local4)))){
SoundManager.playCombo();
};
updateSmileyCount(_local3);
fLastMatchTime = getTimer();
fStuck = false;
};
}
}
}//package smileymatcher
Section 36
//GameTextAnimation (smileymatcher.GameTextAnimation)
package smileymatcher {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
public class GameTextAnimation extends AAnimation {
private var fSteps:int;
private var fTextField:TextField;
public function GameTextAnimation(_arg1:DisplayObjectContainer, _arg2:String, _arg3:int, _arg4:int){
fTextField = TextFactory.createGameText();
super(fTextField);
fTextField.x = _arg3;
fTextField.y = _arg4;
fTextField.text = _arg2;
looping = false;
_arg1.addChild(fTextField);
fSteps = (SmileyMatcher.LOWFPS) ? 30 : 44;
new MoveAnimation(displayObject, new Point(displayObject.x, displayObject.y), new Point(displayObject.x, (displayObject.y - fSteps)), fSteps, InterpolationUtil.TYPE_LINEAR, 0, true);
new FadeAnimation(displayObject, (fSteps / 2), FadeAnimation.MODE_FADE_OUT, (fSteps / 2));
}
override protected function get frameCount():int{
return (fSteps);
}
}
}//package smileymatcher
Section 37
//HandSprite (smileymatcher.HandSprite)
package smileymatcher {
import smileygamer.*;
import flash.filters.*;
public class HandSprite extends SGSprite {
private var fMouseDown:Boolean;// = false
private var MagicHand:Class;
private var HandOpen:Class;
private var HandClosed:Class;
private var RemoverHand:Class;
private var fHotspotX:int;// = 16
private var fHotspotY:int;// = 16
private static const STATE_DOWN:String = "down";
private static const STATE_NORMAL:String = "default";
private static const STATE_REMOVER:String = "remover";
private static const STATE_RECOLOR:String = "recolor";
public function HandSprite(){
var _local1:DropShadowFilter;
var _local2:DropShadowFilter;
HandOpen = HandSprite_HandOpen;
HandClosed = HandSprite_HandClosed;
RemoverHand = HandSprite_RemoverHand;
MagicHand = HandSprite_MagicHand;
fMouseDown = false;
fHotspotX = 16;
fHotspotY = 16;
super();
addAnimation(STATE_NORMAL, new ImageAnimation(new HandOpen()));
addAnimation(STATE_DOWN, new ImageAnimation(new HandClosed()));
addAnimation(STATE_REMOVER, new ImageAnimation(new RemoverHand()));
addAnimation(STATE_RECOLOR, new ImageAnimation(new MagicHand()));
_local1 = new DropShadowFilter(2);
_local1.alpha = 0.6;
_local1.quality = BitmapFilterQuality.HIGH;
_local2 = new DropShadowFilter(1, -135);
_local2.quality = BitmapFilterQuality.HIGH;
_local2.alpha = 0.8;
_local2.inner = true;
filters = [_local2, _local1];
mouseEnabled = false;
}
public function enableRecolor():void{
state = STATE_RECOLOR;
fHotspotX = 8;
fHotspotY = 4;
}
public function button(_arg1:Boolean):void{
fMouseDown = _arg1;
if (((!((state == STATE_REMOVER))) && (!((state == STATE_RECOLOR))))){
if (fMouseDown){
state = STATE_DOWN;
} else {
state = STATE_NORMAL;
};
};
}
public function enableRemover():void{
state = STATE_REMOVER;
fHotspotX = 8;
fHotspotY = 4;
}
public function disableSpecial():void{
if (fMouseDown){
state = STATE_DOWN;
} else {
state = STATE_NORMAL;
};
fHotspotX = 16;
fHotspotY = 16;
}
public function move(_arg1:int, _arg2:int):void{
x = (_arg1 - fHotspotX);
y = (_arg2 - fHotspotY);
}
public function isMouseDown():Boolean{
return (fMouseDown);
}
}
}//package smileymatcher
Section 38
//HandSprite_HandClosed (smileymatcher.HandSprite_HandClosed)
package smileymatcher {
import mx.core.*;
public class HandSprite_HandClosed extends BitmapAsset {
}
}//package smileymatcher
Section 39
//HandSprite_HandOpen (smileymatcher.HandSprite_HandOpen)
package smileymatcher {
import mx.core.*;
public class HandSprite_HandOpen extends BitmapAsset {
}
}//package smileymatcher
Section 40
//HandSprite_MagicHand (smileymatcher.HandSprite_MagicHand)
package smileymatcher {
import mx.core.*;
public class HandSprite_MagicHand extends BitmapAsset {
}
}//package smileymatcher
Section 41
//HandSprite_RemoverHand (smileymatcher.HandSprite_RemoverHand)
package smileymatcher {
import mx.core.*;
public class HandSprite_RemoverHand extends BitmapAsset {
}
}//package smileymatcher
Section 42
//HelpFrame (smileymatcher.HelpFrame)
package smileymatcher {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class HelpFrame extends Shape {
public static const COLOR:int = 3891199;
public static const RECT1:Rectangle = new Rectangle(50, 80, 120, 120);
public static const RECT2:Rectangle = new Rectangle(230, 80, 120, 120);
public static const RECT3:Rectangle = new Rectangle(410, 80, 80, 80);
public function HelpFrame(){
var _local1:BevelFilter;
var _local2:DropShadowFilter;
super();
graphics.beginFill(COLOR);
graphics.drawRect(0, 0, 540, 400);
graphics.drawRoundRect(RECT1.x, RECT1.y, RECT1.width, RECT1.height, 12, 12);
graphics.drawRoundRect(RECT2.x, RECT2.y, RECT2.width, RECT2.height, 12, 12);
graphics.drawRoundRect(RECT3.x, RECT3.y, RECT3.width, RECT3.height, 10, 10);
graphics.endFill();
_local1 = new BevelFilter(8, 45, 0xFFFFFF, 1, 0, 0.8, 8, 8, 0.7, BitmapFilterQuality.HIGH);
_local2 = new DropShadowFilter(4);
_local2.alpha = 0.5;
_local2.quality = BitmapFilterQuality.HIGH;
filters = [_local1, _local2];
cacheAsBitmap = true;
}
}
}//package smileymatcher
Section 43
//HelpScreen (smileymatcher.HelpScreen)
package smileymatcher {
import flash.events.*;
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
public class HelpScreen extends Sprite implements ILogic {
private var fSmileyBoard1:Sprite;
private var fSmileyBoard2:Sprite;
private var fLockedSmiley:SmileySprite;
private var fProgress:int;// = 0
private var fState:int;// = 0
private var fSmileyProgress:SmileyProgress;
private var fSmileys1:Array;
private var fSmileys2:Array;
private static const STATE_RUNNING:int = 1;
private static const STATE_INVALID:int = 0;
private static const SMILEY_TYPES_1:Array = [1, 0, 2, 3, 4, 0, 5, 6, 0, 7];
private static const SMILEY_TYPES_2:Array = [1, 2, 0, 4, 1, 1, 5, 7, 6, 3];
public function HelpScreen(_arg1:Function){
var _local2:int;
var _local3:SimpleButton;
var _local4:TextField;
var _local5:TextField;
var _local6:TextField;
var _local7:TextField;
var _local8:SpecialItem;
var _local9:SpecialItem;
var _local10:TextField;
var _local11:SmileySprite;
fState = STATE_INVALID;
fProgress = 0;
super();
fSmileyBoard1 = new Sprite();
fSmileyBoard1.x = HelpFrame.RECT1.x;
fSmileyBoard1.y = HelpFrame.RECT1.y;
addChild(fSmileyBoard1);
fSmileys1 = new Array();
_local2 = 0;
while (_local2 < 10) {
_local11 = new SmileySprite(SMILEY_TYPES_1[_local2]);
_local11.scaleX = (2 / 3);
_local11.scaleY = (2 / 3);
if (_local2 < 3){
_local11.x = (_local2 * 40);
_local11.y = 0;
} else {
if (_local2 < 7){
_local11.x = ((_local2 - 3) * 40);
_local11.y = 40;
} else {
_local11.x = ((_local2 - 7) * 40);
_local11.y = 80;
};
};
fSmileys1[_local2] = _local11;
fSmileyBoard1.addChild(_local11);
_local2++;
};
fSmileyBoard2 = new Sprite();
fSmileyBoard2.x = HelpFrame.RECT2.x;
fSmileyBoard2.y = HelpFrame.RECT2.y;
addChild(fSmileyBoard2);
fSmileys2 = new Array();
_local2 = 0;
while (_local2 < 10) {
_local11 = new SmileySprite(SMILEY_TYPES_2[_local2]);
_local11.scaleX = (2 / 3);
_local11.scaleY = (2 / 3);
if (_local2 < 3){
_local11.x = (_local2 * 40);
_local11.y = 0;
} else {
if (_local2 < 7){
_local11.x = ((_local2 - 3) * 40);
_local11.y = 40;
} else {
_local11.x = ((_local2 - 7) * 40);
_local11.y = 80;
};
};
fSmileys2[_local2] = _local11;
fSmileyBoard2.addChild(_local11);
_local2++;
};
fLockedSmiley = SmileySprite.createSmileySprite(RandomUtil.generateRandom(1, 6));
fLockedSmiley.lock();
fLockedSmiley.x = (HelpFrame.RECT3.x + 10);
fLockedSmiley.y = (HelpFrame.RECT3.y + 10);
addChild(fLockedSmiley);
addChild(new HelpFrame());
_local3 = TextFactory.createTextButton("Play", TextFactory.SIZE_LARGE);
_local3.x = (520 - _local3.width);
_local3.y = (380 - _local3.height);
_local3.addEventListener(MouseEvent.CLICK, _arg1);
addChild(_local3);
_local4 = TextFactory.createHelpTextField();
_local4.x = (HelpFrame.RECT1.x - 20);
_local4.y = 18;
_local4.width = 160;
_local4.height = 60;
_local4.text = "Slide rows or columns to match 3 or more smileys";
addChild(_local4);
_local5 = TextFactory.createHelpTextField();
_local5.x = (HelpFrame.RECT2.x - 20);
_local5.y = 25;
_local5.width = 160;
_local5.height = 60;
_local5.text = "Match in any direction";
addChild(_local5);
_local6 = TextFactory.createHelpTextField();
_local6.x = (HelpFrame.RECT3.x - 20);
_local6.y = 18;
_local6.width = 120;
_local6.height = 60;
_local6.text = "A locked smiley can't be moved";
addChild(_local6);
fSmileyProgress = new SmileyProgress();
fSmileyProgress.x = 50;
fSmileyProgress.y = 265;
addChild(fSmileyProgress);
_local7 = TextFactory.createHelpTextField();
_local7.x = (fSmileyProgress.x - 20);
_local7.y = 218;
_local7.width = 160;
_local7.height = 40;
_local7.text = "Fill big smiley to complete level";
addChild(_local7);
_local8 = new SpecialItem();
_local8.showHand(SpecialItem.REMOVER_HAND);
_local8.x = 210;
_local8.y = 260;
addChild(_local8);
_local9 = new SpecialItem();
_local9.showHand(SpecialItem.RECOLOR_HAND);
_local9.x = 330;
_local9.y = 260;
addChild(_local9);
_local10 = TextFactory.createHelpTextField();
_local10.x = 210;
_local10.y = 218;
_local10.width = 220;
_local10.height = 40;
_local10.text = "Special items: remove or recolor clicked smiley";
addChild(_local10);
}
public function doLogic():void{
var _local1:int;
var _local2:DisplayObject;
var _local3:DisplayObject;
if ((fProgress % 100) == 0){
_local1 = 3;
while (_local1 < 7) {
_local2 = (fSmileys1[_local1] as DisplayObject);
_local3 = (fSmileys2[_local1] as DisplayObject);
new MoveAnimation(_local2, new Point(_local2.x, _local2.y), new Point((_local2.x - 40), _local2.y), 60, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(_local3, new Point(_local3.x, _local3.y), new Point((_local3.x - 40), _local3.y), 60, InterpolationUtil.TYPE_COSINE);
_local1++;
};
};
if ((fProgress % 100) == 30){
SmileySprite(fSmileys1[1]).selected = true;
SmileySprite(fSmileys1[5]).selected = true;
SmileySprite(fSmileys1[8]).selected = true;
SmileySprite(fSmileys2[0]).selected = true;
SmileySprite(fSmileys2[4]).selected = true;
SmileySprite(fSmileys2[5]).selected = true;
};
if ((fProgress % 100) == 61){
SmileySprite(fSmileys1[1]).selected = false;
SmileySprite(fSmileys1[5]).selected = false;
SmileySprite(fSmileys1[8]).selected = false;
SmileySprite(fSmileys2[0]).selected = false;
SmileySprite(fSmileys2[4]).selected = false;
SmileySprite(fSmileys2[5]).selected = false;
new SmileyJumpAnimation(SmileySprite(fSmileys1[1]), false);
new SmileyJumpAnimation(SmileySprite(fSmileys1[5]), false);
new SmileyJumpAnimation(SmileySprite(fSmileys1[8]), false);
new SmileyJumpAnimation(SmileySprite(fSmileys2[0]), false);
new SmileyJumpAnimation(SmileySprite(fSmileys2[4]), false);
new SmileyJumpAnimation(SmileySprite(fSmileys2[5]), false);
};
if ((fProgress % 100) == 94){
_local1 = 0;
while (_local1 < 10) {
_local2 = (fSmileys1[_local1] as DisplayObject);
_local2.scaleX = (2 / 3);
_local2.scaleY = (2 / 3);
_local3 = (fSmileys2[_local1] as DisplayObject);
_local3.scaleX = (2 / 3);
_local3.scaleY = (2 / 3);
if (_local1 < 3){
_local2.x = (_local1 * 40);
_local2.y = 0;
} else {
if (_local1 < 7){
_local2.x = ((_local1 - 3) * 40);
_local2.y = 40;
} else {
_local2.x = ((_local1 - 7) * 40);
_local2.y = 80;
};
};
_local3.x = _local2.x;
_local3.y = _local2.y;
if (!fSmileyBoard1.contains(_local2)){
fSmileyBoard1.addChild(_local2);
};
if (!fSmileyBoard2.contains(_local3)){
fSmileyBoard2.addChild(_local3);
};
_local1++;
};
};
fSmileyProgress.progress = ((fProgress % 250) / 240);
if ((fProgress % 120) == 0){
fLockedSmiley.glowLock();
};
fProgress++;
}
}
}//package smileymatcher
Section 44
//IntroScreen (smileymatcher.IntroScreen)
package smileymatcher {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import smileygamer.util.*;
import smileygamer.*;
import flash.filters.*;
public class IntroScreen extends Sprite {
private static var Smiley:Class = IntroScreen_Smiley;
private static var Hand:Class = IntroScreen_Hand;
private static var HandMask:Class = IntroScreen_HandMask;
private static var SmileyMask:Class = IntroScreen_SmileyMask;
private static var BewareFont:Class = IntroScreen_BewareFont;
public function IntroScreen(){
addEventListener(Event.ADDED_TO_STAGE, added);
}
public function added(_arg1:Event):void{
var _local2:Sprite;
var _local3:TextField;
var _local4:TextField;
var _local5:DropShadowFilter;
var _local6:DropShadowFilter;
var _local7:Bitmap;
var _local8:Bitmap;
var _local9:MoveAnimation;
_local2 = new Sprite();
_local3 = createTextField(0xFF0000);
_local3.text = "Smiley";
_local2.addChild(_local3);
_local4 = createTextField(4145151);
_local4.text = "Gamer";
_local4.x = _local3.width;
_local2.addChild(_local4);
_local2.x = ((540 - _local2.width) / 2);
_local2.y = -10;
addChild(_local2);
_local5 = new DropShadowFilter(3);
_local5.alpha = 0.8;
_local5.quality = BitmapFilterQuality.HIGH;
_local6 = new DropShadowFilter(2, -135);
_local6.quality = BitmapFilterQuality.HIGH;
_local6.inner = true;
_local7 = BitmapUtil.createMaskedBitmap(new Smiley(), new SmileyMask());
_local7.x = ((540 / 2) - 140);
_local7.y = ((400 / 2) - 80);
_local7.filters = [_local6, _local5];
addChild(_local7);
_local8 = BitmapUtil.createMaskedBitmap(new Hand(), new HandMask());
_local8.filters = [_local6, _local5];
addChild(_local8);
_local9 = new MoveAnimation(_local8, new Point((_local7.x + 240), (_local7.y + 90)), new Point((_local7.x + 240), (_local7.y + 120)), 20, InterpolationUtil.TYPE_COSINE, 0, false, true);
_local9.looping = true;
}
private function createTextField(_arg1:int):TextField{
var _local2:TextField;
var _local3:TextFormat;
var _local4:Array;
_local2 = new TextField();
_local3 = new TextFormat("beware", 48, _arg1);
_local3.letterSpacing = 1;
_local2.autoSize = TextFieldAutoSize.LEFT;
_local2.mouseEnabled = false;
_local2.embedFonts = true;
_local2.defaultTextFormat = _local3;
_local2.antiAliasType = AntiAliasType.ADVANCED;
_local2.multiline = false;
_local2.transform.matrix = new Matrix(1, 0, 0, 2, 0, 0);
_local4 = new Array();
_local4.push(new BevelFilter(3, 45, 0xFFFFFF, 1, 0, 0.8, 2, 2, 0.7, BitmapFilterQuality.HIGH));
_local4.push(new DropShadowFilter(2, 45, 0, 1, 2, 2, 0.8, BitmapFilterQuality.HIGH));
_local2.filters = _local4;
return (_local2);
}
}
}//package smileymatcher
Section 45
//IntroScreen_BewareFont (smileymatcher.IntroScreen_BewareFont)
package smileymatcher {
import mx.core.*;
public class IntroScreen_BewareFont extends FontAsset {
}
}//package smileymatcher
Section 46
//IntroScreen_Hand (smileymatcher.IntroScreen_Hand)
package smileymatcher {
import mx.core.*;
public class IntroScreen_Hand extends BitmapAsset {
}
}//package smileymatcher
Section 47
//IntroScreen_HandMask (smileymatcher.IntroScreen_HandMask)
package smileymatcher {
import mx.core.*;
public class IntroScreen_HandMask extends BitmapAsset {
}
}//package smileymatcher
Section 48
//IntroScreen_Smiley (smileymatcher.IntroScreen_Smiley)
package smileymatcher {
import mx.core.*;
public class IntroScreen_Smiley extends BitmapAsset {
}
}//package smileymatcher
Section 49
//IntroScreen_SmileyMask (smileymatcher.IntroScreen_SmileyMask)
package smileymatcher {
import mx.core.*;
public class IntroScreen_SmileyMask extends BitmapAsset {
}
}//package smileymatcher
Section 50
//LevelAnimation (smileymatcher.LevelAnimation)
package smileymatcher {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
public class LevelAnimation extends AAnimation {
public function LevelAnimation(_arg1:DisplayObjectContainer, _arg2:int){
var levelField:TextField;
var anim:AAnimation;
var fade:Function;
var aParent = _arg1;
var aLevel = _arg2;
fade = function ():void{
var _local1:int;
_local1 = (SmileyMatcher.LOWFPS) ? 15 : 30;
new FadeAnimation(displayObject, _local1, FadeAnimation.MODE_FADE_OUT_REMOVE);
};
levelField = TextFactory.createTextField(TextFactory.SIZE_LARGEST, TextFactory.COLOR_SELECTED, TextFactory.DEFAULT_FONT);
levelField.text = ("LEVEL " + aLevel);
super(levelField);
looping = false;
anim = new MoveAnimation(displayObject, new Point((320 - (displayObject.width / 2)), ((-(displayObject.height) / 2) - 160)), new Point((320 - (displayObject.width / 2)), (200 - (displayObject.height / 2))), 20, InterpolationUtil.TYPE_LINEAR);
anim.addCallback(fade);
aParent.addChild(levelField);
}
override protected function get frameCount():int{
return (20);
}
}
}//package smileymatcher
Section 51
//LevelCompleteAnimation (smileymatcher.LevelCompleteAnimation)
package smileymatcher {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
public class LevelCompleteAnimation extends AAnimation {
public function LevelCompleteAnimation(_arg1:DisplayObjectContainer, _arg2:int){
var _local3:TextField;
var _local4:TextField;
var _local5:Sprite;
_local3 = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_SELECTED);
_local3.autoSize = TextFieldAutoSize.CENTER;
_local3.text = ("LEVEL " + _arg2);
_local4 = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_SELECTED);
_local4.autoSize = TextFieldAutoSize.CENTER;
_local4.text = "COMPLETE!";
_local5 = new Sprite();
_local5.addChild(_local3);
_local5.addChild(_local4);
super(_local5);
looping = false;
new FadeAnimation(_local5, 15, FadeAnimation.MODE_FADE_IN);
new MoveAnimation(_local3, new Point((-(_local3.width) - 5), 100), new Point((320 - (_local3.width / 2)), 100), 20, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(_local4, new Point(545, 180), new Point((320 - (_local4.width / 2)), 180), 20, InterpolationUtil.TYPE_COSINE);
_arg1.addChild(_local5);
}
public function endAnimation():void{
new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
}
override protected function get frameCount():int{
return (30);
}
}
}//package smileymatcher
Section 52
//LockSprite (smileymatcher.LockSprite)
package smileymatcher {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.filters.*;
public class LockSprite extends Sprite {
private var fNormalFilters:Array;
private var fSelectedFilters:Array;
public static const SIZE:int = 60;
private static var LockHands:Class = LockSprite_LockHands;
public function LockSprite(){
var _local1:DropShadowFilter;
var _local2:DropShadowFilter;
var _local3:GlowFilter;
super();
addChild(new LockHands());
_local1 = new DropShadowFilter(3);
_local1.alpha = 0.6;
_local1.quality = BitmapFilterQuality.HIGH;
_local2 = new DropShadowFilter(1, -135);
_local2.quality = BitmapFilterQuality.HIGH;
_local2.inner = true;
_local3 = new GlowFilter(16727839, 1, 16, 16, 2, BitmapFilterQuality.HIGH);
fNormalFilters = [_local2, _local1];
fSelectedFilters = [_local2, _local3];
filters = fNormalFilters;
}
public function glow():void{
var stopGlow:Function;
var t:Timer;
stopGlow = function (_arg1:Event):void{
filters = fNormalFilters;
};
filters = fSelectedFilters;
t = new Timer(2000, 1);
t.addEventListener(TimerEvent.TIMER_COMPLETE, stopGlow);
t.start();
}
}
}//package smileymatcher
Section 53
//LockSprite_LockHands (smileymatcher.LockSprite_LockHands)
package smileymatcher {
import mx.core.*;
public class LockSprite_LockHands extends BitmapAsset {
}
}//package smileymatcher
Section 54
//MatchPositions (smileymatcher.MatchPositions)
package smileymatcher {
public class MatchPositions {
private var fMatchData:Array;
private var fMatchCount:int;
public function MatchPositions(){
var _local1:int;
super();
fMatchCount = 0;
fMatchData = new Array(12);
_local1 = 0;
while (_local1 < fMatchData.length) {
fMatchData[_local1] = new Object();
fMatchData[_local1].posCnt = 0;
fMatchData[_local1].rows = new Array(11);
fMatchData[_local1].cols = new Array(11);
_local1++;
};
}
public function newMatch():void{
fMatchCount++;
fMatchData[(fMatchCount - 1)].posCnt = 0;
}
public function positionCount(_arg1:int):int{
return (fMatchData[_arg1].posCnt);
}
public function get matchCount():int{
return (fMatchCount);
}
public function reset():void{
fMatchCount = 0;
}
public function positionRow(_arg1:int, _arg2:int):int{
return (fMatchData[_arg1].rows[_arg2]);
}
public function addPosition(_arg1:int, _arg2:int):void{
fMatchData[(fMatchCount - 1)].rows[fMatchData[(fMatchCount - 1)].posCnt] = _arg1;
fMatchData[(fMatchCount - 1)].cols[fMatchData[(fMatchCount - 1)].posCnt] = _arg2;
fMatchData[(fMatchCount - 1)].posCnt++;
}
public function positionColumn(_arg1:int, _arg2:int):int{
return (fMatchData[_arg1].cols[_arg2]);
}
}
}//package smileymatcher
Section 55
//MatchResult (smileymatcher.MatchResult)
package smileymatcher {
import flash.display.*;
public class MatchResult {
private var fMatchData:Array;
private var fMatchCount:int;
public function MatchResult(){
var _local1:int;
super();
fMatchCount = 0;
fMatchData = new Array(10);
_local1 = 0;
while (_local1 < fMatchData.length) {
fMatchData[_local1] = new Object();
fMatchData[_local1].posCnt = 0;
fMatchData[_local1].smileys = new Array(11);
fMatchData[_local1].bonusSprite = null;
fMatchData[_local1].locks = 0;
_local1++;
};
}
public function newMatch():void{
fMatchCount++;
fMatchData[(fMatchCount - 1)].posCnt = 0;
fMatchData[(fMatchCount - 1)].bonusSprite = null;
fMatchData[(fMatchCount - 1)].locks = 0;
}
public function locks(_arg1:int):int{
return (fMatchData[_arg1].locks);
}
public function get matchCount():int{
return (fMatchCount);
}
public function addLock():void{
fMatchData[(fMatchCount - 1)].locks++;
}
public function reset():void{
fMatchCount = 0;
}
public function smiley(_arg1:int, _arg2:int):SmileySprite{
return ((fMatchData[_arg1].smileys[_arg2] as SmileySprite));
}
public function addSmiley(_arg1:SmileySprite):void{
fMatchData[(fMatchCount - 1)].smileys[fMatchData[(fMatchCount - 1)].posCnt] = _arg1;
fMatchData[(fMatchCount - 1)].posCnt++;
}
public function setBonus(_arg1:DisplayObject):void{
fMatchData[(fMatchCount - 1)].bonusSprite = _arg1;
}
public function smileyCount(_arg1:int):int{
return (fMatchData[_arg1].posCnt);
}
public function bonus(_arg1:int):DisplayObject{
return (fMatchData[_arg1].bonusSprite);
}
}
}//package smileymatcher
Section 56
//PointingHand (smileymatcher.PointingHand)
package smileymatcher {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.filters.*;
public class PointingHand extends Sprite {
public static const LEFT:int = 0;
public static const DOWN:int = 2;
public static const UP:int = 3;
public static const RIGHT:int = 1;
private static var Hand:Class = PointingHand_Hand;
public function PointingHand(_arg1:int){
var _local2:ImageStrip;
var _local3:Bitmap;
var _local4:DropShadowFilter;
var _local5:GlowFilter;
var _local6:MoveAnimation;
super();
_local2 = new ImageStrip(new Hand(), 30, 30);
_local3 = _local2.createImage(_arg1);
_local3.x = 15;
_local3.y = 15;
_local4 = new DropShadowFilter(1, -135);
_local4.quality = BitmapFilterQuality.HIGH;
_local4.alpha = 0.8;
_local4.inner = true;
_local5 = new GlowFilter(14680015, 1, 16, 16, 3, BitmapFilterQuality.HIGH);
_local3.filters = [_local4, _local5];
addChild(_local3);
switch (_arg1){
case LEFT:
_local6 = new MoveAnimation(_local3, new Point(0, 15), new Point(30, 15), 15, InterpolationUtil.TYPE_COSINE, 0, false, true);
_local6.looping = true;
break;
case RIGHT:
_local6 = new MoveAnimation(_local3, new Point(30, 15), new Point(0, 15), 15, InterpolationUtil.TYPE_COSINE, 0, false, true);
_local6.looping = true;
break;
case DOWN:
_local6 = new MoveAnimation(_local3, new Point(15, 0), new Point(15, 30), 15, InterpolationUtil.TYPE_COSINE, 0, false, true);
_local6.looping = true;
break;
case UP:
_local6 = new MoveAnimation(_local3, new Point(15, 30), new Point(15, 0), 15, InterpolationUtil.TYPE_COSINE, 0, false, true);
_local6.looping = true;
break;
};
}
}
}//package smileymatcher
Section 57
//PointingHand_Hand (smileymatcher.PointingHand_Hand)
package smileymatcher {
import mx.core.*;
public class PointingHand_Hand extends BitmapAsset {
}
}//package smileymatcher
Section 58
//SaveData (smileymatcher.SaveData)
package smileymatcher {
import flash.net.*;
public class SaveData {
private static var fScoresObject:SharedObject = null;
private static var fHighscore:int = 0;
private static var fName:String;
private static var fSavedGame:Array = [null, null];
private static var fLevel:int = 1;
private static function writeScores():void{
if (fScoresObject != null){
fScoresObject.data.score = fHighscore;
fScoresObject.data.level = fLevel;
fScoresObject.data.savedgames = fSavedGame;
fScoresObject.data.name = fName;
fScoresObject.flush(500);
};
}
public static function getSavedGame(_arg1:int):Object{
if (fSavedGame[_arg1] != null){
return (fSavedGame[_arg1]);
};
return (null);
}
public static function endGame(_arg1:int, _arg2:int):void{
if (_arg2 >= fHighscore){
fLevel = _arg1;
fHighscore = _arg2;
writeScores();
};
}
public static function get name():String{
return (fName);
}
public static function saveGame(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:Object;
_local4 = new Object();
_local4.level = _arg2;
_local4.score = _arg3;
fSavedGame[_arg1] = _local4;
writeScores();
}
public static function init():void{
try {
fScoresObject = SharedObject.getLocal("smiley-puzzle-data", "/");
if (fScoresObject.data.level != null){
fHighscore = fScoresObject.data.score;
fLevel = fScoresObject.data.level;
fSavedGame = fScoresObject.data.savedgames;
fName = fScoresObject.data.name;
} else {
writeScores();
};
} catch(e:Error) {
};
}
public static function set name(_arg1:String):void{
fName = _arg1;
writeScores();
}
public static function getStats():Array{
return (new Array(fLevel, fHighscore));
}
public static function clearSavedGame(_arg1:int):void{
fSavedGame[_arg1] = null;
writeScores();
}
}
}//package smileymatcher
Section 59
//SmileyJumpAnimation (smileymatcher.SmileyJumpAnimation)
package smileymatcher {
import flash.display.*;
import smileygamer.*;
import smileygamer.util.*;
public class SmileyJumpAnimation extends AAnimation {
private var fReturnToPool:Boolean;
private var fSpeedX:int;
private var fSpeedY:int;
public function SmileyJumpAnimation(_arg1:DisplayObject, _arg2:Boolean=true){
fReturnToPool = _arg2;
if (SmileyMatcher.LOWFPS){
fSpeedX = RandomUtil.generateRandom(12, 20);
} else {
fSpeedX = RandomUtil.generateRandom(8, 17);
};
if (RandomUtil.chance(2)){
fSpeedX = -(fSpeedX);
};
fSpeedY = RandomUtil.generateRandom(-28, -20);
super(_arg1);
looping = false;
}
override public function update():void{
fSpeedY = (fSpeedY + (SmileyMatcher.LOWFPS) ? 5 : 3);
displayObject.x = (displayObject.x + fSpeedX);
displayObject.y = (displayObject.y + fSpeedY);
}
override protected function get frameCount():int{
return (1000);
}
override public function get finished():Boolean{
var _local1:Boolean;
_local1 = (((((((displayObject.y > 400)) || (((displayObject.y + displayObject.height) < 0)))) || ((displayObject.x > 520)))) || (((displayObject.x + displayObject.width) < 0)));
if (((_local1) && (fReturnToPool))){
SmileySprite.returnToPool((displayObject as SmileySprite));
displayObject.parent.removeChild(displayObject);
};
return (_local1);
}
}
}//package smileymatcher
Section 60
//SmileyProgress (smileymatcher.SmileyProgress)
package smileymatcher {
import flash.display.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.filters.*;
public class SmileyProgress extends Sprite {
private var fTopSmiley:Sprite;
private var fMask:Shape;
private static var Smiley:Class = SmileyProgress_Smiley;
private static var SmileyMask:Class = SmileyProgress_SmileyMask;
public function SmileyProgress(){
var _local1:Bitmap;
var _local2:DropShadowFilter;
var _local3:DropShadowFilter;
var _local4:DropShadowFilter;
var _local5:Bitmap;
var _local6:Bitmap;
var _local7:Bitmap;
var _local8:BevelFilter;
super();
_local1 = BitmapUtil.createMaskedBitmap(new Smiley(), new SmileyMask());
_local2 = new DropShadowFilter(1);
_local2.alpha = 1;
_local2.quality = BitmapFilterQuality.HIGH;
_local3 = new DropShadowFilter(2, -135);
_local3.quality = BitmapFilterQuality.HIGH;
_local3.inner = true;
_local4 = new DropShadowFilter(2, 45);
_local4.quality = BitmapFilterQuality.HIGH;
_local4.inner = true;
_local1.filters = [_local3, _local2];
_local5 = new Bitmap(new BitmapData(_local1.width, _local1.height, true, 0));
_local5.bitmapData.draw(_local1);
_local6 = BitmapUtil.createMaskedBitmap(new Smiley(), new SmileyMask());
_local6.alpha = 0.2;
_local6.filters = [_local3, _local4];
_local7 = new Bitmap(new BitmapData(_local1.width, _local1.height, true, (4278190080 + BoardFrame.COLOR)));
_local7.bitmapData.copyChannel(_local5.bitmapData, _local5.bitmapData.rect, new Point(0, 0), BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA);
_local1.filters = [_local3, _local4];
addChild(_local7);
addChild(_local6);
fTopSmiley = new Sprite();
fTopSmiley.addChild(_local1);
addChild(fTopSmiley);
_local8 = new BevelFilter(4, -135, 0xFFFFFF, 0.8, 0, 0.8, 6, 6, 1, BitmapFilterQuality.HIGH, BitmapFilterType.OUTER);
filters = [_local8];
fMask = new Shape();
fMask.graphics.beginFill(0);
fMask.graphics.drawRect(0, 0, fTopSmiley.width, 0);
fMask.graphics.endFill();
fMask.y = fTopSmiley.height;
fTopSmiley.mask = fMask;
fTopSmiley.addChild(fMask);
progress = 0;
}
public function set progress(_arg1:Number):void{
fMask.graphics.clear();
fMask.graphics.beginFill(0xFFFFFF);
fMask.graphics.drawRect(0, 0, fTopSmiley.width, (_arg1 * fTopSmiley.height));
fMask.graphics.endFill();
fMask.y = ((1 - _arg1) * fTopSmiley.height);
fTopSmiley.mask = fMask;
}
}
}//package smileymatcher
Section 61
//SmileyProgress_Smiley (smileymatcher.SmileyProgress_Smiley)
package smileymatcher {
import mx.core.*;
public class SmileyProgress_Smiley extends BitmapAsset {
}
}//package smileymatcher
Section 62
//SmileyProgress_SmileyMask (smileymatcher.SmileyProgress_SmileyMask)
package smileymatcher {
import mx.core.*;
public class SmileyProgress_SmileyMask extends BitmapAsset {
}
}//package smileymatcher
Section 63
//SmileySprite (smileymatcher.SmileySprite)
package smileymatcher {
import flash.events.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.filters.*;
public class SmileySprite extends SGSprite {
private var fCloneRect:Rectangle;
private var fSlideSpeed:int;// = 10
private var fSelected:Boolean;
private var fSlideXTo:int;// = -1
private var fDropping:Boolean;// = false
private var fEndAnim:ImageArrayAnimation;
private var fNormalAnim:ImageArrayAnimation;
private var fType:int;
private var fReverseAnim:ImageArrayAnimation;
private var fLockSprite:LockSprite;// = null
private var fSlideYTo:int;// = -1
private var fChangeAnim:ImageArrayAnimation;
public static const SIZE:int = 60;
private static const INNERGLOW:GlowFilter = new GlowFilter(0xFFFFFF, 0.3, 32, 32, 2, BitmapFilterQuality.HIGH, true);
private static const BOARDSIZE:int = BoardLayer.BOARDSIZE;
private static const NORMAL_FILTERS:Array = [INNERSHADOW, SHADOW];
private static const GLOW:GlowFilter = new GlowFilter(0xFFFFFF, 0.75, 10, 10, 2, BitmapFilterQuality.HIGH);
private static const INNERSHADOW:DropShadowFilter = new DropShadowFilter(1, -135, 0, 1, 4, 4, 1, BitmapFilterQuality.HIGH, true);
private static const STATE_ANIM_END:String = "end";
private static const STATE_ANIM:String = "anim";
private static const SHADOW:DropShadowFilter = new DropShadowFilter(3, 45, 0, 0.6, 4, 4, 1, BitmapFilterQuality.HIGH);
private static const POOL:Array = new Array();
private static const ANIM_END_CHANCE:int = 400;
private static const ANIM_CHANCE:int = 600;
private static const BORDER:int = 8;
private static const STATE_NORMAL:String = "default";
private static const SELECTED_FILTERS:Array = [INNERSHADOW, INNERGLOW, GLOW];
private static const STATE_REVERSE_ANIM:String = "reverse";
private static var Smileys:Class = SmileySprite_Smileys;
private static var sNormalSmileys:Array = BitmapUtil.splitImage(BitmapUtil.createMaskedBitmap(new Smileys(), new SmileysMask()), SIZE, SIZE, BORDER, NORMAL_FILTERS);
private static var sSelectedSmileys:Array = BitmapUtil.splitImage(BitmapUtil.createMaskedBitmap(new Smileys(), new SmileysMask()), SIZE, SIZE, BORDER, SELECTED_FILTERS);
private static var SmileysMask:Class = SmileySprite_SmileysMask;
public function SmileySprite(_arg1:int){
fCloneRect = new Rectangle(0, 0, SIZE, SIZE);
fSlideXTo = -1;
fSlideYTo = -1;
fSlideSpeed = 10;
fDropping = false;
fLockSprite = null;
super();
type = _arg1;
clear();
cacheAsBitmap = true;
addEventListener(Event.ENTER_FRAME, animate);
}
private function moveClone(_arg1:Number, _arg2:Number):void{
if (clonePos == null){
clonePos = new Point(_arg1, _arg2);
} else {
clonePos.x = _arg1;
clonePos.y = _arg2;
};
fCloneRect.x = (x + _arg1);
fCloneRect.y = (y + _arg2);
}
public function get locked():Boolean{
var _local1:Boolean;
_local1 = !((fLockSprite == null));
return (_local1);
}
override public function set state(_arg1:String):void{
super.state = _arg1;
if (fLockSprite != null){
addChild(fLockSprite);
};
}
public function lock():void{
fLockSprite = new LockSprite();
addChild(fLockSprite);
}
public function locationChanged():void{
if (x < 0){
moveClone(BOARDSIZE, 0);
};
if ((x + SIZE) > BOARDSIZE){
moveClone(-(BOARDSIZE), 0);
};
if (y < 0){
moveClone(0, BOARDSIZE);
};
if ((y + SIZE) > BOARDSIZE){
moveClone(0, -(BOARDSIZE));
};
if (((((((((!((clonePos == null))) && ((fCloneRect.x > 0)))) && ((fCloneRect.y > 0)))) && (((fCloneRect.x + fCloneRect.width) <= BOARDSIZE)))) && (((fCloneRect.y + fCloneRect.height) <= BOARDSIZE)))){
if ((((x < 0)) || ((x >= (BOARDSIZE - SIZE))))){
x = ((x + (BOARDSIZE * 2)) % BOARDSIZE);
};
if ((((y < 0)) || ((y >= (BOARDSIZE - SIZE))))){
y = ((y + (BOARDSIZE * 2)) % BOARDSIZE);
};
clonePos = null;
};
}
public function get type():int{
return (fType);
}
public function unlock():void{
if (fLockSprite != null){
removeChild(fLockSprite);
fLockSprite = null;
};
}
public function set selected(_arg1:Boolean):void{
if (((!(fSelected)) && (_arg1))){
fNormalAnim.setImages(sSelectedSmileys);
fChangeAnim.setImages(sSelectedSmileys);
fEndAnim.setImages(sSelectedSmileys);
fReverseAnim.setImages(sSelectedSmileys);
};
if (((fSelected) && (!(_arg1)))){
fNormalAnim.setImages(sNormalSmileys);
fChangeAnim.setImages(sNormalSmileys);
fEndAnim.setImages(sNormalSmileys);
fReverseAnim.setImages(sNormalSmileys);
};
fSelected = _arg1;
}
public function glowLock():void{
if (fLockSprite != null){
fLockSprite.glow();
};
}
public function get moving():Boolean{
return (((!((fSlideXTo == -1))) || (!((fSlideYTo == -1)))));
}
override protected function nextState():String{
if ((((state == STATE_ANIM)) && (!((fType == 3))))){
return (STATE_ANIM_END);
};
return (STATE_DEFAULT);
}
private function clear():void{
x = 0;
y = 0;
fCloneRect.x = 0;
fCloneRect.y = 0;
clonePos = null;
selected = false;
fSlideXTo = -1;
fSlideYTo = -1;
fDropping = false;
fLockSprite = null;
state = STATE_NORMAL;
}
public function slideBack(_arg1:int, _arg2:int):void{
fSlideXTo = ((Math.round((x / SIZE)) - _arg2) * SIZE);
fSlideYTo = ((Math.round((y / SIZE)) - _arg1) * SIZE);
fSlideSpeed = 30;
if (fSlideXTo == x){
fSlideXTo = -1;
};
if (fSlideYTo == y){
fSlideYTo = -1;
};
}
public function set type(_arg1:int):void{
var _local2:Array;
var _local3:int;
fType = _arg1;
_local2 = new Array();
_local3 = (fType * 6);
while (_local3 < ((fType * 6) + 6)) {
_local2.push(_local3);
_local3++;
};
fNormalAnim = new ImageArrayAnimation(sNormalSmileys, [(fType * 6)]);
fNormalAnim.displayObject.x = -(BORDER);
fNormalAnim.displayObject.y = -(BORDER);
fChangeAnim = new ImageArrayAnimation(sNormalSmileys, _local2, 4, false, false);
fChangeAnim.displayObject.x = -(BORDER);
fChangeAnim.displayObject.y = -(BORDER);
fEndAnim = new ImageArrayAnimation(sNormalSmileys, [((fType * 6) + 5)]);
fEndAnim.displayObject.x = -(BORDER);
fEndAnim.displayObject.y = -(BORDER);
fReverseAnim = new ImageArrayAnimation(sNormalSmileys, _local2, 4, false, true);
fReverseAnim.displayObject.x = -(BORDER);
fReverseAnim.displayObject.y = -(BORDER);
addAnimation(STATE_NORMAL, fNormalAnim);
addAnimation(STATE_ANIM, fChangeAnim);
addAnimation(STATE_ANIM_END, fEndAnim);
addAnimation(STATE_REVERSE_ANIM, fReverseAnim);
}
public function containsPt(_arg1:Number, _arg2:Number):Boolean{
return (((GeometryUtil.contains(getChildAt(0), (_arg1 - x), (_arg2 - y))) || (((!((clonePos == null))) && (fCloneRect.contains(_arg1, _arg2))))));
}
public function containsPoint(_arg1:int, _arg2:int):Boolean{
return ((((((((_arg1 >= x)) && ((_arg1 < (x + SIZE))))) && ((_arg2 >= y)))) && ((_arg2 < (y + SIZE)))));
}
public function get selected():Boolean{
return (fSelected);
}
public function doLogic():void{
if (fSlideXTo != -1){
if (Math.abs(((fSlideXTo - x) % BOARDSIZE)) <= fSlideSpeed){
x = fSlideXTo;
fSlideXTo = -1;
if ((((x < 0)) || ((x >= (BOARDSIZE - SIZE))))){
x = ((x + (BOARDSIZE * 2)) % BOARDSIZE);
};
if ((((y < 0)) || ((y >= (BOARDSIZE - SIZE))))){
y = ((y + (BOARDSIZE * 2)) % BOARDSIZE);
};
clonePos = null;
} else {
if (fSlideXTo > x){
x = (x + fSlideSpeed);
} else {
x = (x - fSlideSpeed);
};
locationChanged();
};
};
if (fSlideYTo != -1){
if (Math.abs(((fSlideYTo - y) % BOARDSIZE)) <= fSlideSpeed){
y = fSlideYTo;
fSlideYTo = -1;
if ((((x < 0)) || ((x >= (BOARDSIZE - SIZE))))){
x = ((x + (BOARDSIZE * 2)) % BOARDSIZE);
};
if ((((y < 0)) || ((y >= (BOARDSIZE - SIZE))))){
y = ((y + (BOARDSIZE * 2)) % BOARDSIZE);
};
clonePos = null;
fDropping = false;
} else {
if (fSlideYTo > y){
y = (y + fSlideSpeed);
} else {
y = (y - fSlideSpeed);
};
if (!fDropping){
locationChanged();
};
};
};
}
public function get column():int{
var _local1:int;
_local1 = (x + (SIZE / 2));
if (_local1 < 0){
_local1 = (_local1 + BOARDSIZE);
};
if (_local1 > BOARDSIZE){
_local1 = (_local1 - BOARDSIZE);
};
return (Math.floor((_local1 / SIZE)));
}
public function get row():int{
var _local1:int;
_local1 = (y + (SIZE / 2));
if (_local1 < 0){
_local1 = (_local1 + BOARDSIZE);
};
if (_local1 > BOARDSIZE){
_local1 = (_local1 - BOARDSIZE);
};
return (Math.floor((_local1 / SIZE)));
}
private function animate(_arg1:Event):void{
if ((((state == STATE_DEFAULT)) && (RandomUtil.chance(ANIM_CHANCE)))){
state = STATE_ANIM;
} else {
if ((((state == STATE_ANIM_END)) && (RandomUtil.chance(ANIM_END_CHANCE)))){
state = STATE_REVERSE_ANIM;
};
};
}
public function drop(_arg1:int):void{
fSlideYTo = ((Math.round((y / SIZE)) + _arg1) * SIZE);
fSlideSpeed = (SmileyMatcher.LOWFPS) ? 20 : 12;
fDropping = true;
}
public function slideInPosition():void{
fSlideXTo = (Math.round((x / SIZE)) * SIZE);
fSlideYTo = (Math.round((y / SIZE)) * SIZE);
fSlideSpeed = (SmileyMatcher.LOWFPS) ? 15 : 10;
if (fSlideXTo == x){
fSlideXTo = -1;
};
if (fSlideYTo == y){
fSlideYTo = -1;
};
}
public static function createSmileySprite(_arg1:int):SmileySprite{
var _local2:SmileySprite;
_local2 = null;
if (POOL.length > 0){
_local2 = (POOL.pop() as SmileySprite);
if (_local2.type != _arg1){
_local2.type = _arg1;
};
_local2.state = STATE_NORMAL;
} else {
_local2 = new SmileySprite(_arg1);
};
return (_local2);
}
public static function returnToPool(_arg1:SmileySprite):void{
_arg1.clear();
if (POOL.indexOf(_arg1) == -1){
POOL.push(_arg1);
};
}
}
}//package smileymatcher
Section 64
//SmileySprite_Smileys (smileymatcher.SmileySprite_Smileys)
package smileymatcher {
import mx.core.*;
public class SmileySprite_Smileys extends BitmapAsset {
}
}//package smileymatcher
Section 65
//SmileySprite_SmileysMask (smileymatcher.SmileySprite_SmileysMask)
package smileymatcher {
import mx.core.*;
public class SmileySprite_SmileysMask extends BitmapAsset {
}
}//package smileymatcher
Section 66
//SoundManager (smileymatcher.SoundManager)
package smileymatcher {
import flash.events.*;
import flash.utils.*;
import smileygamer.util.*;
import flash.media.*;
public class SoundManager {
private static var Music:Class = SoundManager_Music;
private static var GameOver:Class = SoundManager_GameOver;
private static var fWiii:Sound = (new Wiii() as Sound);
private static var Bonus:Class = SoundManager_Bonus;
private static var Applause:Class = SoundManager_Applause;
private static var Wiii:Class = SoundManager_Wiii;
private static var fLevelComplete:Sound = (new LevelComplete() as Sound);
private static var Ping:Class = SoundManager_Ping;
private static var Special:Class = SoundManager_Special;
private static var fYay:Sound = (new Yay() as Sound);
private static var fButtonSound:Sound = (new Beep() as Sound);
private static var fLock:Sound = (new Lock() as Sound);
private static var fMusicChannel:SoundChannel;
private static var LevelComplete:Class = SoundManager_LevelComplete;
private static var fSound:Boolean = true;
private static var Lock:Class = SoundManager_Lock;
private static var Beep:Class = SoundManager_Beep;
private static var fCombo:Sound = (new Combo() as Sound);
private static var Yay:Class = SoundManager_Yay;
private static var fBonus:Sound = (new Bonus() as Sound);
private static var fMusic:Sound = (new Music() as Sound);
private static var fGameOver:Sound = (new GameOver() as Sound);
private static var Combo:Class = SoundManager_Combo;
private static var fSpecial:Sound = (new Special() as Sound);
private static var fApplause:Sound = (new Applause() as Sound);
private static var fPing:Sound = (new Ping() as Sound);
public static function playGameWon():void{
if (fSound){
fApplause.play();
};
}
public static function playLevelComplete():void{
if (fSound){
fLevelComplete.play();
};
}
public static function playButton():void{
if (fSound){
fButtonSound.play();
};
}
public static function get sound():Boolean{
return (fSound);
}
public static function toggleSound():void{
sound = !(sound);
}
public static function set sound(_arg1:Boolean):void{
fSound = _arg1;
if (!fSound){
if (fMusicChannel != null){
fMusicChannel.stop();
};
} else {
fMusicChannel = null;
playMusic();
};
}
public static function playLock():void{
if (fSound){
fLock.play();
};
}
public static function playCombo():void{
if (fSound){
fCombo.play();
};
}
public static function playGameOver():void{
if (fSound){
fGameOver.play();
};
}
public static function playPing():void{
if (fSound){
fPing.play(0, 2);
};
}
public static function playBonus():void{
if (fSound){
fBonus.play();
};
}
public static function playMusic():void{
var replay:Function;
replay = function (_arg1:Event):void{
var _local2:Timer;
if (((!((_arg1 == null))) && ((_arg1.type == Event.SOUND_COMPLETE)))){
_local2 = new Timer(5000, 1);
_local2.addEventListener(TimerEvent.TIMER_COMPLETE, replay);
_local2.start();
} else {
fMusicChannel = fMusic.play();
fMusicChannel.addEventListener(Event.SOUND_COMPLETE, replay);
fMusicChannel.soundTransform = new SoundTransform(0.75);
};
};
if (((fSound) && ((fMusicChannel == null)))){
replay(null);
};
}
public static function playSpecial():void{
if (fSound){
fSpecial.play();
};
}
public static function playMatch():void{
if (fSound){
if (RandomUtil.chance(2)){
fYay.play();
} else {
fWiii.play();
};
};
}
}
}//package smileymatcher
Section 67
//SoundManager_Applause (smileymatcher.SoundManager_Applause)
package smileymatcher {
import mx.core.*;
public class SoundManager_Applause extends SoundAsset {
}
}//package smileymatcher
Section 68
//SoundManager_Beep (smileymatcher.SoundManager_Beep)
package smileymatcher {
import mx.core.*;
public class SoundManager_Beep extends SoundAsset {
}
}//package smileymatcher
Section 69
//SoundManager_Bonus (smileymatcher.SoundManager_Bonus)
package smileymatcher {
import mx.core.*;
public class SoundManager_Bonus extends SoundAsset {
}
}//package smileymatcher
Section 70
//SoundManager_Combo (smileymatcher.SoundManager_Combo)
package smileymatcher {
import mx.core.*;
public class SoundManager_Combo extends SoundAsset {
}
}//package smileymatcher
Section 71
//SoundManager_GameOver (smileymatcher.SoundManager_GameOver)
package smileymatcher {
import mx.core.*;
public class SoundManager_GameOver extends SoundAsset {
}
}//package smileymatcher
Section 72
//SoundManager_LevelComplete (smileymatcher.SoundManager_LevelComplete)
package smileymatcher {
import mx.core.*;
public class SoundManager_LevelComplete extends SoundAsset {
}
}//package smileymatcher
Section 73
//SoundManager_Lock (smileymatcher.SoundManager_Lock)
package smileymatcher {
import mx.core.*;
public class SoundManager_Lock extends SoundAsset {
}
}//package smileymatcher
Section 74
//SoundManager_Music (smileymatcher.SoundManager_Music)
package smileymatcher {
import mx.core.*;
public class SoundManager_Music extends SoundAsset {
}
}//package smileymatcher
Section 75
//SoundManager_Ping (smileymatcher.SoundManager_Ping)
package smileymatcher {
import mx.core.*;
public class SoundManager_Ping extends SoundAsset {
}
}//package smileymatcher
Section 76
//SoundManager_Special (smileymatcher.SoundManager_Special)
package smileymatcher {
import mx.core.*;
public class SoundManager_Special extends SoundAsset {
}
}//package smileymatcher
Section 77
//SoundManager_Wiii (smileymatcher.SoundManager_Wiii)
package smileymatcher {
import mx.core.*;
public class SoundManager_Wiii extends SoundAsset {
}
}//package smileymatcher
Section 78
//SoundManager_Yay (smileymatcher.SoundManager_Yay)
package smileymatcher {
import mx.core.*;
public class SoundManager_Yay extends SoundAsset {
}
}//package smileymatcher
Section 79
//SpecialItem (smileymatcher.SpecialItem)
package smileymatcher {
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
import flash.filters.*;
public class SpecialItem extends Sprite {
private var fRecolorHand:Bitmap;
private var fRemoverHand:Bitmap;
private var fItemName:TextField;
public static const REMOVER_HAND:int = 0;
public static const RECOLOR_HAND:int = 1;
private static var HandMask:Class = SpecialItem_HandMask;
private static var MagicHand:Class = SpecialItem_MagicHand;
private static var Remover:Class = SpecialItem_Remover;
public function SpecialItem(){
var _local1:Bitmap;
var _local2:DropShadowFilter;
var _local3:DropShadowFilter;
var _local4:DropShadowFilter;
var _local5:Bitmap;
var _local6:Bitmap;
var _local7:Sprite;
var _local8:BevelFilter;
super();
_local1 = BitmapUtil.createMaskedBitmap(new Remover(), new HandMask());
_local2 = new DropShadowFilter(1);
_local2.alpha = 1;
_local2.quality = BitmapFilterQuality.HIGH;
_local3 = new DropShadowFilter(2, -135);
_local3.quality = BitmapFilterQuality.HIGH;
_local3.inner = true;
_local4 = new DropShadowFilter(2, 45);
_local4.quality = BitmapFilterQuality.HIGH;
_local4.inner = true;
_local1.filters = [_local3, _local2];
_local5 = new Bitmap(new BitmapData(_local1.width, _local1.height, true, 0));
_local5.bitmapData.draw(_local1);
_local6 = new Bitmap(new BitmapData(_local1.width, _local1.height, true, (4278190080 + BoardFrame.COLOR)));
_local6.bitmapData.copyChannel(_local5.bitmapData, _local5.bitmapData.rect, new Point(0, 0), BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA);
fRemoverHand = _local1;
fRemoverHand.filters = [_local3, _local4];
fRemoverHand.visible = false;
fRecolorHand = BitmapUtil.createMaskedBitmap(new MagicHand(), new HandMask());
fRecolorHand.filters = [_local3, _local4];
fRecolorHand.visible = false;
_local7 = new Sprite();
_local7.addChild(_local6);
_local7.addChild(fRemoverHand);
_local7.addChild(fRecolorHand);
_local8 = new BevelFilter(4, -135, 0xFFFFFF, 0.8, 0, 0.8, 6, 6, 1, BitmapFilterQuality.HIGH, BitmapFilterType.OUTER);
_local7.filters = [_local8];
addChild(_local7);
fItemName = TextFactory.createTextField(TextFactory.SIZE_SMALL);
fItemName.autoSize = TextFieldAutoSize.CENTER;
fItemName.x = (_local7.width / 2);
fItemName.y = (_local7.height + 8);
fItemName.text = " ";
addChild(fItemName);
}
public function get armed():Boolean{
return (((fRemoverHand.visible) || (fRecolorHand.visible)));
}
public function showHand(_arg1:int):void{
if (_arg1 == REMOVER_HAND){
fRemoverHand.visible = true;
fItemName.text = "REMOVE";
};
if (_arg1 == RECOLOR_HAND){
fRecolorHand.visible = true;
fItemName.text = "RECOLOR";
};
}
public function hideHand():void{
fRemoverHand.visible = false;
fRecolorHand.visible = false;
fItemName.text = "";
}
}
}//package smileymatcher
Section 80
//SpecialItem_HandMask (smileymatcher.SpecialItem_HandMask)
package smileymatcher {
import mx.core.*;
public class SpecialItem_HandMask extends BitmapAsset {
}
}//package smileymatcher
Section 81
//SpecialItem_MagicHand (smileymatcher.SpecialItem_MagicHand)
package smileymatcher {
import mx.core.*;
public class SpecialItem_MagicHand extends BitmapAsset {
}
}//package smileymatcher
Section 82
//SpecialItem_Remover (smileymatcher.SpecialItem_Remover)
package smileymatcher {
import mx.core.*;
public class SpecialItem_Remover extends BitmapAsset {
}
}//package smileymatcher
Section 83
//TextBalloon (smileymatcher.TextBalloon)
package smileymatcher {
import flash.display.*;
public class TextBalloon extends Shape {
public function TextBalloon(_arg1:int, _arg2:int){
graphics.beginFill(0xFFFFFF, 0.6);
graphics.lineStyle(2, 0x303030, 1);
graphics.drawRoundRect(0, 0, _arg1, _arg2, (_arg1 / 4), (_arg1 / 6));
graphics.endFill();
cacheAsBitmap = true;
}
}
}//package smileymatcher
Section 84
//TextBlinkAnimation (smileymatcher.TextBlinkAnimation)
package smileymatcher {
import smileygamer.*;
import flash.text.*;
public class TextBlinkAnimation extends AAnimation {
private var fTextField:TextField;
private var fPeriod:int;
private var fBlinkColor:int;
private var fNormalColor:int;
public function TextBlinkAnimation(_arg1:TextField, _arg2:int, _arg3:int, _arg4:int){
fTextField = _arg1;
fNormalColor = _arg2;
fBlinkColor = _arg3;
fPeriod = _arg4;
super(fTextField);
looping = true;
}
override public function update():void{
if (frame == 0){
if (fTextField.textColor == fNormalColor){
fTextField.textColor = fBlinkColor;
} else {
fTextField.textColor = fNormalColor;
};
};
}
override protected function get frameCount():int{
return (fPeriod);
}
}
}//package smileymatcher
Section 85
//TextFactory (smileymatcher.TextFactory)
package smileymatcher {
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class TextFactory {
public static const SIZE_LARGER:int = 64;
public static const SIZE_SMALLER:int = 14;
public static const COLOR_SELECTED:int = 16727839;
public static const SIZE_LARGE:int = 28;
public static const SIZE_NORMAL:int = 24;
public static const SIZE_SMALL:int = 16;
public static const COLOR_DEFAULT:int = 0xFFD800;
public static const DEFAULT_FONT:String = "bionic";
public static const SIZE_TITLE:int = 56;
public static const SIZE_LARGEST:int = 72;
private static var MainFont:Class = TextFactory_MainFont;
public static function createScoreText():TextField{
var _local1:TextField;
_local1 = createTextField(SIZE_LARGE);
_local1.autoSize = TextFieldAutoSize.RIGHT;
return (_local1);
}
public static function createCopyrightTextField(_arg1:String, _arg2:int=16727839):TextField{
var _local3:TextField;
var _local4:TextFormat;
var _local5:GlowFilter;
var _local6:DropShadowFilter;
_local3 = new TextField();
_local4 = new TextFormat("Arial", 14, _arg2);
_local4.bold = true;
_local3.autoSize = TextFieldAutoSize.LEFT;
_local3.mouseEnabled = false;
_local3.defaultTextFormat = _local4;
_local3.multiline = false;
_local5 = new GlowFilter(0, 0.6, 4, 4);
_local6 = new DropShadowFilter(2);
_local3.filters = [_local5, _local6];
_local3.text = _arg1;
return (_local3);
}
public static function createEditableTextField(_arg1:int=24, _arg2:int=0xFFD800, _arg3:String="bionic"):TextField{
var _local4:TextField;
_local4 = createTextField(_arg1, _arg2, _arg3);
_local4.autoSize = TextFieldAutoSize.NONE;
_local4.defaultTextFormat.align = TextFormatAlign.CENTER;
_local4.mouseEnabled = true;
_local4.type = TextFieldType.INPUT;
return (_local4);
}
public static function createGameText():TextField{
var _local1:TextField;
_local1 = createTextField(SIZE_LARGE, COLOR_SELECTED);
_local1.autoSize = TextFieldAutoSize.CENTER;
return (_local1);
}
private static function createFilters(_arg1:int, _arg2:Boolean):Array{
var _local3:Array;
_local3 = new Array();
switch (_arg1){
case SIZE_SMALLER:
_local3.push(new BevelFilter(1, 45, 0xFFFFFF, 1, 0, 0.8, 1.2, 1.2, 0.7, BitmapFilterQuality.HIGH));
_local3.push(new DropShadowFilter(2, 45, 0, 1, 2, 2, 0.8, BitmapFilterQuality.HIGH));
if (_arg2){
_local3.push(new GlowFilter(16777136, 0.75, 8, 8, 2, BitmapFilterQuality.HIGH));
} else {
_local3.push(new GlowFilter(0, 1, 2, 2, 2, BitmapFilterQuality.HIGH));
};
break;
case SIZE_SMALL:
case SIZE_NORMAL:
_local3.push(new BevelFilter(2, 45, 0xFFFFFF, 1, 0, 0.8, 1.2, 1.2, 0.7, BitmapFilterQuality.HIGH));
_local3.push(new DropShadowFilter(2, 45, 0, 1, 2, 2, 0.8, BitmapFilterQuality.HIGH));
if (_arg2){
_local3.push(new GlowFilter(16777136, 0.75, 8, 8, 2, BitmapFilterQuality.HIGH));
} else {
_local3.push(new GlowFilter(0, 1, 2, 2, 2, BitmapFilterQuality.HIGH));
};
break;
case SIZE_LARGE:
case SIZE_TITLE:
case SIZE_LARGER:
_local3.push(new BevelFilter(3, 45, 0xFFFFFF, 1, 0, 0.8, 2, 2, 0.7, BitmapFilterQuality.HIGH));
_local3.push(new DropShadowFilter(2, 45, 0, 1, 2, 2, 0.8, BitmapFilterQuality.HIGH));
if (_arg2){
_local3.push(new GlowFilter(16777136, 0.75, 16, 16, 2, BitmapFilterQuality.HIGH));
} else {
_local3.push(new GlowFilter(0, 1, 4, 4, 2, BitmapFilterQuality.HIGH));
};
break;
case SIZE_LARGEST:
_local3.push(new BevelFilter(5, 45, 0xFFFFFF, 1, 0, 0.8, 3, 3, 0.7, BitmapFilterQuality.HIGH));
_local3.push(new DropShadowFilter(3, 45, 0, 1, 3, 3, 0.8, BitmapFilterQuality.HIGH));
if (_arg2){
_local3.push(new GlowFilter(16777136, 0.75, 32, 32, 2, BitmapFilterQuality.HIGH));
} else {
_local3.push(new GlowFilter(0, 1, 4, 4, 2, BitmapFilterQuality.HIGH));
};
break;
};
return (_local3);
}
public static function createInfoTextField():TextField{
var _local1:TextField;
var _local2:TextFormat;
_local1 = new TextField();
_local2 = new TextFormat("Arial", 14, 0x303030);
_local2.bold = true;
_local1.autoSize = TextFieldAutoSize.LEFT;
_local1.mouseEnabled = false;
_local1.defaultTextFormat = _local2;
_local1.multiline = true;
return (_local1);
}
public static function createHelpTextField():TextField{
var _local1:TextField;
var _local2:TextFormat;
_local1 = createTextField(SIZE_SMALLER);
_local1.autoSize = TextFieldAutoSize.NONE;
_local2 = _local1.defaultTextFormat;
_local2.align = TextFormatAlign.CENTER;
_local1.defaultTextFormat = _local2;
_local1.wordWrap = true;
_local1.multiline = true;
return (_local1);
}
public static function createTextField(_arg1:int=24, _arg2:int=0xFFD800, _arg3:String="bionic", _arg4:Boolean=false):TextField{
var _local5:TextField;
var _local6:TextFormat;
_local5 = new TextField();
_local6 = new TextFormat(_arg3, _arg1, _arg2);
_local6.letterSpacing = 1;
_local6.rightMargin = Math.round((_arg1 / 10));
_local5.autoSize = TextFieldAutoSize.LEFT;
_local5.mouseEnabled = false;
_local5.embedFonts = true;
_local5.defaultTextFormat = _local6;
_local5.antiAliasType = AntiAliasType.ADVANCED;
_local5.multiline = false;
_local5.filters = createFilters(_arg1, _arg4);
return (_local5);
}
public static function createTextButton(_arg1:String, _arg2:int=24, _arg3:int=0xFFD800, _arg4:int=16727839, _arg5:String="bionic"):SimpleButton{
var _local6:TextField;
var _local7:TextField;
var _local8:SimpleButton;
_local6 = createTextField(_arg2, _arg3, _arg5);
_local6.text = _arg1;
_local7 = createTextField(_arg2, _arg4, _arg5);
_local7.text = _arg1;
_local8 = new SimpleButton(_local6, _local7, _local7, _local7);
return (_local8);
}
}
}//package smileymatcher
Section 86
//TextFactory_MainFont (smileymatcher.TextFactory_MainFont)
package smileymatcher {
import mx.core.*;
public class TextFactory_MainFont extends FontAsset {
}
}//package smileymatcher
Section 87
//TimeBar (smileymatcher.TimeBar)
package smileymatcher {
import flash.events.*;
import smileygamer.*;
import flash.filters.*;
public class TimeBar extends AProgressBar {
public function TimeBar(){
var _local1:BevelFilter;
super(1, 1, false);
addEventListener(Event.ENTER_FRAME, drawProgress);
_local1 = new BevelFilter(8, 45, 0xFFFFFF, 1, 0, 0.8, 8, 8, 0.7, BitmapFilterQuality.HIGH);
filters = [_local1];
}
private function drawProgress(_arg1:Event):void{
if (valueChanged){
graphics.clear();
graphics.beginFill(16727839);
graphics.drawRoundRect(0, (height - progress), width, progress, 6, 6);
graphics.endFill();
};
}
}
}//package smileymatcher
Section 88
//TitleButton (smileymatcher.TitleButton)
package smileymatcher {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class TitleButton extends SimpleButton {
private var fRadius:int;
private static const DIFFWIDTH:int = 230;
private static const COLOR:int = 3891199;
private static const WIDTH:int = 220;
private static const HEIGHT:int = 36;
private static const DIFFHEIGHT:int = 70;
private static const BIGWIDTH:int = 220;
private static const BIGHEIGHT:int = 70;
private static const COLOR_SEL:int = 5275903;
public function TitleButton(_arg1:String, _arg2:String=null, _arg3:Boolean=false){
var butheight:int;
var butwidth:int;
var normal:Sprite;
var background:Shape;
var textSize:int;
var tf:TextField;
var selected:Sprite;
var tfsel:TextField;
var bevel:BevelFilter;
var shadow:DropShadowFilter;
var playSound:Function;
var tf2:TextField;
var tfsel2:TextField;
var aTitle = _arg1;
var aTitle2 = _arg2;
var aBigSize = _arg3;
playSound = function (_arg1:Event):void{
SoundManager.playButton();
};
butheight = (aBigSize) ? BIGHEIGHT : ((aTitle2)!=null) ? DIFFHEIGHT : HEIGHT;
fRadius = (butheight / 2);
butwidth = (aBigSize) ? BIGWIDTH : ((aTitle2)!=null) ? DIFFWIDTH : WIDTH;
normal = new Sprite();
background = createBackground(butwidth, butheight);
normal.addChild(background);
textSize = (aBigSize) ? TextFactory.SIZE_TITLE : ((aTitle2)!=null) ? TextFactory.SIZE_LARGE : TextFactory.SIZE_NORMAL;
tf = TextFactory.createTextField(textSize);
tf.text = aTitle;
tf.x = ((normal.width - tf.width) / 2);
tf.y = (((normal.height - tf.height) / 2) + 1);
if (aBigSize){
tf.y = (tf.y + 2);
};
normal.addChild(tf);
if (aTitle2 != null){
tf2 = TextFactory.createTextField(TextFactory.SIZE_SMALL);
tf2.text = aTitle2;
tf2.x = ((normal.width - tf2.width) / 2);
tf.y = (tf.y - ((textSize / 2) - 1));
tf2.y = ((((normal.height - tf2.height) / 2) + (textSize / 2)) + 2);
normal.addChild(tf2);
};
normal.cacheAsBitmap = true;
selected = new Sprite();
selected.addChild(createBackground(butwidth, butheight, true));
tfsel = TextFactory.createTextField(textSize, TextFactory.COLOR_SELECTED);
tfsel.text = aTitle;
tfsel.x = ((selected.width - tfsel.width) / 2);
tfsel.y = (((selected.height - tfsel.height) / 2) + 1);
if (aBigSize){
tfsel.y = (tfsel.y + 2);
};
selected.addChild(tfsel);
if (aTitle2 != null){
tfsel2 = TextFactory.createTextField(TextFactory.SIZE_SMALL, TextFactory.COLOR_SELECTED);
tfsel2.text = aTitle2;
tfsel2.x = ((selected.width - tfsel2.width) / 2);
tfsel.y = (tfsel.y - ((textSize / 2) - 1));
tfsel2.y = ((((selected.height - tfsel2.height) / 2) + (textSize / 2)) + 2);
selected.addChild(tfsel2);
};
selected.cacheAsBitmap = true;
super(normal, selected, selected, background);
bevel = new BevelFilter(8, 45, 0xFFFFFF, 1, 0, 0.8, 8, 8, 0.7, BitmapFilterQuality.HIGH);
shadow = new DropShadowFilter(4);
shadow.alpha = 0.8;
shadow.quality = BitmapFilterQuality.HIGH;
filters = [bevel, shadow];
addEventListener(MouseEvent.MOUSE_OVER, playSound);
}
private function createBackground(_arg1:int, _arg2:int, _arg3:Boolean=false):Shape{
var _local4:Shape;
_local4 = new Shape();
_local4.graphics.beginFill((_arg3) ? COLOR_SEL : COLOR);
_local4.graphics.drawCircle(fRadius, fRadius, fRadius);
_local4.graphics.endFill();
_local4.graphics.beginFill((_arg3) ? COLOR_SEL : COLOR);
_local4.graphics.drawRect((_arg2 / 2), 0, _arg1, _arg2);
_local4.graphics.endFill();
return (_local4);
}
override public function get width():Number{
return ((super.width - fRadius));
}
}
}//package smileymatcher
Section 89
//TitleScreen (smileymatcher.TitleScreen)
package smileymatcher {
import flash.events.*;
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
import flash.filters.*;
public class TitleScreen extends Sprite implements ILogic {
private var fContinueLayer:Sprite;
private var fChallengeButton:SimpleButton;
private var fCreditsLayer:Sprite;
private var fSavedGame:Boolean;
private var fBestResultLayer:Sprite;
private var fSmiley:Sprite;
private var fRelaxedButton:SimpleButton;
private var fGame:SmileyMatcher;
private var fMoreGamesButton:SimpleButton;
private var fTitle:Sprite;
private var fChosenDiff:int;
private var fPlayButton:SimpleButton;
private var fCreditsButton:SimpleButton;
private var fState:int;// = 0
private var fHighscoresButton:SimpleButton;
private static const STATE_INVALID:int = 0;
private static const STATE_SHOWING:int = 1;
private static var TitleSmiley:Class = TitleScreen_TitleSmiley;
private static var SoundOnImage:Class = TitleScreen_SoundOnImage;
private static var TitleLeftHand:Class = TitleScreen_TitleLeftHand;
private static var TitleRightHand:Class = TitleScreen_TitleRightHand;
private static var SmileySmall:Class = TitleScreen_SmileySmall;
private static var SoundOffImage:Class = TitleScreen_SoundOffImage;
public function TitleScreen(_arg1:SmileyMatcher){
fState = STATE_INVALID;
super();
fGame = _arg1;
addEventListener(Event.ENTER_FRAME, added);
}
public function added(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, added);
init();
}
private function createTitleSmileyLayer():Sprite{
var _local1:Sprite;
var _local2:DropShadowFilter;
var _local3:DropShadowFilter;
var _local4:DisplayObject;
var _local5:DisplayObject;
var _local6:MoveAnimation;
var _local7:DisplayObject;
var _local8:MoveAnimation;
var _local9:int;
var _local10:SmileySprite;
_local1 = new Sprite();
_local2 = new DropShadowFilter(3);
_local2.alpha = 0.8;
_local2.quality = BitmapFilterQuality.HIGH;
_local3 = new DropShadowFilter(1, -135);
_local3.quality = BitmapFilterQuality.HIGH;
_local3.inner = true;
_local4 = new TitleSmiley();
_local4.x = (150 - (_local4.width / 2));
_local4.y = 60;
_local4.filters = [_local3, _local2];
_local1.addChild(_local4);
_local5 = new TitleLeftHand();
_local5.filters = [_local3, _local2];
_local1.addChild(_local5);
_local6 = new MoveAnimation(_local5, new Point(0, 140), new Point(0, 180), 30, InterpolationUtil.TYPE_COSINE, 0, false, true);
_local6.looping = true;
_local7 = new TitleRightHand();
_local7.filters = [_local3, _local2];
_local1.addChild(_local7);
_local8 = new MoveAnimation(_local7, new Point(220, 180), new Point(220, 140), 30, InterpolationUtil.TYPE_COSINE, 0, false, true);
_local8.looping = true;
_local9 = 0;
while (_local9 < 8) {
_local10 = SmileySprite.createSmileySprite(_local9);
new CircularMoveAnimation(_local10, new Point(150, 150), 120, 160, (_local9 * 20));
_local1.addChild(_local10);
_local9++;
};
return (_local1);
}
private function showBestResult(_arg1:Event):void{
var _local2:Array;
var _local3:TextBalloon;
var _local4:TextField;
_local2 = SaveData.getStats();
fBestResultLayer = new Sprite();
_local3 = new TextBalloon(120, 60);
fBestResultLayer.addChild(_local3);
_local4 = TextFactory.createInfoTextField();
_local4.text = ((("Best Result\nLevel: " + _local2[0]) + "\nScore: ") + _local2[1]);
_local4.x = 8;
_local4.y = 5;
fBestResultLayer.addChild(_local4);
fBestResultLayer.x = 380;
fBestResultLayer.y = 210;
new FadeAnimation(fBestResultLayer, 5, FadeAnimation.MODE_FADE_IN);
addChild(fBestResultLayer);
}
private function init():void{
var _local1:TextField;
var _local2:TextField;
var _local3:Matrix;
var _local4:SimpleButton;
var _local5:DropShadowFilter;
var _local6:DropShadowFilter;
var _local7:DisplayObject;
var _local8:DisplayObject;
var _local9:GlowFilter;
var _local10:SimpleButton;
var _local11:TextField;
var _local12:TextField;
var _local13:SimpleButton;
var _local14:TextField;
var _local15:TextField;
var _local16:SimpleButton;
fTitle = new Sprite();
_local1 = TextFactory.createTextField(TextFactory.SIZE_LARGEST, TextFactory.COLOR_SELECTED);
_local1.text = "Smiley";
_local1.x = 10;
_local1.y = 15;
_local1.cacheAsBitmap = true;
fTitle.addChild(_local1);
_local2 = TextFactory.createTextField(TextFactory.SIZE_LARGEST, TextFactory.COLOR_SELECTED);
_local2.text = "Puzzle";
_local2.x = 185;
_local2.y = 155;
_local3 = _local2.transform.matrix.clone();
_local3.rotate((-(Math.PI) / 10));
_local2.transform.matrix = _local3;
_local2.cacheAsBitmap = true;
fTitle.addChild(_local2);
_local4 = createSoundToggleButton();
_local4.x = (520 - _local4.width);
_local4.y = 20;
fTitle.addChild(_local4);
addChild(fTitle);
fSmiley = createTitleSmileyLayer();
fSmiley.x = 10;
fSmiley.y = 90;
addChild(fSmiley);
_local5 = new DropShadowFilter(1, -135);
_local5.alpha = 0.8;
_local5.quality = BitmapFilterQuality.HIGH;
_local5.inner = true;
_local6 = new DropShadowFilter(2);
_local6.alpha = 1;
_local6.quality = BitmapFilterQuality.HIGH;
_local7 = new SmileySmall();
_local7.filters = [_local5, _local6];
_local8 = new SmileySmall();
_local9 = new GlowFilter(16777176, 1, 16, 16, 2, BitmapFilterQuality.HIGH);
_local8.filters = [_local6, _local9];
_local10 = new SimpleButton(_local7, _local8, _local8, _local8);
_local10.x = 295;
_local10.y = 2;
_local10.addEventListener(MouseEvent.CLICK, showHome);
fTitle.addChild(_local10);
fPlayButton = new TitleButton("PLAY", null, true);
fPlayButton.x = (542 - fPlayButton.width);
fPlayButton.y = 130;
addChild(fPlayButton);
fPlayButton.addEventListener(MouseEvent.CLICK, play);
fHighscoresButton = new TitleButton("HIGHSCORES");
fHighscoresButton.x = (542 - fHighscoresButton.width);
fHighscoresButton.y = 220;
addChild(fHighscoresButton);
fHighscoresButton.addEventListener(MouseEvent.CLICK, showHighscores);
fCreditsButton = new TitleButton("CREDITS");
fCreditsButton.x = (542 - fCreditsButton.width);
fCreditsButton.y = 270;
addChild(fCreditsButton);
fCreditsButton.addEventListener(MouseEvent.CLICK, credits);
fMoreGamesButton = new TitleButton("MORE GAMES");
fMoreGamesButton.x = (542 - fMoreGamesButton.width);
fMoreGamesButton.y = 320;
if (!SmileyMatcher.SPONSORED){
addChild(fMoreGamesButton);
fMoreGamesButton.addEventListener(MouseEvent.CLICK, moreGames);
};
fChallengeButton = new TitleButton("CHALLENGE", "24 TIMED LEVELS");
fChallengeButton.x = 550;
fChallengeButton.y = 130;
addChild(fChallengeButton);
fChallengeButton.addEventListener(MouseEvent.CLICK, chooseDiff);
fChallengeButton.addEventListener(MouseEvent.MOUSE_OVER, showBestResult);
fChallengeButton.addEventListener(MouseEvent.MOUSE_OUT, hideBestResult);
fRelaxedButton = new TitleButton("RELAXED", "UNTIMED & ENDLESS");
fRelaxedButton.x = 550;
fRelaxedButton.y = 280;
addChild(fRelaxedButton);
fRelaxedButton.addEventListener(MouseEvent.CLICK, chooseDiff);
_local11 = TextFactory.createCopyrightTextField("Copyright 2007 SmileyGamer.com");
_local12 = TextFactory.createCopyrightTextField("Copyright 2007 SmileyGamer.com", TextFactory.COLOR_DEFAULT);
_local13 = new SimpleButton(_local11, _local12, _local12, _local12);
_local13.addEventListener(MouseEvent.CLICK, showHome);
_local13.x = (520 - _local13.width);
_local13.y = 376;
addChild(_local13);
if (!SmileyMatcher.SPONSORED){
_local14 = TextFactory.createCopyrightTextField("Put this game on your site");
_local15 = TextFactory.createCopyrightTextField("Put this game on your site", TextFactory.COLOR_DEFAULT);
_local16 = new SimpleButton(_local14, _local15, _local15, _local15);
_local16.addEventListener(MouseEvent.CLICK, addToSite);
_local16.x = 20;
_local16.y = 376;
addChild(_local16);
};
fState = STATE_SHOWING;
showTitle();
showMainButtons();
}
private function hideBestResult(_arg1:Event):void{
new FadeAnimation(fBestResultLayer, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
}
private function hideCredits(_arg1:Event):void{
var _local2:MoveAnimation;
_local2 = new MoveAnimation(fCreditsLayer, new Point((530 - fCreditsLayer.width), fCreditsLayer.y), new Point(550, fCreditsLayer.y), 15, InterpolationUtil.TYPE_COSINE, 0, true);
_local2.addCallback(showMainButtons);
}
private function showHighscores(_arg1:Event):void{
fGame.showHighscoresPage();
}
private function play(_arg1:Event):void{
hideMainButtons();
showDifficultyButtons();
}
private function hideDifficultyButtons():void{
new MoveAnimation(fChallengeButton, new Point((540 - fChallengeButton.width), fChallengeButton.y), new Point(550, fChallengeButton.y), 15, InterpolationUtil.TYPE_COSINE, 6);
new MoveAnimation(fRelaxedButton, new Point((540 - fRelaxedButton.width), fRelaxedButton.y), new Point(550, fRelaxedButton.y), 15, InterpolationUtil.TYPE_COSINE, 4);
}
private function showMainButtons():void{
new MoveAnimation(fPlayButton, new Point(550, fPlayButton.y), new Point((540 - fPlayButton.width), fPlayButton.y), 15, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(fHighscoresButton, new Point(550, fHighscoresButton.y), new Point((540 - fHighscoresButton.width), fHighscoresButton.y), 15, InterpolationUtil.TYPE_COSINE, 2);
new MoveAnimation(fCreditsButton, new Point(550, fCreditsButton.y), new Point((540 - fCreditsButton.width), fCreditsButton.y), 15, InterpolationUtil.TYPE_COSINE, 4);
new MoveAnimation(fMoreGamesButton, new Point(550, fMoreGamesButton.y), new Point((540 - fMoreGamesButton.width), fMoreGamesButton.y), 15, InterpolationUtil.TYPE_COSINE, 6);
}
private function showTitle():void{
new MoveAnimation(fTitle, new Point(0, -(fTitle.height)), new Point(0, 0), 15, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(fSmiley, new Point(10, 440), new Point(10, 90), 15, InterpolationUtil.TYPE_COSINE);
}
private function addToSite(_arg1:Event):void{
NetworkUtil.showGamesForSite();
}
private function startGame():void{
var anim:MoveAnimation;
var showGame:Function;
showGame = function ():void{
fGame.showGameScreen(fChosenDiff, fSavedGame);
};
anim = new MoveAnimation(fTitle, new Point(0, 0), new Point(0, -(fTitle.height)), 15, InterpolationUtil.TYPE_COSINE, 10);
new MoveAnimation(fSmiley, new Point(fSmiley.x, fSmiley.y), new Point(fSmiley.x, 440), 15, InterpolationUtil.TYPE_COSINE, 10);
anim.addCallback(showGame);
}
private function showHome(_arg1:Event):void{
NetworkUtil.showHome();
}
private function moreGames(_arg1:Event):void{
NetworkUtil.showHome();
}
private function credits(_arg1:Event):void{
var _local2:TextBalloon;
var _local3:TextField;
hideMainButtons();
fCreditsLayer = new Sprite();
fCreditsLayer.y = 150;
_local2 = new TextBalloon(180, 150);
fCreditsLayer.addChild(_local2);
_local3 = TextFactory.createInfoTextField();
_local3.text = ("Smiley Puzzle\nVersion 1.1\nby SmileyGamer.com\n\n" + "Coding and artwork by\nJochen De Schepper\n\nMusic by MazeMaster");
_local3.x = (_local2.x + 10);
_local3.y = (_local2.y + 5);
fCreditsLayer.addChild(_local3);
new MoveAnimation(fCreditsLayer, new Point(550, fCreditsLayer.y), new Point((530 - fCreditsLayer.width), fCreditsLayer.y), 15, InterpolationUtil.TYPE_COSINE, 20);
addChild(fCreditsLayer);
fCreditsLayer.addEventListener(MouseEvent.CLICK, hideCredits);
}
public function doLogic():void{
}
private function createSoundToggleButton():SimpleButton{
var soundOn:DisplayObject;
var soundOff:DisplayObject;
var button:SimpleButton;
var setButton:Function;
var toggleSound:Function;
setButton = function ():void{
if (SoundManager.sound){
button.overState = soundOn;
button.downState = soundOn;
button.upState = soundOn;
button.hitTestState = soundOn;
} else {
button.overState = soundOff;
button.downState = soundOff;
button.upState = soundOff;
button.hitTestState = soundOff;
};
};
toggleSound = function (_arg1:Event):void{
SoundManager.toggleSound();
setButton();
};
soundOn = new SoundOnImage();
soundOff = new SoundOffImage();
button = new SimpleButton();
setButton();
button.addEventListener(MouseEvent.CLICK, toggleSound);
return (button);
}
private function chooseDiff(_arg1:Event):void{
var _local2:Object;
hideDifficultyButtons();
if (_arg1.target == fChallengeButton){
fChosenDiff = GameScreen.MODE_CHALLENGE;
};
if (_arg1.target == fRelaxedButton){
fChosenDiff = GameScreen.MODE_RELAXED;
};
_local2 = SaveData.getSavedGame(fChosenDiff);
if (_local2 != null){
showContinueLayer(_local2);
} else {
fSavedGame = false;
startGame();
};
}
private function hideContinueLayer():void{
var _local1:MoveAnimation;
_local1 = new MoveAnimation(fContinueLayer, new Point(fContinueLayer.x, fContinueLayer.y), new Point(550, fContinueLayer.y), 15, InterpolationUtil.TYPE_COSINE, 0, true);
}
private function showDifficultyButtons():void{
new MoveAnimation(fChallengeButton, new Point(550, fChallengeButton.y), new Point((540 - fChallengeButton.width), fChallengeButton.y), 15, InterpolationUtil.TYPE_COSINE, 20);
new MoveAnimation(fRelaxedButton, new Point(550, fRelaxedButton.y), new Point((540 - fRelaxedButton.width), fRelaxedButton.y), 15, InterpolationUtil.TYPE_COSINE, 22);
}
private function hideMainButtons():void{
new MoveAnimation(fPlayButton, new Point((540 - fPlayButton.width), fPlayButton.y), new Point(550, fPlayButton.y), 15, InterpolationUtil.TYPE_COSINE, 6);
new MoveAnimation(fHighscoresButton, new Point((540 - fHighscoresButton.width), fHighscoresButton.y), new Point(550, fHighscoresButton.y), 15, InterpolationUtil.TYPE_COSINE, 4);
new MoveAnimation(fCreditsButton, new Point((540 - fCreditsButton.width), fCreditsButton.y), new Point(550, fCreditsButton.y), 15, InterpolationUtil.TYPE_COSINE, 2);
new MoveAnimation(fMoreGamesButton, new Point((540 - fMoreGamesButton.width), fMoreGamesButton.y), new Point(550, fMoreGamesButton.y), 15, InterpolationUtil.TYPE_COSINE);
}
private function showContinueLayer(_arg1:Object):void{
var balloon:TextBalloon;
var tf:TextField;
var continueButton:SimpleButton;
var continueGame:Function;
var newButton:SimpleButton;
var newGame:Function;
var top:int;
var aSaveGame = _arg1;
continueGame = function (_arg1:Event):void{
fSavedGame = true;
hideContinueLayer();
startGame();
};
newGame = function (_arg1:Event):void{
fSavedGame = false;
hideContinueLayer();
startGame();
};
fContinueLayer = new Sprite();
balloon = new TextBalloon(160, 80);
balloon.x = 40;
fContinueLayer.addChild(balloon);
tf = TextFactory.createInfoTextField();
tf.text = ((((("The game was last\nsaved in level " + aSaveGame.level) + ".\n") + "You can continue\nwith ") + aSaveGame.score) + " points.");
tf.x = (balloon.x + 8);
tf.y = (balloon.y + 5);
fContinueLayer.addChild(tf);
continueButton = new TitleButton("Continue");
continueButton.y = 95;
fContinueLayer.addChild(continueButton);
continueButton.addEventListener(MouseEvent.CLICK, continueGame);
newButton = new TitleButton("New Game");
newButton.y = 145;
fContinueLayer.addChild(newButton);
newButton.addEventListener(MouseEvent.CLICK, newGame);
top = (SmileyMatcher.SPONSORED) ? 125 : 150;
new MoveAnimation(fContinueLayer, new Point(550, top), new Point((540 - newButton.width), top), 15, InterpolationUtil.TYPE_COSINE, 20);
addChild(fContinueLayer);
}
}
}//package smileymatcher
Section 90
//TitleScreen_SmileySmall (smileymatcher.TitleScreen_SmileySmall)
package smileymatcher {
import mx.core.*;
public class TitleScreen_SmileySmall extends BitmapAsset {
}
}//package smileymatcher
Section 91
//TitleScreen_SoundOffImage (smileymatcher.TitleScreen_SoundOffImage)
package smileymatcher {
import mx.core.*;
public class TitleScreen_SoundOffImage extends BitmapAsset {
}
}//package smileymatcher
Section 92
//TitleScreen_SoundOnImage (smileymatcher.TitleScreen_SoundOnImage)
package smileymatcher {
import mx.core.*;
public class TitleScreen_SoundOnImage extends BitmapAsset {
}
}//package smileymatcher
Section 93
//TitleScreen_TitleLeftHand (smileymatcher.TitleScreen_TitleLeftHand)
package smileymatcher {
import mx.core.*;
public class TitleScreen_TitleLeftHand extends BitmapAsset {
}
}//package smileymatcher
Section 94
//TitleScreen_TitleRightHand (smileymatcher.TitleScreen_TitleRightHand)
package smileymatcher {
import mx.core.*;
public class TitleScreen_TitleRightHand extends BitmapAsset {
}
}//package smileymatcher
Section 95
//TitleScreen_TitleSmiley (smileymatcher.TitleScreen_TitleSmiley)
package smileymatcher {
import mx.core.*;
public class TitleScreen_TitleSmiley extends BitmapAsset {
}
}//package smileymatcher
Section 96
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.1");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
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 f:Function;
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);
};
if (clip._mochiad_loaded){
return (null);
};
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;
};
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;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
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];
};
};
_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++;
};
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
_arg1.removeChild(_arg1._mochiad);
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{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
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_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
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;
_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.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_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 _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 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 _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
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.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
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 r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
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_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
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);
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{
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.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
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.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;
_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);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_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{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
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 {
mc.removeEventListener(Event.ENTER_FRAME, f);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 97
//MochiAdPreloaderFactory (MochiAdPreloaderFactory)
package {
import flash.events.*;
import flash.display.*;
import smileymatcher.*;
import smileygamer.util.*;
import smileygamer.*;
import flash.utils.*;
public dynamic class MochiAdPreloaderFactory extends MovieClip {
private var fAdStarted:Boolean;
private var fAdFinishedTime:int;
private var fIntro:IntroScreen;
private var fProgress:Shape;
private var fAdFinished:Boolean;
private static const MAIN_CLASS:String = "SmileyMatcher";
public function MochiAdPreloaderFactory(){
var f:Function;
super();
f = function (_arg1:IOErrorEvent):void{
};
loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
stage.frameRate = 32;
stage.scaleMode = StageScaleMode.NO_SCALE;
stop();
NetworkUtil.init(stage, 657, "Smiley Puzzle", 540, 400);
NetworkUtil.tracking();
MochiBot.track(this, "2e405d44");
addChild(new Background());
fIntro = new IntroScreen();
addChild(fIntro);
if (!NetworkUtil.isHome()){
fIntro.addEventListener(MouseEvent.CLICK, clicked);
fIntro.buttonMode = true;
};
fAdStarted = false;
fAdFinished = false;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
if (NetworkUtil.isDomain("agame.com")){
adFinished();
fProgress = new Shape();
addChild(fProgress);
} else {
MochiAd.showPreGameAd({id:"c67a0f8a00139ff4", res:"540x400", clip:this, background:0xFFD800, color:15615, ad_started:adStarted, ad_finished:adFinished, no_bg:true});
};
}
public function init():void{
var mainClass:Class;
var app:Object;
try {
mainClass = (getDefinitionByName(MAIN_CLASS) as Class);
app = new (mainClass);
addChild((app as DisplayObject));
new FadeAnimation(fIntro, 15, FadeAnimation.MODE_FADE_OUT_REMOVE);
if (fProgress != null){
new FadeAnimation(fProgress, 15, FadeAnimation.MODE_FADE_OUT_REMOVE);
};
} catch(re:ReferenceError) {
};
}
private function clicked(_arg1:Event):void{
NetworkUtil.showHome();
}
public function adFinished():void{
fAdFinished = true;
fAdFinishedTime = getTimer();
if (!NetworkUtil.isHome()){
fIntro.addEventListener(MouseEvent.CLICK, clicked);
fIntro.buttonMode = true;
};
}
public function checkAdStarted(_arg1:Event):void{
if (!fAdStarted){
adFinished();
};
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
if ((((((loaderInfo.bytesLoaded == loaderInfo.bytesTotal)) && (fAdFinished))) && (((getTimer() - fAdFinishedTime) > 3000)))){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextFrame();
init();
} else {
if (fProgress != null){
_local2 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
_local3 = ((getTimer() - fAdFinishedTime) / 3000);
_local4 = Math.min(_local2, _local3, 1);
fProgress.graphics.clear();
fProgress.graphics.beginFill(0xFFD800);
fProgress.graphics.drawRect(10, (stage.stageHeight - 20), (stage.stageWidth - 20), 10);
fProgress.graphics.endFill();
fProgress.graphics.beginFill(4145151);
fProgress.graphics.drawRect(11, (stage.stageHeight - 19), ((stage.stageWidth - 21) * _local4), 8);
fProgress.graphics.endFill();
};
};
}
public function adStarted():void{
fAdStarted = true;
if (!NetworkUtil.isHome()){
fIntro.removeEventListener(MouseEvent.CLICK, clicked);
fIntro.buttonMode = false;
};
}
}
}//package
Section 98
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 99
//SmileyMatcher (SmileyMatcher)
package {
import flash.events.*;
import smileymatcher.*;
import smileygamer.*;
import flash.text.*;
import flash.utils.*;
import smileygamer.util.*;
import flash.ui.*;
public dynamic class SmileyMatcher extends AGame {
private var fHand:HandSprite;
private var fFPSTime:int;
private var fFPSField:TextField;
private var fFrame:int;// = 0
public static const SPONSORED:Boolean = false;
public static const GAMEID:int = 657;
public static var LOWFPS:Boolean = false;
public function SmileyMatcher(){
var added:Function;
fHand = new HandSprite();
fFrame = 0;
added = function (_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, added);
fFPSTime = getTimer();
Mouse.show();
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseUpdate);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpdate);
stage.addEventListener(MouseEvent.CLICK, mouseUpdate);
addChild(fHand);
fHand.x = mouseX;
fHand.y = mouseY;
showTitleScreen();
};
super();
SaveData.init();
addEventListener(Event.ENTER_FRAME, added);
}
public function isHome():Boolean{
var _local1:Boolean;
var _local2:Boolean;
_local1 = NetworkUtil.isDomain("www.flashgamelicense.com");
_local2 = NetworkUtil.isDomain("www.fantasticchoice.com");
return (((((((SPONSORED) || (NetworkUtil.isHome()))) || (_local1))) || (_local2)));
}
public function showTitleScreen():void{
addChildAt(new TitleScreen(this), 0);
SoundManager.playMusic();
}
public function mouseUpdate(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.CLICK){
Mouse.show();
Mouse.hide();
} else {
fHand.button(_arg1.buttonDown);
};
}
public function showHighscoresPage():void{
NetworkUtil.showHighscores();
}
public function showGameScreen(_arg1:int, _arg2:Boolean):void{
var _local3:GameScreen;
var _local4:Object;
if (_arg2){
_local4 = SaveData.getSavedGame(_arg1);
_local3 = new GameScreen(this, _arg1, _local4.level, _local4.score);
} else {
_local3 = new GameScreen(this, _arg1);
};
removeChildAt(0);
addChildAt(_local3, 0);
}
public function getHand():HandSprite{
return (fHand);
}
override public function mainLoop(_arg1:Event):void{
var _local2:int;
super.mainLoop(_arg1);
fHand.move(stage.mouseX, stage.mouseY);
fFrame++;
if ((fFrame % 10) == 0){
_local2 = int(((fFrame * 1000) / (getTimer() - fFPSTime)));
LOWFPS = (_local2 < 20);
fFrame = 0;
fFPSTime = getTimer();
};
}
}
}//package