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 = "3.0.0.0";
public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
super(bitmapData, pixelSnapping, smoothing);
}
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(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
}
}//package mx.core
Section 2
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
public function ByteArrayAsset(){
super();
}
}
}//package mx.core
Section 3
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(left:Number=0, top:Number=0, right:Number=0, bottom:Number=0){
super();
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 4
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
var bitmapData = bitmapData;
var pixelSnapping = pixelSnapping;
var smoothing = smoothing;
super(bitmapData, pixelSnapping, smoothing);
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 5
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexMovieClip(){
super();
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 6
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
public function FontAsset(){
super();
}
}
}//package mx.core
Section 7
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 8
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 9
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(void:Point):Point;
function get name():String;
function set width(flash.display:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(flash.display:String):void;
function set scaleX(flash.display:Number):void;
function set scaleY(flash.display:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(flash.display:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(void:Point):Point;
function get height():Number;
function set blendMode(flash.display:String):void;
function get parent():DisplayObjectContainer;
function getBounds(String:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(flash.display:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(flash.display:Number):void;
function set accessibilityProperties(flash.display:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(flash.display:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(flash.display:Number):void;
function set mask(flash.display:DisplayObject):void;
function getRect(String:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(flash.display:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean;
function set opaqueBackground(flash.display:Object):void;
function set visible(flash.display:Boolean):void;
function get mask():DisplayObject;
function set x(flash.display:Number):void;
function set y(flash.display:Number):void;
function get transform():Transform;
function set filters(flash.display:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(flash.display:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 10
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 11
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function MovieClipAsset(){
super();
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 12
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
protected var initialHeight:Number;// = 0
private var loader:Loader;// = null
private var initialized:Boolean;// = false
protected var initialWidth:Number;// = 0
private var requestedHeight:Number;
private var requestedWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function MovieClipLoaderAsset(){
super();
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
if (("allowLoadBytesCodeExecution" in loaderContext)){
loaderContext["allowLoadBytesCodeExecution"] = true;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(movieClipData, loaderContext);
addChild(loader);
}
override public function get width():Number{
if (!initialized){
return (initialWidth);
};
return (super.width);
}
override public function set width(value:Number):void{
if (!initialized){
requestedWidth = value;
} else {
loader.width = value;
};
}
override public function get measuredHeight():Number{
return (initialHeight);
}
private function completeHandler(event:Event):void{
initialized = true;
initialWidth = loader.width;
initialHeight = loader.height;
if (!isNaN(requestedWidth)){
loader.width = requestedWidth;
};
if (!isNaN(requestedHeight)){
loader.height = requestedHeight;
};
dispatchEvent(event);
}
override public function set height(value:Number):void{
if (!initialized){
requestedHeight = value;
} else {
loader.height = value;
};
}
override public function get measuredWidth():Number{
return (initialWidth);
}
override public function get height():Number{
if (!initialized){
return (initialHeight);
};
return (super.height);
}
public function get movieClipData():ByteArray{
return (null);
}
}
}//package mx.core
Section 13
//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 14
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
public function SoundAsset(){
super();
}
}
}//package mx.core
Section 15
//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 = "3.0.0.0";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var s:String;
var indices:Array;
var o:DisplayObject = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
return (result);
}
public static function createUniqueName(object:Object):String{
if (!object){
return (null);
};
var name:String = getQualifiedClassName(object);
var index:int = name.indexOf("::");
if (index != -1){
name = name.substr((index + 2));
};
var charCode:int = name.charCodeAt((name.length - 1));
if ((((charCode >= 48)) && ((charCode <= 57)))){
name = (name + "_");
};
return ((name + counter++));
}
}
}//package mx.utils
Section 16
//Background (smileydifference.Background)
package smileydifference {
import flash.display.*;
public class Background extends Sprite {
private static var BGimg:Class = Background_BGimg;
public function Background(){
super();
addChild(new BGimg());
}
}
}//package smileydifference
Section 17
//Background_BGimg (smileydifference.Background_BGimg)
package smileydifference {
import mx.core.*;
public class Background_BGimg extends BitmapAsset {
}
}//package smileydifference
Section 18
//BigTextAnimation (smileydifference.BigTextAnimation)
package smileydifference {
import flash.display.*;
import flash.text.*;
import smileygamer.*;
import smileygamer.util.*;
public class BigTextAnimation extends AAnimation {
private var fSteps:int;
private var fTextField:TextField;
public function BigTextAnimation(aParent:DisplayObjectContainer, aText:String, aTop:Boolean=false){
fTextField = new SDTextField(SDTextField.SIZE_LARGEST, SDTextField.COLOR_DEFAULT, aText);
super(fTextField);
fTextField.y = (aTop) ? 80 : 200;
looping = false;
aParent.addChild(fTextField);
fTextField.x = (330 - (fTextField.width / 2));
fSteps = 15;
var anim:ScaleAnimation = new ScaleAnimation(fTextField, 0.01, 0.01, 1.2, 1.2, fSteps, InterpolationUtil.TYPE_COSINE, 0);
}
override protected function get frameCount():int{
return (fSteps);
}
public function reverse():void{
var anim:ScaleAnimation = new ScaleAnimation(fTextField, 1.2, 1.2, 0.01, 0.01, fSteps, InterpolationUtil.TYPE_COSINE, 0, true);
}
}
}//package smileydifference
Section 19
//BoardFrame (smileydifference.BoardFrame)
package smileydifference {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class BoardFrame extends Shape {
public static const COLOR:int = 6058296;
private static const TIMEBAR_RECT:Rectangle = new Rectangle(320, 10, 300, 20);
public function BoardFrame(){
super();
graphics.beginFill(COLOR);
graphics.drawRect(0, 0, 640, 480);
graphics.drawRect(4, 4, 632, 52);
graphics.drawRect(0, 60, 318, 420);
graphics.drawRect(322, 60, 318, 420);
graphics.endFill();
var bevel:BevelFilter = new BevelFilter(2, 45, 0xFFFFFF, 1, 0, 0.8, 4, 4, 0.7, BitmapFilterQuality.HIGH);
var glow:GlowFilter = new GlowFilter(0, 1, 4, 4, 2, BitmapFilterQuality.LOW);
filters = [bevel, glow];
cacheAsBitmap = true;
}
public function get timeBarRect():Rectangle{
return (TIMEBAR_RECT);
}
}
}//package smileydifference
Section 20
//GameButton (smileydifference.GameButton)
package smileydifference {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class GameButton extends SimpleButton {
private static const COLOR:int = 0xFF8200;
private static const HEIGHT:int = 36;
private static const COLOR_SEL:int = 7507015;
public function GameButton(aTitle:String){
var normal:Sprite;
var playSound:Function;
var aTitle = aTitle;
playSound = function (e:Event):void{
SoundManager.playButton();
};
normal = new Sprite();
var tf:TextField = new SDTextField(SDTextField.SIZE_BUTTON, COLOR);
tf.text = aTitle;
var background:Shape = createBackground(tf.width);
normal.addChild(background);
tf.x = ((normal.width - tf.width) / 2);
tf.y = (normal.x + 6);
normal.addChild(tf);
normal.cacheAsBitmap = true;
var selected:Sprite = new Sprite();
selected.addChild(createBackground(tf.width, true));
var tfsel:TextField = new SDTextField(SDTextField.SIZE_BUTTON, COLOR_SEL);
tfsel.text = aTitle;
tfsel.x = ((selected.width - tfsel.width) / 2);
tfsel.y = (selected.x + 6);
selected.addChild(tfsel);
selected.cacheAsBitmap = true;
super(normal, selected, selected, background);
var bevel:BevelFilter = new BevelFilter(8, 45, 0xFFFFFF, 1, 0, 0.8, 8, 8, 0.7, BitmapFilterQuality.HIGH);
var glow:GlowFilter = new GlowFilter(0, 1, 8, 8, 8, BitmapFilterQuality.LOW);
filters = [bevel, glow];
addEventListener(MouseEvent.MOUSE_OVER, playSound);
}
private function createBackground(aWidth:int, aSelected:Boolean=false):Shape{
var bg:Shape = new Shape();
bg.graphics.beginFill((aSelected) ? COLOR : COLOR_SEL);
bg.graphics.drawRect(0, 0, (aWidth + HEIGHT), HEIGHT);
bg.graphics.endFill();
return (bg);
}
}
}//package smileydifference
Section 21
//GamePlay (smileydifference.GamePlay)
package smileydifference {
import flash.display.*;
import flash.geom.*;
public class GamePlay {
private var fDiffImages:Array;
private var fImage:Bitmap;
private var fLevel:int;// = 0
private static const RECTS2:Array = [67, 73, 8, 37, 139, 103, 28, 33, 118, 191, 40, 26, 94, 177, 12, 44, 274, 194, 41, 10, 65, 296, 26, 31, 194, 282, 26, 62];
private static const RECTS3:Array = [61, 42, 27, 24, 245, 76, 25, 27, 0, 127, 79, 16, 114, 114, 46, 23, 125, 170, 18, 18, 157, 166, 11, 22, 66, 325, 28, 25];
private static const RECTS4:Array = [77, 47, 72, 72, 7, 65, 45, 47, 111, 145, 38, 25, 24, 148, 60, 88, 173, 185, 39, 54, 253, 183, 28, 45, 0, 334, 38, 34];
private static const RECTS5:Array = [287, 0, 33, 33, 176, 196, 10, 10, 169, 237, 19, 19, 287, 0x0101, 11, 20, 301, 351, 16, 27, 108, 316, 35, 31, 26, 0x0101, 14, 16, 0, 346, 22, 22];
private static const RECTS6:Array = [94, 146, 27, 18, 85, 223, 20, 24, 5, 198, 9, 95, 81, 321, 40, 11, 263, 280, 22, 19, 267, 244, 14, 22, 295, 146, 25, 136];
private static const RECTS1:Array = [245, 0, 75, 25, 47, 152, 57, 29, 206, 61, 63, 58, 121, 141, 27, 22, 148, 147, 38, 32, 188, 122, 63, 46, 212, 202, 26, 22, 231, 337, 89, 60];
private static const LEVELS:int = 6;
private static const DIFFERENCES:Array = [8, 7, 7, 7, 8, 7];
private static var Smiley1A:Class = GamePlay_Smiley1A;
private static var Smiley5B:Class = GamePlay_Smiley5B;
private static var Smiley3B:Class = GamePlay_Smiley3B;
private static var Smiley1B:Class = GamePlay_Smiley1B;
private static var Smiley6A:Class = GamePlay_Smiley6A;
private static var Smiley6B:Class = GamePlay_Smiley6B;
private static var Smiley4A:Class = GamePlay_Smiley4A;
private static var Smiley4B:Class = GamePlay_Smiley4B;
private static var Smiley2A:Class = GamePlay_Smiley2A;
private static var Smiley2B:Class = GamePlay_Smiley2B;
private static var Smiley5A:Class = GamePlay_Smiley5A;
private static var Smiley3A:Class = GamePlay_Smiley3A;
public function GamePlay(){
super();
nextLevel();
}
public function getDiffImage(aIndex:int):Bitmap{
return (fDiffImages[aIndex]);
}
public function get level():int{
return (fLevel);
}
public function getImage():Bitmap{
return (fImage);
}
public function nextLevel():Boolean{
if (fLevel < LEVELS){
fLevel++;
switch (fLevel){
case 1:
fImage = new Smiley1A();
createDiffImages(new Smiley1B(), RECTS1);
break;
case 2:
fImage = new Smiley2A();
createDiffImages(new Smiley2B(), RECTS2);
break;
case 3:
fImage = new Smiley3A();
createDiffImages(new Smiley3B(), RECTS3);
break;
case 4:
fImage = new Smiley4A();
createDiffImages(new Smiley4B(), RECTS4);
break;
case 5:
fImage = new Smiley5A();
createDiffImages(new Smiley5B(), RECTS5);
break;
case 6:
fImage = new Smiley6A();
createDiffImages(new Smiley6B(), RECTS6);
break;
};
return (true);
};
return (false);
}
public function get differences():int{
return (DIFFERENCES[(level - 1)]);
}
private function createDiffImages(aSource:Bitmap, aRects:Array):void{
var rect:Rectangle;
var bitmapData:BitmapData;
var bm:Bitmap;
fDiffImages = new Array(differences);
var aImage:BitmapData = aSource.bitmapData;
var origin:Point = new Point(0, 0);
var i:int;
while (i < differences) {
rect = new Rectangle(aRects[(i * 4)], aRects[((i * 4) + 1)], aRects[((i * 4) + 2)], aRects[((i * 4) + 3)]);
bitmapData = new BitmapData(rect.width, rect.height, false);
bitmapData.copyPixels(aImage, rect, origin);
bm = new Bitmap(bitmapData);
bm.x = rect.x;
bm.y = rect.y;
fDiffImages[i] = bm;
i++;
};
}
}
}//package smileydifference
Section 22
//GamePlay_Smiley1A (smileydifference.GamePlay_Smiley1A)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley1A extends BitmapAsset {
}
}//package smileydifference
Section 23
//GamePlay_Smiley1B (smileydifference.GamePlay_Smiley1B)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley1B extends BitmapAsset {
}
}//package smileydifference
Section 24
//GamePlay_Smiley2A (smileydifference.GamePlay_Smiley2A)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley2A extends BitmapAsset {
}
}//package smileydifference
Section 25
//GamePlay_Smiley2B (smileydifference.GamePlay_Smiley2B)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley2B extends BitmapAsset {
}
}//package smileydifference
Section 26
//GamePlay_Smiley3A (smileydifference.GamePlay_Smiley3A)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley3A extends BitmapAsset {
}
}//package smileydifference
Section 27
//GamePlay_Smiley3B (smileydifference.GamePlay_Smiley3B)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley3B extends BitmapAsset {
}
}//package smileydifference
Section 28
//GamePlay_Smiley4A (smileydifference.GamePlay_Smiley4A)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley4A extends BitmapAsset {
}
}//package smileydifference
Section 29
//GamePlay_Smiley4B (smileydifference.GamePlay_Smiley4B)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley4B extends BitmapAsset {
}
}//package smileydifference
Section 30
//GamePlay_Smiley5A (smileydifference.GamePlay_Smiley5A)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley5A extends BitmapAsset {
}
}//package smileydifference
Section 31
//GamePlay_Smiley5B (smileydifference.GamePlay_Smiley5B)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley5B extends BitmapAsset {
}
}//package smileydifference
Section 32
//GamePlay_Smiley6A (smileydifference.GamePlay_Smiley6A)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley6A extends BitmapAsset {
}
}//package smileydifference
Section 33
//GamePlay_Smiley6B (smileydifference.GamePlay_Smiley6B)
package smileydifference {
import mx.core.*;
public class GamePlay_Smiley6B extends BitmapAsset {
}
}//package smileydifference
Section 34
//GameScreen (smileydifference.GameScreen)
package smileydifference {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import smileygamer.*;
import flash.utils.*;
import flash.filters.*;
import smileygamer.util.*;
import flash.ui.*;
public class GameScreen extends Sprite implements ILogic {
private var fBigText:BigTextAnimation;
private var fScoreField:TextField;
private var fDifferences:int;
private var fDiffsField:TextField;
private var fHelpText:TextField;
private var fContinue:TextField;
private var fDiffFound:Array;
private var fTimeBar:TimeBar;
private var fState:int;// = 0
private var fScore:int;
private var fGamePlay:GamePlay;
private var fFocus1:Shape;
private var fFocus2:Shape;
private var fTickTimer:Timer;
private var fDiffImages:Sprite;
private var fImagesLayer:Sprite;
private var fGame:SmileyDifference;
private static const HALFWIDTH:int = 320;
private static const STATE_LEVEL_COMPLETE:int = 3;
private static const STATE_INVALID:int = 0;
private static const STATE_RUNNING:int = 1;
private static const STATE_GAME_OVER:int = 4;
private static const STATE_GAME_WON:int = 5;
private static const LEVELTIME:int = 75;
private static const STATE_LEVEL_LOADING:int = 6;
private static const STATE_LEVEL_COMPLETING:int = 2;
private static var Joker:Class = GameScreen_Joker;
public function GameScreen(aGame:SmileyDifference){
super();
fGame = aGame;
fGamePlay = new GamePlay();
addEventListener(Event.ADDED, added);
addEventListener(Event.REMOVED, removed);
}
private function createJokerButton():SimpleButton{
var joker:DisplayObject = new Joker();
var innershadow:DropShadowFilter = new DropShadowFilter(1, -135);
innershadow.quality = BitmapFilterQuality.MEDIUM;
innershadow.alpha = 1;
innershadow.inner = true;
var glow:GlowFilter = new GlowFilter(0, 1, 4, 4, 4, BitmapFilterQuality.LOW);
joker.filters = [glow];
var sb:SimpleButton = new SimpleButton(joker, joker, joker, joker);
sb.addEventListener(MouseEvent.CLICK, jokerclick);
return (sb);
}
public function added(aEvent:Event):void{
removeEventListener(Event.ADDED, added);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseUpdate);
stage.addEventListener(MouseEvent.CLICK, mouseUpdate);
init();
}
private function init():void{
var jokerbutton:SimpleButton;
fImagesLayer = new Sprite();
fImagesLayer.y = 60;
addChild(fImagesLayer);
addChild(new BoardFrame());
fScoreField = new SDTextField(SDTextField.SIZE_NORMAL, SDTextField.COLOR_DEFAULT, (SGLanguage.getText("Score") + ": 9999"));
fScoreField.x = 20;
fScoreField.y = 8;
addChild(fScoreField);
fDiffsField = new SDTextField(SDTextField.SIZE_NORMAL, SDTextField.COLOR_DEFAULT, (SGLanguage.getText("Differences") + ": 99"));
fDiffsField.x = 20;
fDiffsField.y = 32;
addChild(fDiffsField);
fTimeBar = new TimeBar();
fTimeBar.maxValue = LEVELTIME;
fTimeBar.x = (HALFWIDTH - 60);
fTimeBar.y = 10;
fTimeBar.width = 300;
fTimeBar.height = 15;
addChild(fTimeBar);
var jokertext:TextField = new SDTextField(SDTextField.SIZE_NORMAL, SDTextField.COLOR_DEFAULT, (SGLanguage.getText("Hints") + ":"));
jokertext.x = (HALFWIDTH - 60);
jokertext.y = 32;
addChild(jokertext);
var i:int;
while (i < 5) {
jokerbutton = createJokerButton();
jokerbutton.x = ((HALFWIDTH + 40) + (i * 25));
jokerbutton.y = 30;
addChild(jokerbutton);
i++;
};
var soundBtn:SimpleButton = new SoundButton();
soundBtn.x = 220;
soundBtn.y = 10;
addChild(soundBtn);
var smileyLogo:SmileyButton = new SmileyButton();
smileyLogo.x = 570;
smileyLogo.y = 8;
addChild(smileyLogo);
fFocus1 = new Shape();
var g:Graphics = fFocus1.graphics;
g.lineStyle(4, 0xFF0000, 0.8);
g.drawCircle(0, 0, 12);
addChild(fFocus1);
fFocus1.visible = false;
fFocus2 = new Shape();
g = fFocus2.graphics;
g.lineStyle(4, 0xFF0000, 0.8);
g.drawCircle(0, 0, 12);
addChild(fFocus2);
fFocus2.visible = false;
fContinue = new SDTextField();
fContinue.text = SGLanguage.getText("clicktocontinue");
fContinue.x = (HALFWIDTH - (fContinue.width / 2));
fContinue.y = 420;
fContinue.visible = false;
addChild(fContinue);
fHelpText = new SDTextField(SDTextField.SIZE_SMALL);
fHelpText.text = SGLanguage.getText("instructions");
fHelpText.x = 60;
fHelpText.y = 460;
addChild(fHelpText);
fScore = 0;
fScoreField.text = (SGLanguage.getText("Score") + ": 0 ");
fTickTimer = new Timer(100);
fTickTimer.addEventListener(TimerEvent.TIMER, tick);
initLevel();
}
public function doLogic():void{
if (fState == STATE_LEVEL_COMPLETING){
if (fTimeBar.value > 0){
fTimeBar.value = (fTimeBar.value - 1);
changeScore(1);
} else {
fState = STATE_LEVEL_COMPLETE;
fContinue.visible = true;
};
};
}
private function tick(e:TimerEvent):void{
fTimeBar.value = (int(((fTimeBar.value * 10) - 1)) / 10);
if ((((fTimeBar.value <= 10)) && ((((fTimeBar.value * 10) % 10) == 0)))){
SoundManager.playBlip();
};
if ((((fTimeBar.value <= 5)) && ((((fTimeBar.value * 10) % 10) == 5)))){
SoundManager.playBlip();
} else {
if (fTimeBar.value <= 1){
SoundManager.playBlip();
};
};
if (fTimeBar.value == 0){
gameOver();
};
}
private function backToMenu(e:Event):void{
this.parent.removeChild(this);
fGame.showTitleScreen();
}
private function changeScore(aScore:int):void{
fScore = (fScore + aScore);
fScoreField.text = ((SGLanguage.getText("Score") + ": ") + fScore);
}
private function showDifferenceGames(e:Event):void{
fGame.showDifferenceGames();
}
private function initLevel():void{
var startLevel:Function;
var bm:Bitmap;
startLevel = function ():void{
fTimeBar.value = LEVELTIME;
fTickTimer.start();
fState = STATE_RUNNING;
};
fState = STATE_LEVEL_LOADING;
fDifferences = fGamePlay.differences;
fDiffsField.text = ((SGLanguage.getText("Differences") + ": ") + fDifferences);
if (fDiffImages != null){
fImagesLayer.removeChild(fDiffImages);
new MoveAnimation(fImagesLayer.getChildAt(0), new Point(0, 0), new Point(0, 500), 15, InterpolationUtil.TYPE_COSINE, 0, true);
new MoveAnimation(fImagesLayer.getChildAt(1), new Point(HALFWIDTH, 0), new Point(HALFWIDTH, 500), 15, InterpolationUtil.TYPE_COSINE, 0, true);
};
fDiffFound = new Array(fDifferences);
var anim:MoveAnimation = new MoveAnimation(fGamePlay.getImage(), new Point(-370, 0), new Point(0, 0), 15, InterpolationUtil.TYPE_COSINE);
fImagesLayer.addChild(fGamePlay.getImage());
var image2:Bitmap = new Bitmap(fGamePlay.getImage().bitmapData);
new MoveAnimation(image2, new Point(690, 0), new Point(HALFWIDTH, 0), 15, InterpolationUtil.TYPE_COSINE);
fImagesLayer.addChild(image2);
fDiffImages = new Sprite();
new MoveAnimation(fDiffImages, new Point(690, 0), new Point(HALFWIDTH, 0), 15, InterpolationUtil.TYPE_COSINE);
fImagesLayer.addChild(fDiffImages);
var i:int;
while (i < fDifferences) {
fDiffFound[i] = false;
bm = fGamePlay.getDiffImage(i);
fDiffImages.addChild(bm);
i = (i + 1);
};
anim.addCallback(startLevel);
}
public function mouseUpdate(aEvent:MouseEvent):void{
var valid:Boolean;
var i:int;
if (aEvent.type == MouseEvent.MOUSE_MOVE){
if (fState == STATE_RUNNING){
if (aEvent.stageY > 59){
fFocus1.x = aEvent.stageX;
if (aEvent.stageX < HALFWIDTH){
fFocus2.x = (aEvent.stageX + HALFWIDTH);
} else {
fFocus2.x = (aEvent.stageX - HALFWIDTH);
};
fFocus1.y = aEvent.stageY;
fFocus1.visible = true;
fFocus2.y = aEvent.stageY;
fFocus2.visible = true;
Mouse.hide();
} else {
fFocus1.visible = false;
fFocus2.visible = false;
Mouse.show();
};
} else {
fFocus1.visible = false;
fFocus2.visible = false;
Mouse.show();
};
} else {
switch (fState){
case STATE_RUNNING:
if (aEvent.stageY > 59){
valid = false;
i = 0;
while (i < fDiffImages.numChildren) {
if (((!(fDiffFound[i])) && (((fDiffImages.getChildAt(i).hitTestPoint(aEvent.stageX, aEvent.stageY)) || (fDiffImages.getChildAt(i).hitTestPoint((aEvent.stageX + HALFWIDTH), aEvent.stageY)))))){
fDiffFound[i] = true;
new BlinkAnimation(fDiffImages.getChildAt(i), 7, 3);
valid = true;
break;
};
i++;
};
if (valid){
changeScore(20);
foundDifference();
if (fHelpText.visible){
new FadeAnimation(fHelpText, 15, InterpolationUtil.TYPE_COSINE);
};
} else {
fTimeBar.value = (fTimeBar.value - 5);
if (fTimeBar.value <= 0){
gameOver();
} else {
SoundManager.playWrong();
};
};
};
break;
case STATE_LEVEL_COMPLETE:
fBigText.reverse();
fContinue.visible = false;
if (fGamePlay.nextLevel()){
initLevel();
} else {
gameWon();
};
break;
};
};
}
private function gameWon():void{
fTickTimer.stop();
changeScore(100);
fBigText = new BigTextAnimation(this, SGLanguage.getText("Game Won!"), true);
SoundManager.playGameWon();
fState = STATE_GAME_WON;
fGame.submitScore(fScore);
addChild(createGameOverLayer());
}
private function foundDifference():void{
fDifferences--;
fDiffsField.text = ((SGLanguage.getText("Differences") + ": ") + fDifferences);
if (fDifferences == 0){
endLevel();
} else {
SoundManager.playCorrect();
};
}
public function removed(aEvent:Event):void{
removeEventListener(Event.REMOVED, removed);
}
private function endLevel():void{
fTickTimer.stop();
fBigText = new BigTextAnimation(this, SGLanguage.getText("Well Done!"));
SoundManager.playLevelComplete();
fState = STATE_LEVEL_COMPLETING;
}
private function createGameOverLayer():Sprite{
var layer:Sprite = new Sprite();
layer.x = 0;
layer.y = 150;
var adbg:Shape = new Shape();
adbg.graphics.beginFill(0xFFFFFF, 0.5);
adbg.graphics.drawRoundRect(-5, -5, 460, 260, 16, 16);
adbg.graphics.endFill();
adbg.x = 95;
adbg.y = 0;
layer.addChild(adbg);
var adbox:AdBox = new AdBox();
SmileyGamer.showSGAd(adbox);
adbox.x = 95;
adbox.y = 0;
layer.addChild(adbox);
var sd1ad:SimpleButton = fGame.getSG1Ad();
sd1ad.x = (adbox.x + 315);
sd1ad.y = 40;
layer.addChild(sd1ad);
var backmenu:SimpleButton = new GameButton(SGLanguage.getText("Back To Menu"));
backmenu.x = ((HALFWIDTH / 2) - (backmenu.width / 2));
backmenu.y = 270;
layer.addChild(backmenu);
backmenu.addEventListener(MouseEvent.CLICK, backToMenu);
var moregames:SimpleButton = new GameButton(SGLanguage.getText("Play More Games"));
moregames.x = ((HALFWIDTH * 1.5) - (moregames.width / 2));
moregames.y = 270;
layer.addChild(moregames);
moregames.addEventListener(MouseEvent.CLICK, showDifferenceGames);
return (layer);
}
private function gameOver():void{
fTickTimer.stop();
fBigText = new BigTextAnimation(this, SGLanguage.getText("Game Over!"), true);
SoundManager.playGameOver();
fState = STATE_GAME_OVER;
fGame.submitScore(fScore);
addChild(createGameOverLayer());
}
private function jokerclick(e:Event):void{
var button:SimpleButton;
var i:int;
if (fState == STATE_RUNNING){
button = (e.target as SimpleButton);
button.enabled = false;
button.mouseEnabled = false;
button.overState.alpha = 0.3;
button.downState.alpha = 0.3;
button.upState.alpha = 0.3;
i = 0;
while (i < fDiffImages.numChildren) {
if (!fDiffFound[i]){
fDiffFound[i] = true;
new BlinkAnimation(fDiffImages.getChildAt(i), 7, 3);
break;
};
i++;
};
foundDifference();
};
}
}
}//package smileydifference
Section 35
//GameScreen_Joker (smileydifference.GameScreen_Joker)
package smileydifference {
import mx.core.*;
public class GameScreen_Joker extends BitmapAsset {
}
}//package smileydifference
Section 36
//SDTextField (smileydifference.SDTextField)
package smileydifference {
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class SDTextField extends TextField {
private var fGlowFilter:GlowFilter;
public static const COLOR_DEFAULT:int = 0xFF8200;
public static const SIZE_SMALL:int = 14;
public static const SIZE_NORMAL:int = 16;
public static const DEFAULT_FONT:String = "mainFont";
public static const SIZE_LARGER:int = 46;
public static const SIZE_MEGA:int = 80;
public static const COLOR_SELECTED:int = 7507015;
public static const SIZE_LARGE:int = 32;
public static const SIZE_LARGEST:int = 52;
public static const SIZE_BUTTON:int = 20;
private static var MainFont:Class = SDTextField_MainFont;
public function SDTextField(aSize:int=16, aColor:int=0xFF8200, aText:String=""){
super();
var format:TextFormat = new TextFormat(DEFAULT_FONT, aSize, aColor);
format.letterSpacing = ((aSize > SIZE_NORMAL)) ? 3 : 2;
autoSize = TextFieldAutoSize.LEFT;
mouseEnabled = false;
embedFonts = true;
defaultTextFormat = format;
antiAliasType = AntiAliasType.ADVANCED;
multiline = false;
filters = createFilters(aSize);
text = aText;
}
override public function get y():Number{
return ((super.y + Math.ceil((this.textHeight / 4))));
}
override public function set y(y:Number):void{
super.y = (y - Math.ceil((this.textHeight / 4)));
}
private function createFilters(aSize:int):Array{
var filters:Array = new Array();
switch (aSize){
case SIZE_SMALL:
filters.push(new BevelFilter(1, 45, 0xFFFFFF, 1, 0, 0.8, 1.2, 1.2, 0.7, BitmapFilterQuality.HIGH));
filters.push(new GlowFilter(0, 1, 4, 4, 4, BitmapFilterQuality.LOW));
break;
case SIZE_NORMAL:
case SIZE_BUTTON:
filters.push(new BevelFilter(1, 45, 0xFFFFFF, 1, 0, 0.8, 1.2, 1.2, 0.7, BitmapFilterQuality.HIGH));
filters.push(new GlowFilter(0, 1, 6, 6, 6, BitmapFilterQuality.LOW));
break;
case SIZE_LARGE:
case SIZE_LARGER:
filters.push(new BevelFilter(1, 45, 0xFFFFFF, 1, 0, 0.8, 2, 2, 1, BitmapFilterQuality.HIGH));
filters.push(new GlowFilter(0, 1, 8, 8, 8, BitmapFilterQuality.LOW));
break;
case SIZE_LARGEST:
case SIZE_MEGA:
filters.push(new BevelFilter(1, 45, 0xFFFFFF, 1, 0, 0.8, 2, 2, 1, BitmapFilterQuality.HIGH));
filters.push(new GlowFilter(0, 1, 8, 8, 8, BitmapFilterQuality.LOW));
break;
};
return (filters);
}
public static function createTextButton(aText:String, aSize:int=16, aSelColor:int=7507015):SimpleButton{
var normal:TextField = new SDTextField(aSize);
normal.text = aText;
var selected:TextField = new SDTextField(aSize, aSelColor);
selected.text = aText;
var button:SimpleButton = new SimpleButton(normal, selected, selected, selected);
return (button);
}
}
}//package smileydifference
Section 37
//SDTextField_MainFont (smileydifference.SDTextField_MainFont)
package smileydifference {
import mx.core.*;
public class SDTextField_MainFont extends FontAsset {
}
}//package smileydifference
Section 38
//SoundButton (smileydifference.SoundButton)
package smileydifference {
import flash.events.*;
import flash.display.*;
import flash.filters.*;
public class SoundButton extends SimpleButton {
private var fSoundOff:DisplayObject;
private var fSoundOn:DisplayObject;
private static var SoundOffImage:Class = SoundButton_SoundOffImage;
private static var SoundOnImage:Class = SoundButton_SoundOnImage;
public function SoundButton(){
fSoundOn = new SoundOnImage();
fSoundOff = new SoundOffImage();
super();
setButton();
addEventListener(MouseEvent.CLICK, toggleSound);
var soundborder:GlowFilter = new GlowFilter(0, 1, 2, 2, 3, BitmapFilterQuality.LOW);
filters = [soundborder];
}
private function setButton():void{
if (SoundManager.sound){
overState = fSoundOn;
downState = fSoundOn;
upState = fSoundOn;
hitTestState = fSoundOn;
} else {
overState = fSoundOff;
downState = fSoundOff;
upState = fSoundOff;
hitTestState = fSoundOff;
};
}
private function toggleSound(e:Event):void{
SoundManager.toggleSound();
setButton();
}
}
}//package smileydifference
Section 39
//SoundButton_SoundOffImage (smileydifference.SoundButton_SoundOffImage)
package smileydifference {
import mx.core.*;
public class SoundButton_SoundOffImage extends BitmapAsset {
}
}//package smileydifference
Section 40
//SoundButton_SoundOnImage (smileydifference.SoundButton_SoundOnImage)
package smileydifference {
import mx.core.*;
public class SoundButton_SoundOnImage extends BitmapAsset {
}
}//package smileydifference
Section 41
//SoundManager (smileydifference.SoundManager)
package smileydifference {
import flash.media.*;
import flash.net.*;
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 fSaveObject:SharedObject = null;
private static var Yay:Class = SoundManager_Yay;
private static var fNo:Sound = (new No() as Sound);
private static var Blip:Class = SoundManager_Blip;
private static var fBlip:Sound = (new Blip() as Sound);
private static var fMusic:Sound = (new Music() as Sound);
private static var Applause:Class = SoundManager_Applause;
private static var No:Class = SoundManager_No;
private static var fMusicChannel:SoundChannel;
private static var fYes:Sound = (new Yes() as Sound);
private static var fYay:Sound = (new Yay() as Sound);
private static var fGameOver:Sound = (new GameOver() as Sound);
private static var fApplause:Sound = (new Applause() as Sound);
private static var fButtonSound:Sound = (new Beep() as Sound);
public function SoundManager(){
super();
}
public static function playGameOver():void{
if (fSound){
fGameOver.play();
};
}
public static function playButton():void{
if (fSound){
fButtonSound.play();
};
}
public static function init():void{
fSaveObject = SharedObject.getLocal("sd2data", "/");
if (fSaveObject.data.sound == null){
fSaveObject.data.sound = true;
fSaveObject.flush();
};
//unresolved jump
var _slot1 = e;
fSound = fSaveObject.data.sound;
}
public static function playBlip():void{
var ch:SoundChannel;
if (fSound){
ch = fBlip.play();
ch.soundTransform = new SoundTransform(3);
};
}
public static function toggleSound():void{
sound = !(sound);
}
public static function get sound():Boolean{
return (fSound);
}
public static function set sound(aSound:Boolean):void{
var aSound = aSound;
fSound = aSound;
if (!fSound){
if (fMusicChannel != null){
fMusicChannel.stop();
};
} else {
fMusicChannel = null;
playMusic();
};
fSaveObject.data.sound = fSound;
//unresolved jump
var _slot1 = e;
}
public static function playMusic():void{
if (((((fSound) && ((fMusicChannel == null)))) && (!((fMusic == null))))){
fMusicChannel = fMusic.play(0, 20);
};
}
public static function playLevelComplete():void{
if (fSound){
fYay.play();
};
}
public static function playCorrect():void{
if (fSound){
fYes.play();
};
}
public static function playWrong():void{
if (fSound){
fNo.play();
};
}
public static function playGameWon():void{
if (fSound){
fApplause.play();
};
}
}
}//package smileydifference
Section 42
//SoundManager_Applause (smileydifference.SoundManager_Applause)
package smileydifference {
import mx.core.*;
public class SoundManager_Applause extends SoundAsset {
}
}//package smileydifference
Section 43
//SoundManager_Beep (smileydifference.SoundManager_Beep)
package smileydifference {
import mx.core.*;
public class SoundManager_Beep extends SoundAsset {
}
}//package smileydifference
Section 44
//SoundManager_Blip (smileydifference.SoundManager_Blip)
package smileydifference {
import mx.core.*;
public class SoundManager_Blip extends SoundAsset {
}
}//package smileydifference
Section 45
//SoundManager_GameOver (smileydifference.SoundManager_GameOver)
package smileydifference {
import mx.core.*;
public class SoundManager_GameOver extends SoundAsset {
}
}//package smileydifference
Section 46
//SoundManager_Music (smileydifference.SoundManager_Music)
package smileydifference {
import mx.core.*;
public class SoundManager_Music extends SoundAsset {
}
}//package smileydifference
Section 47
//SoundManager_No (smileydifference.SoundManager_No)
package smileydifference {
import mx.core.*;
public class SoundManager_No extends SoundAsset {
}
}//package smileydifference
Section 48
//SoundManager_Yay (smileydifference.SoundManager_Yay)
package smileydifference {
import mx.core.*;
public class SoundManager_Yay extends SoundAsset {
}
}//package smileydifference
Section 49
//SoundManager_Yes (smileydifference.SoundManager_Yes)
package smileydifference {
import mx.core.*;
public class SoundManager_Yes extends SoundAsset {
}
}//package smileydifference
Section 50
//TextBalloon (smileydifference.TextBalloon)
package smileydifference {
import flash.display.*;
public class TextBalloon extends Shape {
public function TextBalloon(aWidth:int, aHeight:int){
super();
graphics.beginFill(0xFFFFFF, 0.7);
graphics.lineStyle(2, 0x303030, 1);
graphics.drawRoundRect(0, 0, aWidth, aHeight, (aWidth / 4), (aWidth / 6));
graphics.endFill();
cacheAsBitmap = true;
}
}
}//package smileydifference
Section 51
//TextFactory (smileydifference.TextFactory)
package smileydifference {
import flash.text.*;
import flash.filters.*;
public class TextFactory {
public static const COLOR_DEFAULT:int = 0xF0F0F0;
public static const COLOR_SELECTED:int = 0xFF2400;
public function TextFactory(){
super();
}
public static function createInfoTextField():TextField{
var tf:TextField = new TextField();
var format:TextFormat = new TextFormat("Arial", 14, 0x303030);
format.bold = true;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.mouseEnabled = false;
tf.defaultTextFormat = format;
tf.multiline = true;
return (tf);
}
public static function createCopyrightTextField(aText:String, aColor:int=0xF0F0F0):TextField{
var tf:TextField;
tf = new TextField();
var format:TextFormat = new TextFormat("Arial", 14, aColor);
format.bold = true;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.mouseEnabled = false;
tf.defaultTextFormat = format;
tf.multiline = false;
var glow:GlowFilter = new GlowFilter(aColor, 0.5, 2, 2);
var shadow:DropShadowFilter = new DropShadowFilter(2);
tf.filters = [glow];
tf.text = aText;
return (tf);
}
}
}//package smileydifference
Section 52
//TimeBar (smileydifference.TimeBar)
package smileydifference {
import flash.events.*;
import smileygamer.*;
import flash.filters.*;
public class TimeBar extends AProgressBar {
public function TimeBar(){
super(1, 1, true);
addEventListener(Event.ENTER_FRAME, drawProgress);
var bevel:BevelFilter = new BevelFilter(2, 45, 0xFFFFFF, 1, 0, 0.8, 4, 4, 0.7, BitmapFilterQuality.HIGH);
var glow:GlowFilter = new GlowFilter(0, 1, 6, 6, 6, BitmapFilterQuality.LOW);
filters = [bevel, glow];
}
private function drawProgress(e:Event):void{
if (valueChanged){
graphics.clear();
graphics.beginFill(0xFF8200);
graphics.drawRoundRect(0, 0, progress, height, 4, 4);
graphics.endFill();
};
}
}
}//package smileydifference
Section 53
//TitleButton (smileydifference.TitleButton)
package smileydifference {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class TitleButton extends SimpleButton {
private var fRadius:int;
private static const DIFFWIDTH:int = 230;
private static const COLOR:int = 0xFF8200;
private static const WIDTH:int = 220;
private static const HEIGHT:int = 36;
private static const DIFFHEIGHT:int = 70;
private static const BIGWIDTH:int = 220;
private static const BIGHEIGHT:int = 70;
private static const COLOR_SEL:int = 7507015;
public function TitleButton(aTitle:String, aTitle2:String=null, aBigSize:Boolean=false, aSelTitle:String=null, aSelTitle2:String=null){
var playSound:Function;
var tf2:TextField;
var tfsel2:TextField;
var aTitle = aTitle;
var aTitle2 = aTitle2;
var aBigSize = aBigSize;
var aSelTitle = aSelTitle;
var aSelTitle2 = aSelTitle2;
playSound = function (e:Event):void{
SoundManager.playButton();
};
var butheight:int = (aBigSize) ? BIGHEIGHT : ((aTitle2)!=null) ? DIFFHEIGHT : HEIGHT;
fRadius = (butheight / 2);
var butwidth:int = (aBigSize) ? BIGWIDTH : ((aTitle2)!=null) ? DIFFWIDTH : WIDTH;
if (((aBigSize) && ((aTitle.length > 5)))){
butwidth = (butwidth + 25);
};
var normal:Sprite = new Sprite();
var background:Shape = createBackground(butwidth, butheight);
normal.addChild(background);
var textSize:int = (aBigSize) ? SDTextField.SIZE_LARGER : ((aTitle2)!=null) ? SDTextField.SIZE_LARGE : SDTextField.SIZE_BUTTON;
var tf:TextField = new SDTextField(textSize, COLOR);
tf.text = aTitle;
tf.x = ((normal.width - tf.width) / 2);
tf.y = (normal.y + 6);
if (aBigSize){
tf.y = (tf.y + 2);
};
normal.addChild(tf);
if (aTitle2 != null){
tf2 = new SDTextField(SDTextField.SIZE_SMALL, COLOR);
tf2.text = aTitle2;
tf2.x = ((normal.width - tf2.width) / 2);
tf.y = (tf.y - ((textSize / 2) - 1));
tf2.y = ((((normal.height - tf2.height) / 2) + (textSize / 2)) + 2);
normal.addChild(tf2);
};
normal.cacheAsBitmap = true;
var selected:Sprite = new Sprite();
selected.addChild(createBackground(butwidth, butheight, true));
var tfsel:TextField = new SDTextField(textSize, COLOR_SEL);
tfsel.text = ((aSelTitle)!=null) ? aSelTitle : aTitle;
tfsel.x = ((selected.width - tfsel.width) / 2);
tfsel.y = (selected.y + 6);
if (aBigSize){
tfsel.y = (tfsel.y + 2);
};
selected.addChild(tfsel);
if (aTitle2 != null){
tfsel2 = new SDTextField(SDTextField.SIZE_SMALL, COLOR_SEL);
tfsel2.text = ((aSelTitle2)!=null) ? aSelTitle2 : aTitle2;
tfsel2.x = ((selected.width - tfsel2.width) / 2);
tfsel.y = (tfsel.y - ((textSize / 2) - 1));
tfsel2.y = ((((selected.height - tfsel2.height) / 2) + (textSize / 2)) + 2);
selected.addChild(tfsel2);
};
selected.cacheAsBitmap = true;
super(normal, selected, selected, background);
var bevel:BevelFilter = new BevelFilter(8, 45, 0xFFFFFF, 1, 0, 0.8, 8, 8, 0.7, BitmapFilterQuality.HIGH);
var glow:GlowFilter = new GlowFilter(0, 1, 8, 8, 8, BitmapFilterQuality.LOW);
filters = [bevel, glow];
addEventListener(MouseEvent.MOUSE_OVER, playSound);
}
private function createBackground(aWidth:int, aHeight:int, aSelected:Boolean=false):Shape{
var bg:Shape = new Shape();
bg.graphics.beginFill((aSelected) ? COLOR : COLOR_SEL);
bg.graphics.drawCircle(fRadius, fRadius, fRadius);
bg.graphics.endFill();
bg.graphics.beginFill((aSelected) ? COLOR : COLOR_SEL);
bg.graphics.drawRect((aHeight / 2), 0, aWidth, aHeight);
bg.graphics.endFill();
return (bg);
}
override public function get width():Number{
return ((super.width - fRadius));
}
}
}//package smileydifference
Section 54
//TitleScreen (smileydifference.TitleScreen)
package smileydifference {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import smileygamer.*;
import smileygamer.util.*;
public class TitleScreen extends Sprite implements ILogic {
private var fState:int;// = 0
private var fTitle:Sprite;
private var fPlayButton:SimpleButton;
private var fCreditsLayer:Sprite;
private var fHighscoresButton:SimpleButton;
private var fTitleSmiley:DisplayObject;
private var fCreditsButton:SimpleButton;
private var fAddToSiteButton:SimpleButton;
private var fMoreGamesButton:SimpleButton;
private var fGame:SmileyDifference;
private static const STATE_SHOWING:int = 1;
private static const STATE_INVALID:int = 0;
private static var TitleSmiley:Class = TitleScreen_TitleSmiley;
public function TitleScreen(aGame:SmileyDifference){
super();
fGame = aGame;
addEventListener(Event.ADDED, added);
addEventListener(Event.REMOVED, removed);
}
public function added(aEvent:Event):void{
removeEventListener(Event.ADDED, added);
init();
}
private function hideTitleScreen(aNextFunction:Function):void{
var anim:MoveAnimation = new MoveAnimation(fTitle, new Point(fTitle.x, fTitle.y), new Point(fTitle.x, -(fTitle.height)), 15, InterpolationUtil.TYPE_COSINE, 10);
new MoveAnimation(fTitleSmiley, new Point(fTitleSmiley.x, fTitleSmiley.y), new Point(-650, fTitleSmiley.y), 15, InterpolationUtil.TYPE_COSINE, 10);
anim.addCallback(aNextFunction);
}
private function hideCredits(e:Event):void{
var anim:MoveAnimation = new MoveAnimation(fCreditsLayer, new Point((630 - fCreditsLayer.width), fCreditsLayer.y), new Point(650, fCreditsLayer.y), 15, InterpolationUtil.TYPE_COSINE, 0, true);
anim.addCallback(showMainButtons);
}
private function init():void{
var newTf:Matrix;
var cologo:Sprite;
var addgame:TextField;
var addgameSel:TextField;
var agButton:SimpleButton;
var copyright:TextField;
var copyrightSel:TextField;
var crButton:SimpleButton;
fTitleSmiley = new TitleSmiley();
fTitleSmiley.x = -650;
fTitleSmiley.y = 10;
addChild(fTitleSmiley);
fTitle = new Sprite();
var title1:TextField = new SDTextField(SDTextField.SIZE_LARGER, SDTextField.COLOR_SELECTED, SGLanguage.getText("Smiley"));
newTf = title1.transform.matrix.clone();
newTf.rotate((-(Math.PI) / 10));
title1.transform.matrix = newTf;
title1.x = 5;
title1.y = 60;
title1.cacheAsBitmap = true;
fTitle.addChild(title1);
var title2:TextField = new SDTextField(SDTextField.SIZE_LARGER, SDTextField.COLOR_DEFAULT, SGLanguage.getText("Difference"));
newTf = title2.transform.matrix.clone();
newTf.rotate((-(Math.PI) / 10));
title2.transform.matrix = newTf;
title2.cacheAsBitmap = true;
title2.x = 5;
title2.y = 130;
fTitle.addChild(title2);
var title3:TextField = new SDTextField(SDTextField.SIZE_MEGA, SDTextField.COLOR_SELECTED, "2");
title3.cacheAsBitmap = true;
title3.x = 330;
title3.y = 15;
fTitle.addChild(title3);
var title4:TextField = new SDTextField(SDTextField.SIZE_LARGEST, SDTextField.COLOR_DEFAULT, "SPORTS");
newTf = title4.transform.matrix.clone();
newTf.rotate((Math.PI / 15));
title4.transform.matrix = newTf;
title4.cacheAsBitmap = true;
title4.x = 415;
title4.y = 20;
fTitle.addChild(title4);
fTitle.x = 0;
fTitle.y = 0;
addChild(fTitle);
var soundBtn:SimpleButton = new SoundButton();
soundBtn.x = 600;
soundBtn.y = 20;
addChild(soundBtn);
var smiley:SmileyButton = new SmileyButton(0xFF0000, ((!(SmileyDifference.BFG)) && (!(fGame.isHomeSite()))));
smiley.x = 5;
smiley.y = (475 - smiley.height);
addChild(smiley);
fPlayButton = new TitleButton(SGLanguage.getText("PLAY"), null, true);
fPlayButton.x = (640 - fPlayButton.width);
fPlayButton.y = 180;
addChild(fPlayButton);
fPlayButton.addEventListener(MouseEvent.CLICK, play);
fCreditsButton = new TitleButton(SGLanguage.getText("CREDITS"));
fCreditsButton.x = (640 - fCreditsButton.width);
fCreditsButton.y = 285;
addChild(fCreditsButton);
fCreditsButton.addEventListener(MouseEvent.CLICK, credits);
if (!SmileyDifference.BFG){
if (SmileyDifference.SPONSORED){
fCreditsButton.y = 280;
} else {
fMoreGamesButton = new TitleButton(SGLanguage.getText("MORE GAMES"));
fMoreGamesButton.addEventListener(MouseEvent.CLICK, moreGames);
fMoreGamesButton.x = (640 - fMoreGamesButton.width);
fMoreGamesButton.y = 355;
addChild(fMoreGamesButton);
cologo = CobrandingUtil.getSmallLogo();
if (cologo != null){
cologo.x = (638 - cologo.width);
cologo.y = 410;
addChild(cologo);
};
addgame = TextFactory.createCopyrightTextField(SGLanguage.getText("Add this game to your site"));
addgameSel = TextFactory.createCopyrightTextField(SGLanguage.getText("Add this game to your site"), TextFactory.COLOR_SELECTED);
agButton = new SimpleButton(addgame, addgameSel, addgameSel, addgameSel);
agButton.addEventListener(MouseEvent.CLICK, showGamesForSite);
agButton.x = 80;
agButton.y = 456;
addChild(agButton);
};
} else {
fPlayButton.y = 135;
fCreditsButton.y = 225;
};
if (SmileyDifference.SPONSORED){
};
if (!SmileyDifference.BFG){
copyright = TextFactory.createCopyrightTextField(SGLanguage.getText("copyright", ["2010"]));
copyrightSel = TextFactory.createCopyrightTextField(SGLanguage.getText("copyright", ["2010"]), TextFactory.COLOR_SELECTED);
crButton = new SimpleButton(copyright, copyrightSel, copyrightSel, copyrightSel);
crButton.addEventListener(MouseEvent.CLICK, showHome);
crButton.x = (630 - crButton.width);
crButton.y = 456;
addChild(crButton);
} else {
copyright = TextFactory.createCopyrightTextField(SGLanguage.getText("copyright", ["2010"]));
copyright.x = 100;
copyright.y = 456;
addChild(copyright);
};
fState = STATE_SHOWING;
showTitle();
showMainButtons();
}
private function showMainButtons():void{
new MoveAnimation(fPlayButton, new Point(650, fPlayButton.y), new Point((640 - fPlayButton.width), fPlayButton.y), 15, InterpolationUtil.TYPE_COSINE);
if (fHighscoresButton != null){
new MoveAnimation(fHighscoresButton, new Point(650, fHighscoresButton.y), new Point((640 - fHighscoresButton.width), fHighscoresButton.y), 15, InterpolationUtil.TYPE_COSINE, 2);
};
new MoveAnimation(fCreditsButton, new Point(650, fCreditsButton.y), new Point((640 - fCreditsButton.width), fCreditsButton.y), 15, InterpolationUtil.TYPE_COSINE, 4);
if (fMoreGamesButton != null){
new MoveAnimation(fMoreGamesButton, new Point(650, fMoreGamesButton.y), new Point((640 - fMoreGamesButton.width), fMoreGamesButton.y), 15, InterpolationUtil.TYPE_COSINE, 6);
};
if (fAddToSiteButton != null){
new MoveAnimation(fAddToSiteButton, new Point(650, fAddToSiteButton.y), new Point((640 - fAddToSiteButton.width), fAddToSiteButton.y), 15, InterpolationUtil.TYPE_COSINE, 8);
};
}
private function showTitle():void{
new MoveAnimation(fTitle, new Point(fTitle.x, -(fTitle.height)), new Point(fTitle.x, fTitle.y), 15, InterpolationUtil.TYPE_COSINE);
new MoveAnimation(fTitleSmiley, new Point(fTitleSmiley.x, fTitleSmiley.y), new Point(-20, fTitleSmiley.y), 15, InterpolationUtil.TYPE_COSINE);
}
public function removed(aEvent:Event):void{
}
private function credits(e:Event):void{
hideMainButtons();
fCreditsLayer = new Sprite();
fCreditsLayer.y = 180;
var balloon:TextBalloon = new TextBalloon(200, 250);
fCreditsLayer.addChild(balloon);
var tf:TextField = TextFactory.createInfoTextField();
tf.text = SGLanguage.getText("creditstext", ["1.0"]);
tf.x = (balloon.x + 20);
tf.y = (balloon.y + 15);
fCreditsLayer.addChild(tf);
new MoveAnimation(fCreditsLayer, new Point(650, fCreditsLayer.y), new Point((630 - fCreditsLayer.width), fCreditsLayer.y), 15, InterpolationUtil.TYPE_COSINE, 20);
addChild(fCreditsLayer);
fCreditsLayer.addEventListener(MouseEvent.CLICK, hideCredits);
}
private function showHighscores(e:Event):void{
fGame.showHighscoresPage();
}
public function doLogic():void{
}
private function moreGames(e:Event):void{
fGame.showSponsorSite();
}
private function hideMainButtons():void{
new MoveAnimation(fPlayButton, new Point((640 - fPlayButton.width), fPlayButton.y), new Point(650, fPlayButton.y), 15, InterpolationUtil.TYPE_COSINE, 8);
if (fHighscoresButton != null){
new MoveAnimation(fHighscoresButton, new Point((640 - fHighscoresButton.width), fHighscoresButton.y), new Point(650, fHighscoresButton.y), 15, InterpolationUtil.TYPE_COSINE, 6);
};
new MoveAnimation(fCreditsButton, new Point((640 - fCreditsButton.width), fCreditsButton.y), new Point(650, fCreditsButton.y), 15, InterpolationUtil.TYPE_COSINE, 4);
if (fMoreGamesButton != null){
new MoveAnimation(fMoreGamesButton, new Point((640 - fMoreGamesButton.width), fMoreGamesButton.y), new Point(650, fMoreGamesButton.y), 15, InterpolationUtil.TYPE_COSINE, 2);
};
if (fAddToSiteButton != null){
new MoveAnimation(fAddToSiteButton, new Point((640 - fAddToSiteButton.width), fAddToSiteButton.y), new Point(650, fAddToSiteButton.y), 15, InterpolationUtil.TYPE_COSINE);
};
}
private function showGamesForSite(e:Event):void{
SmileyGamer.showFreeContent();
}
private function play(e:Event):void{
hideMainButtons();
startGame();
}
private function showGameOnSite(e:Event):void{
SmileyGamer.showGameAtHome();
}
private function startGame():void{
var showGame:Function;
showGame = function ():void{
fGame.showGameScreen();
};
hideTitleScreen(showGame);
}
private function showHome(e:Event):void{
fGame.showSGSite();
}
}
}//package smileydifference
Section 55
//TitleScreen_TitleSmiley (smileydifference.TitleScreen_TitleSmiley)
package smileydifference {
import mx.core.*;
public class TitleScreen_TitleSmiley extends BitmapAsset {
}
}//package smileydifference
Section 56
//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 function InterpolationUtil(){
super();
}
public static function createValues(aType:int, aBegin:Number, aEnd:Number, aSteps:int):Array{
var values:Array = new Array(aSteps);
var max:int = (aSteps - 1);
var i:int;
while (i < aSteps) {
if (aType == TYPE_COSINE){
values[i] = (aBegin + (((aEnd - aBegin) * Number((1 - Math.cos(((i * Math.PI) / max))))) / 2));
} else {
if (aType == TYPE_ACOS){
values[i] = (aBegin + ((aEnd - aBegin) * Number((Math.acos((1 - ((2 * Number(i)) / max))) / Math.PI))));
} else {
values[i] = (aBegin + (((aEnd - aBegin) * Number(i)) / max));
};
};
i++;
};
return (values);
}
}
}//package smileygamer.util
Section 57
//AAnimation (smileygamer.AAnimation)
package smileygamer {
import flash.events.*;
import flash.display.*;
public class AAnimation implements IAnimation {
private var fStopped:Boolean;
private var fCallbacks:Array;
private var fDisplayObject:DisplayObject;
private var fFrame:int;// = 0
private var fLooping:Boolean;
public function AAnimation(aDisplayObject:DisplayObject){
super();
fDisplayObject = aDisplayObject;
looping = true;
fCallbacks = new Array();
reset();
}
public function stop():void{
fStopped = true;
}
private function doCallbacks():void{
var callback:Function;
var i:int;
while (i < fCallbacks.length) {
callback = (fCallbacks[i] as Function);
callback.call(this);
i++;
};
}
public function get looping():Boolean{
return (fLooping);
}
public function addCallback(aCallback:Function):void{
if (aCallback != null){
fCallbacks.push(aCallback);
};
}
public function update():void{
}
public function reset():void{
fFrame = 0;
fStopped = false;
displayObject.removeEventListener(Event.ENTER_FRAME, next);
displayObject.addEventListener(Event.ENTER_FRAME, next);
update();
}
public function get displayObject():DisplayObject{
return (fDisplayObject);
}
protected function get frameCount():int{
return (1);
}
public function removeCallback(aCallback:Function):void{
var i:int;
while (i < fCallbacks.length) {
if (fCallbacks[i] == aCallback){
fCallbacks.splice(i, 1);
};
i++;
};
}
protected function get frame():int{
return (fFrame);
}
public function get finished():Boolean{
return ((((fFrame == frameCount)) || (fStopped)));
}
private function next(aEvent: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(aValue:Boolean):void{
fLooping = aValue;
}
}
}//package smileygamer
Section 58
//AGame (smileygamer.AGame)
package smileygamer {
import flash.events.*;
import flash.display.*;
public class AGame extends MovieClip {
public function AGame(){
super();
addEventListener(Event.ENTER_FRAME, mainLoop);
}
public function mainLoop(aEvent:Event):void{
var logic:ILogic;
var i:int;
while (i < numChildren) {
if ((getChildAt(i) is ILogic)){
logic = (getChildAt(i) as ILogic);
logic.doLogic();
};
i++;
};
}
}
}//package smileygamer
Section 59
//AProgressBar (smileygamer.AProgressBar)
package smileygamer {
import flash.display.*;
public class AProgressBar extends Shape {
private var fWidth:Number;
private var fValueChanged:Boolean;
private var fHorizontal:Boolean;
private var fValue:Number;
private var fHeight:Number;
private var fMaxValue:Number;
public function AProgressBar(aMaxValue:Number=1, aBeginValue:Number=0, aHorizontal:Boolean=true){
super();
fMaxValue = aMaxValue;
fValue = aBeginValue;
fHorizontal = aHorizontal;
fValueChanged = true;
}
public function set maxValue(aMaxValue:Number):void{
fMaxValue = aMaxValue;
if (fValue > fMaxValue){
fValue = fMaxValue;
};
}
protected function get valueChanged():Boolean{
return (fValueChanged);
}
public function set value(aValue:Number):void{
if (fValue != aValue){
fValueChanged = true;
};
fValue = aValue;
if (fValue < 0){
fValue = 0;
};
if (fValue > fMaxValue){
fValue = fMaxValue;
};
}
protected function get progress():Number{
fValueChanged = false;
if (fHorizontal){
return (((width * fValue) / fMaxValue));
};
return (((height * fValue) / fMaxValue));
}
override public function set width(aWidth:Number):void{
fWidth = aWidth;
}
override public function get height():Number{
return (fHeight);
}
public function get fraction():Number{
return ((fValue / fMaxValue));
}
public function get value():Number{
return (fValue);
}
override public function get width():Number{
return (fWidth);
}
public function get maxValue():Number{
return (fMaxValue);
}
override public function set height(aHeight:Number):void{
fHeight = aHeight;
}
}
}//package smileygamer
Section 60
//BlinkAnimation (smileygamer.BlinkAnimation)
package smileygamer {
import flash.display.*;
public class BlinkAnimation extends AAnimation {
private var fTimes:int;
private var fFramesPerBlink:int;
public function BlinkAnimation(aDisplayObject:DisplayObject, aTimes:int, aFramesPerBlink:int=1){
fTimes = aTimes;
fFramesPerBlink = aFramesPerBlink;
super(aDisplayObject);
looping = false;
}
override protected function get frameCount():int{
return ((fTimes * fFramesPerBlink));
}
override public function update():void{
if ((frame % fFramesPerBlink) == (fFramesPerBlink - 1)){
displayObject.visible = !(displayObject.visible);
};
}
}
}//package smileygamer
Section 61
//FadeAnimation (smileygamer.FadeAnimation)
package smileygamer {
import flash.display.*;
import smileygamer.util.*;
public class FadeAnimation extends AAnimation {
private var fSteps:int;
private var fValues:Array;
private var fMode:int;
private var fDelay:int;
public static const MODE_FADE_IN_OUT_REMOVE:int = 4;
public static const MODE_FADE_IN:int = 0;
public static const MODE_FADE_OUT:int = 1;
public static const MODE_FADE_IN_OUT:int = 3;
public static const MODE_FADE_OUT_REMOVE:int = 2;
public function FadeAnimation(aDisplayObject:DisplayObject, aSteps:int, aMode:int, aDelay:int=0){
var val2:Array;
var i:int;
fSteps = aSteps;
fMode = aMode;
fDelay = aDelay;
if (fMode == MODE_FADE_IN){
fValues = InterpolationUtil.createValues(InterpolationUtil.TYPE_COSINE, 0, 1, fSteps);
} else {
if ((((fMode == MODE_FADE_OUT)) || (MODE_FADE_OUT_REMOVE))){
fValues = InterpolationUtil.createValues(InterpolationUtil.TYPE_COSINE, 1, 0, fSteps);
} else {
fValues = InterpolationUtil.createValues(InterpolationUtil.TYPE_COSINE, 0, 1, (fSteps / 2));
val2 = InterpolationUtil.createValues(InterpolationUtil.TYPE_COSINE, 1, 0, (fSteps / 2));
i = 0;
while (i < val2.length) {
fValues.push(val2[i]);
i++;
};
};
};
super(aDisplayObject);
looping = false;
}
public function setFadeValues(aStart:Number, aEnd:Number):void{
fValues = InterpolationUtil.createValues(InterpolationUtil.TYPE_COSINE, aStart, aEnd, fSteps);
}
override protected function get frameCount():int{
return ((fSteps + fDelay));
}
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 public function get finished():Boolean{
var res:Boolean = super.finished;
if (((res) && ((((fMode == MODE_FADE_OUT_REMOVE)) || ((fMode == MODE_FADE_IN_OUT_REMOVE)))))){
displayObject.parent.removeChild(displayObject);
};
return (res);
}
}
}//package smileygamer
Section 62
//IAnimation (smileygamer.IAnimation)
package smileygamer {
public interface IAnimation {
function update():void;
function get finished():Boolean;
function get looping():Boolean;
}
}//package smileygamer
Section 63
//ILogic (smileygamer.ILogic)
package smileygamer {
public interface ILogic {
function doLogic():void;
}
}//package smileygamer
Section 64
//MoveAnimation (smileygamer.MoveAnimation)
package smileygamer {
import flash.display.*;
import flash.geom.*;
import smileygamer.util.*;
public class MoveAnimation extends AAnimation {
private var fSteps:int;
private var fRemove:Boolean;
private var fXCoords:Array;
private var fYCoords:Array;
public function MoveAnimation(aDisplayObject:DisplayObject, aStartPos:Point, aStopPos:Point, aSteps:int, aType:int=0, aDelay:int=0, aRemove:Boolean=false, aReturnToStart:Boolean=false){
fSteps = (aSteps + aDelay);
fXCoords = new Array();
fYCoords = new Array();
var i:int;
while (i < aDelay) {
fXCoords.push(aStartPos.x);
fYCoords.push(aStartPos.y);
i++;
};
var xs:Array = InterpolationUtil.createValues(aType, aStartPos.x, aStopPos.x, aSteps);
var ys:Array = InterpolationUtil.createValues(aType, aStartPos.y, aStopPos.y, aSteps);
fXCoords.push(Math.round(xs[0]));
fYCoords.push(Math.round(ys[0]));
i = 1;
while (i < (xs.length - 1)) {
fXCoords.push(xs[i]);
fYCoords.push(ys[i]);
i++;
};
fXCoords.push(Math.round(xs[(xs.length - 1)]));
fYCoords.push(Math.round(ys[(xs.length - 1)]));
if (aReturnToStart){
fSteps = ((aSteps * 2) + aDelay);
i = (xs.length - 1);
while (i >= 0) {
fXCoords.push(fXCoords[i]);
fYCoords.push(fYCoords[i]);
i--;
};
};
fRemove = aRemove;
super(aDisplayObject);
looping = false;
}
override protected function get frameCount():int{
return (fSteps);
}
override public function get finished():Boolean{
var res:Boolean = super.finished;
if (((res) && (fRemove))){
displayObject.parent.removeChild(displayObject);
};
return (res);
}
override public function update():void{
displayObject.x = fXCoords[frame];
displayObject.y = fYCoords[frame];
}
}
}//package smileygamer
Section 65
//ScaleAnimation (smileygamer.ScaleAnimation)
package smileygamer {
import flash.display.*;
import flash.geom.*;
import smileygamer.util.*;
public class ScaleAnimation extends AAnimation {
private var fSteps:int;
private var fOrigMatrix:Matrix;
private var fRemove:Boolean;
private var fXScales:Array;
private var fYScales:Array;
private var fCenterX:Number;
private var fCenterY:Number;
public function ScaleAnimation(aDisplayObject:DisplayObject, aStartXScale:Number, aStartYScale:Number, aStopXScale:Number, aStopYScale:Number, aSteps:int, aType:int=0, aDelay:int=0, aRemove:Boolean=false, aReturnToStart:Boolean=false){
fCenterX = (aDisplayObject.x + (aDisplayObject.width / 2));
fCenterY = (aDisplayObject.y + (aDisplayObject.height / 2));
fSteps = (aSteps + aDelay);
fXScales = new Array();
fYScales = new Array();
var i:int;
while (i < aDelay) {
fXScales.push(aStartXScale);
fYScales.push(aStartYScale);
i++;
};
var xs:Array = InterpolationUtil.createValues(aType, aStartXScale, aStopXScale, aSteps);
var ys:Array = InterpolationUtil.createValues(aType, aStartYScale, aStopYScale, aSteps);
i = 0;
while (i < xs.length) {
fXScales.push(xs[i]);
fYScales.push(ys[i]);
i++;
};
if (aReturnToStart){
fSteps = ((aSteps * 2) + aDelay);
i = (xs.length - 1);
while (i >= 0) {
fXScales.push(fXScales[i]);
fYScales.push(fYScales[i]);
i--;
};
};
fRemove = aRemove;
aDisplayObject.scaleX = 1;
aDisplayObject.scaleY = 1;
aDisplayObject.x = (fCenterX - (aDisplayObject.width / 2));
aDisplayObject.y = (fCenterY - (aDisplayObject.height / 2));
fOrigMatrix = aDisplayObject.transform.matrix;
super(aDisplayObject);
looping = false;
}
override protected function get frameCount():int{
return (fSteps);
}
override public function update():void{
var tf:Matrix = fOrigMatrix.clone();
tf.translate(-(fCenterX), -(fCenterY));
tf.scale(fXScales[frame], fYScales[frame]);
tf.translate(fCenterX, fCenterY);
displayObject.transform.matrix = tf;
}
override public function get finished():Boolean{
var res:Boolean = super.finished;
if (((res) && (fRemove))){
displayObject.parent.removeChild(displayObject);
};
return (res);
}
}
}//package smileygamer
Section 66
//SmileyButton (smileygamer.SmileyButton)
package smileygamer {
import flash.events.*;
import flash.display.*;
import flash.filters.*;
public class SmileyButton extends SimpleButton {
private static var SmileySmall:Class = SmileyButton_SmileySmall;
public function SmileyButton(aGlowColor:int=0xFF0000, aEnabled:Boolean=true){
var innershadow2:DropShadowFilter = new DropShadowFilter(1, -135);
innershadow2.alpha = 0.8;
innershadow2.quality = BitmapFilterQuality.HIGH;
innershadow2.inner = true;
var blackglow:GlowFilter = new GlowFilter(0, 1, 4, 4, 4, BitmapFilterQuality.LOW);
var smiley:DisplayObject = new SmileySmall();
smiley.filters = [innershadow2, blackglow];
var smileysel:DisplayObject = new SmileySmall();
var glow:GlowFilter = new GlowFilter(aGlowColor, 1, 4, 4, 4, BitmapFilterQuality.LOW);
smileysel.filters = [innershadow2, glow];
super(smiley, smileysel, smileysel, smileysel);
if (aEnabled){
addEventListener(MouseEvent.CLICK, showHome);
} else {
mouseEnabled = false;
};
}
private function showHome(e:Event):void{
SmileyGamer.showHome();
}
}
}//package smileygamer
Section 67
//SmileyButton_SmileySmall (smileygamer.SmileyButton_SmileySmall)
package smileygamer {
import mx.core.*;
public class SmileyButton_SmileySmall extends BitmapAsset {
}
}//package smileygamer
Section 68
//Log (SWFStats.Log)
package SWFStats {
import flash.events.*;
import flash.utils.*;
import flash.external.*;
import flash.net.*;
import flash.system.*;
public final class Log {
private static const PingR:Timer = new Timer(30000);
private static const Random:Number = Math.random();
private static const PingF:Timer = new Timer(60000);
public static var GUID:String = "";
private static var Plays:int = 0;
private static var Enabled:Boolean = false;
private static var FirstPing:Boolean = true;
private static var Pings:int = 0;
public static var SourceUrl:String;
private static var HighestGoal:int = 0;
public static var SWFID:int = 0;
public function Log(){
super();
}
private static function GetCookie(n:String):int{
var cookie:SharedObject = SharedObject.getLocal("swfstats");
if (cookie.data[n] == undefined){
return (0);
};
return (int(cookie.data[n]));
}
private static function SaveCookie(n:String, v:int):void{
var cookie:SharedObject = SharedObject.getLocal("swfstats");
cookie.data[n] = v.toString();
cookie.flush();
}
public static function View(swfid:int=0, guid:String="", defaulturl:String=""):void{
SWFID = swfid;
GUID = guid;
Enabled = true;
if ((((SWFID == 0)) || ((GUID == "")))){
Enabled = false;
return;
};
if (((((!((defaulturl.indexOf("http://") == 0))) && (!((Security.sandboxType == "localWithNetwork"))))) && (!((Security.sandboxType == "localTrusted"))))){
Enabled = false;
return;
};
SourceUrl = GetUrl(defaulturl);
if ((((SourceUrl == null)) || ((SourceUrl == "")))){
Enabled = false;
return;
};
Security.allowDomain("http://tracker.swfstats.com/");
Security.allowInsecureDomain("http://tracker.swfstats.com/");
Security.loadPolicyFile("http://tracker.swfstats.com/crossdomain.xml");
Security.allowDomain("http://utils.swfstats.com/");
Security.allowInsecureDomain("http://utils.swfstats.com/");
Security.loadPolicyFile("http://utils.swfstats.com/crossdomain.xml");
var views:int = GetCookie("views");
views++;
SaveCookie("views", views);
Send("View", ("views=" + views));
PingF.addEventListener(TimerEvent.TIMER, PingServer);
PingF.start();
}
public static function LevelCounterMetric(name:String, level):void{
if (!Enabled){
return;
};
Send("LevelMetric", ((("name=" + escape(name)) + "&level=") + level));
}
private static function Send(page:String, data:String):void{
var sendaction:URLLoader = new URLLoader();
sendaction.addEventListener(IOErrorEvent.IO_ERROR, ErrorHandler);
sendaction.addEventListener(HTTPStatusEvent.HTTP_STATUS, StatusChange);
sendaction.addEventListener(SecurityErrorEvent.SECURITY_ERROR, ErrorHandler);
sendaction.load(new URLRequest(((((((((((("http://tracker.swfstats.com/Games/" + page) + ".html?guid=") + GUID) + "&swfid=") + SWFID) + "&") + data) + "&url=") + SourceUrl) + "&") + Random)));
}
public static function Play():void{
if (!Enabled){
return;
};
Plays++;
Send("Play", ("plays=" + Plays));
}
private static function GetUrl(defaulturl:String):String{
var url:String;
var defaulturl = defaulturl;
if (ExternalInterface.available){
url = String(ExternalInterface.call("window.location.href.toString"));
//unresolved jump
var _slot1 = s;
url = defaulturl;
} else {
if (defaulturl.indexOf("http://") == 0){
url = defaulturl;
};
};
if ((((((url == null)) || ((url == "")))) || ((url == "null")))){
if ((((Security.sandboxType == "localWithNetwork")) || ((Security.sandboxType == "localTrusted")))){
url = "http://local-testing/";
} else {
url = null;
};
};
return (url);
}
private static function ErrorHandler(... _args):void{
Enabled = false;
}
public static function LevelRangedMetric(name:String, level, value:int):void{
if (!Enabled){
return;
};
Send("LevelMetricRanged", ((((("name=" + escape(name)) + "&level=") + level) + "&value=") + value));
}
private static function StatusChange(... _args):void{
}
public static function Goal(n:int, name:String):void{
}
private static function PingServer(... _args):void{
if (!Enabled){
return;
};
Pings++;
Send("Ping", (((FirstPing) ? "&firstping=yes" : "" + "&pings=") + Pings));
if (FirstPing){
PingF.stop();
PingR.addEventListener(TimerEvent.TIMER, PingServer);
PingR.start();
FirstPing = false;
};
}
public static function LevelAverageMetric(name:String, level, value:int):void{
if (!Enabled){
return;
};
Send("LevelMetricAverage", ((((("name=" + escape(name)) + "&level=") + level) + "&value=") + value));
}
public static function CustomMetric(name:String, group:String=null):void{
if (!Enabled){
return;
};
if (group == null){
group = "";
};
Send("CustomMetric", ((("name=" + escape(name)) + "&group=") + escape(group)));
}
}
}//package SWFStats
Section 69
//AdBox (AdBox)
package {
import flash.display.*;
public dynamic class AdBox extends MovieClip {
public function AdBox(){
super();
}
}
}//package
Section 70
//CobrandingUtil (CobrandingUtil)
package {
import flash.events.*;
import flash.display.*;
public class CobrandingUtil {
private static var sConfig:Object = null;
public function CobrandingUtil(){
super();
}
public static function getIntroLogo():Sprite{
var logo:DisplayObject;
if (sConfig == null){
return (null);
};
var coLogo:Sprite = new Sprite();
if ((((sConfig.domain == null)) || (SmileyGamer.isDomain(sConfig.domain)))){
logo = DisplayObject(sConfig.logo);
if (sConfig.logoTf != null){
logo.transform.matrix = sConfig.logoTf;
};
coLogo.addChild(logo);
} else {
return (null);
};
if (sConfig.logoURL != null){
var coclick:Function = function (e:Event):void{
SmileyGamer.showURL(sConfig.logoURL);
};
coLogo.addEventListener(MouseEvent.CLICK, coclick);
coLogo.buttonMode = true;
};
return (coLogo);
}
public static function getMochiBot():String{
return (((sConfig == null)) ? null : sConfig.mochibot);
}
public static function getSmallLogo():Sprite{
var logo:DisplayObject;
if (sConfig == null){
return (null);
};
var coLogo:Sprite = new Sprite();
if ((((sConfig.domain == null)) || (SmileyGamer.isDomain(sConfig.domain)))){
logo = ((sConfig.smallLogo)!=null) ? DisplayObject(sConfig.smallLogo) : DisplayObject(sConfig.logo);
if (sConfig.smallTf != null){
logo.transform.matrix = sConfig.smallTf;
};
coLogo.addChild(logo);
} else {
return (null);
};
if (sConfig.logoURL != null){
var coclick:Function = function (e:Event):void{
SmileyGamer.showURL(sConfig.logoURL);
};
coLogo.addEventListener(MouseEvent.CLICK, coclick);
coLogo.buttonMode = true;
};
return (coLogo);
}
}
}//package
Section 71
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public function MochiBot(){
super();
}
public static function track(parent:Sprite, tag:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var self:MochiBot = new (MochiBot);
parent.addChild(self);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var server:String = "http://core.mochibot.com/my/core.swf";
var lv:URLVariables = new URLVariables();
lv["sb"] = Security.sandboxType;
lv["v"] = Capabilities.version;
lv["swfid"] = tag;
lv["mv"] = "8";
lv["fv"] = "9";
var url:String = self.root.loaderInfo.loaderURL;
if (url.indexOf("http") == 0){
lv["url"] = url;
} else {
lv["url"] = "local";
};
var req:URLRequest = new URLRequest(server);
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
var loader:Loader = new Loader();
self.addChild(loader);
loader.load(req);
return (self);
}
}
}//package
Section 72
//PreloaderFactory (PreloaderFactory)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import SWFStats.*;
import smileygamer.*;
import smileydifference.*;
import smileygamer.util.*;
import flash.filters.*;
public dynamic class PreloaderFactory extends MovieClip {
private var PlayButton:Class;
private var fStartTime:int;
private var fShowTab:Boolean;
private var fPlayButton:SimpleButton;
private var fProgress:Shape;
private var PlayButtonSel:Class;
private var fIntro:Sprite;
private var fLoadTime:int;
private var SGLogo:Class;
private static const MAIN_CLASS:String = "SmileyDifference";
public static const WIDTH:int = 640;
public static const HEIGHT:int = 480;
private static const SG_COLOR:int = 3353614;
public function PreloaderFactory(){
var playgame:Function;
SGLogo = PreloaderFactory_SGLogo;
PlayButton = PreloaderFactory_PlayButton;
PlayButtonSel = PreloaderFactory_PlayButtonSel;
playgame = function (e:Event):void{
nextFrame();
init();
};
super();
stage.frameRate = 32;
stage.scaleMode = StageScaleMode.NO_SCALE;
stop();
SmileyGamer.init(stage, 5536, "Smiley Difference 2: Sports");
addEventListener(Event.ADDED_TO_STAGE, added);
MochiBot.track(this, "154356de");
addChild(new Background());
fLoadTime = (((SmileyGamer.isHome()) || (SmileyGamer.isLocal()))) ? 4000 : 8000;
showIntro();
fStartTime = getTimer();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
fProgress = new Shape();
fProgress.filters = [new GlowFilter(SG_COLOR, 0.75, 2, 2, 2, BitmapFilterQuality.HIGH)];
addChild(fProgress);
var playBtn:DisplayObject = new PlayButton();
var playbackground:Shape = new Shape();
playbackground.graphics.beginFill(0, 1);
playbackground.graphics.drawRect(-3, -3, (playBtn.width + 5), (playBtn.height + 5));
fPlayButton = new SimpleButton(playBtn, new PlayButtonSel(), new PlayButtonSel(), playbackground);
fPlayButton.x = ((WIDTH / 2) - 50);
fPlayButton.y = (HEIGHT - 50);
fPlayButton.addEventListener(MouseEvent.CLICK, playgame);
}
private function added(e:Event):void{
Log.View(396, "b0322ec4-2f42-4eba-b0ac-dedb0d93d6f3", root.loaderInfo.loaderURL);
}
public function onEnterFrame(event:Event):void{
var p1:Number;
var p2:Number;
var percent:Number;
if ((((framesLoaded == totalFrames)) && (((getTimer() - fStartTime) > fLoadTime)))){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
fProgress.graphics.clear();
fProgress.graphics.lineStyle(1, SG_COLOR);
fProgress.graphics.drawRect(10, (HEIGHT - 30), (WIDTH - 20), 10);
fProgress.graphics.beginFill(SG_COLOR);
fProgress.graphics.drawRect(11, (HEIGHT - 19), (WIDTH - 22), 8);
fProgress.graphics.endFill();
removeChild(fProgress);
addChild(fPlayButton);
} else {
if (fProgress != null){
p1 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
p2 = ((getTimer() - fStartTime) / fLoadTime);
percent = Math.min(p1, p2, 1);
fProgress.graphics.clear();
fProgress.graphics.lineStyle(1, SG_COLOR);
fProgress.graphics.drawRect(10, (HEIGHT - 30), (WIDTH - 20), 10);
fProgress.graphics.beginFill(SG_COLOR);
fProgress.graphics.drawRect(11, (HEIGHT - 29), ((WIDTH - 22) * percent), 8);
fProgress.graphics.endFill();
};
};
}
private function clicked(e:Event):void{
SmileyGamer.showHome();
}
private function showIntro():void{
fIntro = new Sprite();
fIntro.addChild(new SGLogo());
fIntro.x = ((WIDTH - 400) / 2);
fIntro.y = ((HEIGHT - 320) / 2);
addChild(fIntro);
if (!SmileyGamer.isHome()){
var clicked:Function = function (e:Event):void{
SmileyGamer.showHome();
};
fIntro.addEventListener(MouseEvent.CLICK, clicked);
fIntro.buttonMode = true;
};
new MoveAnimation(fIntro, new Point((WIDTH + 10), fIntro.y), new Point(fIntro.x, fIntro.y), 30, InterpolationUtil.TYPE_COSINE);
}
public function init():void{
var mainClass:Class;
var app:Object;
mainClass = (getDefinitionByName(MAIN_CLASS) as Class);
app = new (mainClass);
addChild((app as DisplayObject));
new MoveAnimation(fIntro, new Point(fIntro.x, fIntro.y), new Point(fIntro.x, -400), 10, InterpolationUtil.TYPE_COSINE, 0, true);
removeChild(fPlayButton);
//unresolved jump
var _slot1 = re;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}//package
Section 73
//PreloaderFactory_PlayButton (PreloaderFactory_PlayButton)
package {
import mx.core.*;
import flash.utils.*;
public class PreloaderFactory_PlayButton extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function PreloaderFactory_PlayButton(){
dataClass = PreloaderFactory_PlayButton_dataClass;
super();
initialWidth = (2040 / 20);
initialHeight = (560 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 74
//PreloaderFactory_PlayButton_dataClass (PreloaderFactory_PlayButton_dataClass)
package {
import mx.core.*;
public class PreloaderFactory_PlayButton_dataClass extends ByteArrayAsset {
}
}//package
Section 75
//PreloaderFactory_PlayButtonSel (PreloaderFactory_PlayButtonSel)
package {
import mx.core.*;
import flash.utils.*;
public class PreloaderFactory_PlayButtonSel extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function PreloaderFactory_PlayButtonSel(){
dataClass = PreloaderFactory_PlayButtonSel_dataClass;
super();
initialWidth = (2040 / 20);
initialHeight = (560 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 76
//PreloaderFactory_PlayButtonSel_dataClass (PreloaderFactory_PlayButtonSel_dataClass)
package {
import mx.core.*;
public class PreloaderFactory_PlayButtonSel_dataClass extends ByteArrayAsset {
}
}//package
Section 77
//PreloaderFactory_SGLogo (PreloaderFactory_SGLogo)
package {
import mx.core.*;
import flash.utils.*;
public class PreloaderFactory_SGLogo extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function PreloaderFactory_SGLogo(){
dataClass = PreloaderFactory_SGLogo_dataClass;
super();
initialWidth = (8000 / 20);
initialHeight = (0x1900 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 78
//PreloaderFactory_SGLogo_dataClass (PreloaderFactory_SGLogo_dataClass)
package {
import mx.core.*;
public class PreloaderFactory_SGLogo_dataClass extends ByteArrayAsset {
}
}//package
Section 79
//SGLanguage (SGLanguage)
package {
import flash.system.*;
public class SGLanguage {
public static const GERMAN:Object = {Smiley:"Smiley", Difference:"Difference", PLAY:"SPIELEN", HIGHSCORES:"HIGHSCORES", CREDITS:"CREDITS", MORE GAMES:"MEHR SPIELE", Add this game to your site:"Dieses Spiel zu deiner Website", copyright:"Copyright #0 SmileyGamer", creditstext:("Smiley Difference 2\nVersion #0\nvon SmileyGamer\n\nProgrammierung von\nJochen De Schepper\n\n" + "Grafiken von\nJochen De Schepper &\nAndrew Rowe"), Score:"Punkte", Differences:"Unterschiede", clicktocontinue:"Zum Weitermachen klicken", Game Over!:"Game Over!", Well Done!:"Sehr Gut!", Game Won!:"Gewonnen!", Hints:"Hints", Back To Menu:"Zum Menü", Play More Games:"Mehr Spiele", instructions:"Klicken Sie auf die Unterschiede"};
public static const ITALIAN:Object = {Smiley:"Smiley", Difference:"Difference", PLAY:"GIOCA", HIGHSCORES:"PUNTEGGI PIÙ ALTI", CREDITS:"CREDITI", MORE GAMES:"PIÙ GIOCHI", Add this game to your site:"Aggiungi al tuo sito", copyright:"Copyright 2009 SmileyGamer", creditstext:("Smiley Difference 2\nversione #0\ndi SmileyGamer\n\nCodificazione di\nJochen De Schepper\n\n" + "Grafica di\nJochen De Schepper &\nAndrew Rowe"), clicktocontinue:"Fai clic per continuare", Score:"Punteggio", Differences:"Differenze", Game Over!:"Gioco Finito!", Well Done!:"Ben Fatto!", Game Won!:"Ha Vinto!", Hints:"Hints", Back To Menu:"Al Menu", Play More Games:"Più Giochi", instructions:"Clicca sulle differenze tra i 2 immagini"};
public static const DUTCH:Object = {Smiley:"Smiley", Difference:"Difference", PLAY:"SPELEN", HIGHSCORES:"HIGHSCORES", CREDITS:"CREDITS", MORE GAMES:"MEER SPELLEN", Add this game to your site:"Zet dit spel op je eigen site", copyright:"Copyright #0 SmileyGamer", creditstext:("Smiley Difference 2\nversie #0\ndoor SmileyGamer\n\nProgrammering door\nJochen De Schepper\n\n" + "Vormgeving door\nJochen De Schepper &\nAndrew Rowe"), clicktocontinue:"Klik om verder te gaan", Score:"Score", Differences:"Verschillen", Game Over!:"Game Over!", Well Done!:"Zeer Goed!", Game Won!:"Gewonnen!", Hints:"Hints", Back To Menu:"Naar Menu", Play More Games:"Meer Spellen", instructions:"Klik op de verschillen in de afbeeldingen"};
public static const ENGLISH:Object = {Smiley:"Smiley", Difference:"Difference", PLAY:"PLAY", HIGHSCORES:"HIGHSCORES", CREDITS:"CREDITS", MORE GAMES:"MORE GAMES", Add this game to your site:"Add this game to your site", copyright:"Copyright #0 SmileyGamer", creditstext:("Smiley Difference 2\nversion #0\nby SmileyGamer\n\nCoding by\nJochen De Schepper\n\n" + "Artwork by\nJochen De Schepper &\nAndrew Rowe\n\nMusic by\nRageVI"), Score:"Score", Differences:"Differences", clicktocontinue:"Click to continue", Game Over!:"Game Over!", Well Done!:"Well Done!", Game Won!:"Game Won!", Hints:"Hints", Back To Menu:"Back To Menu", Play More Games:"More Games", instructions:"Click on the differences in the 2 images"};
public static const PORTUGUESE:Object = {Smiley:"Smiley", Difference:"Difference", PLAY:"JOGAR", HIGHSCORES:"PONTUAÇÕES MAIS ALTAS", CREDITS:"CRÉDITOS", MORE GAMES:"MAIS JOGOS", Add this game to your site:"Adicione este jogo ao seu site", copyright:"Copyright #0 SmileyGamer", creditstext:("Smiley Difference 2\nversão #0\nde SmileyGamer\n\nProgramação de\nJochen De Schepper\n\n" + "Arte de\nJochen De Schepper &\nAndrew Rowe"), clicktocontinue:"Clique para continuar", Score:"Pontuação", Differences:"Diferenças", Game Over!:"Game Over", Well Done!:"Bem Feito", Game Won!:"Ganhou!", Hints:"Hints", Back To Menu:"Para o Menu", Play More Games:"Mais Jogos", instructions:"Clique sobre as diferenças"};
public static const FRENCH:Object = {Smiley:"Smiley", Difference:"Difference", PLAY:"JOUER", HIGHSCORES:"MEILLEURS SCORES", CREDITS:"CRÉDITS", MORE GAMES:"PLUS DE JEUX", Add this game to your site:"Ajoute ce jeu à ton site", copyright:"Copyright #0 SmileyGamer", creditstext:("Smiley Difference 2\nversion #0\npar SmileyGamer\n\nCodage par\nJochen De Schepper\n\n" + "Graphiques by\nJochen De Schepper &\nAndrew Rowe"), Score:"Score", Differences:"Différences", clicktocontinue:"Clique pour continuer", Game Over!:"Game Over!", Well Done!:"Bien Fait!", Game Won!:"Gagné!", Hints:"Hints", Back To Menu:"Au Menu", Play More Games:"Plus De Jeux", instructions:"Cliquez sur les différences"};
public static const SPANISH:Object = {Smiley:"Smiley", Difference:"Difference", PLAY:"JUGAR", HIGHSCORES:"PUNTUACIONES MÁXIMAS", CREDITS:"CRÉDITOS", MORE GAMES:"MÁS JUEGOS", Add this game to your site:"Añade este juego a tu página", copyright:"Copyright #0 SmileyGamer", creditstext:("Smiley Difference 2\nversión #0\nde SmileyGamer\n\nCodificación de\nJochen De Schepper\n\n" + "Diseño de\nJochen De Schepper &\nAndrew Rowe"), clicktocontinue:"Hacer clic para continuar", Score:"Puntuación", Differences:"Diferencias", Game Over!:"Game Over", Well Done!:"Bien Hecho", Game Won!:"¡Ganó!", Hints:"Hints", Back To Menu:"Al Menú", Play More Games:"Más Juegos", instructions:"Haga clic sobre las diferencias"};
public static var sLanguage:Object = ENGLISH;
public function SGLanguage(){
super();
}
public static function setLanguage(aLang:String):void{
if (aLang == "en"){
sLanguage = ENGLISH;
};
}
public static function getText(aText:String, aParams:Array=null):String{
var i:int;
var text:String = ((sLanguage[aText])!=null) ? sLanguage[aText] : aText;
if (aParams != null){
i = 0;
while (i < aParams.length) {
text = text.replace(("#" + i), aParams[i]);
i++;
};
};
return (text);
}
public static function setSystemLanguage():void{
setLanguage(Capabilities.language);
}
public static function set language(aLang:Object):void{
sLanguage = aLang;
}
public static function get language():Object{
return (sLanguage);
}
}
}//package
Section 80
//SmileyDifference (SmileyDifference)
package {
import flash.events.*;
import flash.display.*;
import smileygamer.*;
import smileydifference.*;
import flash.filters.*;
import SWFStats.*;
public dynamic class SmileyDifference extends AGame {
public static const BFG:Boolean = false;
public static const GAMEID:int = 5536;
private static var SD1Ad:Class = SmileyDifference_SD1Ad;
public static var SPONSORED:Boolean = false;
public function SmileyDifference(){
var added:Function;
added = function (e:Event):void{
removeEventListener(Event.ADDED, added);
var gameParams:Object = LoaderInfo(root.loaderInfo).parameters;
if (gameParams.lang != null){
SGLanguage.setLanguage(gameParams.lang);
} else {
SGLanguage.setSystemLanguage();
};
showTitleScreen();
};
super();
SoundManager.init();
addEventListener(Event.ADDED, added);
}
public function isHomeSite():Boolean{
return (((SPONSORED) || (SmileyGamer.isHome())));
}
public function submitScore(aScore:int, aRankListener:Function=null):void{
}
public function showSponsorSite():void{
SmileyGamer.showHome();
}
public function showTitleScreen():void{
addChildAt(new TitleScreen(this), 0);
SoundManager.playMusic();
}
public function showSGSite():void{
SmileyGamer.showHome();
}
public function getSG1Ad():SimpleButton{
var showSD1:Function;
showSD1 = function (e:Event):void{
SmileyGamer.showURL("http://www.smileygamer.com/play/2541/smiley-difference.html", true);
};
var sd1ad:DisplayObject = new SD1Ad();
sd1ad.filters = [new GlowFilter(0, 1, 4, 4, 5, 1)];
var sd1adsel:DisplayObject = new SD1Ad();
sd1adsel.filters = [new GlowFilter(0xFF0000, 1, 4, 4, 5, 1)];
var sb:SimpleButton = new SimpleButton(sd1ad, sd1adsel, sd1adsel, sd1adsel);
sb.addEventListener(MouseEvent.CLICK, showSD1);
return (sb);
}
public function showGameScreen():void{
Log.Play();
var screen:GameScreen = new GameScreen(this);
removeChildAt(0);
addChildAt(screen, 0);
}
public function showDifferenceGames():void{
SmileyGamer.showURL("http://www.smileygamer.com/tags/104/difference-games.html", true);
}
public function showHighscoresPage():void{
SmileyGamer.showHighscores();
}
}
}//package
Section 81
//SmileyDifference_SD1Ad (SmileyDifference_SD1Ad)
package {
import mx.core.*;
public class SmileyDifference_SD1Ad extends BitmapAsset {
}
}//package
Section 82
//SmileyGamer (SmileyGamer)
package {
import flash.events.*;
import flash.display.*;
import flash.external.*;
import flash.net.*;
import flash.system.*;
public class SmileyGamer {
public static const HOME:String = "http://www.smileygamer.com";
private static var sGame:String;
private static var sStage:Stage;
private static var sID:int;
private static var sReferer:String;
public function SmileyGamer(){
super();
}
public static function isInDomains(aDomains:Array):Boolean{
var allowed:Boolean;
var i:int;
while (i < aDomains.length) {
allowed = ((allowed) || (isDomain(aDomains[i])));
i++;
};
return (allowed);
}
public static function showSGMoreGamesTab(aClip:DisplayObjectContainer, aColor:uint=4281543694):void{
var aClip = aClip;
var aColor = aColor;
Security.allowDomain("smileygamer.com");
var url = "http://www.smileygamer.com/sgads/SGMoreGamesTab.swf";
var ldr:Loader = new Loader();
ldr.load(new URLRequest(((((url + "?gameid=") + sID) + "&color=") + aColor)));
//unresolved jump
var _slot1 = e;
aClip.addChild(ldr);
}
public static function init(aStage:Stage, aID:int, aGame:String):void{
sStage = aStage;
sID = aID;
sGame = aGame;
sReferer = getReferer();
}
public static function showSGAd(aClip:DisplayObjectContainer):void{
var dispatchHandler:Function;
var aClip = aClip;
dispatchHandler = function (event:Event):void{
aClip.dispatchEvent(event);
};
Security.allowDomain("smileygamer.com");
var url = "http://www.smileygamer.com/sgads/SGMoreGamesAd.swf";
var ldr:Loader = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
ldr.load(new URLRequest(((((url + "?gameid=") + sID) + "&siteref=") + sReferer)));
//unresolved jump
var _slot1 = e;
aClip.addChild(ldr);
}
public static function isDomain(aDomain:String):Boolean{
if (((isLocal()) && ((sStage.loaderInfo.loaderURL.toLowerCase().indexOf(aDomain) > -1)))){
return (true);
};
return ((((sReferer.indexOf(aDomain) == 0)) || (((!((sReferer.indexOf(("." + aDomain)) == -1))) && ((sReferer.indexOf(("." + aDomain)) == ((sReferer.length - aDomain.length) - 1)))))));
}
public static function submitScore(aName:String, aScore:int, aMode:int=0, aRankListener:Function=null):void{
var rank:int;
var loader:URLLoader;
var error:Function;
var infoReceived:Function;
var aName = aName;
var aScore = aScore;
var aMode = aMode;
var aRankListener = aRankListener;
error = function (aEvent:Event):void{
rank = -1;
if (aRankListener != null){
aRankListener.call(null, rank);
};
};
infoReceived = function (aEvent:Event):void{
rank = int(loader.data);
if (aRankListener != null){
aRankListener.call(null, rank);
};
};
rank = 0;
var score:int = ((aScore * 100) + (aScore % 97));
var url:String = ((((((((HOME + "/scripts/highscores.php?id=") + sID) + "&mode=") + aMode) + "&score=") + score) + "&player=") + aName);
var req:URLRequest = new URLRequest(url);
loader = new URLLoader(req);
loader.addEventListener(IOErrorEvent.IO_ERROR, error);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, error);
loader.addEventListener(Event.COMPLETE, infoReceived);
}
public static function showHighscores():void{
showURL((((((HOME + "/highscores/") + sID) + "/") + getGameSlug()) + ".html"), true);
}
public static function isLocal():Boolean{
return ((sReferer == "local"));
}
public static function showGameAtHome():void{
showURL(((((((HOME + "/play/") + sID) + "/") + getGameSlug()) + ".html?gameref=") + sID));
}
public static function isHome():Boolean{
return (isDomain("smileygamer.com"));
}
public static function showFreeContent():void{
showURL((HOME + "/freecontent.html"), true);
}
public static function showURL(aURL:String, aAddRef:Boolean=false):void{
var aURL = aURL;
var aAddRef = aAddRef;
if (aAddRef){
aURL = ((aURL + "?gameref=") + sID);
};
ExternalInterface.call("window.open", aURL, "_blank", "");
//unresolved jump
var _slot1 = e;
navigateToURL(new URLRequest(aURL), "_blank");
//unresolved jump
var _slot1 = e;
}
public static function getGameSlug():String{
var name:String = sGame.toLowerCase();
name = name.replace(/\s/g, "-");
return (name);
}
public static function getReferer():String{
var referer:String;
if (sStage != null){
referer = sStage.loaderInfo.loaderURL.toLowerCase();
if (referer.indexOf("file://") == 0){
referer = "local";
} else {
referer = referer.split("/")[2];
};
return (referer);
//unresolved jump
};
return ("");
}
public static function showHome():void{
showURL(HOME, true);
}
}
}//package