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
//ComplexMovement (smileygamer.movement.ComplexMovement)
package smileygamer.movement {
public class ComplexMovement implements IMovement {
private var fType:int;// = 0
private var fIndex:int;
private var fMovements:Array;
public static const TYPE_SIMULTANEOUS:int = 0;
public static const TYPE_SEQUENTIAL:int = 1;
public function ComplexMovement(_arg1:Array, _arg2:int=0){
fType = TYPE_SIMULTANEOUS;
super();
fMovements = _arg1;
fType = _arg2;
fIndex = 0;
}
private function sequentialMove():Boolean{
if (fMovements[fIndex].move()){
fIndex++;
};
return ((fIndex == fMovements.length));
}
public function move():Boolean{
if (fType == TYPE_SEQUENTIAL){
return (sequentialMove());
};
return (simultaneousMove());
}
private function simultaneousMove():Boolean{
var _local1:Boolean;
var _local2:int;
_local1 = true;
_local2 = 0;
while (_local2 < fMovements.length) {
_local1 = ((fMovements[_local2].move()) && (_local1));
_local2++;
};
return (_local1);
}
}
}//package smileygamer.movement
Section 11
//IMovement (smileygamer.movement.IMovement)
package smileygamer.movement {
public interface IMovement {
function move():Boolean;
}
}//package smileygamer.movement
Section 12
//LinearMovement (smileygamer.movement.LinearMovement)
package smileygamer.movement {
import flash.display.*;
import smileygamer.util.*;
public class LinearMovement implements IMovement {
private var fObjectContainer:DisplayObjectContainer;
private var fMoves:int;
private var fObjects:Array;// = null
private var fMove:int;// = 0
private var fDX:Number;
private var fDY:Number;
private var fObjectFilter:IFilter;
public function LinearMovement(_arg1:DisplayObjectContainer, _arg2:int, _arg3:Number=1, _arg4:Number=1, _arg5:IFilter=null){
fObjects = null;
fMove = 0;
super();
fObjectContainer = _arg1;
fObjectFilter = _arg5;
fDX = _arg3;
fDY = _arg4;
fMoves = _arg2;
}
public function move():Boolean{
var _local1:int;
var _local2:DisplayObject;
var _local3:DisplayObject;
if (fMove == fMoves){
return (true);
};
if (fObjects == null){
fObjects = new Array();
_local1 = (fObjectContainer.numChildren - 1);
while (_local1 >= 0) {
_local2 = fObjectContainer.getChildAt(_local1);
if ((((fObjectFilter == null)) || (fObjectFilter.accept(_local2)))){
fObjects.push(_local2);
};
_local1--;
};
};
_local1 = 0;
while (_local1 < fObjects.length) {
_local3 = fObjects[_local1];
_local3.x = (_local3.x + fDX);
_local3.y = (_local3.y + fDY);
if ((fMove + 1) == fMoves){
_local3.x = Math.round(_local3.x);
_local3.y = Math.round(_local3.y);
};
_local1++;
};
fMove++;
return ((fMove == fMoves));
}
public function getObjects():DisplayObjectContainer{
return (fObjectContainer);
}
}
}//package smileygamer.movement
Section 13
//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):Array{
var _local4:Array;
var _local5:Rectangle;
var _local6:Point;
var _local7:BitmapData;
_local4 = new Array();
_local5 = new Rectangle(0, 0, _arg2, _arg3);
_local6 = new Point(0, 0);
_local5.y = 0;
while (_local5.y < _arg1.height) {
_local5.x = 0;
while (_local5.x < _arg1.width) {
_local7 = new BitmapData(_arg2, _arg3, true, 0);
_local7.copyPixels(_arg1.bitmapData, _local5, _local6);
_local4.push(new Bitmap(_local7));
_local5.x = (_local5.x + _arg2);
};
_local5.y = (_local5.y + _arg3);
};
return (_local4);
}
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 14
//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 15
//IFilter (smileygamer.util.IFilter)
package smileygamer.util {
public interface IFilter {
function accept(_arg1:Object):Boolean;
}
}//package smileygamer.util
Section 16
//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 17
//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) || (!((sReferer.indexOf(_arg1[_local3]) == -1))));
_local3++;
};
if (!_local2){
showNotAllowedWarning();
};
return (_local2);
}
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);
}
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 (!((sReferer.indexOf("smileygamer.com") == -1)));
}
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 getReferer():String{
var _local1:String;
_local1 = sStage.loaderInfo.loaderURL.toLowerCase();
if (_local1.indexOf("file://") == 0){
_local1 = "local";
};
if (_local1.indexOf("http://") == 0){
_local1 = _local1.substring(7);
};
if (_local1.indexOf("/") > 0){
_local1 = _local1.substring(0, _local1.indexOf("/"));
};
return (_local1);
}
public static function showHome():void{
showURL(((HOME + "?gameref=") + sID));
}
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) {
};
};
}
}
}//package smileygamer.util
Section 18
//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 19
//AAnimation (smileygamer.AAnimation)
package smileygamer {
import flash.events.*;
import flash.display.*;
public class AAnimation implements IAnimation {
private var fCallbacks:Array;
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();
}
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;
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));
}
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 20
//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 21
//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 22
//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;
}
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 23
//IAnimation (smileygamer.IAnimation)
package smileygamer {
public interface IAnimation {
function get finished():Boolean;
function update():void;
function get looping():Boolean;
}
}//package smileygamer
Section 24
//ILogic (smileygamer.ILogic)
package smileygamer {
public interface ILogic {
function doLogic():void;
}
}//package smileygamer
Section 25
//ImageAnimation (smileygamer.ImageAnimation)
package smileygamer {
import flash.display.*;
public class ImageAnimation extends AAnimation {
public function ImageAnimation(_arg1:DisplayObject){
super(_arg1);
}
}
}//package smileygamer
Section 26
//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 27
//ImageStripAnimation (smileygamer.ImageStripAnimation)
package smileygamer {
import flash.display.*;
public class ImageStripAnimation extends AAnimation {
private var fImageStrip:ImageStrip;
private var fIndices:Array;
private var fLastIndex:int;
public function ImageStripAnimation(_arg1:ImageStrip, _arg2:Array, _arg3:int=1, _arg4:Boolean=true, _arg5:Boolean=false){
var _local6:int;
fImageStrip = _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;
super(new Bitmap(new BitmapData(_arg1.width, _arg1.height, true, 0)));
looping = _arg4;
}
override protected function get frameCount():int{
return (fIndices.length);
}
override public function update():void{
var _local1:Bitmap;
_local1 = (displayObject as Bitmap);
if (fLastIndex != fIndices[frame]){
fLastIndex = fIndices[frame];
fImageStrip.copyImage(fLastIndex, _local1);
};
}
override public function reset():void{
fLastIndex = -1;
super.reset();
}
}
}//package smileygamer
Section 28
//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);
_local9 = 0;
while (_local9 < _local10.length) {
fXCoords.push(Math.round(_local10[_local9]));
fYCoords.push(Math.round(_local11[_local9]));
_local9++;
};
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 29
//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:Bitmap;
var _local4:Class;
if ((_arg1 is Bitmap)){
_local3 = (_arg1 as Bitmap);
_local2 = new Bitmap(_local3.bitmapData);
} else {
_local4 = (getDefinitionByName(getQualifiedClassName(_arg1)) as Class);
_local2 = new (_local4);
};
_local2.transform = _arg1.transform;
_local2.filters = _arg1.filters;
_local2.cacheAsBitmap = _arg1.cacheAsBitmap;
_local2.opaqueBackground = _arg1.opaqueBackground;
return (_local2);
}
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 30
//EasyLevelGame (smileymemory.gameplay.EasyLevelGame)
package smileymemory.gameplay {
public class EasyLevelGame implements ILevelGame {
private var fLevel:int;
private static const MOVETYPE:Array = new Array(15, 14, 19, 4, 5, 7, 8, 16, 19, 6, 9, 20, 16, 19, 6, 15, 14, 19, 6, 9, 16, 19, 6, 9, 19);
private static const LIFE:Array = new Array(150, 150, 120, 120, 120, 120, 120, 90, 90, 90, 90, 120, 120, 120, 120, 90, 90, 90, 120, 120, 120, 120, 120, 120, 120);
private static const MOVECOUNT:Array = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4);
private static const MOVETIME:Array = new Array(40, 30, 20, 30, 30, 30, 30, 15, 15, 15, 20, 10, 30, 30, 30, 15, 15, 15, 10, 20, 20, 20, 20, 20, 10);
private static const LEVELS:int = 25;
public function EasyLevelGame(_arg1:int=1){
fLevel = _arg1;
}
public function get life():int{
return (LIFE[(fLevel - 1)]);
}
public function get level():int{
return (fLevel);
}
public function get moveTime():int{
return (MOVETIME[(fLevel - 1)]);
}
public function get showingTime():int{
return (3);
}
public function nextLevel():void{
fLevel++;
}
public function get smileySize():int{
return (75);
}
public function get moveCount():int{
return (MOVECOUNT[(fLevel - 1)]);
}
public function get id():int{
return (0);
}
public function get totalLife():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < LEVELS) {
_local1 = (_local1 + LIFE[_local2]);
_local2++;
};
return (_local1);
}
public function get columns():int{
return (4);
}
public function get rows():int{
return (4);
}
public function get levelCount():int{
return (LEVELS);
}
public function get moveType():int{
return (MOVETYPE[(fLevel - 1)]);
}
public function get secondsPerTry():int{
return (5);
}
}
}//package smileymemory.gameplay
Section 31
//HardLevelGame (smileymemory.gameplay.HardLevelGame)
package smileymemory.gameplay {
public class HardLevelGame implements ILevelGame {
private var fLevel:int;
private static const MOVETYPE:Array = new Array(15, 14, 19, 4, 5, 7, 8, 16, 19, 6, 9, 20, 16, 19, 6, 15, 14, 19, 6, 9, 16, 19, 6, 9, 19);
private static const LIFE:Array = new Array(330, 330, 300, 300, 300, 300, 300, 240, 240, 240, 300, 300, 300, 300, 300, 240, 240, 240, 300, 300, 300, 300, 300, 300, 300);
private static const MOVECOUNT:Array = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4);
private static const MOVETIME:Array = new Array(90, 60, 45, 60, 60, 60, 60, 45, 45, 45, 45, 45, 60, 60, 60, 45, 45, 45, 45, 45, 60, 60, 60, 60, 40);
private static const LEVELS:int = 25;
public function HardLevelGame(_arg1:int=1){
fLevel = _arg1;
}
public function get life():int{
return (LIFE[(fLevel - 1)]);
}
public function get level():int{
return (fLevel);
}
public function get moveTime():int{
return (MOVETIME[(fLevel - 1)]);
}
public function get showingTime():int{
return (5);
}
public function nextLevel():void{
fLevel++;
}
public function get smileySize():int{
return (50);
}
public function get moveCount():int{
return (MOVECOUNT[(fLevel - 1)]);
}
public function get id():int{
return (2);
}
public function get totalLife():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < LEVELS) {
_local1 = (_local1 + LIFE[_local2]);
_local2++;
};
return (_local1);
}
public function get columns():int{
return (6);
}
public function get rows():int{
return (6);
}
public function get levelCount():int{
return (LEVELS);
}
public function get moveType():int{
return (MOVETYPE[(fLevel - 1)]);
}
public function get secondsPerTry():int{
return (4);
}
}
}//package smileymemory.gameplay
Section 32
//ILevelGame (smileymemory.gameplay.ILevelGame)
package smileymemory.gameplay {
public interface ILevelGame {
function get totalLife():int;
function get level():int;
function get moveCount():int;
function get showingTime():int;
function get levelCount():int;
function get columns():int;
function nextLevel():void;
function get smileySize():int;
function get rows():int;
function get moveType():int;
function get id():int;
function get life():int;
function get secondsPerTry():int;
function get moveTime():int;
}
}//package smileymemory.gameplay
Section 33
//NormalLevelGame (smileymemory.gameplay.NormalLevelGame)
package smileymemory.gameplay {
public class NormalLevelGame implements ILevelGame {
private var fLevel:int;
private static const MOVETYPE:Array = new Array(20, 14, 19, 4, 5, 7, 8, 16, 19, 6, 9, 20, 16, 19, 6, 15, 14, 19, 6, 9, 16, 19, 6, 9, 19);
private static const LIFE:Array = new Array(210, 210, 180, 180, 180, 180, 180, 150, 150, 150, 150, 180, 180, 180, 180, 150, 150, 150, 180, 180, 180, 180, 180, 180, 180);
private static const MOVECOUNT:Array = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4);
private static const MOVETIME:Array = new Array(60, 45, 30, 45, 45, 45, 45, 20, 20, 20, 30, 15, 45, 45, 45, 20, 20, 20, 15, 30, 30, 30, 30, 30, 15);
private static const LEVELS:int = 25;
public function NormalLevelGame(_arg1:int=1){
fLevel = _arg1;
}
public function get life():int{
return (LIFE[(fLevel - 1)]);
}
public function get level():int{
return (fLevel);
}
public function get moveTime():int{
return (MOVETIME[(fLevel - 1)]);
}
public function get showingTime():int{
return (4);
}
public function nextLevel():void{
fLevel++;
}
public function get smileySize():int{
return (75);
}
public function get moveCount():int{
return (MOVECOUNT[(fLevel - 1)]);
}
public function get id():int{
return (1);
}
public function get totalLife():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < LEVELS) {
_local1 = (_local1 + LIFE[_local2]);
_local2++;
};
return (_local1);
}
public function get columns():int{
return (6);
}
public function get rows():int{
return (4);
}
public function get levelCount():int{
return (LEVELS);
}
public function get moveType():int{
return (MOVETYPE[(fLevel - 1)]);
}
public function get secondsPerTry():int{
return (5);
}
}
}//package smileymemory.gameplay
Section 34
//VeryHardLevelGame (smileymemory.gameplay.VeryHardLevelGame)
package smileymemory.gameplay {
public class VeryHardLevelGame implements ILevelGame {
private var fLevel:int;
private static const MOVETYPE:Array = new Array(15, 14, 19, 4, 5, 7, 8, 16, 19, 6, 9, 20, 16, 19, 6, 15, 14, 19, 6, 9, 16, 19, 6, 9, 19);
private static const LIFE:Array = new Array(450, 450, 420, 420, 420, 420, 420, 360, 360, 360, 420, 420, 420, 420, 420, 360, 360, 360, 420, 420, 420, 420, 420, 420, 420);
private static const MOVECOUNT:Array = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, 2, 4);
private static const MOVETIME:Array = new Array(120, 90, 60, 90, 90, 90, 90, 45, 45, 45, 60, 45, 90, 90, 90, 45, 45, 45, 45, 45, 60, 60, 60, 60, 45);
private static const LEVELS:int = 25;
public function VeryHardLevelGame(_arg1:int=1){
fLevel = _arg1;
}
public function get life():int{
return (LIFE[(fLevel - 1)]);
}
public function get level():int{
return (fLevel);
}
public function get moveTime():int{
return (MOVETIME[(fLevel - 1)]);
}
public function get showingTime():int{
return (5);
}
public function nextLevel():void{
fLevel++;
}
public function get smileySize():int{
return (50);
}
public function get moveCount():int{
return (MOVECOUNT[(fLevel - 1)]);
}
public function get id():int{
return (3);
}
public function get totalLife():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < LEVELS) {
_local1 = (_local1 + LIFE[_local2]);
_local2++;
};
return (_local1);
}
public function get columns():int{
return (8);
}
public function get rows():int{
return (6);
}
public function get levelCount():int{
return (LEVELS);
}
public function get moveType():int{
return (MOVETYPE[(fLevel - 1)]);
}
public function get secondsPerTry():int{
return (3);
}
}
}//package smileymemory.gameplay
Section 35
//CoordinateFilter (smileymemory.movements.CoordinateFilter)
package smileymemory.movements {
import flash.display.*;
import smileygamer.util.*;
class CoordinateFilter implements IFilter {
private var fRow:Boolean;
private var fValue:int;
private var fSize:int;
function CoordinateFilter(_arg1:Boolean, _arg2:int, _arg3:int){
fRow = _arg1;
fValue = _arg2;
fSize = _arg3;
}
public function accept(_arg1:Object):Boolean{
var _local2:DisplayObject;
var _local3:int;
_local2 = (_arg1 as DisplayObject);
_local3 = int(((fValue * fSize) + (fSize / 2)));
return ((fRow) ? (int((_local2.x + (_local2.width / 2))) == _local3) : (int((_local2.y + (_local2.height / 2))) == _local3));
}
}
}//package smileymemory.movements
Section 36
//MovementFactory (smileymemory.movements.MovementFactory)
package smileymemory.movements {
import flash.display.*;
import smileygamer.movement.*;
import smileygamer.util.*;
public class MovementFactory {
private var fMovementsList:Array;
private var fSize:int;
private var fSpeed:Number;
private var fCols:int;
private var fObjectContainer:DisplayObjectContainer;
private var fRows:int;
public static const TYPE_BOARD_RANDOM:int = 6;
public static const TYPE_LINE_COL_RND:int = 14;
public static const TYPE_BOARD_VER:int = 5;
public static const TYPE_LINE_COL_UP:int = 10;
public static const TYPE_BOARD_LEFT:int = 2;
public static const TYPE_BOARD_RIGHT:int = 3;
public static const TYPE_LINE_ROW_LEFT:int = 12;
public static const TYPE_LINE_COL_DOWN:int = 11;
public static const TYPE_LINE_ROW_RIGHT:int = 13;
public static const TYPE_BOARD_UP:int = 0;
public static const TYPE_NEIGHBOUR_SWAP_RND:int = 19;
public static const TYPE_BOARD_DOWN:int = 1;
public static const TYPE_TOTAL_RANDOM:int = 20;
public static const TYPE_NEIGHBOUR_SWAP_HOR:int = 17;
public static const TYPE_BOARD_VER_MESH:int = 8;
public static const TYPE_BOARD_RANDOM_MESH:int = 9;
public static const TYPE_LINE_ROW_RND:int = 15;
public static const TYPE_BOARD_HOR:int = 4;
public static const TYPE_LINE_RANDOM:int = 16;
public static const TYPE_NEIGHBOUR_SWAP_VER:int = 18;
public static const TYPE_BOARD_HOR_MESH:int = 7;
private static var SWAPMOVES:int = 24;
private static var MOVES:int = 25;
public function MovementFactory(_arg1:int, _arg2:int, _arg3:int, _arg4:DisplayObjectContainer){
fMovementsList = new Array();
super();
fRows = _arg1;
fCols = _arg2;
fSize = _arg3;
fObjectContainer = _arg4;
fSpeed = (Number(_arg3) / MOVES);
}
public function createColMeshMovement():IMovement{
var _local1:Array;
var _local2:int;
var _local3:int;
_local1 = new Array(fCols);
_local2 = 0;
while (_local2 < _local1.length) {
_local3 = (((_local2 % 2) == 0)) ? fSpeed : -(fSpeed);
_local1[_local2] = new LinearMovement(fObjectContainer, MOVES, 0, _local3, new CoordinateFilter(true, _local2, fSize));
_local2++;
};
return (new ComplexMovement(_local1));
}
public function createVerSwapMovement():IMovement{
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:String;
var _local5:DisplayObject;
var _local6:DisplayObject;
var _local7:int;
var _local8:DisplayObject;
_local1 = RandomUtil.generateRandom(0, (fRows - 1));
_local2 = RandomUtil.generateRandom(0, fCols);
_local3 = ((_local1 + "-") + _local2);
_local4 = (((_local1 + 1) + "-") + _local2);
while (((!((fMovementsList.indexOf(_local3) == -1))) || (!((fMovementsList.indexOf(_local4) == -1))))) {
_local1 = RandomUtil.generateRandom(0, (fRows - 1));
_local2 = RandomUtil.generateRandom(0, fCols);
_local3 = ((_local1 + "-") + _local2);
_local4 = (((_local1 + 1) + "-") + _local2);
};
fMovementsList.push(_local3);
fMovementsList.push(_local4);
_local5 = null;
_local6 = null;
_local7 = 0;
while (_local7 < fObjectContainer.numChildren) {
_local8 = fObjectContainer.getChildAt(_local7);
if ((((Math.round(_local8.x) == (_local2 * fSize))) && ((Math.round(_local8.y) == (_local1 * fSize))))){
_local5 = _local8;
} else {
if ((((Math.round(_local8.x) == (_local2 * fSize))) && ((Math.round(_local8.y) == ((_local1 + 1) * fSize))))){
_local6 = _local8;
};
};
_local7++;
};
return (new SwapMovement(_local5, _local6, SWAPMOVES));
}
public function createComplexMovement(_arg1:int, _arg2:int):IMovement{
var _local3:Array;
var _local4:int;
if (_arg2 == 1){
return (createMovement(_arg1));
};
_local3 = new Array(_arg2);
_local4 = 0;
while (_local4 < _local3.length) {
_local3[_local4] = createMovement(_arg1);
_local4++;
};
fMovementsList = new Array();
if ((((((_arg1 == TYPE_NEIGHBOUR_SWAP_HOR)) || ((_arg1 == TYPE_NEIGHBOUR_SWAP_VER)))) || ((_arg1 == TYPE_NEIGHBOUR_SWAP_RND)))){
return (new ComplexMovement(_local3));
};
return (new ComplexMovement(_local3, ComplexMovement.TYPE_SEQUENTIAL));
}
public function createMovement(_arg1:int):IMovement{
var _local2:int;
var _local3:int;
switch (_arg1){
case TYPE_BOARD_UP:
return (new LinearMovement(fObjectContainer, MOVES, 0, -(fSpeed)));
case TYPE_BOARD_DOWN:
return (new LinearMovement(fObjectContainer, MOVES, 0, fSpeed));
case TYPE_BOARD_LEFT:
return (new LinearMovement(fObjectContainer, MOVES, -(fSpeed), 0));
case TYPE_BOARD_RIGHT:
return (new LinearMovement(fObjectContainer, MOVES, fSpeed, 0));
case TYPE_BOARD_HOR:
_local2 = (RandomUtil.randomBoolean()) ? -(fSpeed) : fSpeed;
return (new LinearMovement(fObjectContainer, MOVES, _local2, 0));
case TYPE_BOARD_VER:
_local3 = (RandomUtil.randomBoolean()) ? -(fSpeed) : fSpeed;
return (new LinearMovement(fObjectContainer, MOVES, 0, _local3));
case TYPE_BOARD_RANDOM:
return (createRandomBoardMovement());
case TYPE_BOARD_HOR_MESH:
return (createRowMeshMovement());
case TYPE_BOARD_VER_MESH:
return (createColMeshMovement());
case TYPE_BOARD_RANDOM_MESH:
if (RandomUtil.randomBoolean()){
return (createRowMeshMovement());
};
return (createColMeshMovement());
case TYPE_LINE_COL_UP:
return (createColMovement(true));
case TYPE_LINE_COL_DOWN:
return (createColMovement(false));
case TYPE_LINE_COL_RND:
return (createColMovement(RandomUtil.randomBoolean()));
case TYPE_LINE_ROW_LEFT:
return (createRowMovement(true));
case TYPE_LINE_ROW_RIGHT:
return (createRowMovement(false));
case TYPE_LINE_ROW_RND:
return (createRowMovement(RandomUtil.randomBoolean()));
case TYPE_LINE_RANDOM:
if (RandomUtil.randomBoolean()){
return (createRowMovement(RandomUtil.randomBoolean()));
};
return (createColMovement(RandomUtil.randomBoolean()));
case TYPE_NEIGHBOUR_SWAP_HOR:
return (createHorSwapMovement());
case TYPE_NEIGHBOUR_SWAP_VER:
return (createVerSwapMovement());
case TYPE_NEIGHBOUR_SWAP_RND:
if (RandomUtil.randomBoolean()){
return (createHorSwapMovement());
};
return (createVerSwapMovement());
case TYPE_TOTAL_RANDOM:
return (createMovement(RandomUtil.generateRandom(0, TYPE_NEIGHBOUR_SWAP_HOR)));
};
return (null);
}
public function createRowMovement(_arg1:Boolean):IMovement{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:String;
_local2 = (_arg1) ? -(fSpeed) : fSpeed;
_local3 = (fSize / fSpeed);
_local4 = RandomUtil.generateRandom(0, fRows);
_local5 = (("row" + _arg1) + _local4);
while (fMovementsList.indexOf(_local5) != -1) {
_local4 = RandomUtil.generateRandom(0, fRows);
_local5 = (("row" + _arg1) + _local4);
};
fMovementsList.push(_local5);
return (new LinearMovement(fObjectContainer, MOVES, _local2, 0, new CoordinateFilter(false, _local4, fSize)));
}
public function createHorSwapMovement():IMovement{
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:String;
var _local5:DisplayObject;
var _local6:DisplayObject;
var _local7:int;
var _local8:DisplayObject;
_local1 = RandomUtil.generateRandom(0, fRows);
_local2 = RandomUtil.generateRandom(0, (fCols - 1));
_local3 = ((_local1 + "-") + _local2);
_local4 = ((_local1 + "-") + (_local2 + 1));
while (((!((fMovementsList.indexOf(_local3) == -1))) || (!((fMovementsList.indexOf(_local4) == -1))))) {
_local1 = RandomUtil.generateRandom(0, fRows);
_local2 = RandomUtil.generateRandom(0, (fCols - 1));
_local3 = ((_local1 + "-") + _local2);
_local4 = ((_local1 + "-") + (_local2 + 1));
};
fMovementsList.push(_local3);
fMovementsList.push(_local4);
_local5 = null;
_local6 = null;
_local7 = 0;
while (_local7 < fObjectContainer.numChildren) {
_local8 = fObjectContainer.getChildAt(_local7);
if ((((Math.round(_local8.x) == (_local2 * fSize))) && ((Math.round(_local8.y) == (_local1 * fSize))))){
_local5 = _local8;
} else {
if ((((Math.round(_local8.x) == ((_local2 + 1) * fSize))) && ((Math.round(_local8.y) == (_local1 * fSize))))){
_local6 = _local8;
};
};
_local7++;
};
return (new SwapMovement(_local5, _local6, SWAPMOVES));
}
public function createColMovement(_arg1:Boolean):IMovement{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:String;
_local2 = (_arg1) ? -(fSpeed) : fSpeed;
_local3 = (fSize / fSpeed);
_local4 = RandomUtil.generateRandom(0, fCols);
_local5 = (("col" + _arg1) + _local4);
while (fMovementsList.indexOf(_local5) != -1) {
_local4 = RandomUtil.generateRandom(0, fRows);
_local5 = (("col" + _arg1) + _local4);
};
fMovementsList.push(_local5);
return (new LinearMovement(fObjectContainer, MOVES, 0, _local2, new CoordinateFilter(true, _local4, fSize)));
}
public function createRowMeshMovement():IMovement{
var _local1:Array;
var _local2:int;
var _local3:int;
_local1 = new Array(fRows);
_local2 = 0;
while (_local2 < _local1.length) {
_local3 = (((_local2 % 2) == 0)) ? fSpeed : -(fSpeed);
_local1[_local2] = new LinearMovement(fObjectContainer, MOVES, _local3, 0, new CoordinateFilter(false, _local2, fSize));
_local2++;
};
return (new ComplexMovement(_local1));
}
public function createRandomBoardMovement():IMovement{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = RandomUtil.generateRandom(0, 4);
_local2 = 0;
_local3 = 0;
switch (_local1){
case 0:
_local2 = -(fSpeed);
break;
case 1:
_local2 = fSpeed;
break;
case 2:
_local3 = -(fSpeed);
break;
case 3:
_local3 = fSpeed;
break;
};
return (new LinearMovement(fObjectContainer, MOVES, _local2, _local3));
}
}
}//package smileymemory.movements
Section 37
//SwapMovement (smileymemory.movements.SwapMovement)
package smileymemory.movements {
import flash.display.*;
import smileymemory.*;
import smileygamer.movement.*;
public class SwapMovement implements IMovement {
private var fSteps:int;
private var fCircleY:Array;
private var fCircleX:Array;
private var fObject1:SmileySprite;
private var fObject2:SmileySprite;
private var fStep:int;// = 0
public function SwapMovement(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:int){
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
fStep = 0;
super();
fObject1 = (_arg1 as SmileySprite);
fObject2 = (_arg2 as SmileySprite);
fSteps = _arg3;
_local4 = ((fObject1.x + fObject2.x) / 2);
_local5 = ((fObject1.y + fObject2.y) / 2);
_local6 = Math.sqrt((Math.pow((fObject1.x - _local4), 2) + Math.pow((fObject1.y - _local5), 2)));
_local7 = Math.atan2((fObject1.y - _local5), (fObject1.x - _local4));
fCircleX = new Array((fSteps * 2));
fCircleY = new Array((fSteps * 2));
_local8 = 0;
while (_local8 < fCircleX.length) {
fCircleX[_local8] = ((Math.cos((((Math.PI * _local8) / (fSteps - 1)) + _local7)) * _local6) + _local4);
fCircleY[_local8] = ((Math.sin((((Math.PI * _local8) / (fSteps - 1)) + _local7)) * _local6) + _local5);
_local8++;
};
fCircleX[0] = (fCircleX[((fSteps * 2) - 1)] = fObject1.x);
fCircleY[0] = (fCircleY[((fSteps * 2) - 1)] = fObject1.y);
fCircleX[(fSteps - 1)] = (fCircleX[fSteps] = fObject2.x);
fCircleY[(fSteps - 1)] = (fCircleY[fSteps] = fObject2.y);
}
public function move():Boolean{
if (fStep < fSteps){
fObject1.x = fCircleX[fStep];
fObject1.y = fCircleY[fStep];
fObject2.x = fCircleX[(fStep + fSteps)];
fObject2.y = fCircleY[(fStep + fSteps)];
fObject1.moving = true;
fObject2.moving = true;
fStep++;
} else {
fObject1.moving = false;
fObject2.moving = false;
};
return ((fStep == fSteps));
}
}
}//package smileymemory.movements
Section 38
//Background (smileymemory.Background)
package smileymemory {
import flash.display.*;
import flash.geom.*;
public class Background extends Shape {
public function Background(){
var _local1:Matrix;
super();
_local1 = new Matrix();
_local1.createGradientBox(500, 500, (-(Math.PI) / 4));
graphics.beginGradientFill(GradientType.LINEAR, new Array(0xBF4400, 0xFF5B00, 0xBF4400), new Array(1, 1, 1), new Array(31, 127, 223), _local1);
graphics.drawRect(0, 0, 500, 360);
cacheAsBitmap = true;
}
}
}//package smileymemory
Section 39
//BoardFrame (smileymemory.BoardFrame)
package smileymemory {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class BoardFrame extends Shape {
private var fBoardCorner:Point;
private var fLifeBarRect:Rectangle;
private static const MOVEBAR_RECT:Rectangle = new Rectangle(150, 330, 160, 15);
private static const COLOR:int = 0xFFD800;
public function BoardFrame(_arg1:int){
var _local2:int;
var _local3:int;
var _local4:BevelFilter;
var _local5:DropShadowFilter;
fLifeBarRect = new Rectangle(0, 25, 15, 280);
super();
_local2 = ((450 - _arg1) / 2);
_local3 = ((_local2 + _arg1) + 15);
fBoardCorner = new Point((_local2 + 15), 15);
fLifeBarRect.x = (_local3 + 10);
graphics.beginFill(COLOR);
graphics.drawRoundRect(_local2, 0, (_arg1 + 50), 330, 40, 40);
graphics.drawRoundRect(fBoardCorner.x, fBoardCorner.y, _arg1, 300, 20, 20);
graphics.drawRoundRect(fLifeBarRect.x, fLifeBarRect.y, fLifeBarRect.width, fLifeBarRect.height, 6, 6);
graphics.endFill();
graphics.beginFill(COLOR);
graphics.drawRoundRect(0, 315, 500, 70, 40, 40);
graphics.drawRoundRect(MOVEBAR_RECT.x, MOVEBAR_RECT.y, MOVEBAR_RECT.width, MOVEBAR_RECT.height, 6, 6);
graphics.endFill();
_local4 = new BevelFilter(8, 45, 0xFFFFFF, 1, 0, 0.8, 8, 8, 0.7, BitmapFilterQuality.HIGH);
_local5 = new DropShadowFilter(3);
_local5.alpha = 0.6;
_local5.quality = BitmapFilterQuality.HIGH;
filters = [_local4, _local5];
cacheAsBitmap = true;
}
public function get lifeBarRect():Rectangle{
return (fLifeBarRect);
}
public function get moveBarRect():Rectangle{
return (MOVEBAR_RECT);
}
public function get boardCorner():Point{
return (fBoardCorner);
}
}
}//package smileymemory
Section 40
//BoardLayer (smileymemory.BoardLayer)
package smileymemory {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import smileygamer.movement.*;
import smileygamer.util.*;
import smileymemory.movements.*;
public class BoardLayer extends Sprite {
private var fBoardBounds:Rectangle;
private var fMovementFactory:MovementFactory;
private var fMovement:IMovement;
private var fSmiley1:int;
private var fSmiley2:int;
private var fSmileysSprite:Sprite;
private var fState:int;// = 0
private var fTries:int;
private var fSmileys:Array;
public static const RES_MATCH:int = 1;
private static const NORMAL:int = 0;
public static const RES_MISMATCH:int = 2;
private static const MISMATCH:int = 2;
private static const FINISHED:int = 3;
private static const ONE_CLICKED:int = 1;
public static const RES_NONE:int = 0;
public function BoardLayer(){
fState = NORMAL;
super();
addEventListener(Event.ENTER_FRAME, update);
}
public function turnAll():void{
var _local1:int;
var _local2:SmileySprite;
_local1 = 0;
while (_local1 < fSmileys.length) {
_local2 = fSmileys[_local1];
_local2.turn();
_local1++;
};
}
public function init(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:int;
var _local8:Sprite;
_local4 = (numChildren - 1);
while (_local4 >= 0) {
removeChildAt(_local4);
_local4--;
};
_local5 = RandomUtil.generateRandomArray(((_arg3)==75) ? 12 : 24);
_local6 = RandomUtil.generateRandomArray((_arg1 * _arg2));
fSmileys = new Array((_arg1 * _arg2));
fBoardBounds = new Rectangle(0, 0, (_arg1 * _arg3), (_arg2 * _arg3));
fSmileysSprite = new Sprite();
_local7 = 0;
while (_local7 < fSmileys.length) {
fSmileys[_local7] = new SmileySprite(_local5[int((_local6[_local7] / 2))], _arg3, fBoardBounds);
fSmileys[_local7].x = ((_local7 % _arg1) * _arg3);
fSmileys[_local7].y = (int((_local7 / _arg1)) * _arg3);
fSmileysSprite.addChild(fSmileys[_local7]);
_local7++;
};
addChild(fSmileysSprite);
fState = NORMAL;
fTries = 0;
fMovementFactory = new MovementFactory(_arg2, _arg1, _arg3, fSmileysSprite);
_local8 = new Sprite();
_local8.graphics.beginFill(0xFF0000);
_local8.graphics.drawRect(-1, -1, ((_arg1 * _arg3) + 2), ((_arg2 * _arg3) + 2));
addChild(_local8);
mask = _local8;
turnAll();
}
private function moveSmileys():void{
var _local1:int;
var _local2:SmileySprite;
if (fMovement != null){
if (fMovement.move()){
fMovement = null;
_local1 = 0;
while (_local1 < fSmileys.length) {
_local2 = fSmileys[_local1];
_local2.moving = false;
_local1++;
};
};
_local1 = 0;
while (_local1 < fSmileys.length) {
_local2 = fSmileys[_local1];
_local2.locationChanged();
if (_local2.moving){
fSmileysSprite.setChildIndex(_local2, (fSmileysSprite.numChildren - 1));
};
_local1++;
};
};
}
public function clicked(_arg1:int, _arg2:int):int{
var _local3:int;
var _local4:int;
var _local5:Boolean;
var _local6:SmileySprite;
if (!fBoardBounds.contains(_arg1, _arg2)){
return (RES_NONE);
};
_local3 = -1;
_local4 = 0;
while (_local4 < fSmileys.length) {
if (fSmileys[_local4].containsPt(_arg1, _arg2)){
_local3 = _local4;
break;
};
_local4++;
};
if (_local3 == -1){
return (RES_NONE);
};
switch (fState){
case MISMATCH:
fSmileys[fSmiley1].turn();
fSmileys[fSmiley2].turn();
fState = NORMAL;
case NORMAL:
if (!fSmileys[_local3].isVisible()){
fSmiley1 = _local3;
fSmileys[fSmiley1].turn();
fState = ONE_CLICKED;
};
break;
case ONE_CLICKED:
if (!fSmileys[_local3].isVisible()){
fTries++;
fSmiley2 = _local3;
fSmileys[fSmiley2].turn();
if (fSmileys[fSmiley1].type == fSmileys[fSmiley2].type){
fState = NORMAL;
_local5 = true;
_local4 = 0;
while (_local4 < fSmileys.length) {
_local6 = fSmileys[_local4];
_local5 = ((_local5) && (_local6.isVisible()));
_local4++;
};
if (_local5){
fState = FINISHED;
};
return (RES_MATCH);
} else {
fState = MISMATCH;
return (RES_MISMATCH);
};
};
break;
};
return (RES_NONE);
}
public function doMovement(_arg1:int, _arg2:int):void{
fMovement = fMovementFactory.createComplexMovement(_arg1, _arg2);
}
public function get tries():int{
return (fTries);
}
public function isFinished():Boolean{
return ((fState == FINISHED));
}
public function update(_arg1:Event):void{
moveSmileys();
}
}
}//package smileymemory
Section 41
//BonusAnimation (smileymemory.BonusAnimation)
package smileymemory {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.text.*;
public class BonusAnimation extends AAnimation {
private var fSteps:int;
public function BonusAnimation(_arg1:DisplayObjectContainer, _arg2:String){
var _local3:TextField;
_local3 = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
_local3.defaultTextFormat.italic = true;
_local3.text = _arg2;
fSteps = (SmileyMemory.LOWFPS) ? 40 : 60;
super(_local3);
looping = false;
_arg1.addChild(_local3);
}
override protected function get frameCount():int{
return (fSteps);
}
override public function update():void{
if (frame == ((fSteps / 2) + 5)){
new MoveAnimation(displayObject, new Point((250 - (displayObject.width / 2)), 80), new Point(-(displayObject.width), 80), ((fSteps / 2) - 5), InterpolationUtil.TYPE_COSINE, 0, true);
};
}
override public function reset():void{
super.reset();
new MoveAnimation(displayObject, new Point(510, 80), new Point((250 - (displayObject.width / 2)), 80), ((fSteps / 2) - 5), InterpolationUtil.TYPE_COSINE);
}
}
}//package smileymemory
Section 42
//GameButton (smileymemory.GameButton)
package smileymemory {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class GameButton extends SimpleButton {
private static const COLOR:int = 0xFFD800;
private static const HEIGHT:int = 30;
private static const COLOR_SEL:int = 0xFF0000;
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);
tf.text = aTitle;
background = createBackground(tf.width);
normal.addChild(background);
tf.x = ((normal.width - tf.width) / 2);
tf.y = ((normal.height - (1.5 * tf.height)) / 2);
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 - (1.5 * tfsel.height)) / 2);
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 smileymemory
Section 43
//GameCompleteAnimation (smileymemory.GameCompleteAnimation)
package smileymemory {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.text.*;
public class GameCompleteAnimation extends AAnimation {
private var fCongrats:TextField;
private var fLevelField:TextField;
private var fScoreField:TextField;
private static const COLOR_BLUE:int = 15615;
public function GameCompleteAnimation(_arg1:DisplayObjectContainer, _arg2:int, _arg3:String, _arg4:ThumbsUpLayer){
var layer:Sprite;
var timeField:TextField;
var anim:MoveAnimation;
var addThumbsLayer:Function;
var aParent = _arg1;
var aScore = _arg2;
var aTime = _arg3;
var aThumbsUpLayer = _arg4;
addThumbsLayer = function ():void{
layer.addChild(aThumbsUpLayer);
};
layer = new Sprite();
fCongrats = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
fCongrats.text = "You did it!";
layer.addChild(fCongrats);
fScoreField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
fScoreField.text = ("Total score: " + aScore);
layer.addChild(fScoreField);
timeField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
timeField.text = ("Total time: " + aTime);
layer.addChild(timeField);
super(layer);
looping = true;
new MoveAnimation(fCongrats, new Point((250 - (fCongrats.width / 2)), -(fCongrats.height)), new Point((250 - (fCongrats.width / 2)), -30), 20, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(fScoreField, new Point(500, 50), new Point((250 - (fScoreField.width / 2)), 50), 20, InterpolationUtil.TYPE_COSINE, 5);
anim = new MoveAnimation(timeField, new Point(500, 90), new Point((250 - (timeField.width / 2)), 90), 20, InterpolationUtil.TYPE_COSINE, 10);
aThumbsUpLayer.x = (250 - (aThumbsUpLayer.width / 2));
aThumbsUpLayer.y = 160;
anim.addCallback(addThumbsLayer);
aParent.addChild(layer);
}
override protected function get frameCount():int{
return (20);
}
override public function update():void{
if ((frame % 10) == 0){
if (fCongrats.textColor == TextFactory.COLOR_DEFAULT){
fCongrats.textColor = COLOR_BLUE;
} else {
fCongrats.textColor = TextFactory.COLOR_DEFAULT;
};
};
}
public function endAnimation():void{
new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
}
}
}//package smileymemory
Section 44
//GameOverAnimation (smileymemory.GameOverAnimation)
package smileymemory {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.text.*;
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_DEFAULT, TextFactory.DEFAULT_FONT, true);
_local6.text = "Game Over";
_local5.addChild(_local6);
fLevelField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
fLevelField.text = ((("Reached level " + _arg3) + " of ") + _arg4);
fLevelField.x = 510;
fLevelField.y = 70;
_local5.addChild(fLevelField);
fScoreField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
fScoreField.text = ("Total score: " + _arg2);
fScoreField.x = 510;
fScoreField.y = 120;
_local5.addChild(fScoreField);
super(_local5);
looping = false;
new MoveAnimation(_local6, new Point((250 - (_local6.width / 2)), -(_local6.height)), new Point((250 - (_local6.width / 2)), -20), 20, InterpolationUtil.TYPE_COSINE);
_arg1.addChild(_local5);
}
override protected function get frameCount():int{
return (50);
}
override public function update():void{
if (frame == 20){
new MoveAnimation(fLevelField, new Point(510, 70), new Point((250 - (fLevelField.width / 2)), 70), 20, InterpolationUtil.TYPE_COSINE);
};
if (frame == 30){
new MoveAnimation(fScoreField, new Point(510, 120), new Point((250 - (fScoreField.width / 2)), 120), 20, InterpolationUtil.TYPE_COSINE);
};
}
public function endAnimation():void{
new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
}
}
}//package smileymemory
Section 45
//GameScreen (smileymemory.GameScreen)
package smileymemory {
import flash.events.*;
import flash.display.*;
import smileymemory.gameplay.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
import flash.filters.*;
import flash.ui.*;
public class GameScreen extends Sprite implements ILogic {
private var fBoardLayer:BoardLayer;
private var fBoardFrame:BoardFrame;
private var fLifeBar:LifeBar;
private var fLevelCompleteAnimation:LevelCompleteAnimation;
private var fMoveBar:MoveBar;
private var fClickField:TextField;
private var fTimeField:TextField;
private var fTotalTime:int;
private var fBoardBackground:Sprite;
private var fNameField:TextField;
private var fTime:int;
private var fGame:SmileyMemory;
private var fDownloadSprite:Sprite;
private var fSubmitSprite:Sprite;
private var fPausedLayer:Sprite;
private var fStartTime:int;
private var fPointsField:TextField;
private var fShowButton:SimpleButton;
private var fThumbsUpLayer:ThumbsUpLayer;
private var fTotalLife:int;
private var fEndShowingTimer:Timer;
private var fMessageField:TextField;
private var fLimitText:Sprite;
private var fHelpLayer:Sprite;
private var fLevelGame:ILevelGame;
private var fLevelCompleteTimer:Timer;
private var fState:int;// = 0
private var fPoints:int;
private var fMatches:int;// = 0
private var fTriesField:TextField;
private var fTickTimer:Timer;
private static const STATE_LIMIT_REACHED:int = 10;
private static const STATE_LEVEL_COMPLETE:int = 6;
private static const STATE_PAUSED:int = 5;
private static const STATE_INVALID:int = 0;
private static const STATE_HELP:int = 2;
private static const STATE_RUNNING:int = 4;
private static const STATE_SHOWING:int = 3;
private static const STATE_OUTRO:int = 9;
private static const BONUS_POINTS:int = 500;
private static const STATE_GAME_OVER:int = 7;
private static const STATE_GAME_WON:int = 8;
private static const MATCH_POINTS:int = 50;
private static const STATE_INTRO:int = 1;
private static var sHelpShown:Boolean = false;
public function GameScreen(_arg1:SmileyMemory, _arg2:ILevelGame, _arg3:int=0, _arg4:int=0, _arg5:int=0){
fState = STATE_INVALID;
fMatches = 0;
super();
fGame = _arg1;
fLevelGame = _arg2;
fPoints = _arg3;
fTotalLife = _arg4;
fTotalTime = _arg5;
y = 360;
addEventListener(Event.ADDED, added);
addEventListener(Event.REMOVED, removed);
}
public function added(_arg1:Event):void{
removeEventListener(Event.ADDED, added);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseUpdate);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseUpdate);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpdate);
stage.addEventListener(MouseEvent.CLICK, mouseUpdate);
init();
}
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 showLimitText():void{
var _local1:TextField;
var _local2:TextField;
var _local3:TextField;
var _local4:SimpleButton;
var _local5:TextField;
var _local6:TextField;
var _local7:SimpleButton;
fState = STATE_LIMIT_REACHED;
fLimitText = new Sprite();
_local1 = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
_local1.multiline = true;
_local1.wordWrap = true;
_local1.text = (("This version of Smiley Memory is limited to " + fLevelGame.level) + " of 25 levels on this difficulty!");
_local1.width = 460;
_local1.x = 20;
_local1.y = 0;
fLimitText.addChild(_local1);
_local2 = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
_local2.multiline = true;
_local2.wordWrap = true;
_local2.text = "Click here to download the full ad-free version to play offline.";
_local2.width = 460;
_local3 = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_SELECTED, TextFactory.DEFAULT_FONT, true);
_local3.multiline = true;
_local3.wordWrap = true;
_local3.text = "Click here to download the full ad-free version to play offline.";
_local3.width = 460;
_local4 = new SimpleButton(_local2, _local3, _local3, _local3);
_local4.addEventListener(MouseEvent.CLICK, limitClickDownload);
_local4.x = 20;
_local4.y = 120;
fLimitText.addChild(_local4);
_local5 = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
_local5.multiline = true;
_local5.wordWrap = true;
_local5.text = "Click here to play the full unlimited version at SmileyGamer.com!";
_local5.width = 460;
_local6 = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_SELECTED, TextFactory.DEFAULT_FONT, true);
_local6.multiline = true;
_local6.wordWrap = true;
_local6.text = "Click here to play the full unlimited version at SmileyGamer.com!";
_local6.width = 460;
_local7 = new SimpleButton(_local5, _local6, _local6, _local6);
_local7.addEventListener(MouseEvent.CLICK, limitClickFull);
_local7.x = 20;
_local7.y = 220;
fLimitText.addChild(_local7);
addChild(fLimitText);
}
private function init():void{
var _local1:int;
var _local2:PauseButton;
var _local3:MoveAnimation;
_local1 = (fLevelGame.columns * fLevelGame.smileySize);
fBoardFrame = new BoardFrame(_local1);
fBoardLayer = new BoardLayer();
fBoardLayer.init(fLevelGame.columns, fLevelGame.rows, fLevelGame.smileySize);
fBoardLayer.x = fBoardFrame.boardCorner.x;
fBoardLayer.y = fBoardFrame.boardCorner.y;
addChild(fBoardLayer);
addChild(fBoardFrame);
fMoveBar = new MoveBar();
fMoveBar.maxValue = fLevelGame.moveTime;
fMoveBar.value = fLevelGame.moveTime;
fMoveBar.x = fBoardFrame.moveBarRect.x;
fMoveBar.y = fBoardFrame.moveBarRect.y;
fMoveBar.width = fBoardFrame.moveBarRect.width;
fMoveBar.height = fBoardFrame.moveBarRect.height;
addChild(fMoveBar);
fLifeBar = new LifeBar();
fLifeBar.maxValue = fLevelGame.life;
fLifeBar.value = fLevelGame.life;
fLifeBar.x = fBoardFrame.lifeBarRect.x;
fLifeBar.y = fBoardFrame.lifeBarRect.y;
fLifeBar.width = fBoardFrame.lifeBarRect.width;
fLifeBar.height = fBoardFrame.lifeBarRect.height;
addChild(fLifeBar);
fTriesField = TextFactory.createTextField();
fTriesField.x = 15;
fTriesField.y = 302;
fTriesField.width = 130;
fTriesField.height = 18;
fTriesField.text = (("TRIES: " + fBoardLayer.tries) + " ");
addChild(fTriesField);
fTimeField = TextFactory.createTextField();
fTimeField.x = 15;
fTimeField.y = 321;
fTimeField.width = 130;
fTimeField.height = 18;
fTimeField.text = "TIME: 0:00 ";
addChild(fTimeField);
fPointsField = TextFactory.createTextField(TextFactory.SIZE_LARGE);
fPointsField.autoSize = TextFieldAutoSize.RIGHT;
fPointsField.x = 355;
fPointsField.y = 293;
fPointsField.width = 135;
fPointsField.height = 30;
fPointsField.text = " ";
addChild(fPointsField);
_local2 = new PauseButton();
_local2.x = 325;
_local2.y = 322;
addChild(_local2);
_local2.addEventListener(MouseEvent.CLICK, pauseGame);
fClickField = TextFactory.createTextField(TextFactory.SIZE_NORMAL, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
fClickField.autoSize = TextFieldAutoSize.CENTER;
fClickField.text = "Click to continue...";
fClickField.x = (250 - (fClickField.width / 2));
fClickField.y = 250;
fClickField.visible = false;
addChild(fClickField);
fState = STATE_INTRO;
_local3 = new MoveAnimation(this, new Point(0, 360), new Point(0, 0), 20, InterpolationUtil.TYPE_LINEAR);
if (!sHelpShown){
_local3.addCallback(startHelp);
} else {
_local3.addCallback(startGame);
};
}
private function levelFinished():void{
fTickTimer.stop();
if (fMatches > 2){
fLevelCompleteTimer.delay = 2000;
} else {
fLevelCompleteTimer.delay = 1000;
};
fTotalLife = (fTotalLife + fLifeBar.value);
fTotalTime = (fTotalTime + fTime);
fLevelCompleteTimer.start();
}
private function createPausedLayer():Sprite{
var _local1:Sprite;
var _local2:TextField;
var _local3:SimpleButton;
var _local4:SimpleButton;
_local1 = new Sprite();
_local2 = TextFactory.createTextField(TextFactory.SIZE_LARGEST, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
_local2.text = "PAUSED";
_local2.x = (250 - (_local2.width / 2));
_local2.y = 35;
_local1.addChild(_local2);
_local3 = new GameButton("RESUME GAME");
_local3.y = 190;
_local1.addChild(_local3);
_local3.addEventListener(MouseEvent.CLICK, unpauseGame);
_local4 = new GameButton("SAVE & END GAME");
_local4.y = 190;
_local1.addChild(_local4);
_local4.addEventListener(MouseEvent.CLICK, endGame);
_local3.x = (250 - (((_local3.width + _local4.width) + 20) / 2));
_local4.x = ((_local3.x + _local3.width) + 20);
return (_local1);
}
private function limitClickDownload(_arg1:Event):void{
var _local2:Sprite;
fGame.showDownloadPage();
removeChild(fLimitText);
fLimitText = null;
fState = STATE_GAME_OVER;
new GameOverAnimation(this, fPoints, fLevelGame.level, fLevelGame.levelCount);
_local2 = createEndGameButtonLayer();
new MoveAnimation(_local2, new Point(500, 0), new Point((250 - (_local2.width / 2)), 0), 20, InterpolationUtil.TYPE_COSINE);
addChild(_local2);
SaveData.endGame(fLevelGame.id, fLevelGame.level, fPoints, 0);
}
private function addPoints(_arg1:int):void{
fPoints = (fPoints + _arg1);
fPointsField.text = ("" + fPoints);
}
private function createHelpLayer():Sprite{
var _local1:Sprite;
var _local2:TextBalloon;
var _local3:TextField;
var _local4:GameButton;
var _local5:TextBalloon;
var _local6:TextField;
var _local7:TextBalloon;
var _local8:TextField;
var _local9:TextBalloon;
var _local10:TextField;
var _local11:TextBalloon;
var _local12:TextField;
_local1 = new Sprite();
_local2 = new TextBalloon(328, 116);
_local2.x = 32;
_local2.y = 20;
_local1.addChild(_local2);
_local3 = TextFactory.createHelpTextField();
_local3.text = (((("Goal: find all matching pairs of smileys!\n" + "A level starts with all smileys facing up.\n") + "Remember as many as possible! \n\n") + "Click on faced-down smiley to turn around.\n") + "Then try to find the matching smiley.");
_local3.x = (_local2.x + 12);
_local3.y = (_local2.y + 8);
_local1.addChild(_local3);
_local4 = new GameButton("Start game");
_local4.x = (_local2.x + ((_local2.width - _local4.width) / 2));
_local4.y = ((_local2.y + _local2.height) + 8);
_local1.addChild(_local4);
_local4.addEventListener(MouseEvent.CLICK, stopHelp);
_local5 = new TextBalloon(180, 100);
_local5.x = (496 - _local5.width);
_local5.y = 150;
_local1.addChild(_local5);
_local6 = TextFactory.createHelpTextField();
_local6.text = (((("Life indicator: when it\n" + "runs empty, the game\n") + "is over! Decreases\n") + "with time and each\n") + "mismatch you make.");
_local6.x = (_local5.x + 12);
_local6.y = (_local5.y + 8);
_local1.addChild(_local6);
_local7 = new TextBalloon(286, 68);
_local7.x = 32;
_local7.y = 250;
_local1.addChild(_local7);
_local8 = TextFactory.createHelpTextField();
_local8.text = (("Next move indicator: when empty,\n" + "some smileys will move around!\n") + "Decreases with time and mismatches.");
_local8.x = (_local7.x + 12);
_local8.y = (_local7.y + 8);
_local1.addChild(_local8);
_local9 = new TextBalloon(62, 26);
_local9.x = 328;
_local9.y = 300;
_local1.addChild(_local9);
_local10 = TextFactory.createHelpTextField();
_local10.text = "Pause";
_local10.x = (_local9.x + 8);
_local10.y = (_local9.y + 2);
_local1.addChild(_local10);
_local11 = new TextBalloon(62, 26);
_local11.x = (490 - _local11.width);
_local11.y = 300;
_local1.addChild(_local11);
_local12 = TextFactory.createHelpTextField();
_local12.text = "Score";
_local12.x = (_local11.x + 8);
_local12.y = (_local11.y + 2);
_local1.addChild(_local12);
return (_local1);
}
private function stopHelp(_arg1:Event):void{
removeChild(fHelpLayer);
fBoardLayer.turnAll();
startGame();
}
private function showHighscores(_arg1:Event):void{
fGame.showHighscoresPage();
}
public function removed(_arg1:Event):void{
removeEventListener(Event.REMOVED, removed);
}
private function endShowing(_arg1:Event):void{
fBoardLayer.turnAll();
fState = STATE_RUNNING;
fStartTime = getTimer();
fTime = 0;
fTickTimer.start();
fMatches = 0;
}
private function startGame():void{
fState = STATE_SHOWING;
fPointsField.text = ("" + fPoints);
fEndShowingTimer = new Timer((fLevelGame.showingTime * 1000), 1);
fEndShowingTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endShowing);
fEndShowingTimer.start();
new LevelAnimation(this, fLevelGame.level);
fTickTimer = new Timer(100);
fTickTimer.addEventListener(TimerEvent.TIMER, tick);
fLevelCompleteTimer = new Timer(1000, 1);
fLevelCompleteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, showLevelComplete);
}
private function tick(_arg1:TimerEvent):void{
fMoveBar.value = (fMoveBar.value - 0.1);
fLifeBar.value = (fLifeBar.value - 0.1);
checkBars();
}
private function showDownloadMessage():void{
var balloon:TextBalloon;
var text1:TextField;
var text2:TextField;
var text2sel:TextField;
var dlbutton:SimpleButton;
var text3:TextField;
var text3sel:TextField;
var contbutton:SimpleButton;
var dlclick:Function;
var contclick:Function;
var dlgone:Function;
dlclick = function (_arg1:Event):void{
var _local2:MoveAnimation;
fGame.showDownloadPage();
_local2 = new MoveAnimation(fDownloadSprite, new Point(100, 40), new Point(-310, 40), 20, InterpolationUtil.TYPE_COSINE, 0, true);
_local2.addCallback(dlgone);
};
contclick = function (_arg1:Event):void{
var _local2:MoveAnimation;
_local2 = new MoveAnimation(fDownloadSprite, new Point(100, 40), new Point(-310, 40), 20, InterpolationUtil.TYPE_COSINE, 0, true);
_local2.addCallback(dlgone);
};
dlgone = function ():void{
fDownloadSprite = null;
};
fDownloadSprite = new Sprite();
balloon = new TextBalloon(300, 250);
balloon.x = 0;
balloon.y = 0;
fDownloadSprite.addChild(balloon);
text1 = TextFactory.createHelpTextField();
text1.width = 275;
text1.multiline = true;
text1.wordWrap = true;
text1.text = ((((("Did you know that you can also download this game?\n\nBenefits of downloading:\n" + " - play offline, no browser needed!\n") + " - full unlimited version, all 100 levels!\n") + " - contains no ads!\n") + " - max speed & smoother animations!\n") + " - no interruptions like this one ;)");
text1.x = (balloon.x + 12);
text1.y = (balloon.y + 8);
fDownloadSprite.addChild(text1);
text2 = TextFactory.createHelpTextField();
text2.width = 275;
text2.text = "Click here to download the full version of Smiley Memory!";
text2.textColor = 208;
text2.multiline = true;
text2.wordWrap = true;
text2sel = TextFactory.createHelpTextField();
text2sel.width = 275;
text2sel.text = "Click here to download the full version of Smiley Memory!";
text2sel.textColor = 0xD00000;
text2sel.multiline = true;
text2sel.wordWrap = true;
dlbutton = new SimpleButton(text2, text2sel, text2sel, text2sel);
dlbutton.x = (balloon.x + 12);
dlbutton.y = ((text1.y + text1.height) + 18);
fDownloadSprite.addChild(dlbutton);
dlbutton.addEventListener(MouseEvent.CLICK, dlclick);
text3 = TextFactory.createHelpTextField();
text3.text = "Click here to continue";
text3.textColor = 208;
text3sel = TextFactory.createHelpTextField();
text3sel.text = "Click here to continue";
text3sel.textColor = 0xD00000;
contbutton = new SimpleButton(text3, text3sel, text3sel, text3sel);
contbutton.x = (balloon.x + 12);
contbutton.y = ((dlbutton.y + dlbutton.height) + 8);
fDownloadSprite.addChild(contbutton);
contbutton.addEventListener(MouseEvent.CLICK, contclick);
new MoveAnimation(fDownloadSprite, new Point(510, 40), new Point(100, 40), 20, InterpolationUtil.TYPE_COSINE, 20);
addChild(fDownloadSprite);
}
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 endGame(_arg1:Event):void{
var anim:MoveAnimation;
var showTitle:Function;
var showAd:Function;
var ind:int;
var e = _arg1;
showTitle = function ():void{
Mouse.hide();
fGame.showTitleScreen();
};
showAd = function ():void{
Mouse.show();
MochiAd.showInterLevelAd({id:"8f19ee7d1849c4a4", res:"500x360", 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);
ind = NetworkUtil.getReferer().indexOf("agame.com");
if ((((ind == 0)) || ((((ind > 0)) && ((NetworkUtil.getReferer().charAt((ind - 1)) == ".")))))){
anim.addCallback(showTitle);
} else {
anim.addCallback(showAd);
};
}
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=" + SmileyMemory.GAMEID) + "&mode=") + fLevelGame.id) + "&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 startHelp():void{
fState = STATE_HELP;
fBoardLayer.turnAll();
fPointsField.text = "32850";
fHelpLayer = createHelpLayer();
addChild(fHelpLayer);
sHelpShown = true;
}
private function formatTime(_arg1:int):String{
return ((((int((_arg1 / 60)) + ":") + (((_arg1 % 60) < 10)) ? "0" : "") + (_arg1 % 60)));
}
public function doLogic():void{
var ind:int;
var adFinished:Function;
switch (fState){
case STATE_RUNNING:
if (((((getTimer() - fStartTime) > 1000)) && (fTickTimer.running))){
fStartTime = getTimer();
fTime++;
fTimeField.text = ("TIME: " + formatTime(fTime));
};
break;
case STATE_LEVEL_COMPLETE:
if (((fLevelCompleteAnimation.finished) && ((fLifeBar.value > 0)))){
fLifeBar.value--;
addPoints(10);
fThumbsUpLayer.count++;
if (((SmileyMemory.LOWFPS) && ((fLifeBar.value > 0)))){
fLifeBar.value--;
addPoints(10);
fThumbsUpLayer.count++;
};
if (fLifeBar.value <= 0){
ind = NetworkUtil.getReferer().indexOf("agame.com");
if (((((!(fGame.isHomeSite())) && (((fLevelGame.level % 4) == 0)))) && ((ind == -1)))){
adFinished = function ():void{
Mouse.hide();
fClickField.visible = true;
};
Mouse.show();
MochiAd.showInterLevelAd({id:"8f19ee7d1849c4a4", res:"500x360", clip:fGame, ad_started:function ():void{
}, ad_finished:adFinished, no_bg:true});
} else {
fClickField.visible = true;
};
};
};
break;
};
}
private function limitClickFull(_arg1:Event):void{
var _local2:Sprite;
NetworkUtil.showGameAtHome();
removeChild(fLimitText);
fLimitText = null;
fState = STATE_GAME_OVER;
new GameOverAnimation(this, fPoints, fLevelGame.level, fLevelGame.levelCount);
_local2 = createEndGameButtonLayer();
new MoveAnimation(_local2, new Point(500, 0), new Point((250 - (_local2.width / 2)), 0), 20, InterpolationUtil.TYPE_COSINE);
addChild(_local2);
SaveData.endGame(fLevelGame.id, fLevelGame.level, fPoints, 0);
}
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 (SmileyMemory.DOWNLOADABLE){
menuButton = new GameButton("BACK TO MENU");
menuButton.x = (400 - menuButton.width);
menuButton.y = 260;
layer.addChild(menuButton);
menuButton.addEventListener(MouseEvent.CLICK, endGame);
} else {
other = function (_arg1:Event):void{
fGame.showSponsorSite();
};
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 = (400 - otherButton.width);
otherButton.y = 260;
layer.addChild(otherButton);
otherButton.addEventListener(MouseEvent.CLICK, other);
};
fSubmitSprite = new Sprite();
layer.addChild(fSubmitSprite);
submitButton = new GameButton("SUBMIT");
submitButton.x = (400 - submitButton.width);
submitButton.y = 210;
fSubmitSprite.addChild(submitButton);
submitButton.addEventListener(MouseEvent.CLICK, submitScore);
bg = new Shape();
bg.graphics.lineStyle(1, 0xFF0000);
bg.graphics.beginFill(0xFFD800);
bg.graphics.drawRect(0, 0, (380 - submitButton.width), 30);
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;
fSubmitSprite.addChild(bg);
fNameField = TextFactory.createEditableTextField();
fNameField.maxChars = 16;
fNameField.x = 0;
fNameField.y = 198;
fNameField.width = (380 - submitButton.width);
fNameField.height = 30;
fSubmitSprite.addChild(fNameField);
if (SaveData.name != null){
fNameField.text = SaveData.name;
};
fShowButton = new GameButton("SHOW");
fShowButton.x = (400 - fShowButton.width);
fShowButton.y = 210;
fShowButton.visible = false;
layer.addChild(fShowButton);
fShowButton.addEventListener(MouseEvent.CLICK, showHighscores);
fMessageField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
fMessageField.autoSize = TextFieldAutoSize.NONE;
fMessageField.x = 0;
fMessageField.y = 180;
fMessageField.width = (390 - fShowButton.width);
fMessageField.visible = false;
layer.addChild(fMessageField);
return (layer);
}
public function mouseUpdate(_arg1:MouseEvent):void{
var _local2:int;
var _local3:Sprite;
var _local4:ThumbsUpLayer;
switch (fState){
case STATE_RUNNING:
if (_arg1.type == MouseEvent.MOUSE_DOWN){
if (!fBoardLayer.isFinished()){
_local2 = fBoardLayer.clicked(fBoardLayer.mouseX, fBoardLayer.mouseY);
if (_local2 == BoardLayer.RES_MISMATCH){
fMoveBar.value = (fMoveBar.value - fLevelGame.secondsPerTry);
fLifeBar.value = (fLifeBar.value - fLevelGame.secondsPerTry);
fMatches = 0;
SoundManager.playMismatch();
} else {
if (_local2 == BoardLayer.RES_MATCH){
fMatches++;
addPoints(MATCH_POINTS);
if (fMatches > 2){
addPoints(BONUS_POINTS);
new BonusAnimation(this, ("BONUS: " + BONUS_POINTS));
SoundManager.playBonus();
} else {
SoundManager.playMatch();
};
if (fBoardLayer.isFinished()){
levelFinished();
};
};
};
fTriesField.text = ("TRIES: " + fBoardLayer.tries);
checkBars();
};
};
break;
case STATE_LEVEL_COMPLETE:
if ((((((_arg1.type == MouseEvent.CLICK)) && (fClickField.visible))) && ((fDownloadSprite == null)))){
fLevelCompleteAnimation.endAnimation();
new FadeAnimation(fThumbsUpLayer, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
fClickField.visible = false;
if (fLevelGame.level < fLevelGame.levelCount){
if (((!(fGame.isHomeSite())) && ((((((fLevelGame.level == 3)) && ((fLevelGame.id == 1)))) || ((((fLevelGame.level == 1)) && ((fLevelGame.id > 1)))))))){
showLimitText();
} else {
SaveData.saveGame(fLevelGame.id, (fLevelGame.level + 1), fPoints, fTotalLife, fTotalTime);
fLevelGame.nextLevel();
fBoardLayer.init(fLevelGame.columns, fLevelGame.rows, fLevelGame.smileySize);
fMoveBar.maxValue = fLevelGame.moveTime;
fMoveBar.value = fLevelGame.moveTime;
fLifeBar.maxValue = fLevelGame.life;
fLifeBar.value = fLevelGame.life;
fState = STATE_SHOWING;
new LevelAnimation(this, fLevelGame.level);
fEndShowingTimer.start();
};
} else {
_local3 = createEndGameButtonLayer();
new MoveAnimation(_local3, new Point(500, 10), new Point((250 - (_local3.width / 2)), 10), 20, InterpolationUtil.TYPE_COSINE, 20);
addChild(_local3);
_local4 = new ThumbsUpLayer(fLevelGame.totalLife);
_local4.count = fTotalLife;
new GameCompleteAnimation(this, fPoints, formatTime(fTotalTime), _local4);
SaveData.endGame(fLevelGame.id, fLevelGame.level, fPoints, _local4.rank);
SaveData.clearSavedGame(fLevelGame.id);
fState = STATE_GAME_WON;
SoundManager.playGameWon();
};
};
break;
};
}
private function showLevelComplete(_arg1:Event):void{
fLevelCompleteTimer.stop();
fLevelCompleteAnimation = new LevelCompleteAnimation(this, fLevelGame.level);
fBoardLayer.turnAll();
fThumbsUpLayer = new ThumbsUpLayer(fLevelGame.life);
fThumbsUpLayer.x = 150;
fThumbsUpLayer.y = 175;
new FadeAnimation(fThumbsUpLayer, 5, FadeAnimation.MODE_FADE_IN);
addChild(fThumbsUpLayer);
fState = STATE_LEVEL_COMPLETE;
SoundManager.playLevelComplete();
if (((((!(fGame.isHomeSite())) && (((fLevelGame.level % 4) == 2)))) || ((fLevelGame.level == 2)))){
showDownloadMessage();
};
}
private function checkBars():void{
var _local1:Sprite;
if (fLifeBar.value <= 0){
fTickTimer.stop();
fState = STATE_GAME_OVER;
new GameOverAnimation(this, fPoints, fLevelGame.level, fLevelGame.levelCount);
SoundManager.playGameOver();
_local1 = createEndGameButtonLayer();
new MoveAnimation(_local1, new Point(500, 0), new Point((250 - (_local1.width / 2)), 0), 20, InterpolationUtil.TYPE_COSINE);
addChild(_local1);
SaveData.endGame(fLevelGame.id, fLevelGame.level, fPoints, 0);
SaveData.saveGame(fLevelGame.id, fLevelGame.level, 0, fTotalLife, fTotalTime);
} else {
if (fMoveBar.value <= 0){
fBoardLayer.doMovement(fLevelGame.moveType, fLevelGame.moveCount);
fMoveBar.value = fLevelGame.moveTime;
};
};
}
}
}//package smileymemory
Section 46
//HandSprite (smileymemory.HandSprite)
package smileymemory {
import flash.events.*;
import smileygamer.*;
import flash.filters.*;
public class HandSprite extends SGSprite {
private var fMouseDown:Boolean;// = false
private var HandUp:Class;
private var HandDown:Class;
private var fHotspotX:int;// = 8
private var fHotspotY:int;// = 4
private static const STATE_DOWN:String = "down";
private static const STATE_NORMAL:String = "default";
public function HandSprite(){
var _local1:DropShadowFilter;
var _local2:DropShadowFilter;
HandUp = HandSprite_HandUp;
HandDown = HandSprite_HandDown;
fMouseDown = false;
fHotspotX = 8;
fHotspotY = 4;
super();
addAnimation(STATE_NORMAL, new ImageAnimation(new HandUp()));
addAnimation(STATE_DOWN, new ImageAnimation(new HandDown()));
_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 mouseUpdate(_arg1:MouseEvent):void{
x = (_arg1.stageX - fHotspotX);
y = (_arg1.stageY - fHotspotY);
fMouseDown = _arg1.buttonDown;
if (fMouseDown){
state = STATE_DOWN;
} else {
state = STATE_NORMAL;
};
}
public function isMouseDown():Boolean{
return (fMouseDown);
}
}
}//package smileymemory
Section 47
//HandSprite_HandDown (smileymemory.HandSprite_HandDown)
package smileymemory {
import mx.core.*;
public class HandSprite_HandDown extends BitmapAsset {
}
}//package smileymemory
Section 48
//HandSprite_HandUp (smileymemory.HandSprite_HandUp)
package smileymemory {
import mx.core.*;
public class HandSprite_HandUp extends BitmapAsset {
}
}//package smileymemory
Section 49
//IntroScreen (smileymemory.IntroScreen)
package smileymemory {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import smileygamer.util.*;
import smileygamer.*;
import flash.filters.*;
public class IntroScreen extends Sprite {
private static var Smiley:Class = IntroScreen_Smiley;
private static var HandMask:Class = IntroScreen_HandMask;
private static var SmileyMask:Class = IntroScreen_SmileyMask;
private static var Hand:Class = IntroScreen_Hand;
public function IntroScreen(){
addEventListener(Event.ADDED, 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;
removeEventListener(Event.ADDED, added);
_local2 = new Sprite();
_local3 = TextFactory.createTextField(TextFactory.SIZE_LARGER);
_local3.text = "Smiley";
_local2.addChild(_local3);
_local4 = TextFactory.createTextField(TextFactory.SIZE_LARGER, 4145151);
_local4.text = "Gamer";
_local4.x = _local3.width;
_local2.addChild(_local4);
_local2.x = (250 - (_local2.width / 2));
_local2.y = -40;
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 = 100;
_local7.y = 90;
_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(340, 190), new Point(340, 220), 20, InterpolationUtil.TYPE_COSINE, 0, false, true);
_local9.looping = true;
}
}
}//package smileymemory
Section 50
//IntroScreen_Hand (smileymemory.IntroScreen_Hand)
package smileymemory {
import mx.core.*;
public class IntroScreen_Hand extends BitmapAsset {
}
}//package smileymemory
Section 51
//IntroScreen_HandMask (smileymemory.IntroScreen_HandMask)
package smileymemory {
import mx.core.*;
public class IntroScreen_HandMask extends BitmapAsset {
}
}//package smileymemory
Section 52
//IntroScreen_Smiley (smileymemory.IntroScreen_Smiley)
package smileymemory {
import mx.core.*;
public class IntroScreen_Smiley extends BitmapAsset {
}
}//package smileymemory
Section 53
//IntroScreen_SmileyMask (smileymemory.IntroScreen_SmileyMask)
package smileymemory {
import mx.core.*;
public class IntroScreen_SmileyMask extends BitmapAsset {
}
}//package smileymemory
Section 54
//LevelAnimation (smileymemory.LevelAnimation)
package smileymemory {
import flash.events.*;
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.text.*;
import flash.utils.*;
public class LevelAnimation extends AAnimation {
public function LevelAnimation(_arg1:DisplayObjectContainer, _arg2:int){
var levelField:TextField;
var fade:Function;
var fader:Timer;
var aParent = _arg1;
var aLevel = _arg2;
fade = function (_arg1:Event):void{
new FadeAnimation(displayObject, frame, FadeAnimation.MODE_FADE_OUT_REMOVE);
};
levelField = TextFactory.createTextField(TextFactory.SIZE_LARGEST, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
levelField.text = ("LEVEL " + aLevel);
super(levelField);
looping = false;
new MoveAnimation(displayObject, new Point((250 - (displayObject.width / 2)), -(displayObject.height)), new Point((250 - (displayObject.width / 2)), 60), 20, InterpolationUtil.TYPE_COSINE);
fader = new Timer(1000, 1);
fader.addEventListener(TimerEvent.TIMER_COMPLETE, fade);
fader.start();
aParent.addChild(levelField);
}
override protected function get frameCount():int{
return (60);
}
}
}//package smileymemory
Section 55
//LevelCompleteAnimation (smileymemory.LevelCompleteAnimation)
package smileymemory {
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.text.*;
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_DEFAULT, TextFactory.DEFAULT_FONT, true);
_local3.autoSize = TextFieldAutoSize.CENTER;
_local3.text = ("LEVEL " + _arg2);
_local4 = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true);
_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), -20), new Point((250 - (_local3.width / 2)), -20), 20, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(_local4, new Point(500, 50), new Point((250 - (_local4.width / 2)), 50), 20, InterpolationUtil.TYPE_COSINE);
_arg1.addChild(_local5);
}
override protected function get frameCount():int{
return (30);
}
public function endAnimation():void{
new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
}
}
}//package smileymemory
Section 56
//LifeBar (smileymemory.LifeBar)
package smileymemory {
import flash.events.*;
import smileygamer.*;
import flash.filters.*;
public class LifeBar extends AProgressBar {
public function LifeBar(){
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(15615);
graphics.drawRoundRect(0, (height - progress), width, progress, 6, 6);
graphics.endFill();
};
}
}
}//package smileymemory
Section 57
//MoveBar (smileymemory.MoveBar)
package smileymemory {
import flash.events.*;
import smileygamer.*;
import flash.filters.*;
public class MoveBar extends AProgressBar {
public function MoveBar(){
var _local1:BevelFilter;
super();
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(15615);
graphics.drawRoundRect(0, 0, progress, height, 6, 6);
graphics.endFill();
};
}
}
}//package smileymemory
Section 58
//PauseButton (smileymemory.PauseButton)
package smileymemory {
import flash.events.*;
import flash.display.*;
import flash.filters.*;
public class PauseButton extends SimpleButton {
private static const COLOR_DEFAULT:int = 0xFF0000;
private static const COLOR_SELECTED:int = 0xFF;
public function PauseButton(){
var normal:Shape;
var sel:Shape;
var hit:Shape;
var bevel:BevelFilter;
var shadow:DropShadowFilter;
var playSound:Function;
playSound = function (_arg1:Event):void{
SoundManager.playButton();
};
normal = createPauseShape(COLOR_DEFAULT);
sel = createPauseShape(COLOR_SELECTED);
hit = new Shape();
hit.graphics.beginFill(0);
hit.graphics.drawCircle(16, 16, 16);
hit.graphics.endFill();
super(normal, sel, sel, hit);
bevel = new BevelFilter(2, 45, 0xFFFFFF, 1, 0, 0.8, 2, 2, 0.7, BitmapFilterQuality.HIGH);
shadow = new DropShadowFilter(2);
shadow.alpha = 0.8;
shadow.quality = BitmapFilterQuality.HIGH;
filters = [bevel, shadow];
addEventListener(MouseEvent.MOUSE_OVER, playSound);
}
private function createPauseShape(_arg1:int):Shape{
var _local2:Shape;
_local2 = new Shape();
_local2.graphics.beginFill(_arg1);
_local2.graphics.drawCircle(16, 16, 16);
_local2.graphics.drawCircle(16, 16, 12);
_local2.graphics.drawRect(10, 9, 5, 14);
_local2.graphics.drawRect(17, 9, 5, 14);
_local2.graphics.endFill();
return (_local2);
}
}
}//package smileymemory
Section 59
//SaveData (smileymemory.SaveData)
package smileymemory {
import flash.net.*;
public class SaveData {
private static var fScoresObject:SharedObject = null;
private static var fHighscores:Array = [0, 0, 0, 0];
private static var fName:String;
private static var fRank:Array = [0, 0, 0, 0];
private static var fSavedGame:Array = [null, null, null, null];
private static var fLevel:Array = [1, 1, 1, 1];
private static function writeScores():void{
if (fScoresObject != null){
fScoresObject.data.scores = fHighscores;
fScoresObject.data.ranks = fRank;
fScoresObject.data.levels = fLevel;
fScoresObject.data.savedgames = fSavedGame;
fScoresObject.data.name = fName;
fScoresObject.flush(500);
};
}
public static function getSavedGame(_arg1:int):Object{
var _local2:Object;
if (fSavedGame[_arg1] != null){
_local2 = fSavedGame[_arg1];
return (_local2);
};
return (null);
}
public static function get name():String{
return (fName);
}
public static function saveGame(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int):void{
var _local6:Object;
_local6 = new Object();
_local6.level = _arg2;
_local6.score = _arg3;
_local6.totalLife = _arg4;
_local6.totalTime = _arg5;
fSavedGame[_arg1] = _local6;
writeScores();
}
public static function init():void{
try {
fScoresObject = SharedObject.getLocal("smiley-memory-data", "/");
if (fScoresObject.data.levels != null){
fHighscores = fScoresObject.data.scores;
fRank = fScoresObject.data.ranks;
fLevel = fScoresObject.data.levels;
fSavedGame = fScoresObject.data.savedgames;
fName = fScoresObject.data.name;
} else {
writeScores();
};
} catch(e:Error) {
};
}
public static function endGame(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if (_arg3 >= fHighscores[_arg1]){
fLevel[_arg1] = _arg2;
fHighscores[_arg1] = _arg3;
fRank[_arg1] = _arg4;
writeScores();
};
}
public static function set name(_arg1:String):void{
fName = _arg1;
writeScores();
}
public static function getStats(_arg1:int):Array{
return (new Array(fLevel[_arg1], fHighscores[_arg1], fRank[_arg1]));
}
public static function clearSavedGame(_arg1:int):void{
fSavedGame[_arg1] = null;
writeScores();
}
}
}//package smileymemory
Section 60
//SmileySprite (smileymemory.SmileySprite)
package smileymemory {
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.filters.*;
public class SmileySprite extends SGSprite {
private var fCloneRect:Rectangle;
private var fBoard:Rectangle;
private var fMoving:Boolean;
private var fType:int;
private static const ALL_INDICES:Array = [0, 1, 2, 3, 4, 5];
private static const IMAGESTRIPS:Array = [new ImageStrip(sSmileyTypesSmall[0], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[1], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[2], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[3], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[4], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[5], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[6], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[7], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[8], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[9], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[10], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[11], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[12], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[13], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[14], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[15], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[16], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[17], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[18], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[19], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[20], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[21], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[22], NORMALSIZE, NORMALSIZE), new ImageStrip(sSmileyTypesSmall[23], NORMALSIZE, NORMALSIZE)];
private static const IMAGESTRIPSBIG:Array = [new ImageStrip(sSmileyTypesBig[0], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[1], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[2], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[3], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[4], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[5], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[6], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[7], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[8], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[9], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[10], BIGSIZE, BIGSIZE), new ImageStrip(sSmileyTypesBig[11], BIGSIZE, BIGSIZE)];
private static const INNERSHADOW:DropShadowFilter = new DropShadowFilter(1, -135, 0, 1, 4, 4, 1, BitmapFilterQuality.HIGH, true);
private static const SHADOW:DropShadowFilter = new DropShadowFilter(2, 45, 0, 0.6, 2, 2, 1, BitmapFilterQuality.HIGH);
private static const BIGSIZE:int = 75;
private static const STATE_TURN_UP:String = "turnup";
private static const NORMALSIZE:int = 50;
private static const STATE_TURN_DOWN:String = "turndown";
private static const END_INDEX:Array = [5];
private static const STATE_FACE_UP:String = "up";
private static const STATE_FACE_DOWN:String = "default";
private static const BEGIN_INDEX:Array = [0];
private static var SmileysMaskBig:Class = SmileySprite_SmileysMaskBig;
private static var SmileysBig:Class = SmileySprite_SmileysBig;
private static var SmileysSmall:Class = SmileySprite_SmileysSmall;
private static var sSmileyTypesBig:Array = BitmapUtil.splitImage(BitmapUtil.createMaskedBitmap(new SmileysBig(), new SmileysMaskBig()), (BIGSIZE * 6), BIGSIZE);
private static var SmileysMaskSmall:Class = SmileySprite_SmileysMaskSmall;
private static var sSmileyTypesSmall:Array = BitmapUtil.splitImage(BitmapUtil.createMaskedBitmap(new SmileysSmall(), new SmileysMaskSmall()), (NORMALSIZE * 6), NORMALSIZE);
public function SmileySprite(_arg1:int, _arg2:int, _arg3:Rectangle){
var _local4:int;
super();
fType = _arg1;
fBoard = _arg3;
_local4 = (SmileyMemory.LOWFPS) ? 1 : 2;
if (_arg2 == BIGSIZE){
addAnimation(STATE_FACE_DOWN, new ImageStripAnimation(IMAGESTRIPSBIG[0], END_INDEX));
addAnimation(STATE_TURN_UP, new ImageStripAnimation(IMAGESTRIPSBIG[fType], ALL_INDICES, _local4, false, true));
addAnimation(STATE_FACE_UP, new ImageStripAnimation(IMAGESTRIPSBIG[fType], BEGIN_INDEX));
addAnimation(STATE_TURN_DOWN, new ImageStripAnimation(IMAGESTRIPSBIG[fType], ALL_INDICES, _local4, false, false));
} else {
addAnimation(STATE_FACE_DOWN, new ImageStripAnimation(IMAGESTRIPS[0], END_INDEX));
addAnimation(STATE_TURN_UP, new ImageStripAnimation(IMAGESTRIPS[fType], ALL_INDICES, _local4, false, true));
addAnimation(STATE_FACE_UP, new ImageStripAnimation(IMAGESTRIPS[fType], BEGIN_INDEX));
addAnimation(STATE_TURN_DOWN, new ImageStripAnimation(IMAGESTRIPS[fType], ALL_INDICES, _local4, false, false));
};
state = STATE_FACE_DOWN;
fCloneRect = new Rectangle(0, 0, _arg2, _arg2);
filters = [INNERSHADOW, SHADOW];
cacheAsBitmap = true;
}
private function moveClone(_arg1:Number, _arg2:Number):void{
if (clonePos == null){
clonePos = new Point(_arg1, _arg2);
};
fCloneRect.x = (x + _arg1);
fCloneRect.y = (y + _arg2);
}
public function locationChanged():void{
if (x < fBoard.x){
moveClone(fBoard.width, 0);
};
if ((x + width) > (fBoard.x + fBoard.width)){
moveClone(-(fBoard.width), 0);
};
if (y < fBoard.y){
moveClone(0, fBoard.height);
};
if ((y + height) > (fBoard.y + fBoard.height)){
moveClone(0, -(fBoard.height));
};
if (((!((clonePos == null))) && (fBoard.containsRect(fCloneRect)))){
x = (x + clonePos.x);
y = (y + clonePos.y);
clonePos = null;
};
}
public function get type():int{
return (fType);
}
public function get moving():Boolean{
return (fMoving);
}
override protected function nextState():String{
if (STATE_TURN_DOWN == state){
return (STATE_FACE_DOWN);
};
if (STATE_TURN_UP == state){
return (STATE_FACE_UP);
};
return (STATE_FACE_DOWN);
}
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 turn():void{
if ((((STATE_FACE_DOWN == state)) || ((STATE_TURN_DOWN == state)))){
state = STATE_TURN_UP;
} else {
if ((((STATE_FACE_UP == state)) || ((STATE_TURN_UP == state)))){
state = STATE_TURN_DOWN;
};
};
}
public function set moving(_arg1:Boolean):void{
fMoving = _arg1;
if (!fMoving){
clonePos = null;
};
}
public function isVisible():Boolean{
return ((((state == STATE_FACE_UP)) || ((state == STATE_TURN_UP))));
}
}
}//package smileymemory
Section 61
//SmileySprite_SmileysBig (smileymemory.SmileySprite_SmileysBig)
package smileymemory {
import mx.core.*;
public class SmileySprite_SmileysBig extends BitmapAsset {
}
}//package smileymemory
Section 62
//SmileySprite_SmileysMaskBig (smileymemory.SmileySprite_SmileysMaskBig)
package smileymemory {
import mx.core.*;
public class SmileySprite_SmileysMaskBig extends BitmapAsset {
}
}//package smileymemory
Section 63
//SmileySprite_SmileysMaskSmall (smileymemory.SmileySprite_SmileysMaskSmall)
package smileymemory {
import mx.core.*;
public class SmileySprite_SmileysMaskSmall extends BitmapAsset {
}
}//package smileymemory
Section 64
//SmileySprite_SmileysSmall (smileymemory.SmileySprite_SmileysSmall)
package smileymemory {
import mx.core.*;
public class SmileySprite_SmileysSmall extends BitmapAsset {
}
}//package smileymemory
Section 65
//SoundManager (smileymemory.SoundManager)
package smileymemory {
import flash.events.*;
import flash.utils.*;
import flash.media.*;
public class SoundManager {
private static var Music:Class = SoundManager_Music;
private static var GameOver:Class = SoundManager_GameOver;
private static var Yes:Class = SoundManager_Yes;
private static var fSound:Boolean = true;
private static var Beep:Class = SoundManager_Beep;
private static var fApplause:Sound = (new Applause() as Sound);
private static var Applause:Class = SoundManager_Applause;
private static var fNo:Sound = (new No() as Sound);
private static var fLevelComplete:Sound = (new LevelComplete() as Sound);
private static var fBonus:Sound = (new Bonus() as Sound);
private static var fMusic:Sound = (new Music() as Sound);
private static var No:Class = SoundManager_No;
private static var fMusicChannel:SoundChannel;
private static var fYes:Sound = (new Yes() as Sound);
private static var fGameOver:Sound = (new GameOver() as Sound);
private static var fButtonSound:Sound = (new Beep() as Sound);
private static var LevelComplete:Class = SoundManager_LevelComplete;
private static var Bonus:Class = SoundManager_Bonus;
public static function playGameOver():void{
if (fSound){
fGameOver.play();
};
}
public static function playMismatch():void{
if (fSound){
fNo.play();
};
}
public static function playBonus():void{
if (fSound){
fBonus.play();
};
}
public static function toggleSound():void{
sound = !(sound);
}
public static function get sound():Boolean{
return (fSound);
}
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 set sound(_arg1:Boolean):void{
fSound = _arg1;
if (!fSound){
if (fMusicChannel != null){
fMusicChannel.stop();
};
} else {
fMusicChannel = null;
playMusic();
};
}
public static function playLevelComplete():void{
if (fSound){
fLevelComplete.play();
};
}
public static function playGameWon():void{
if (fSound){
fApplause.play();
};
}
public static function playMatch():void{
if (fSound){
fYes.play();
};
}
public static function playButton():void{
if (fSound){
fButtonSound.play();
};
}
}
}//package smileymemory
Section 66
//SoundManager_Applause (smileymemory.SoundManager_Applause)
package smileymemory {
import mx.core.*;
public class SoundManager_Applause extends SoundAsset {
}
}//package smileymemory
Section 67
//SoundManager_Beep (smileymemory.SoundManager_Beep)
package smileymemory {
import mx.core.*;
public class SoundManager_Beep extends SoundAsset {
}
}//package smileymemory
Section 68
//SoundManager_Bonus (smileymemory.SoundManager_Bonus)
package smileymemory {
import mx.core.*;
public class SoundManager_Bonus extends SoundAsset {
}
}//package smileymemory
Section 69
//SoundManager_GameOver (smileymemory.SoundManager_GameOver)
package smileymemory {
import mx.core.*;
public class SoundManager_GameOver extends SoundAsset {
}
}//package smileymemory
Section 70
//SoundManager_LevelComplete (smileymemory.SoundManager_LevelComplete)
package smileymemory {
import mx.core.*;
public class SoundManager_LevelComplete extends SoundAsset {
}
}//package smileymemory
Section 71
//SoundManager_Music (smileymemory.SoundManager_Music)
package smileymemory {
import mx.core.*;
public class SoundManager_Music extends SoundAsset {
}
}//package smileymemory
Section 72
//SoundManager_No (smileymemory.SoundManager_No)
package smileymemory {
import mx.core.*;
public class SoundManager_No extends SoundAsset {
}
}//package smileymemory
Section 73
//SoundManager_Yes (smileymemory.SoundManager_Yes)
package smileymemory {
import mx.core.*;
public class SoundManager_Yes extends SoundAsset {
}
}//package smileymemory
Section 74
//TextBalloon (smileymemory.TextBalloon)
package smileymemory {
import flash.display.*;
public class TextBalloon extends Shape {
public function TextBalloon(_arg1:int, _arg2:int){
graphics.beginFill(0xFFFFFF, 0.7);
graphics.lineStyle(2, 0x303030, 1);
graphics.drawRoundRect(0, 0, _arg1, _arg2, (_arg1 / 4), (_arg1 / 6));
graphics.endFill();
cacheAsBitmap = true;
}
}
}//package smileymemory
Section 75
//TextFactory (smileymemory.TextFactory)
package smileymemory {
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.filters.*;
public class TextFactory {
public static const COLOR_DEFAULT:int = 0xFF0000;
public static const SIZE_NORMAL:int = 16;
public static const SIZE_LARGEST:int = 64;
public static const DEFAULT_FONT:String = "beware";
public static const SIZE_LARGER:int = 48;
public static const COLOR_SELECTED:int = 0xFFD800;
public static const SIZE_LARGE:int = 28;
private static var BewareFont:Class = TextFactory_BewareFont;
public static function createEditableTextField(_arg1:int=16, _arg2:int=0xFF0000, _arg3:String="beware"):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 createCopyrightTextField(_arg1:String, _arg2:int=0xFFD800):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(1);
_local3.filters = [_local5, _local6];
_local3.text = _arg1;
return (_local3);
}
public static function createHelpTextField():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 createTextField(_arg1:int=16, _arg2:int=0xFF0000, _arg3:String="beware", _arg4:Boolean=false):TextField{
var _local5:TextField;
var _local6:TextFormat;
_local5 = new TextField();
_local6 = new TextFormat(_arg3, _arg1, _arg2);
_local6.letterSpacing = 1;
_local5.autoSize = TextFieldAutoSize.LEFT;
_local5.mouseEnabled = false;
_local5.embedFonts = true;
_local5.defaultTextFormat = _local6;
_local5.antiAliasType = AntiAliasType.ADVANCED;
_local5.multiline = false;
_local5.transform.matrix = new Matrix(1, 0, 0, 2, 0, 0);
_local5.filters = createFilters(_arg1, _arg4);
return (_local5);
}
public static function createTextButton(_arg1:String, _arg2:int=16, _arg3:int=0xFF0000, _arg4:int=0xFFD800, _arg5:String="beware"):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);
}
private static function createFilters(_arg1:int, _arg2:Boolean):Array{
var _local3:Array;
_local3 = new Array();
switch (_arg1){
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(1, 45, 0, 1, 2, 2, 0.8, BitmapFilterQuality.HIGH));
if (_arg2){
_local3.push(new GlowFilter(16777136, 0.75, 8, 8, 2, BitmapFilterQuality.HIGH));
};
break;
case SIZE_LARGE:
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));
};
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));
};
break;
};
return (_local3);
}
}
}//package smileymemory
Section 76
//TextFactory_BewareFont (smileymemory.TextFactory_BewareFont)
package smileymemory {
import mx.core.*;
public class TextFactory_BewareFont extends FontAsset {
}
}//package smileymemory
Section 77
//ThumbsUpLayer (smileymemory.ThumbsUpLayer)
package smileymemory {
import flash.display.*;
import flash.filters.*;
public class ThumbsUpLayer extends Sprite {
private var fMax:int;
private var fCount:int;
private static var ThumbsUp:Class = ThumbsUpLayer_ThumbsUp;
public function ThumbsUpLayer(_arg1:int){
var _local2:int;
var _local3:DisplayObject;
var _local4:DropShadowFilter;
var _local5:DropShadowFilter;
super();
fMax = _arg1;
fCount = 0;
_local2 = 0;
while (_local2 < 5) {
_local3 = new ThumbsUp();
_local3.x = ((_local2 * 40) - 5);
_local3.alpha = 0.3;
_local4 = new DropShadowFilter(2);
_local4.alpha = 0.6;
_local4.quality = BitmapFilterQuality.HIGH;
_local5 = new DropShadowFilter(1, -135);
_local5.quality = BitmapFilterQuality.HIGH;
_local5.alpha = 0.8;
_local5.inner = true;
_local3.filters = [_local5, _local4];
addChild(_local3);
_local2++;
};
}
public function set count(_arg1:int):void{
fCount = _arg1;
if (fCount >= int((fMax / 20))){
getChildAt(0).alpha = 1;
};
if (fCount >= (fMax / 6)){
getChildAt(1).alpha = 1;
};
if (fCount >= ((2 * fMax) / 6)){
getChildAt(2).alpha = 1;
};
if (fCount >= ((3 * fMax) / 6)){
getChildAt(3).alpha = 1;
};
if (fCount >= ((4 * fMax) / 6)){
getChildAt(4).alpha = 1;
};
}
public function get rank():int{
var _local1:int;
_local1 = 0;
if (fCount >= int((fMax / 20))){
_local1++;
};
if (fCount >= (fMax / 6)){
_local1++;
};
if (fCount >= ((2 * fMax) / 6)){
_local1++;
};
if (fCount >= ((3 * fMax) / 6)){
_local1++;
};
if (fCount >= ((4 * fMax) / 6)){
_local1++;
};
return (_local1);
}
public function get count():int{
return (fCount);
}
}
}//package smileymemory
Section 78
//ThumbsUpLayer_ThumbsUp (smileymemory.ThumbsUpLayer_ThumbsUp)
package smileymemory {
import mx.core.*;
public class ThumbsUpLayer_ThumbsUp extends BitmapAsset {
}
}//package smileymemory
Section 79
//TitleButton (smileymemory.TitleButton)
package smileymemory {
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 = 150;
private static const COLOR:int = 0xFFD800;
private static const WIDTH:int = 185;
private static const HEIGHT:int = 30;
private static const DIFFHEIGHT:int = 50;
private static const BIGWIDTH:int = 215;
private static const BIGHEIGHT:int = 70;
private static const COLOR_SEL:int = 0xFF0000;
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_LARGER : TextFactory.SIZE_NORMAL;
tf = TextFactory.createTextField(textSize);
tf.text = aTitle;
tf.x = ((normal.width - tf.width) / 2);
tf.y = ((normal.height - (1.5 * tf.height)) / 2);
if (aBigSize){
tf.y = (tf.y - 2);
};
normal.addChild(tf);
if (aTitle2 != null){
tf2 = TextFactory.createTextField(textSize);
tf2.text = aTitle2;
tf2.x = ((normal.width - tf2.width) / 2);
tf.y = (tf.y - (textSize / 2));
tf2.y = ((((normal.height - (1.5 * tf2.height)) / 2) + (textSize / 2)) - 3);
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 - (1.5 * tfsel.height)) / 2);
if (aBigSize){
tfsel.y = (tfsel.y - 2);
};
selected.addChild(tfsel);
if (aTitle2 != null){
tfsel2 = TextFactory.createTextField(textSize, TextFactory.COLOR_SELECTED);
tfsel2.text = aTitle2;
tfsel2.x = ((selected.width - tfsel2.width) / 2);
tfsel.y = (tfsel.y - (textSize / 2));
tfsel2.y = ((((selected.height - (1.5 * tfsel2.height)) / 2) + (textSize / 2)) - 3);
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 smileymemory
Section 80
//TitleScreen (smileymemory.TitleScreen)
package smileymemory {
import flash.events.*;
import flash.display.*;
import smileygamer.*;
import flash.geom.*;
import smileygamer.util.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
public class TitleScreen extends Sprite implements ILogic {
private var fHardButton:SimpleButton;
private var fContinueLayer:Sprite;
private var fAddToSiteButton:SimpleButton;
private var fCreditsLayer:Sprite;
private var fSavedGame:Boolean;
private var fBestResultLayer:Sprite;
private var fSmiley:Sprite;
private var fGame:SmileyMemory;
private var fMoreGamesButton:SimpleButton;
private var fNormalButton:SimpleButton;
private var fTitle:Sprite;
private var fChosenDiff:int;
private var fPlayButton:SimpleButton;
private var fCreditsButton:SimpleButton;
private var fState:int;// = 0
private var fVeryHardButton:SimpleButton;
private var fEasyButton:SimpleButton;
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 TitleSmileyEyes:Class = TitleScreen_TitleSmileyEyes;
private static var SoundOnImage:Class = TitleScreen_SoundOnImage;
private static var TitleRightHand:Class = TitleScreen_TitleRightHand;
private static var TitleSmileyMask:Class = TitleScreen_TitleSmileyMask;
private static var TitleRightHandMask:Class = TitleScreen_TitleRightHandMask;
private static var TitleLeftHand:Class = TitleScreen_TitleLeftHand;
private static var ThumbsUp:Class = TitleScreen_ThumbsUp;
private static var TitleLeftHandMask:Class = TitleScreen_TitleLeftHandMask;
private static var SoundOffImage:Class = TitleScreen_SoundOffImage;
private static var SmileySmall:Class = TitleScreen_SmileySmall;
public function TitleScreen(_arg1:SmileyMemory){
fState = STATE_INVALID;
super();
fGame = _arg1;
addEventListener(Event.ADDED, added);
addEventListener(Event.REMOVED, removed);
}
public function added(_arg1:Event):void{
removeEventListener(Event.ADDED, added);
init();
}
private function createTitleSmileyLayer():Sprite{
var layer:Sprite;
var shadow:DropShadowFilter;
var innershadow:DropShadowFilter;
var smiley:Bitmap;
var eyes:Bitmap;
var eyeTimer:Timer;
var switchEyes:Function;
var rightHand:Bitmap;
var rightAnim:MoveAnimation;
var leftHand:Bitmap;
var leftAnim:MoveAnimation;
switchEyes = function (_arg1:Event):void{
eyes.visible = !(eyes.visible);
eyeTimer.delay = RandomUtil.generateRandom(2000, 7000);
};
layer = new Sprite();
shadow = new DropShadowFilter(3);
shadow.alpha = 0.8;
shadow.quality = BitmapFilterQuality.HIGH;
innershadow = new DropShadowFilter(1, -135);
innershadow.quality = BitmapFilterQuality.HIGH;
innershadow.inner = true;
smiley = BitmapUtil.createMaskedBitmap(new TitleSmiley(), new TitleSmileyMask());
smiley.filters = [innershadow, shadow];
smiley.cacheAsBitmap = true;
layer.addChild(smiley);
eyes = new TitleSmileyEyes();
eyes.visible = false;
eyes.x = 58;
eyes.y = 99;
layer.addChild(eyes);
eyeTimer = new Timer(RandomUtil.generateRandom(2000, 7000));
eyeTimer.addEventListener(TimerEvent.TIMER, switchEyes);
eyeTimer.start();
rightHand = BitmapUtil.createMaskedBitmap(new TitleRightHand(), new TitleRightHandMask());
rightHand.filters = [innershadow, shadow];
rightHand.cacheAsBitmap = true;
rightHand.x = 40;
rightHand.y = 185;
layer.addChild(rightHand);
rightAnim = new MoveAnimation(rightHand, new Point(40, 185), new Point(30, 193), 45, InterpolationUtil.TYPE_COSINE, 0, false, true);
rightAnim.looping = true;
leftHand = BitmapUtil.createMaskedBitmap(new TitleLeftHand(), new TitleLeftHandMask());
leftHand.filters = [innershadow, shadow];
leftHand.cacheAsBitmap = true;
leftHand.x = 192;
leftHand.y = 32;
layer.addChild(leftHand);
leftAnim = new MoveAnimation(leftHand, new Point(204, 48), new Point(188, 28), 35, InterpolationUtil.TYPE_COSINE, 0, false, true);
leftAnim.looping = true;
return (layer);
}
private function showBestResult(_arg1:Event):void{
var _local2:int;
var _local3:Array;
var _local4:TextBalloon;
var _local5:TextField;
var _local6:int;
var _local7:DisplayObject;
var _local8:DropShadowFilter;
var _local9:DropShadowFilter;
if (_arg1.target == fEasyButton){
_local2 = SmileyMemory.DIFF_EASY;
};
if (_arg1.target == fNormalButton){
_local2 = SmileyMemory.DIFF_NORMAL;
};
if (_arg1.target == fHardButton){
_local2 = SmileyMemory.DIFF_HARD;
};
if (_arg1.target == fVeryHardButton){
_local2 = SmileyMemory.DIFF_VERYHARD;
};
_local3 = SaveData.getStats(_local2);
fBestResultLayer = new Sprite();
_local4 = new TextBalloon(108, 108);
fBestResultLayer.addChild(_local4);
_local5 = TextFactory.createHelpTextField();
_local5.text = ((("Best Result\n\nLevel: " + _local3[0]) + "\nScore: ") + _local3[1]);
_local5.x = 8;
_local5.y = 5;
fBestResultLayer.addChild(_local5);
_local6 = 0;
while (_local6 < 5) {
_local7 = new ThumbsUp();
_local7.x = ((_local6 * 20) + 5);
_local7.y = 75;
if (_local6 >= _local3[2]){
_local7.alpha = 0.3;
};
_local8 = new DropShadowFilter(2);
_local8.alpha = 0.6;
_local8.quality = BitmapFilterQuality.HIGH;
_local9 = new DropShadowFilter(1, -135);
_local9.quality = BitmapFilterQuality.HIGH;
_local9.alpha = 0.6;
_local9.inner = true;
_local7.filters = [_local9, _local8];
fBestResultLayer.addChild(_local7);
_local6++;
};
fBestResultLayer.x = 232;
fBestResultLayer.y = 200;
new FadeAnimation(fBestResultLayer, 5, FadeAnimation.MODE_FADE_IN);
addChild(fBestResultLayer);
}
private function init():void{
var title1:TextField;
var title2:TextField;
var newTf:Matrix;
var soundBtn:SimpleButton;
var innershadow2:DropShadowFilter;
var smallshadow:DropShadowFilter;
var smiley:DisplayObject;
var smileysel:DisplayObject;
var glow:GlowFilter;
var smileyButton:SimpleButton;
var copyright:TextField;
var copyrightSel:TextField;
var crButton:SimpleButton;
var download:Function;
fSmiley = createTitleSmileyLayer();
fSmiley.x = -(fSmiley.width);
fSmiley.y = 80;
addChild(fSmiley);
fTitle = new Sprite();
title1 = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_SELECTED);
title1.text = "Smiley";
title1.x = 20;
title1.y = -38;
title1.cacheAsBitmap = true;
fTitle.addChild(title1);
title2 = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_SELECTED);
title2.text = "Memory";
title2.x = 152;
title2.y = 68;
newTf = title2.transform.matrix.clone();
newTf.rotate((-(Math.PI) / 12));
title2.transform.matrix = newTf;
title2.cacheAsBitmap = true;
fTitle.addChild(title2);
soundBtn = createSoundToggleButton();
soundBtn.x = (490 - soundBtn.width);
soundBtn.y = 10;
fTitle.addChild(soundBtn);
addChild(fTitle);
innershadow2 = new DropShadowFilter(1, -135);
innershadow2.alpha = 0.8;
innershadow2.quality = BitmapFilterQuality.HIGH;
innershadow2.inner = true;
smallshadow = new DropShadowFilter(2);
smallshadow.alpha = 0.8;
smallshadow.quality = BitmapFilterQuality.HIGH;
smiley = new SmileySmall();
smiley.filters = [innershadow2, smallshadow];
smileysel = new SmileySmall();
glow = new GlowFilter(16777176, 1, 16, 16, 2, BitmapFilterQuality.HIGH);
smileysel.filters = [smallshadow, glow];
smileyButton = new SimpleButton(smiley, smileysel, smileysel, smileysel);
smileyButton.x = 248;
smileyButton.y = 2;
if (!fGame.isHomeSite()){
smileyButton.addEventListener(MouseEvent.CLICK, showHome);
};
fTitle.addChild(smileyButton);
fPlayButton = new TitleButton("PLAY", null, true);
fPlayButton.x = (500 - fPlayButton.width);
fPlayButton.y = 100;
addChild(fPlayButton);
fPlayButton.addEventListener(MouseEvent.CLICK, play);
fHighscoresButton = new TitleButton("HIGHSCORES");
fHighscoresButton.x = (500 - fHighscoresButton.width);
fHighscoresButton.y = 180;
addChild(fHighscoresButton);
fHighscoresButton.addEventListener(MouseEvent.CLICK, showHighscores);
fCreditsButton = new TitleButton("CREDITS");
fCreditsButton.x = (500 - fCreditsButton.width);
fCreditsButton.y = 220;
addChild(fCreditsButton);
fCreditsButton.addEventListener(MouseEvent.CLICK, credits);
if (!SmileyMemory.DOWNLOADABLE){
if (fGame.isHomeSite()){
download = function (_arg1:Event):void{
fGame.showDownloadPage();
};
fMoreGamesButton = new TitleButton("DOWNLOAD");
fMoreGamesButton.addEventListener(MouseEvent.CLICK, download);
} else {
fMoreGamesButton = new TitleButton("MORE GAMES");
fMoreGamesButton.addEventListener(MouseEvent.CLICK, moreGames);
};
fMoreGamesButton.x = (500 - fMoreGamesButton.width);
fMoreGamesButton.y = 260;
addChild(fMoreGamesButton);
fAddToSiteButton = new TitleButton("ADD TO SITE");
fAddToSiteButton.x = (500 - fAddToSiteButton.width);
fAddToSiteButton.y = 300;
addChild(fAddToSiteButton);
fAddToSiteButton.addEventListener(MouseEvent.CLICK, showGamesForSite);
} else {
fPlayButton.y = 120;
fHighscoresButton.y = 210;
fCreditsButton.y = 260;
};
fEasyButton = new TitleButton("EASY", "8 PAIRS");
fEasyButton.x = 510;
fEasyButton.y = 100;
addChild(fEasyButton);
fEasyButton.addEventListener(MouseEvent.CLICK, chooseDiff);
fEasyButton.addEventListener(MouseEvent.MOUSE_OVER, showBestResult);
fEasyButton.addEventListener(MouseEvent.MOUSE_OUT, hideBestResult);
fNormalButton = new TitleButton("NORMAL", "12 PAIRS");
fNormalButton.x = 510;
fNormalButton.y = 160;
addChild(fNormalButton);
fNormalButton.addEventListener(MouseEvent.CLICK, chooseDiff);
fNormalButton.addEventListener(MouseEvent.MOUSE_OVER, showBestResult);
fNormalButton.addEventListener(MouseEvent.MOUSE_OUT, hideBestResult);
fHardButton = new TitleButton("HARD", "18 PAIRS");
fHardButton.x = 510;
fHardButton.y = 220;
addChild(fHardButton);
fHardButton.addEventListener(MouseEvent.CLICK, chooseDiff);
fHardButton.addEventListener(MouseEvent.MOUSE_OVER, showBestResult);
fHardButton.addEventListener(MouseEvent.MOUSE_OUT, hideBestResult);
fVeryHardButton = new TitleButton("VERY HARD", "24 PAIRS");
fVeryHardButton.x = 510;
fVeryHardButton.y = 280;
addChild(fVeryHardButton);
fVeryHardButton.addEventListener(MouseEvent.CLICK, chooseDiff);
fVeryHardButton.addEventListener(MouseEvent.MOUSE_OVER, showBestResult);
fVeryHardButton.addEventListener(MouseEvent.MOUSE_OUT, hideBestResult);
copyright = TextFactory.createCopyrightTextField("Copyright 2007 SmileyGamer.com");
copyrightSel = TextFactory.createCopyrightTextField("Copyright 2007 SmileyGamer.com", TextFactory.COLOR_DEFAULT);
crButton = new SimpleButton(copyright, copyrightSel, copyrightSel, copyrightSel);
crButton.addEventListener(MouseEvent.CLICK, showHome);
crButton.x = (490 - crButton.width);
crButton.y = 336;
addChild(crButton);
fState = STATE_SHOWING;
showTitle();
showMainButtons();
}
private function hideCredits(_arg1:Event):void{
var _local2:MoveAnimation;
_local2 = new MoveAnimation(fCreditsLayer, new Point((490 - fCreditsLayer.width), fCreditsLayer.y), new Point(510, fCreditsLayer.y), 15, InterpolationUtil.TYPE_COSINE, 0, true);
_local2.addCallback(showMainButtons);
}
private function hideBestResult(_arg1:Event):void{
new FadeAnimation(fBestResultLayer, 5, FadeAnimation.MODE_FADE_OUT_REMOVE);
}
private function showHighscores(_arg1:Event):void{
fGame.showHighscoresPage();
}
private function play(_arg1:Event):void{
hideMainButtons();
showDifficultyButtons();
}
private function hideDifficultyButtons():void{
new MoveAnimation(fEasyButton, new Point((500 - fEasyButton.width), fEasyButton.y), new Point(510, fEasyButton.y), 15, InterpolationUtil.TYPE_COSINE, 6);
new MoveAnimation(fNormalButton, new Point((500 - fNormalButton.width), fNormalButton.y), new Point(510, fNormalButton.y), 15, InterpolationUtil.TYPE_COSINE, 4);
new MoveAnimation(fHardButton, new Point((500 - fHardButton.width), fHardButton.y), new Point(510, fHardButton.y), 15, InterpolationUtil.TYPE_COSINE, 2);
new MoveAnimation(fVeryHardButton, new Point((500 - fVeryHardButton.width), fVeryHardButton.y), new Point(510, fVeryHardButton.y), 15, InterpolationUtil.TYPE_COSINE);
}
private function showMainButtons():void{
new MoveAnimation(fPlayButton, new Point(510, fPlayButton.y), new Point((500 - fPlayButton.width), fPlayButton.y), 15, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(fHighscoresButton, new Point(510, fHighscoresButton.y), new Point((500 - fHighscoresButton.width), fHighscoresButton.y), 15, InterpolationUtil.TYPE_COSINE, 2);
new MoveAnimation(fCreditsButton, new Point(510, fCreditsButton.y), new Point((500 - fCreditsButton.width), fCreditsButton.y), 15, InterpolationUtil.TYPE_COSINE, 4);
if (!SmileyMemory.DOWNLOADABLE){
new MoveAnimation(fMoreGamesButton, new Point(510, fMoreGamesButton.y), new Point((500 - fMoreGamesButton.width), fMoreGamesButton.y), 15, InterpolationUtil.TYPE_COSINE, 6);
new MoveAnimation(fAddToSiteButton, new Point(510, fAddToSiteButton.y), new Point((500 - fAddToSiteButton.width), fAddToSiteButton.y), 15, InterpolationUtil.TYPE_COSINE, 8);
};
}
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(-(fSmiley.width), 80), new Point(-8, 80), 15, InterpolationUtil.TYPE_COSINE);
}
public function removed(_arg1:Event):void{
}
private function showGamesForSite(_arg1:Event):void{
NetworkUtil.showGamesForSite();
}
private function startGame():void{
var anim:MoveAnimation;
var showGame:Function;
showGame = function ():void{
fGame.showGameScreen(fChosenDiff, fSavedGame);
};
new MoveAnimation(fTitle, new Point(0, 0), new Point(0, -(fTitle.height)), 15, InterpolationUtil.TYPE_COSINE, 10);
anim = new MoveAnimation(fSmiley, new Point(fSmiley.x, fSmiley.y), new Point(-(fSmiley.width), fSmiley.y), 15, InterpolationUtil.TYPE_COSINE, 10);
anim.addCallback(showGame);
}
private function moreGames(_arg1:Event):void{
fGame.showSponsorSite();
}
private function showHome(_arg1:Event):void{
fGame.showSGSite();
}
private function credits(_arg1:Event):void{
var _local2:TextBalloon;
var _local3:TextField;
hideMainButtons();
fCreditsLayer = new Sprite();
fCreditsLayer.y = 110;
_local2 = new TextBalloon(180, 210);
fCreditsLayer.addChild(_local2);
_local3 = TextFactory.createHelpTextField();
_local3.text = ("Smiley Memory\nVersion 1.3\nby SmileyGamer.com\n\nGame concept by\nJochen De Schepper\n" + "and Els Brunson\n\nCoding 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(510, fCreditsLayer.y), new Point((490 - fCreditsLayer.width), fCreditsLayer.y), 15, InterpolationUtil.TYPE_COSINE, 20);
addChild(fCreditsLayer);
fCreditsLayer.addEventListener(MouseEvent.CLICK, hideCredits);
}
public function doLogic():void{
}
private function chooseDiff(_arg1:Event):void{
var _local2:Object;
hideDifficultyButtons();
if (_arg1.target == fEasyButton){
fChosenDiff = SmileyMemory.DIFF_EASY;
};
if (_arg1.target == fNormalButton){
fChosenDiff = SmileyMemory.DIFF_NORMAL;
};
if (_arg1.target == fHardButton){
fChosenDiff = SmileyMemory.DIFF_HARD;
};
if (_arg1.target == fVeryHardButton){
fChosenDiff = SmileyMemory.DIFF_VERYHARD;
};
_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(510, fContinueLayer.y), 15, InterpolationUtil.TYPE_COSINE, 0, true);
}
private function showDifficultyButtons():void{
new MoveAnimation(fEasyButton, new Point(510, fEasyButton.y), new Point((500 - fEasyButton.width), fEasyButton.y), 15, InterpolationUtil.TYPE_COSINE, 20);
new MoveAnimation(fNormalButton, new Point(510, fNormalButton.y), new Point((500 - fNormalButton.width), fNormalButton.y), 15, InterpolationUtil.TYPE_COSINE, 22);
new MoveAnimation(fHardButton, new Point(510, fHardButton.y), new Point((500 - fHardButton.width), fHardButton.y), 15, InterpolationUtil.TYPE_COSINE, 24);
new MoveAnimation(fVeryHardButton, new Point(510, fVeryHardButton.y), new Point((500 - fVeryHardButton.width), fVeryHardButton.y), 15, InterpolationUtil.TYPE_COSINE, 26);
}
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 hideMainButtons():void{
new MoveAnimation(fPlayButton, new Point((500 - fPlayButton.width), fPlayButton.y), new Point(510, fPlayButton.y), 15, InterpolationUtil.TYPE_COSINE, 8);
new MoveAnimation(fHighscoresButton, new Point((500 - fHighscoresButton.width), fHighscoresButton.y), new Point(510, fHighscoresButton.y), 15, InterpolationUtil.TYPE_COSINE, 6);
new MoveAnimation(fCreditsButton, new Point((500 - fCreditsButton.width), fCreditsButton.y), new Point(510, fCreditsButton.y), 15, InterpolationUtil.TYPE_COSINE, 4);
if (!SmileyMemory.DOWNLOADABLE){
new MoveAnimation(fMoreGamesButton, new Point((500 - fMoreGamesButton.width), fMoreGamesButton.y), new Point(510, fMoreGamesButton.y), 15, InterpolationUtil.TYPE_COSINE, 2);
new MoveAnimation(fAddToSiteButton, new Point((500 - fAddToSiteButton.width), fAddToSiteButton.y), new Point(510, fAddToSiteButton.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 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 = 15;
fContinueLayer.addChild(balloon);
tf = TextFactory.createHelpTextField();
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);
new MoveAnimation(fContinueLayer, new Point(510, 130), new Point((500 - newButton.width), 130), 15, InterpolationUtil.TYPE_COSINE, 20);
addChild(fContinueLayer);
}
}
}//package smileymemory
Section 81
//TitleScreen_SmileySmall (smileymemory.TitleScreen_SmileySmall)
package smileymemory {
import mx.core.*;
public class TitleScreen_SmileySmall extends BitmapAsset {
}
}//package smileymemory
Section 82
//TitleScreen_SoundOffImage (smileymemory.TitleScreen_SoundOffImage)
package smileymemory {
import mx.core.*;
public class TitleScreen_SoundOffImage extends BitmapAsset {
}
}//package smileymemory
Section 83
//TitleScreen_SoundOnImage (smileymemory.TitleScreen_SoundOnImage)
package smileymemory {
import mx.core.*;
public class TitleScreen_SoundOnImage extends BitmapAsset {
}
}//package smileymemory
Section 84
//TitleScreen_ThumbsUp (smileymemory.TitleScreen_ThumbsUp)
package smileymemory {
import mx.core.*;
public class TitleScreen_ThumbsUp extends BitmapAsset {
}
}//package smileymemory
Section 85
//TitleScreen_TitleLeftHand (smileymemory.TitleScreen_TitleLeftHand)
package smileymemory {
import mx.core.*;
public class TitleScreen_TitleLeftHand extends BitmapAsset {
}
}//package smileymemory
Section 86
//TitleScreen_TitleLeftHandMask (smileymemory.TitleScreen_TitleLeftHandMask)
package smileymemory {
import mx.core.*;
public class TitleScreen_TitleLeftHandMask extends BitmapAsset {
}
}//package smileymemory
Section 87
//TitleScreen_TitleRightHand (smileymemory.TitleScreen_TitleRightHand)
package smileymemory {
import mx.core.*;
public class TitleScreen_TitleRightHand extends BitmapAsset {
}
}//package smileymemory
Section 88
//TitleScreen_TitleRightHandMask (smileymemory.TitleScreen_TitleRightHandMask)
package smileymemory {
import mx.core.*;
public class TitleScreen_TitleRightHandMask extends BitmapAsset {
}
}//package smileymemory
Section 89
//TitleScreen_TitleSmiley (smileymemory.TitleScreen_TitleSmiley)
package smileymemory {
import mx.core.*;
public class TitleScreen_TitleSmiley extends BitmapAsset {
}
}//package smileymemory
Section 90
//TitleScreen_TitleSmileyEyes (smileymemory.TitleScreen_TitleSmileyEyes)
package smileymemory {
import mx.core.*;
public class TitleScreen_TitleSmileyEyes extends BitmapAsset {
}
}//package smileymemory
Section 91
//TitleScreen_TitleSmileyMask (smileymemory.TitleScreen_TitleSmileyMask)
package smileymemory {
import mx.core.*;
public class TitleScreen_TitleSmileyMask extends BitmapAsset {
}
}//package smileymemory
Section 92
//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.0");
}
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 93
//MochiAdPreloaderFactory (MochiAdPreloaderFactory)
package {
import flash.events.*;
import flash.display.*;
import smileymemory.*;
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 = "SmileyMemory";
public function MochiAdPreloaderFactory(){
var ind:int;
var clicked:Function;
var t:Timer;
super();
stage.frameRate = 32;
stage.scaleMode = StageScaleMode.NO_SCALE;
stop();
NetworkUtil.init(stage, 547, "Smiley Memory", 500, 360);
NetworkUtil.tracking(false);
addChild(new Background());
fIntro = new IntroScreen();
addChild(fIntro);
if (!NetworkUtil.isHome()){
clicked = function (_arg1:Event):void{
NetworkUtil.showHome();
};
fIntro.addEventListener(MouseEvent.CLICK, clicked);
fIntro.buttonMode = true;
};
fAdStarted = false;
fAdFinished = false;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
ind = NetworkUtil.getReferer().indexOf("agame.com");
if ((((ind == 0)) || ((((ind > 0)) && ((NetworkUtil.getReferer().charAt((ind - 1)) == ".")))))){
adFinished();
fProgress = new Shape();
addChild(fProgress);
} else {
MochiAd.showPreGameAd({id:"8f19ee7d1849c4a4", res:"500x360", clip:this, background:0xFFD800, color:15615, ad_started:adStarted, ad_finished:adFinished, no_bg:true});
t = new Timer(20000, 1);
t.addEventListener(TimerEvent.TIMER_COMPLETE, checkAdStarted);
t.start();
};
}
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) {
};
}
public function adFinished():void{
fAdFinished = true;
fAdFinishedTime = getTimer();
}
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;
}
}
}//package
Section 94
//SmileyMemory (SmileyMemory)
package {
import flash.events.*;
import smileymemory.gameplay.*;
import smileygamer.*;
import smileymemory.*;
import smileygamer.util.*;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
public dynamic class SmileyMemory extends AGame {
private var fHand:HandSprite;
private var fFPSTime:int;
private var fFPSField:TextField;
private var fFrame:int;// = 0
public static const DIFF_NORMAL:int = 1;
public static const DIFF_HARD:int = 2;
public static const DOWNLOADABLE:Boolean = false;
public static const GAMEID:int = 547;
public static const DIFF_VERYHARD:int = 3;
public static const DIFF_EASY:int = 0;
public static var LOWFPS:Boolean = false;
public function SmileyMemory(){
var added:Function;
fHand = new HandSprite();
fFrame = 0;
added = function (_arg1:Event):void{
removeEventListener(Event.ADDED, added);
fFPSTime = getTimer();
Mouse.show();
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseUpdate);
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;
fFPSField = new TextField();
fFPSField.width = 50;
fFPSField.height = 20;
showTitleScreen();
};
super();
SaveData.init();
addEventListener(Event.ADDED, added);
}
public function isHomeSite():Boolean{
return (((DOWNLOADABLE) || (NetworkUtil.isHome())));
}
public function showSponsorSite():void{
NetworkUtil.showHome();
}
public function showTitleScreen():void{
addChildAt(new TitleScreen(this), 0);
SoundManager.playMusic();
}
public function mouseUpdate(_arg1:MouseEvent):void{
fHand.mouseUpdate(_arg1);
if (_arg1.type == MouseEvent.CLICK){
Mouse.show();
Mouse.hide();
};
}
public function showHighscoresPage():void{
NetworkUtil.showHighscores();
}
public function showDownloadPage():void{
if (Capabilities.os.indexOf("Mac") != -1){
navigateToURL(new URLRequest("https://secure.bmtmicro.com/servlets/Orders.ShoppingCart?CID=3576&PRODUCTID=35760001"), "_blank");
} else {
navigateToURL(new URLRequest("https://secure.bmtmicro.com/servlets/Orders.ShoppingCart?CID=3576&PRODUCTID=35760000"), "_blank");
};
}
public function showGameScreen(_arg1:int, _arg2:Boolean):void{
var _local3:ILevelGame;
var _local4:GameScreen;
var _local5:Object;
if (_arg2){
_local5 = SaveData.getSavedGame(_arg1);
switch (_arg1){
case DIFF_EASY:
_local3 = new EasyLevelGame(_local5.level);
break;
case DIFF_NORMAL:
_local3 = new NormalLevelGame(_local5.level);
break;
case DIFF_HARD:
_local3 = new HardLevelGame(_local5.level);
break;
case DIFF_VERYHARD:
_local3 = new VeryHardLevelGame(_local5.level);
break;
};
_local4 = new GameScreen(this, _local3, _local5.score, _local5.totalLife, _local5.totalTime);
} else {
switch (_arg1){
case DIFF_EASY:
_local3 = new EasyLevelGame();
break;
case DIFF_NORMAL:
_local3 = new NormalLevelGame();
break;
case DIFF_HARD:
_local3 = new HardLevelGame();
break;
case DIFF_VERYHARD:
_local3 = new VeryHardLevelGame();
break;
};
_local4 = new GameScreen(this, _local3);
};
removeChildAt(0);
addChildAt(_local4, 0);
}
override public function mainLoop(_arg1:Event):void{
var _local2:int;
super.mainLoop(_arg1);
fFrame++;
if ((fFrame % 30) == 0){
_local2 = int(((fFrame * 1000) / (getTimer() - fFPSTime)));
LOWFPS = (_local2 < 20);
fFPSField.text = (_local2 + " FPS");
fFrame = 0;
fFPSTime = getTimer();
};
}
public function showSGSite():void{
NetworkUtil.showHome();
}
}
}//package