STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228155
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5122

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/98086624?noj=FRM98086624-20DC" width="1" height="1"></div>

wheres-my-pumpkin.swf

This is the info page for
Flash #116368

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
Section 1
//MochiCoins (mochi.as3.MochiCoins) package mochi.as3 { public class MochiCoins { public static const STORE_HIDE:String = "StoreHide"; public static const NO_USER:String = "NoUser"; public static const IO_ERROR:String = "IOError"; public static const ITEM_NEW:String = "ItemNew"; public static const ITEM_OWNED:String = "ItemOwned"; public static const STORE_ITEMS:String = "StoreItems"; public static const ERROR:String = "Error"; public static const STORE_SHOW:String = "StoreShow"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public static var _inventory:MochiInventory; public function MochiCoins(){ super(); } public static function triggerEvent(eventType:String, args:Object):void{ _dispatcher.triggerEvent(eventType, args); } public static function removeEventListener(eventType:String, delegate:Function):void{ _dispatcher.removeEventListener(eventType, delegate); } public static function addEventListener(eventType:String, delegate:Function):void{ _dispatcher.addEventListener(eventType, delegate); } public static function getStoreItems():void{ MochiServices.send("coins_getStoreItems"); } public static function get inventory():MochiInventory{ return (_inventory); } public static function showStore(options:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showStore", {options:options}, null, null); } public static function requestFunding(properties:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_requestFunding", properties); } public static function showItem(options:Object=null):void{ if (((!(options)) || (!((typeof(options.item) == "string"))))){ trace("ERROR: showItem call must pass an Object with an item key"); return; }; MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showItem", {options:options}, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function showVideo(options:Object=null):void{ if (((!(options)) || (!((typeof(options.item) == "string"))))){ trace("ERROR: showVideo call must pass an Object with an item key"); return; }; MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showVideo", {options:options}, null, null); } addEventListener(MochiSocial.LOGGED_IN, function (args:Object):void{ _inventory = new MochiInventory(); }); addEventListener(MochiSocial.LOGGED_OUT, function (args:Object):void{ _inventory = null; }); } }//package mochi.as3
Section 2
//MochiDigits (mochi.as3.MochiDigits) package mochi.as3 { public final class MochiDigits { private var Sibling:MochiDigits; private var Fragment:Number; private var Encoder:Number; public function MochiDigits(digit:Number=0, index:uint=0):void{ super(); Encoder = 0; setValue(digit, index); } public function reencode():void{ var newEncode:uint = int((2147483647 * Math.random())); Fragment = (Fragment ^ (newEncode ^ Encoder)); Encoder = newEncode; } public function set value(v:Number):void{ setValue(v); } public function toString():String{ var s:String = String.fromCharCode((Fragment ^ Encoder)); if (Sibling != null){ s = (s + Sibling.toString()); }; return (s); } public function setValue(digit:Number=0, index:uint=0):void{ var s:String = digit.toString(); var _temp1 = index; index = (index + 1); Fragment = (s.charCodeAt(_temp1) ^ Encoder); if (index < s.length){ Sibling = new MochiDigits(digit, index); } else { Sibling = null; }; reencode(); } public function get value():Number{ return (Number(this.toString())); } public function addValue(inc:Number):void{ value = (value + inc); } } }//package mochi.as3
Section 3
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher) package mochi.as3 { public class MochiEventDispatcher { private var eventTable:Object; public function MochiEventDispatcher():void{ super(); eventTable = {}; } public function triggerEvent(event:String, args:Object):void{ var i:Object; if (eventTable[event] == undefined){ return; }; for (i in eventTable[event]) { var _local6 = eventTable[event]; _local6[i](args); }; } public function removeEventListener(event:String, delegate:Function):void{ var s:Object; if (eventTable[event] == undefined){ eventTable[event] = []; return; }; for (s in eventTable[event]) { if (eventTable[event][s] != delegate){ } else { eventTable[event].splice(Number(s), 1); }; }; } public function addEventListener(event:String, delegate:Function):void{ removeEventListener(event, delegate); eventTable[event].push(delegate); } } }//package mochi.as3
Section 4
//MochiEvents (mochi.as3.MochiEvents) package mochi.as3 { import flash.display.*; public class MochiEvents { public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL"; public static const FORMAT_LONG:String = "LongForm"; public static const ALIGN_BOTTOM:String = "ALIGN_B"; public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived"; public static const FORMAT_SHORT:String = "ShortForm"; public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR"; public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR"; public static const ALIGN_TOP:String = "ALIGN_T"; public static const ALIGN_LEFT:String = "ALIGN_L"; public static const ALIGN_RIGHT:String = "ALIGN_R"; public static const ALIGN_TOP_LEFT:String = "ALIGN_TL"; public static const ALIGN_CENTER:String = "ALIGN_C"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); private static var gameStart:Number; private static var levelStart:Number; public function MochiEvents(){ super(); } public static function endPlay():void{ MochiServices.send("events_clearRoundID", null, null, null); } public static function addEventListener(eventType:String, delegate:Function):void{ _dispatcher.addEventListener(eventType, delegate); } public static function trackEvent(tag:String, value=null):void{ MochiServices.send("events_trackEvent", {tag:tag, value:value}, null, null); } public static function removeEventListener(eventType:String, delegate:Function):void{ _dispatcher.removeEventListener(eventType, delegate); } public static function startSession(achievementID:String):void{ MochiServices.send("events_beginSession", {achievementID:achievementID}, null, null); } public static function triggerEvent(eventType:String, args:Object):void{ _dispatcher.triggerEvent(eventType, args); } public static function setNotifications(clip:MovieClip, style:Object):void{ var s:Object; var args:Object = {}; for (s in style) { args[s] = style[s]; }; args.clip = clip; MochiServices.send("events_setNotifications", args, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function startPlay(tag:String="gameplay"):void{ MochiServices.send("events_setRoundID", {tag:String(tag)}, null, null); } } }//package mochi.as3
Section 5
//MochiInventory (mochi.as3.MochiInventory) package mochi.as3 { import flash.events.*; import flash.utils.*; public dynamic class MochiInventory extends Proxy { private var _timer:Timer; private var _names:Array; private var _syncID:Number; private var _consumableProperties:Object; private var _storeSync:Object; private var _outstandingID:Number; private var _syncPending:Boolean; public static const READY:String = "InvReady"; public static const ERROR:String = "Error"; public static const IO_ERROR:String = "IoError"; private static const KEY_SALT:String = " syncMaint"; public static const WRITTEN:String = "InvWritten"; public static const NOT_READY:String = "InvNotReady"; public static const VALUE_ERROR:String = "InvValueError"; private static const CONSUMER_KEY:String = "MochiConsumables"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public function MochiInventory():void{ super(); MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned); MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems); MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut); _storeSync = new Object(); _syncPending = false; _outstandingID = 0; _syncID = 0; _timer = new Timer(1000); _timer.addEventListener(TimerEvent.TIMER, sync); _timer.start(); if (MochiSocial.loggedIn){ loggedIn(); } else { loggedOut(); }; } private function newItems(event:Object):void{ if (!this[(event.id + KEY_SALT)]){ this[(event.id + KEY_SALT)] = 0; }; if (!this[event.id]){ this[event.id] = 0; }; this[(event.id + KEY_SALT)] = (this[(event.id + KEY_SALT)] + event.count); this[event.id] = (this[event.id] + event.count); if (((event.privateProperties) && (event.privateProperties.consumable))){ if (!this[event.privateProperties.tag]){ this[event.privateProperties.tag] = 0; }; this[event.privateProperties.tag] = (this[event.privateProperties.tag] + (event.privateProperties.inc * event.count)); }; } public function release():void{ MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems); MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn); MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(name){ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (-1); }; if (_consumableProperties[name]){ return (MochiDigits(_consumableProperties[name]).value); }; return (undefined); } private function loggedIn(args:Object=null):void{ MochiUserData.get(CONSUMER_KEY, getConsumableBag); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(name):Boolean{ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (false); }; if (_consumableProperties[name] == undefined){ return (false); }; return (true); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(index:int):int{ return (((index)>=_names.length) ? 0 : (index + 1)); } private function putConsumableBag(userData:MochiUserData):void{ _syncPending = false; if (userData.error){ triggerEvent(ERROR, {type:IO_ERROR, error:userData.error}); _outstandingID = -1; }; triggerEvent(WRITTEN, {}); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(name, value):void{ var d:MochiDigits; if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return; }; if (!(value is Number)){ triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:value}); return; }; if (_consumableProperties[name]){ d = MochiDigits(_consumableProperties[name]); if (d.value == value){ return; }; d.value = value; } else { _names.push(name); _consumableProperties[name] = new MochiDigits(value); }; _syncID++; } private function itemOwned(event:Object):void{ _storeSync[event.id] = {properties:event.properties, count:event.count}; } private function sync(e:Event=null):void{ var key:String; if (((_syncPending) || ((_syncID == _outstandingID)))){ return; }; _outstandingID = _syncID; var output:Object = {}; for (key in _consumableProperties) { output[key] = MochiDigits(_consumableProperties[key]).value; }; MochiUserData.put(CONSUMER_KEY, output, putConsumableBag); _syncPending = true; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(index:int):String{ return (_names[(index - 1)]); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(name):Boolean{ if (!_consumableProperties[name]){ return (false); }; _names.splice(_names.indexOf(name), 1); delete _consumableProperties[name]; return (true); } private function getConsumableBag(userData:MochiUserData):void{ var key:String; var unsynced:Number; if (userData.error){ triggerEvent(ERROR, {type:IO_ERROR, error:userData.error}); return; }; _consumableProperties = {}; _names = new Array(); if (userData.data){ for (key in userData.data) { _names.push(key); _consumableProperties[key] = new MochiDigits(userData.data[key]); }; }; for (key in _storeSync) { unsynced = _storeSync[key].count; if (_consumableProperties[(key + KEY_SALT)]){ unsynced = (unsynced - _consumableProperties[(key + KEY_SALT)].value); }; if (unsynced == 0){ } else { newItems({id:key, count:unsynced, properties:_storeSync[key].properties}); }; }; triggerEvent(READY, {}); } private function loggedOut(args:Object=null):void{ _consumableProperties = null; } public static function triggerEvent(eventType:String, args:Object):void{ _dispatcher.triggerEvent(eventType, args); } public static function removeEventListener(eventType:String, delegate:Function):void{ _dispatcher.removeEventListener(eventType, delegate); } public static function addEventListener(eventType:String, delegate:Function):void{ _dispatcher.addEventListener(eventType, delegate); } } }//package mochi.as3
Section 6
//MochiScores (mochi.as3.MochiScores) package mochi.as3 { import flash.display.*; import flash.text.*; public class MochiScores { private static var boardID:String; public static var onErrorHandler:Object; public static var onCloseHandler:Object; public function MochiScores(){ super(); } public static function showLeaderboard(options:Object=null):void{ var n:Number; var options = options; if (options != null){ delete options.clip; MochiServices.setContainer(); MochiServices.bringToTop(); if (options.name != null){ if ((options.name is TextField)){ if (options.name.text.length > 0){ options.name = options.name.text; }; }; }; if (options.score != null){ if ((options.score is TextField)){ if (options.score.text.length > 0){ options.score = options.score.text; }; } else { if ((options.score is MochiDigits)){ options.score = options.score.value; }; }; n = Number(options.score); if (isNaN(n)){ trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'")); } else { if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){ trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite")); } else { if (Math.floor(n) != n){ trace((("WARNING: Submitted score '" + options.score) + "' will be truncated")); }; options.score = n; }; }; }; if (options.onDisplay != null){ options.onDisplay(); } else { if (MochiServices.clip != null){ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; }; } else { options = {}; if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; if (options.onClose != null){ onCloseHandler = options.onClose; } else { onCloseHandler = function ():void{ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.play(); } else { trace("Warning: Container is not a MovieClip, cannot call default onClose."); }; }; }; if (options.onError != null){ onErrorHandler = options.onError; } else { onErrorHandler = null; }; if (options.boardID == null){ if (MochiScores.boardID != null){ options.boardID = MochiScores.boardID; }; }; MochiServices.warnID(options.boardID, true); trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal"); MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose); } public static function closeLeaderboard():void{ MochiServices.send("scores_closeLeaderboard"); } public static function getPlayerInfo(callbackObj:Object, callbackMethod:Object=null):void{ MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod); } public static function requestList(callbackObj:Object, callbackMethod:Object=null):void{ MochiServices.send("scores_requestList", null, callbackObj, callbackMethod); } public static function scoresArrayToObjects(scores:Object):Object{ var i:Number; var j:Number; var o:Object; var row_obj:Object; var item:String; var param:String; var so:Object = {}; for (item in scores) { if (typeof(scores[item]) == "object"){ if (((!((scores[item].cols == null))) && (!((scores[item].rows == null))))){ so[item] = []; o = scores[item]; j = 0; while (j < o.rows.length) { row_obj = {}; i = 0; while (i < o.cols.length) { row_obj[o.cols[i]] = o.rows[j][i]; i++; }; so[item].push(row_obj); j++; }; } else { so[item] = {}; for (param in scores[item]) { so[item][param] = scores[item][param]; }; }; } else { so[item] = scores[item]; }; }; return (so); } public static function submit(score:Number, name:String, callbackObj:Object=null, callbackMethod:Object=null):void{ score = Number(score); if (isNaN(score)){ trace((("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'")); } else { if ((((score == Number.NEGATIVE_INFINITY)) || ((score == Number.POSITIVE_INFINITY)))){ trace((("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite")); } else { if (Math.floor(score) != score){ trace((("WARNING: Submitted score '" + String(score)) + "' will be truncated")); }; score = Number(score); }; }; MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod); } public static function onClose(args:Object=null):void{ if (((((args) && ((args.error == true)))) && (onErrorHandler))){ if (args.errorCode == null){ args.errorCode = "IOError"; }; onErrorHandler(args.errorCode); MochiServices.doClose(); return; }; onCloseHandler(); MochiServices.doClose(); } public static function setBoardID(boardID:String):void{ MochiServices.warnID(boardID, true); MochiScores.boardID = boardID; MochiServices.send("scores_setBoardID", {boardID:boardID}); } } }//package mochi.as3
Section 7
//MochiServices (mochi.as3.MochiServices) package mochi.as3 { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.utils.*; import flash.net.*; import flash.system.*; public class MochiServices { public static const CONNECTED:String = "onConnected"; private static var _container:Object; private static var _connected:Boolean = false; private static var _queue:Array; private static var _swfVersion:String; private static var _preserved:Object; public static var netupAttempted:Boolean = false; private static var _sendChannel:LocalConnection; private static var _nextCallbackID:Number; private static var _clip:MovieClip; private static var _loader:Loader; private static var _id:String; private static var _services:String = "services.swf"; private static var _servURL:String = "http://www.mochiads.com/static/lib/services/"; public static var widget:Boolean = false; private static var _timer:Timer; private static var _sendChannelName:String; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); private static var _callbacks:Object; private static var _connecting:Boolean = false; private static var _mochiLocalConnection:MovieClip; private static var _listenChannelName:String = "__ms_"; public static var onError:Object; public static var netup:Boolean = true; private static var _mochiLC:String = "MochiLC.swf"; public function MochiServices(){ super(); } public static function isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function get connected():Boolean{ return (_connected); } private static function onReceive(pkg:Object):void{ var methodName:String; var pkg = pkg; var cb:String = pkg.callbackID; var cblst:Object = _callbacks[cb]; if (!cblst){ return; }; var method:* = cblst.callbackMethod; methodName = ""; var obj:Object = cblst.callbackObject; if (((obj) && ((typeof(method) == "string")))){ methodName = method; if (obj[method] != null){ method = obj[method]; } else { trace((("Error: Method " + method) + " does not exist.")); }; }; if (method != undefined){ method.apply(obj, pkg.args); //unresolved jump var _slot1 = error; trace(((("Error invoking callback method '" + methodName) + "': ") + _slot1.toString())); } else { if (obj != null){ obj(pkg.args); //unresolved jump var _slot1 = error; trace(("Error invoking method on object: " + _slot1.toString())); }; }; delete _callbacks[cb]; } public static function send(methodName:String, args:Object=null, callbackObject:Object=null, callbackMethod:Object=null):void{ if (_connected){ _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_nextCallbackID}); } else { if ((((_clip == null)) || (!(_connecting)))){ trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + methodName)); handleError(args, callbackObject, callbackMethod); flush(true); return; }; _queue.push({methodName:methodName, args:args, callbackID:_nextCallbackID}); }; if (_clip != null){ if (_callbacks != null){ _callbacks[_nextCallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod}; _nextCallbackID++; }; }; } private static function init(id:String, clip:Object):void{ _id = id; if (clip != null){ _container = clip; loadCommunicator(id, _container); }; } private static function clickMovie(url:String, cb:Function):MovieClip{ var b:int; var loader:Loader; var avm1_bytecode:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23]; var header:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3]; var footer:Array = [0, 64, 0, 0, 0]; var mc:MovieClip = new MovieClip(); var lc:LocalConnection = new LocalConnection(); var lc_name:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time)); lc = new LocalConnection(); mc.lc = lc; mc.click = cb; lc.client = mc; lc.connect(lc_name); var ba:ByteArray = new ByteArray(); var cpool:ByteArray = new ByteArray(); cpool.endian = Endian.LITTLE_ENDIAN; cpool.writeShort(1); cpool.writeUTFBytes(((url + " ") + lc_name)); cpool.writeByte(0); var actionLength:uint = ((avm1_bytecode.length + cpool.length) + 4); var fileLength:uint = (actionLength + 35); ba.endian = Endian.LITTLE_ENDIAN; ba.writeUTFBytes("FWS"); ba.writeByte(8); ba.writeUnsignedInt(fileLength); for each (b in header) { ba.writeByte(b); }; ba.writeUnsignedInt(actionLength); ba.writeByte(136); ba.writeShort(cpool.length); ba.writeBytes(cpool); for each (b in avm1_bytecode) { ba.writeByte(b); }; for each (b in footer) { ba.writeByte(b); }; loader = new Loader(); loader.loadBytes(ba); mc.addChild(loader); return (mc); } private static function detach(event:Event):void{ var loader:LoaderInfo = LoaderInfo(event.target); loader.removeEventListener(Event.COMPLETE, detach); loader.removeEventListener(IOErrorEvent.IO_ERROR, detach); loader.removeEventListener(Event.COMPLETE, loadLCBridgeComplete); loader.removeEventListener(IOErrorEvent.IO_ERROR, loadError); } public static function stayOnTop():void{ _container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true); if (_clip != null){ _clip.visible = true; }; } private static function loadLCBridgeComplete(e:Event):void{ var loader:Loader = LoaderInfo(e.target).loader; _mochiLocalConnection = MovieClip(loader.content); listen(); } public static function disconnect():void{ if (((_connected) || (_connecting))){ if (_clip != null){ if (_clip.parent != null){ if ((_clip.parent is Sprite)){ Sprite(_clip.parent).removeChild(_clip); _clip = null; }; }; }; _connecting = (_connected = false); flush(true); _mochiLocalConnection.close(); //unresolved jump var _slot1 = error; }; if (_timer != null){ _timer.stop(); _timer.removeEventListener(TimerEvent.TIMER, connectWait); _timer = null; //unresolved jump var _slot1 = error; }; } public static function allowDomains(server:String):String{ var hostname:String; if (Security.sandboxType != "application"){ Security.allowDomain("*"); Security.allowInsecureDomain("*"); }; if (server.indexOf("http://") != -1){ hostname = server.split("/")[2].split(":")[0]; if (Security.sandboxType != "application"){ Security.allowDomain(hostname); Security.allowInsecureDomain(hostname); }; }; return (hostname); } public static function getVersion():String{ return ("3.9.1 as3"); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); } public static function warnID(bid:String, leaderboard:Boolean):void{ bid = bid.toLowerCase(); if (bid.length != 16){ trace((("WARNING: " + (leaderboard) ? "board" : "game") + " ID is not the appropriate length")); return; } else { if (bid == "1e113c7239048b3f"){ if (leaderboard){ trace("WARNING: Using testing board ID"); } else { trace("WARNING: Using testing board ID as game ID"); }; return; } else { if (bid == "84993a1de4031cd8"){ if (leaderboard){ trace("WARNING: Using testing game ID as board ID"); } else { trace("WARNING: Using testing game ID"); }; return; }; }; }; var i:Number = 0; while (i < bid.length) { switch (bid.charAt(i)){ case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "a": case "b": case "c": case "d": case "e": case "f": break; default: trace(("WARNING: Board ID contains illegal characters: " + bid)); return; }; i++; }; } private static function flush(error:Boolean):void{ var request:Object; var callback:Object; if (((_clip) && (_queue))){ while (_queue.length > 0) { request = _queue.shift(); callback = null; if (request != null){ if (request.callbackID != null){ callback = _callbacks[request.callbackID]; }; delete _callbacks[request.callbackID]; if (((error) && (!((callback == null))))){ handleError(request.args, callback.callbackObject, callback.callbackMethod); }; }; }; }; } public static function get id():String{ return (_id); } private static function onEvent(pkg:Object):void{ var target:String = pkg.target; var event:String = pkg.event; switch (target){ case "services": MochiServices.triggerEvent(pkg.event, pkg.args); break; case "events": MochiEvents.triggerEvent(pkg.event, pkg.args); break; case "coins": MochiCoins.triggerEvent(pkg.event, pkg.args); break; case "social": MochiSocial.triggerEvent(pkg.event, pkg.args); break; }; } private static function urlOptions(clip:Object):Object{ var options:String; var pairs:Array; var i:Number; var kv:Array; var opts:Object = {}; if (clip.stage){ options = clip.stage.loaderInfo.parameters.mochiad_options; } else { options = clip.loaderInfo.parameters.mochiad_options; }; if (options){ pairs = options.split("&"); i = 0; while (i < pairs.length) { kv = pairs[i].split("="); opts[unescape(kv[0])] = unescape(kv[1]); i++; }; }; return (opts); } public static function addLinkEvent(url:String, burl:String, btn:DisplayObjectContainer, onClick:Function=null):void{ var avm1Click:DisplayObject; var x:String; var req:URLRequest; var loader:Loader; var setURL:Function; var err:Function; var complete:Function; var url = url; var burl = burl; var btn = btn; var onClick = onClick; var vars:Object = new Object(); vars["mav"] = getVersion(); vars["swfv"] = "9"; vars["swfurl"] = btn.loaderInfo.loaderURL; vars["fv"] = Capabilities.version; vars["os"] = Capabilities.os; vars["lang"] = Capabilities.language; vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY); var s = "?"; var i:Number = 0; for (x in vars) { if (i != 0){ s = (s + "&"); }; i = (i + 1); s = (((s + x) + "=") + escape(vars[x])); }; req = new URLRequest("http://link.mochiads.com/linkping.swf"); loader = new Loader(); setURL = function (url:String):void{ if (avm1Click){ btn.removeChild(avm1Click); }; avm1Click = clickMovie(url, onClick); var rect:Rectangle = btn.getBounds(btn); btn.addChild(avm1Click); avm1Click.x = rect.x; avm1Click.y = rect.y; avm1Click.scaleX = (0.01 * rect.width); avm1Click.scaleY = (0.01 * rect.height); }; err = function (ev:Object):void{ netup = false; ev.target.removeEventListener(ev.type, arguments.callee); setURL(burl); }; complete = function (ev:Object):void{ ev.target.removeEventListener(ev.type, arguments.callee); }; if (netup){ setURL((url + s)); } else { setURL(burl); }; if (!((netupAttempted) || (_connected))){ netupAttempted = true; loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete); loader.load(req); }; } public static function setContainer(container:Object=null, doAdd:Boolean=true):void{ if (_clip.parent){ _clip.parent.removeChild(_clip); }; if (container != null){ if ((container is DisplayObjectContainer)){ _container = container; }; }; if (doAdd){ if ((_container is DisplayObjectContainer)){ DisplayObjectContainer(_container).addChild(_clip); }; }; } private static function handleError(args:Object, callbackObject:Object, callbackMethod:Object):void{ var args = args; var callbackObject = callbackObject; var callbackMethod = callbackMethod; if (args != null){ if (args.onError != null){ args.onError.apply(null, ["NotConnected"]); }; if (((!((args.options == null))) && (!((args.options.onError == null))))){ args.options.onError.apply(null, ["NotConnected"]); }; }; if (callbackMethod != null){ args = {}; args.error = true; args.errorCode = "NotConnected"; if (((!((callbackObject == null))) && ((callbackMethod is String)))){ var _local5 = callbackObject; _local5[callbackMethod](args); //unresolved jump var _slot1 = error; } else { if (callbackMethod != null){ callbackMethod.apply(args); //unresolved jump var _slot1 = error; }; }; }; } private static function loadError(ev:Object):void{ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); } public static function get childClip():Object{ return (_clip); } private static function initComChannels():void{ if (!_connected){ trace("[SERVICES_API] connected!"); _connecting = false; _connected = true; _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"}); _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL}); _clip.onReceive = onReceive; _clip.onEvent = onEvent; _clip.onError = function ():void{ MochiServices.onError("IOError"); }; while (_queue.length > 0) { _mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift()); }; }; } public static function triggerEvent(eventType:String, args:Object):void{ _dispatcher.triggerEvent(eventType, args); } public static function removeEventListener(eventType:String, delegate:Function):void{ _dispatcher.removeEventListener(eventType, delegate); } private static function listen():void{ _mochiLocalConnection.connect(_listenChannelName); _clip.handshake = function (args:Object):void{ MochiServices.comChannelName = args.newChannel; }; trace("Waiting for MochiAds services to connect..."); } public static function addEventListener(eventType:String, delegate:Function):void{ _dispatcher.addEventListener(eventType, delegate); } private static function loadLCBridge(clip:Object):void{ var loader:Loader = new Loader(); var mochiLCURL:String = (_servURL + _mochiLC); var req:URLRequest = new URLRequest(mochiLCURL); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, detach); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); loader.load(req); clip.addChild(loader); } public static function set comChannelName(val:String):void{ if (val != null){ if (val.length > 3){ _sendChannelName = (val + "_fromgame"); initComChannels(); }; }; } private static function loadCommunicator(id:String, clip:Object):MovieClip{ if (_clip != null){ return (_clip); }; if (!MochiServices.isNetworkAvailable()){ return (null); }; if (urlOptions(clip).servURL){ _servURL = urlOptions(clip).servURL; }; var servicesURL:String = (_servURL + _services); if (urlOptions(clip).servicesURL){ servicesURL = urlOptions(clip).servicesURL; }; _listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999)))); MochiServices.allowDomains(servicesURL); _clip = new MovieClip(); loadLCBridge(_clip); _loader = new Loader(); _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, detach); _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach); _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); var req:URLRequest = new URLRequest(servicesURL); var vars:URLVariables = new URLVariables(); vars.listenLC = _listenChannelName; vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options; vars.api_version = getVersion(); if (widget){ vars.widget = true; }; req.data = vars; _loader.load(req); _clip.addChild(_loader); _sendChannel = new LocalConnection(); _queue = []; _nextCallbackID = 0; _callbacks = {}; _timer = new Timer(10000, 1); _timer.addEventListener(TimerEvent.TIMER, connectWait); _timer.start(); return (_clip); } public static function get clip():Object{ return (_container); } public static function connect(id:String, clip:Object, onError:Object=null):void{ var id = id; var clip = clip; var onError = onError; warnID(id, false); if ((clip is DisplayObject)){ if (clip.stage == null){ trace("MochiServices connect requires the containing clip be attached to the stage"); }; if (((!(_connected)) && ((_clip == null)))){ trace("MochiServices Connecting..."); _connecting = true; init(id, clip); }; } else { trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage."); }; if (onError != null){ MochiServices.onError = onError; } else { if (MochiServices.onError == null){ MochiServices.onError = function (errorCode:String):void{ trace(errorCode); }; }; }; } public static function bringToTop(e:Event=null):void{ var e = e; if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){ if (MochiServices.clip.numChildren > 1){ MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1)); }; //unresolved jump var _slot1 = errorObject; trace("Warning: Depth sort error."); _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); }; } public static function connectWait(e:TimerEvent):void{ if (!_connected){ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load. (timeout)"); MochiServices.disconnect(); MochiServices.onError("IOError"); } else { _timer.stop(); _timer.removeEventListener(TimerEvent.TIMER, connectWait); _timer = null; }; } } }//package mochi.as3
Section 8
//MochiSocial (mochi.as3.MochiSocial) package mochi.as3 { public class MochiSocial { public static const LOGGED_IN:String = "LoggedIn"; public static const ACTION_CANCELED:String = "onCancel"; public static const PROPERTIES_SIZE:String = "PropertiesSize"; public static const IO_ERROR:String = "IOError"; public static const NO_USER:String = "NoUser"; public static const FRIEND_LIST:String = "FriendsList"; public static const PROFILE_DATA:String = "ProfileData"; public static const GAMEPLAY_DATA:String = "GameplayData"; public static const ACTION_COMPLETE:String = "onComplete"; public static const LOGIN_SHOW:String = "LoginShow"; public static const PROFILE_HIDE:String = "ProfileHide"; public static const USER_INFO:String = "UserInfo"; public static const PROPERTIES_SAVED:String = "PropertySaved"; public static const WIDGET_LOADED:String = "WidgetLoaded"; public static const ERROR:String = "Error"; public static const LOGGED_OUT:String = "LoggedOut"; public static const PROFILE_SHOW:String = "ProfileShow"; public static const LOGIN_HIDE:String = "LoginHide"; public static const LOGIN_SHOWN:String = "LoginShown"; public static var _user_info:Object = null; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public function MochiSocial(){ super(); } public static function requestFan(properties:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_requestFan", properties); } public static function postToStream(properties:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_postToStream", properties); } public static function getFriendsList(properties:Object=null):void{ MochiServices.send("social_getFriendsList", properties); } public static function requestLogin(properties:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_requestLogin", properties); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function saveUserProperties(properties:Object):void{ MochiServices.send("social_saveUserProperties", properties); } public static function triggerEvent(eventType:String, args:Object):void{ _dispatcher.triggerEvent(eventType, args); } public static function removeEventListener(eventType:String, delegate:Function):void{ _dispatcher.removeEventListener(eventType, delegate); } public static function inviteFriends(properties:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_inviteFriends", properties); } public static function get loggedIn():Boolean{ return (!((_user_info == null))); } public static function addEventListener(eventType:String, delegate:Function):void{ _dispatcher.addEventListener(eventType, delegate); } public static function showLoginWidget(options:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_showLoginWidget", {options:options}); } public static function getAPIURL():String{ if (!_user_info){ return (null); }; return (_user_info.api_url); } public static function hideLoginWidget():void{ MochiServices.send("social_hideLoginWidget"); } public static function getAPIToken():String{ if (!_user_info){ return (null); }; return (_user_info.api_token); } MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (args:Object):void{ _user_info = args; }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (args:Object):void{ _user_info = null; }); } }//package mochi.as3
Section 9
//MochiUserData (mochi.as3.MochiUserData) package mochi.as3 { import flash.events.*; import flash.utils.*; import flash.net.*; public class MochiUserData extends EventDispatcher { public var callback:Function;// = null public var operation:String;// = null public var error:Event;// = null public var data;// = null public var _loader:URLLoader; public var key:String;// = null public function MochiUserData(key:String="", callback:Function=null){ super(); this.key = key; this.callback = callback; } public function serialize(obj):ByteArray{ var arr:ByteArray = new ByteArray(); arr.objectEncoding = ObjectEncoding.AMF3; arr.writeObject(obj); arr.compress(); return (arr); } public function errorHandler(event:IOErrorEvent):void{ data = null; error = event; if (callback != null){ performCallback(); } else { dispatchEvent(event); }; close(); } public function putEvent(obj):void{ request("put", serialize(obj)); } public function deserialize(arr:ByteArray){ arr.objectEncoding = ObjectEncoding.AMF3; arr.uncompress(); return (arr.readObject()); } public function securityErrorHandler(event:SecurityErrorEvent):void{ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + event.toString()))); } public function getEvent():void{ request("get", serialize(null)); } override public function toString():String{ return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]")); } public function performCallback():void{ callback(this); //unresolved jump var _slot1 = e; trace(("[MochiUserData] exception during callback: " + _slot1)); } public function request(_operation:String, _data:ByteArray):void{ var _operation = _operation; var _data = _data; operation = _operation; var api_url:String = MochiSocial.getAPIURL(); var api_token:String = MochiSocial.getAPIToken(); if ((((api_url == null)) || ((api_token == null)))){ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in")); return; }; _loader = new URLLoader(); var args:URLVariables = new URLVariables(); args.op = _operation; args.key = key; var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString())); req.method = URLRequestMethod.POST; req.contentType = "application/x-mochi-userdata"; req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)]; req.data = _data; _loader.dataFormat = URLLoaderDataFormat.BINARY; _loader.addEventListener(Event.COMPLETE, completeHandler); _loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); _loader.load(req); //unresolved jump var _slot1 = e; errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _slot1.toString()))); } public function completeHandler(event:Event):void{ var event = event; if (_loader.data.length){ data = deserialize(_loader.data); } else { data = null; }; //unresolved jump var _slot1 = e; errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + _slot1.toString()))); return; if (callback != null){ performCallback(); } else { dispatchEvent(event); }; close(); } public function close():void{ if (_loader){ _loader.removeEventListener(Event.COMPLETE, completeHandler); _loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); _loader.close(); _loader = null; }; error = null; callback = null; } public static function get(key:String, callback:Function):void{ var userData:MochiUserData = new MochiUserData(key, callback); userData.getEvent(); } public static function put(key:String, obj, callback:Function):void{ var userData:MochiUserData = new MochiUserData(key, callback); userData.putEvent(obj); } } }//package mochi.as3
Section 10
//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 11
//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 12
//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 13
//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 14
//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 15
//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 16
//IBorder (mx.core.IBorder) package mx.core { public interface IBorder { function get borderMetrics():EdgeMetrics; } }//package mx.core
Section 17
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 18
//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 19
//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 20
//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 21
//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 22
//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 23
//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 24
//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 25
//ComplexMovement (smileygamer.movement.ComplexMovement) package smileygamer.movement { public class ComplexMovement implements IMovement { private var fType:int;// = 0 private var fIndex:int; private var fMovements:Array; public static const TYPE_SIMULTANEOUS:int = 0; public static const TYPE_SEQUENTIAL:int = 1; public function ComplexMovement(aMovements:Array, aType:int=0){ super(); fMovements = aMovements; fType = aType; fIndex = 0; } public function move():Boolean{ if (fType == TYPE_SEQUENTIAL){ return (sequentialMove()); }; return (simultaneousMove()); } private function simultaneousMove():Boolean{ var finished:Boolean; var i:int; while (i < fMovements.length) { finished = ((fMovements[i].move()) && (finished)); i++; }; return (finished); } private function sequentialMove():Boolean{ if (fMovements[fIndex].move()){ fIndex++; }; return ((fIndex == fMovements.length)); } } }//package smileygamer.movement
Section 26
//IMovement (smileygamer.movement.IMovement) package smileygamer.movement { public interface IMovement { function move():Boolean; } }//package smileygamer.movement
Section 27
//LinearMovement (smileygamer.movement.LinearMovement) package smileygamer.movement { import flash.display.*; import smileygamer.util.*; public class LinearMovement implements IMovement { private var fMoves:int; private var fObjects:Array;// = null private var fMove:int;// = 0 private var fDX:Number; private var fDY:Number; private var fObjectContainer:DisplayObjectContainer; private var fObjectFilter:IFilter; public function LinearMovement(aObjectContainer:DisplayObjectContainer, aMoves:int, aDX:Number=1, aDY:Number=1, aObjectFilter:IFilter=null){ super(); fObjectContainer = aObjectContainer; fObjectFilter = aObjectFilter; fDX = aDX; fDY = aDY; fMoves = aMoves; } public function move():Boolean{ var i:int; var object:DisplayObject; var obj:DisplayObject; if (fMove == fMoves){ return (true); }; if (fObjects == null){ fObjects = new Array(); i = (fObjectContainer.numChildren - 1); while (i >= 0) { object = fObjectContainer.getChildAt(i); if ((((fObjectFilter == null)) || (fObjectFilter.accept(object)))){ fObjects.push(object); }; i--; }; }; i = 0; while (i < fObjects.length) { obj = fObjects[i]; obj.x = (obj.x + fDX); obj.y = (obj.y + fDY); if ((fMove + 1) == fMoves){ obj.x = Math.round(obj.x); obj.y = Math.round(obj.y); }; i++; }; fMove++; return ((fMove == fMoves)); } public function getObjects():DisplayObjectContainer{ return (fObjectContainer); } } }//package smileygamer.movement
Section 28
//BitmapUtil (smileygamer.util.BitmapUtil) package smileygamer.util { import flash.display.*; import flash.geom.*; public class BitmapUtil { public function BitmapUtil(){ super(); } public static function splitImage(aImage:Bitmap, aWidth:int, aHeight:int, aBorder:int=0, aFilters:Array=null):Array{ var bitmapData:BitmapData; var i:int; var tiles:Array = new Array(); var rect:Rectangle = new Rectangle(0, 0, aWidth, aHeight); var zero:Point = new Point(0, 0); var origin:Point = new Point(aBorder, aBorder); rect.y = 0; while (rect.y < aImage.height) { rect.x = 0; while (rect.x < aImage.width) { bitmapData = new BitmapData((aWidth + (2 * aBorder)), (aHeight + (2 * aBorder)), true, 0); bitmapData.copyPixels(aImage.bitmapData, rect, origin); if (aFilters != null){ i = 0; while (i < aFilters.length) { bitmapData.applyFilter(bitmapData, bitmapData.rect, zero, aFilters[i]); i++; }; }; tiles.push(new Bitmap(bitmapData)); rect.x = (rect.x + aWidth); }; rect.y = (rect.y + aHeight); }; return (tiles); } public static function createMaskedBitmap(aImage:Bitmap, aMask:Bitmap, aFilters:Array=null):Bitmap{ var i:int; var result:Bitmap = new Bitmap(new BitmapData(aImage.width, aImage.height, true, 0)); result.bitmapData.draw(aImage); var imgRect:Rectangle = new Rectangle(0, 0, result.width, result.height); var origin:Point = new Point(0, 0); result.bitmapData.copyChannel(aMask.bitmapData, imgRect, origin, BitmapDataChannel.BLUE, BitmapDataChannel.ALPHA); if (aFilters != null){ i = 0; while (i < aFilters.length) { result.bitmapData.applyFilter(result.bitmapData, imgRect, origin, aFilters[i]); i++; }; }; return (result); } } }//package smileygamer.util
Section 29
//IFilter (smileygamer.util.IFilter) package smileygamer.util { public interface IFilter { function accept(:Object):Boolean; } }//package smileygamer.util
Section 30
//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 31
//RandomUtil (smileygamer.util.RandomUtil) package smileygamer.util { public class RandomUtil { public function RandomUtil(){ super(); } public static function generateRandomArray(aLength:int):Array{ var r:int; var temp:int; var array:Array = new Array(aLength); var i:int; while (i < aLength) { array[i] = i; i++; }; i = 0; while (i < aLength) { r = generateRandom(0, aLength); temp = array[i]; array[i] = array[r]; array[r] = temp; i++; }; return (array); } public static function chance(aChance:int):Boolean{ if (aChance < 2){ return (true); }; var r:int = (randomInt() % aChance); return ((r == 0)); } public static function randomBoolean():Boolean{ return (((randomInt() % 2) == 0)); } public static function seed(aSeed:int):void{ } public static function randomInt():int{ return (Math.round((Math.random() * int.MAX_VALUE))); } public static function generateRandom(aMin:int, aMax:int):int{ if (aMin == aMax){ return (aMin); }; if (aMax > aMin){ return (((randomInt() % (aMax - aMin)) + aMin)); }; return (((randomInt() % (aMin - aMax)) + aMax)); } } }//package smileygamer.util
Section 32
//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 33
//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 34
//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 35
//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 36
//IAnimation (smileygamer.IAnimation) package smileygamer { public interface IAnimation { function update():void; function get finished():Boolean; function get looping():Boolean; } }//package smileygamer
Section 37
//ILogic (smileygamer.ILogic) package smileygamer { public interface ILogic { function doLogic():void; } }//package smileygamer
Section 38
//ImageAnimation (smileygamer.ImageAnimation) package smileygamer { import flash.display.*; import flash.utils.*; public class ImageAnimation extends AAnimation { public function ImageAnimation(aImage:DisplayObject, aCopy:Boolean=false){ var targetClass:Class; var obj:DisplayObject = aImage; if (aCopy){ if ((aImage is Bitmap)){ obj = new Bitmap(Bitmap(aImage).bitmapData); } else { targetClass = (getDefinitionByName(getQualifiedClassName(aImage)) as Class); obj = new (targetClass); }; obj.x = aImage.x; obj.y = aImage.y; obj.transform = aImage.transform; obj.filters = aImage.filters; obj.cacheAsBitmap = aImage.cacheAsBitmap; obj.opaqueBackground = aImage.opaqueBackground; }; super(obj); } } }//package smileygamer
Section 39
//ImageTransitionAnimation (smileygamer.ImageTransitionAnimation) package smileygamer { import flash.display.*; import flash.geom.*; import smileygamer.util.*; public class ImageTransitionAnimation extends AAnimation { private var fPointsPerStep:int; private var fSteps:int; private var fOrder:Array; private var fRect:Rectangle; private var fTopImage:Bitmap; private var fBottomImage:Bitmap; private var fOrigin:Point; public function ImageTransitionAnimation(aTopImage:Bitmap, aBottomImage:Bitmap, aSteps:int){ var pointcount:int; if (((!((aTopImage == null))) || (!((aBottomImage == null))))){ fTopImage = aTopImage; if (fTopImage == null){ fTopImage = new Bitmap(new BitmapData(aBottomImage.width, aBottomImage.height, true, 0)); }; if (aBottomImage == null){ fBottomImage = new Bitmap(new BitmapData(fTopImage.width, fTopImage.height, true, 0)); } else { fBottomImage = new Bitmap(aBottomImage.bitmapData); }; if ((((fTopImage.width == fBottomImage.width)) && ((fTopImage.height == fBottomImage.height)))){ fSteps = aSteps; pointcount = (fTopImage.width * fTopImage.height); fOrder = RandomUtil.generateRandomArray(pointcount); fPointsPerStep = Math.ceil((pointcount / (fSteps - 1))); fRect = new Rectangle(0, 0, fTopImage.width, fTopImage.height); fOrigin = new Point(0, 0); super(new Bitmap(fTopImage.bitmapData.clone())); looping = false; } else { throw (new Error("ImageTransitionAnimation: Both images have to have the same size!")); }; } else { throw (new Error("ImageTransitionAnimation: Both images can not be null!")); }; } override protected function get frameCount():int{ return (fSteps); } override public function update():void{ var start:int; var i:int; var x:int; var y:int; var bm:Bitmap = (displayObject as Bitmap); if (frame == 0){ bm.bitmapData.copyPixels(fTopImage.bitmapData, fRect, fOrigin); }; if (frame == (frameCount - 1)){ bm.bitmapData.copyPixels(fBottomImage.bitmapData, fRect, fOrigin); } else { start = (fPointsPerStep * frame); bm.bitmapData.lock(); i = start; while (i < (start + fPointsPerStep)) { x = (fOrder[i] % bm.width); y = int((fOrder[i] / bm.height)); bm.bitmapData.setPixel32(x, y, fBottomImage.bitmapData.getPixel32(x, y)); i++; }; bm.bitmapData.unlock(); }; } } }//package smileygamer
Section 40
//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 41
//SGSprite (smileygamer.SGSprite) package smileygamer { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.utils.*; public class SGSprite extends Sprite { private var fState:String;// = "default" private var fSpriteClone:DisplayObject;// = null private var fAnimations:Object; private var fClonePos:Point;// = null public static const STATE_DEFAULT:String = "default"; public function SGSprite(){ fAnimations = new Object(); super(); addEventListener(Event.ENTER_FRAME, update); } public function set state(aState:String):void{ fState = aState; var i:int = (numChildren - 1); while (i >= 0) { removeChildAt(i); i--; }; var animation:AAnimation = (fAnimations[fState] as AAnimation); animation.reset(); addChild(animation.displayObject); if (fClonePos != null){ fSpriteClone = clone(animation.displayObject); fSpriteClone.x = fClonePos.x; fSpriteClone.y = fClonePos.y; addChild(fSpriteClone); }; } public function addAnimation(aState:String, aAnimation:AAnimation):void{ fAnimations[aState] = aAnimation; if (state == aState){ state = aState; }; } public function update(e:Event):void{ var animation:AAnimation; if (((!((fState == null))) && (!((fAnimations[fState] == null))))){ animation = (fAnimations[fState] as AAnimation); if (animation.finished){ state = nextState(); }; }; } private function clone(aObject:DisplayObject):DisplayObject{ var copy:DisplayObject; var original:Bitmap; var targetClass:Class; if ((aObject is Bitmap)){ original = (aObject as Bitmap); copy = new Bitmap(original.bitmapData); } else { targetClass = (getDefinitionByName(getQualifiedClassName(aObject)) as Class); copy = new (targetClass); }; copy.x = aObject.x; copy.y = aObject.y; copy.opaqueBackground = aObject.opaqueBackground; copy.transform = aObject.transform; copy.filters = aObject.filters; copy.cacheAsBitmap = aObject.cacheAsBitmap; var sprite:Sprite = new Sprite(); sprite.addChild(copy); return (sprite); } public function set clonePos(aClonePos:Point):void{ var animation:AAnimation; fClonePos = aClonePos; if (fClonePos == null){ if (fSpriteClone != null){ removeChild(fSpriteClone); }; fSpriteClone = null; } else { if (fSpriteClone == null){ animation = (fAnimations[fState] as AAnimation); fSpriteClone = clone(animation.displayObject); addChild(fSpriteClone); }; fSpriteClone.x = fClonePos.x; fSpriteClone.y = fClonePos.y; }; } public function get state():String{ return (fState); } public function get clonePos():Point{ return (fClonePos); } public function get finished():Boolean{ return (false); } protected function nextState():String{ return (STATE_DEFAULT); } } }//package smileygamer
Section 42
//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, aBorderColor:int=0){ var innershadow2:DropShadowFilter = new DropShadowFilter(1, -135); innershadow2.alpha = 0.8; innershadow2.quality = BitmapFilterQuality.HIGH; innershadow2.inner = true; var blackglow:GlowFilter = new GlowFilter(aBorderColor, 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 43
//SmileyButton_SmileySmall (smileygamer.SmileyButton_SmileySmall) package smileygamer { import mx.core.*; public class SmileyButton_SmileySmall extends BitmapAsset { } }//package smileygamer
Section 44
//Log (SWFStats.Log) package SWFStats { import flash.events.*; import flash.utils.*; import flash.net.*; import flash.external.*; import flash.system.*; public final class Log { private static const PingR:Timer = new Timer(30000); private static const PingF:Timer = new Timer(60000); public static var GUID:String = ""; private static var Plays:int = 0; public static var Enabled:Boolean = false; private static var Request:LogRequest = new LogRequest(); private static var Pings:int = 0; public static var Queue:Boolean = true; public static var SourceUrl:String; private static var HighestGoal:int = 0; private static var FirstPing:Boolean = true; public static var SWFID:int = 0; public function Log(){ super(); } 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{ if (SWFID > 0){ return; }; 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(("v/" + views), true); PingF.addEventListener(TimerEvent.TIMER, PingServer); PingF.start(); } public static function LevelCounterMetric(name:String, level):void{ if (!Enabled){ return; }; Send(((("lc/" + Clean(name)) + "/") + Clean(level))); } private static function Clean(s:String):String{ return (escape(s.replace("/", "\\").replace("~", "-"))); } public static function Play():void{ if (!Enabled){ return; }; Plays++; Send(("p/" + Plays)); } private static function Send(s:String, view:Boolean=false):void{ Request.Queue(s); if (((((Request.Ready) || (view))) || (!(Queue)))){ Request.Send(); Request = new LogRequest(); }; } 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 (escape(url)); } public static function LevelRangedMetric(name:String, level, value:int):void{ if (!Enabled){ return; }; Send(((((("lr/" + Clean(name)) + "/") + Clean(level)) + "/") + value)); } 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])); } public static function Goal(n:int, name:String):void{ } private static function PingServer(... _args):void{ if (!Enabled){ return; }; Pings++; Send(((("t/" + (FirstPing) ? "y" : "n") + "/") + Pings), true); 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(((((("la/" + Clean(name)) + "/") + Clean(level)) + "/") + value)); } public static function CustomMetric(name:String, group:String=null):void{ if (!Enabled){ return; }; if (group == null){ group = ""; }; Send(((("c/" + Clean(name)) + "/") + Clean(group))); } } }//package SWFStats
Section 45
//LogRequest (SWFStats.LogRequest) package SWFStats { import flash.events.*; import flash.net.*; public final class LogRequest { private var Data:String;// = "" public var Ready:Boolean;// = false private var Pieces:int; private static var Failed:int = 0; public function LogRequest(){ super(); } private function IOErrorHandler(e:IOErrorEvent):void{ Failed++; } public function Queue(data:String):void{ if (Failed > 3){ return; }; this.Pieces++; this.Data = (this.Data + (((this.Data == "")) ? "" : "~" + data)); if ((((this.Pieces == 8)) || ((this.Data.length > 300)))){ this.Ready = true; }; } private function SecurityErrorHandler(e:SecurityErrorEvent):void{ } private function StatusChange(e:HTTPStatusEvent):void{ } public function Send():void{ var sendaction:URLLoader = new URLLoader(); sendaction.addEventListener(IOErrorEvent.IO_ERROR, this.IOErrorHandler); sendaction.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.StatusChange); sendaction.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.SecurityErrorHandler); sendaction.load(new URLRequest((((((((((("http://tracker.swfstats.com/Games/q.aspx?guid=" + Log.GUID) + "&swfid=") + Log.SWFID) + "&q=") + this.Data) + "&url=") + Log.SourceUrl) + "&") + Math.random()) + "z"))); trace((((((((((("http://tracker.swfstats.com/Games/q.aspx?guid=" + Log.GUID) + "&swfid=") + Log.SWFID) + "&q=") + this.Data) + "&url=") + Log.SourceUrl) + "&") + Math.random()) + "z")); } } }//package SWFStats
Section 46
//EasyLevelGame (wheresmypumpkin.gameplay.EasyLevelGame) package wheresmypumpkin.gameplay { public class EasyLevelGame implements ILevelGame { private var fLevel:int; private static const LIFE:Array = new Array(120, 90, 75, 105, 90, 75, 90, 75); private static const MOVECOUNT:Array = new Array(1, 1, 1, 2, 2, 2, 3, 3); private static const LEVELS:int = 8; public function EasyLevelGame(aLevel:int=1){ super(); fLevel = aLevel; } public function get level():int{ return (fLevel); } public function get moveTime():int{ return (1); } public function nextLevel():void{ fLevel++; } public function get smileySize():int{ return (100); } public function get moveCount():int{ return (MOVECOUNT[(fLevel - 1)]); } public function get id():int{ return (0); } public function get totalLife():int{ var total:int; var i:int; while (i < LEVELS) { total = (total + LIFE[i]); i++; }; return (total); } public function get columns():int{ return (4); } public function get rows():int{ return (4); } public function get levelCount():int{ return (LEVELS); } public function get moveType():int{ return (19); } public function get showingTime():int{ return (4); } public function get life():int{ return (LIFE[(fLevel - 1)]); } public function get secondsPerTry():int{ return (4); } } }//package wheresmypumpkin.gameplay
Section 47
//HardLevelGame (wheresmypumpkin.gameplay.HardLevelGame) package wheresmypumpkin.gameplay { public class HardLevelGame implements ILevelGame { private var fLevel:int; private static const LIFE:Array = new Array(150, 135, 120, 150, 135, 120, 135, 120); private static const MOVECOUNT:Array = new Array(1, 1, 1, 2, 2, 2, 3, 3); private static const LEVELS:int = 8; public function HardLevelGame(aLevel:int=1){ super(); fLevel = aLevel; } public function get level():int{ return (fLevel); } public function get moveTime():int{ return (1); } public function nextLevel():void{ fLevel++; } public function get smileySize():int{ return (100); } public function get moveCount():int{ return (MOVECOUNT[(fLevel - 1)]); } public function get id():int{ return (1); } public function get totalLife():int{ var total:int; var i:int; while (i < LEVELS) { total = (total + LIFE[i]); i++; }; return (total); } public function get columns():int{ return (6); } public function get rows():int{ return (4); } public function get levelCount():int{ return (LEVELS); } public function get moveType():int{ return (19); } public function get showingTime():int{ return (5); } public function get life():int{ return (LIFE[(fLevel - 1)]); } public function get secondsPerTry():int{ return (4); } } }//package wheresmypumpkin.gameplay
Section 48
//ILevelGame (wheresmypumpkin.gameplay.ILevelGame) package wheresmypumpkin.gameplay { public interface ILevelGame { function get totalLife():int; function get level():int; function get moveCount():int; function get rows():int; function get levelCount():int; function get columns():int; function nextLevel():void; function get showingTime():int; function get smileySize():int; function get moveType():int; function get id():int; function get life():int; function get secondsPerTry():int; function get moveTime():int; } }//package wheresmypumpkin.gameplay
Section 49
//CoordinateFilter (wheresmypumpkin.movements.CoordinateFilter) package wheresmypumpkin.movements { import flash.display.*; import smileygamer.util.*; class CoordinateFilter implements IFilter { private var fRow:Boolean; private var fSize:int; private var fValue:int; function CoordinateFilter(aRow:Boolean, aValue:int, aSize:int){ super(); fRow = aRow; fValue = aValue; fSize = aSize; } public function accept(aObject:Object):Boolean{ var obj:DisplayObject = (aObject as DisplayObject); var value:int = int(((fValue * fSize) + (fSize / 2))); return ((fRow) ? (int((obj.x + (fSize / 2))) == value) : (int((obj.y + (fSize / 2))) == value)); } } }//package wheresmypumpkin.movements
Section 50
//MovementFactory (wheresmypumpkin.movements.MovementFactory) package wheresmypumpkin.movements { import flash.display.*; import smileygamer.movement.*; import smileygamer.util.*; public class MovementFactory { private var fSpeed:Number; private var fObjectContainer:DisplayObjectContainer; private var fRows:int; private var fSize:int; private var fCols:int; private var fMovementsList:Array; public static const TYPE_BOARD_RANDOM:int = 6; public static const TYPE_LINE_COL_RND:int = 14; public static const TYPE_BOARD_VER:int = 5; public static const TYPE_LINE_COL_UP:int = 10; public static const TYPE_BOARD_LEFT:int = 2; public static const TYPE_BOARD_RIGHT:int = 3; public static const TYPE_LINE_ROW_LEFT:int = 12; public static const TYPE_LINE_COL_DOWN:int = 11; public static const TYPE_LINE_ROW_RIGHT:int = 13; public static const TYPE_BOARD_UP:int = 0; public static const TYPE_NEIGHBOUR_SWAP_RND:int = 19; public static const TYPE_BOARD_DOWN:int = 1; public static const TYPE_TOTAL_RANDOM:int = 20; public static const TYPE_NEIGHBOUR_SWAP_HOR:int = 17; public static const TYPE_BOARD_VER_MESH:int = 8; public static const TYPE_BOARD_RANDOM_MESH:int = 9; public static const TYPE_LINE_ROW_RND:int = 15; public static const TYPE_BOARD_HOR:int = 4; public static const TYPE_LINE_RANDOM:int = 16; public static const TYPE_NEIGHBOUR_SWAP_VER:int = 18; public static const TYPE_BOARD_HOR_MESH:int = 7; private static var SWAPMOVES:int = 15; private static var MOVES:int = 25; public function MovementFactory(aRows:int, aCols:int, aSize:int, aObjectContainer:DisplayObjectContainer){ fMovementsList = new Array(); super(); fRows = aRows; fCols = aCols; fSize = aSize; fObjectContainer = aObjectContainer; fSpeed = (Number(aSize) / MOVES); } public function createColMeshMovement():IMovement{ var speedY:int; var movements:Array = new Array(fCols); var i:int; while (i < movements.length) { speedY = (((i % 2) == 0)) ? fSpeed : -(fSpeed); movements[i] = new LinearMovement(fObjectContainer, MOVES, 0, speedY, new CoordinateFilter(true, i, fSize)); i++; }; return (new ComplexMovement(movements)); } public function createVerSwapMovement():IMovement{ var bounds:DisplayObject; var row:int = RandomUtil.generateRandom(0, (fRows - 1)); var col:int = RandomUtil.generateRandom(0, fCols); var key1:String = ((row + "-") + col); var key2:String = (((row + 1) + "-") + col); while (((!((fMovementsList.indexOf(key1) == -1))) || (!((fMovementsList.indexOf(key2) == -1))))) { row = RandomUtil.generateRandom(0, (fRows - 1)); col = RandomUtil.generateRandom(0, fCols); key1 = ((row + "-") + col); key2 = (((row + 1) + "-") + col); }; fMovementsList.push(key1); fMovementsList.push(key2); var bounds1:DisplayObject; var bounds2:DisplayObject; var i:int; while (i < fObjectContainer.numChildren) { bounds = fObjectContainer.getChildAt(i); if ((((Math.round(bounds.x) == (col * fSize))) && ((Math.round(bounds.y) == (row * fSize))))){ bounds1 = bounds; } else { if ((((Math.round(bounds.x) == (col * fSize))) && ((Math.round(bounds.y) == ((row + 1) * fSize))))){ bounds2 = bounds; }; }; i++; }; return (new SwapMovement(bounds1, bounds2, SWAPMOVES)); } public function createComplexMovement(aType:int, aCount:int):IMovement{ while (fMovementsList.length > 0) { fMovementsList.pop(); }; if (aCount == 1){ return (createMovement(aType)); }; var movements:Array = new Array(aCount); var i:int; while (i < movements.length) { movements[i] = createMovement(aType); i++; }; if ((((((aType == TYPE_NEIGHBOUR_SWAP_HOR)) || ((aType == TYPE_NEIGHBOUR_SWAP_VER)))) || ((aType == TYPE_NEIGHBOUR_SWAP_RND)))){ return (new ComplexMovement(movements)); }; return (new ComplexMovement(movements, ComplexMovement.TYPE_SEQUENTIAL)); } public function createMovement(aType:int):IMovement{ var _local2:int; var _local3:int; switch (aType){ case TYPE_BOARD_UP: return (new LinearMovement(fObjectContainer, MOVES, 0, -(fSpeed))); case TYPE_BOARD_DOWN: return (new LinearMovement(fObjectContainer, MOVES, 0, fSpeed)); case TYPE_BOARD_LEFT: return (new LinearMovement(fObjectContainer, MOVES, -(fSpeed), 0)); case TYPE_BOARD_RIGHT: return (new LinearMovement(fObjectContainer, MOVES, fSpeed, 0)); case TYPE_BOARD_HOR: _local2 = (RandomUtil.randomBoolean()) ? -(fSpeed) : fSpeed; return (new LinearMovement(fObjectContainer, MOVES, _local2, 0)); case TYPE_BOARD_VER: _local3 = (RandomUtil.randomBoolean()) ? -(fSpeed) : fSpeed; return (new LinearMovement(fObjectContainer, MOVES, 0, _local3)); case TYPE_BOARD_RANDOM: return (createRandomBoardMovement()); case TYPE_BOARD_HOR_MESH: return (createRowMeshMovement()); case TYPE_BOARD_VER_MESH: return (createColMeshMovement()); case TYPE_BOARD_RANDOM_MESH: if (RandomUtil.randomBoolean()){ return (createRowMeshMovement()); }; return (createColMeshMovement()); case TYPE_LINE_COL_UP: return (createColMovement(true)); case TYPE_LINE_COL_DOWN: return (createColMovement(false)); case TYPE_LINE_COL_RND: return (createColMovement(RandomUtil.randomBoolean())); case TYPE_LINE_ROW_LEFT: return (createRowMovement(true)); case TYPE_LINE_ROW_RIGHT: return (createRowMovement(false)); case TYPE_LINE_ROW_RND: return (createRowMovement(RandomUtil.randomBoolean())); case TYPE_LINE_RANDOM: if (RandomUtil.randomBoolean()){ return (createRowMovement(RandomUtil.randomBoolean())); }; return (createColMovement(RandomUtil.randomBoolean())); case TYPE_NEIGHBOUR_SWAP_HOR: return (createHorSwapMovement()); case TYPE_NEIGHBOUR_SWAP_VER: return (createVerSwapMovement()); case TYPE_NEIGHBOUR_SWAP_RND: if (RandomUtil.randomBoolean()){ return (createHorSwapMovement()); }; return (createVerSwapMovement()); case TYPE_TOTAL_RANDOM: return (createMovement(RandomUtil.generateRandom(0, TYPE_NEIGHBOUR_SWAP_HOR))); }; return (null); } public function createRowMovement(aLeft:Boolean):IMovement{ var speedX:int = (aLeft) ? -(fSpeed) : fSpeed; var moves:int = (fSize / fSpeed); var value:int = RandomUtil.generateRandom(0, fRows); var key:String = (("row" + aLeft) + value); while (fMovementsList.indexOf(key) != -1) { value = RandomUtil.generateRandom(0, fRows); key = (("row" + aLeft) + value); }; fMovementsList.push(key); return (new LinearMovement(fObjectContainer, MOVES, speedX, 0, new CoordinateFilter(false, value, fSize))); } public function createHorSwapMovement():IMovement{ var bounds:DisplayObject; var row:int = RandomUtil.generateRandom(0, fRows); var col:int = RandomUtil.generateRandom(0, (fCols - 1)); var key1:String = ((row + "-") + col); var key2:String = ((row + "-") + (col + 1)); while (((!((fMovementsList.indexOf(key1) == -1))) || (!((fMovementsList.indexOf(key2) == -1))))) { row = RandomUtil.generateRandom(0, fRows); col = RandomUtil.generateRandom(0, (fCols - 1)); key1 = ((row + "-") + col); key2 = ((row + "-") + (col + 1)); }; fMovementsList.push(key1); fMovementsList.push(key2); var bounds1:DisplayObject; var bounds2:DisplayObject; var i:int; while (i < fObjectContainer.numChildren) { bounds = fObjectContainer.getChildAt(i); if ((((Math.round(bounds.x) == (col * fSize))) && ((Math.round(bounds.y) == (row * fSize))))){ bounds1 = bounds; } else { if ((((Math.round(bounds.x) == ((col + 1) * fSize))) && ((Math.round(bounds.y) == (row * fSize))))){ bounds2 = bounds; }; }; i++; }; return (new SwapMovement(bounds1, bounds2, SWAPMOVES)); } public function createColMovement(aUp:Boolean):IMovement{ var speedY:int = (aUp) ? -(fSpeed) : fSpeed; var moves:int = (fSize / fSpeed); var value:int = RandomUtil.generateRandom(0, fCols); var key:String = (("col" + aUp) + value); while (fMovementsList.indexOf(key) != -1) { value = RandomUtil.generateRandom(0, fRows); key = (("col" + aUp) + value); }; fMovementsList.push(key); return (new LinearMovement(fObjectContainer, MOVES, 0, speedY, new CoordinateFilter(true, value, fSize))); } public function createRandomBoardMovement():IMovement{ var rnd:int = RandomUtil.generateRandom(0, 4); var speedX:int; var speedY:int; switch (rnd){ case 0: speedX = -(fSpeed); break; case 1: speedX = fSpeed; break; case 2: speedY = -(fSpeed); break; case 3: speedY = fSpeed; break; }; return (new LinearMovement(fObjectContainer, MOVES, speedX, speedY)); } public function createRowMeshMovement():IMovement{ var speedX:int; var movements:Array = new Array(fRows); var i:int; while (i < movements.length) { speedX = (((i % 2) == 0)) ? fSpeed : -(fSpeed); movements[i] = new LinearMovement(fObjectContainer, MOVES, speedX, 0, new CoordinateFilter(false, i, fSize)); i++; }; return (new ComplexMovement(movements)); } } }//package wheresmypumpkin.movements
Section 51
//SwapMovement (wheresmypumpkin.movements.SwapMovement) package wheresmypumpkin.movements { import flash.display.*; import wheresmypumpkin.*; import smileygamer.movement.*; public class SwapMovement implements IMovement { private var fSteps:int; private var fCircleY:Array; private var fCircleX:Array; private var fObject1:ItemSprite; private var fObject2:ItemSprite; private var fStep:int;// = 0 public function SwapMovement(aBounds1:DisplayObject, aBounds2:DisplayObject, aSteps:int){ super(); fObject1 = (aBounds1 as ItemSprite); fObject2 = (aBounds2 as ItemSprite); fSteps = aSteps; var centerX:Number = ((fObject1.x + fObject2.x) / 2); var centerY:Number = ((fObject1.y + fObject2.y) / 2); var dist:Number = Math.sqrt((Math.pow((fObject1.x - centerX), 2) + Math.pow((fObject1.y - centerY), 2))); var startAngle:Number = Math.atan2((fObject1.y - centerY), (fObject1.x - centerX)); fCircleX = new Array((fSteps * 2)); fCircleY = new Array((fSteps * 2)); var i:int; while (i < fCircleX.length) { fCircleX[i] = ((Math.cos((((Math.PI * i) / (fSteps - 1)) + startAngle)) * dist) + centerX); fCircleY[i] = ((Math.sin((((Math.PI * i) / (fSteps - 1)) + startAngle)) * dist) + centerY); i++; }; fCircleX[0] = (fCircleX[((fSteps * 2) - 1)] = fObject1.x); fCircleY[0] = (fCircleY[((fSteps * 2) - 1)] = fObject1.y); fCircleX[(fSteps - 1)] = (fCircleX[fSteps] = fObject2.x); fCircleY[(fSteps - 1)] = (fCircleY[fSteps] = fObject2.y); } public function move():Boolean{ if (fStep < fSteps){ fObject1.x = fCircleX[fStep]; fObject1.y = fCircleY[fStep]; fObject2.x = fCircleX[(fStep + fSteps)]; fObject2.y = fCircleY[(fStep + fSteps)]; fObject1.moving = true; fObject2.moving = true; fStep++; } else { fObject1.moving = false; fObject2.moving = false; }; return ((fStep == fSteps)); } } }//package wheresmypumpkin.movements
Section 52
//Background (wheresmypumpkin.Background) package wheresmypumpkin { import flash.display.*; public class Background extends Sprite { private static var BackgroundImage:Class = Background_BackgroundImage; public function Background(){ super(); addChild(new BackgroundImage()); } } }//package wheresmypumpkin
Section 53
//Background_BackgroundImage (wheresmypumpkin.Background_BackgroundImage) package wheresmypumpkin { import mx.core.*; public class Background_BackgroundImage extends BitmapAsset { } }//package wheresmypumpkin
Section 54
//BoardFrame (wheresmypumpkin.BoardFrame) package wheresmypumpkin { import flash.display.*; import flash.geom.*; import flash.filters.*; public class BoardFrame extends Sprite { private var fBoardCorner:Point; private var fLifeBarRect:Rectangle; private static const COLOR:int = 15695395; public function BoardFrame(aBoardWidth:int){ fLifeBarRect = new Rectangle(5, 15, 14, 390); super(); var outerLeft:int = (310 - (aBoardWidth / 2)); var innerRight:int = (outerLeft + aBoardWidth); fBoardCorner = new Point(outerLeft, 10); fLifeBarRect.x = (innerRight + 5); var frame:Shape = new Shape(); var m:Matrix = new Matrix(); m.createGradientBox(608, 408, (Math.PI / 4)); frame.graphics.beginFill(COLOR, 1); frame.graphics.drawRoundRect((outerLeft - 4), 6, (aBoardWidth + 28), 408, 8, 8); frame.graphics.drawRoundRect(outerLeft, 10, aBoardWidth, 400, 8, 8); frame.graphics.endFill(); frame.cacheAsBitmap = true; frame.filters = [new DropShadowFilter(4, 90, 16683837, 1, 4, 4, 1, 1, true), new DropShadowFilter(4, -90, 0xDB6200, 1, 4, 4, 1, 1, true), new GlowFilter(0, 1, 8, 8, 2, BitmapFilterQuality.HIGH)]; addChild(frame); var inner:Shape = new Shape(); inner.graphics.beginFill(0xFFFFFF, 0.4); inner.graphics.drawRoundRect(outerLeft, 10, aBoardWidth, 400, 8, 8); inner.graphics.endFill(); inner.cacheAsBitmap = true; addChild(inner); cacheAsBitmap = true; } public function get boardCorner():Point{ return (fBoardCorner); } public function get lifeBarRect():Rectangle{ return (fLifeBarRect); } } }//package wheresmypumpkin
Section 55
//BoardLayer (wheresmypumpkin.BoardLayer) package wheresmypumpkin { import flash.events.*; import flash.display.*; import flash.geom.*; import smileygamer.movement.*; import smileygamer.util.*; import wheresmypumpkin.movements.*; public class BoardLayer extends Sprite { private var fItem2:int; private var fSize:int; private var fState:int;// = 0 private var fTries:int; private var fMovementFactory:MovementFactory; private var fRows:int; private var fItemsSprite:Sprite; private var fMovement:IMovement; private var fItem1:int; private var fCols:int; private var fItems:Array; private var fBoardBounds:Rectangle; public static const RES_MATCH:int = 1; private static const NORMAL:int = 0; public static const RES_MISMATCH:int = 2; private static const MISMATCH:int = 2; private static const FINISHED:int = 3; private static const ONE_CLICKED:int = 1; public static const RES_NONE:int = 0; public function BoardLayer(aCols:int, aRows:int, aSize:int){ super(); fCols = aCols; fRows = aRows; fSize = aSize; fItems = new Array((fCols * fRows)); fBoardBounds = new Rectangle(0, 0, (fCols * fSize), (fRows * fSize)); fItemsSprite = new Sprite(); addChild(fItemsSprite); fMovementFactory = new MovementFactory(fRows, fCols, fSize, fItemsSprite); var square:Sprite = new Sprite(); square.graphics.beginFill(0xFF0000); square.graphics.drawRect(-1, -1, ((fCols * fSize) + 2), ((fRows * fSize) + 2)); addChild(square); mask = square; addEventListener(Event.ENTER_FRAME, update); } public function isFinished():Boolean{ return ((fState == FINISHED)); } public function update(e:Event):void{ moveItems(); } public function init():void{ var i:int = (fItemsSprite.numChildren - 1); while (i >= 0) { fItemsSprite.removeChildAt(i); i--; }; var types:Array = RandomUtil.generateRandomArray(12); var randoms:Array = RandomUtil.generateRandomArray((fCols * fRows)); var index:int; while (index < fItems.length) { fItems[index] = new ItemSprite(types[int((randoms[index] / 2))], fSize, fBoardBounds); fItems[index].x = ((index % fCols) * fSize); fItems[index].y = (int((index / fCols)) * fSize); fItemsSprite.addChild(fItems[index]); index++; }; fState = NORMAL; fTries = 0; turnAll(); } public function get tries():int{ return (fTries); } public function doMovement(aType:int, aCount:int):void{ if (fMovement == null){ fMovement = fMovementFactory.createComplexMovement(aType, aCount); }; } public function turnAll():void{ var item:ItemSprite; var i:int; while (i < fItems.length) { item = fItems[i]; item.turn(); i++; }; } public function clicked(aX:int, aY:int):int{ var i:int; var finished:Boolean; var item:ItemSprite; if (!fBoardBounds.contains(aX, aY)){ return (RES_NONE); }; if (fMovement != null){ return (RES_NONE); }; var clickedItem = -1; i = 0; while (i < fItems.length) { if (fItems[i].containsPt(aX, aY)){ clickedItem = i; break; }; i++; }; if (clickedItem == -1){ return (RES_NONE); }; switch (fState){ case MISMATCH: fItems[fItem1].turn(); fItems[fItem2].turn(); fState = NORMAL; case NORMAL: if (!fItems[clickedItem].isVisible()){ fItem1 = clickedItem; fItems[fItem1].turn(); fState = ONE_CLICKED; }; break; case ONE_CLICKED: if (!fItems[clickedItem].isVisible()){ fTries++; fItem2 = clickedItem; fItems[fItem2].turn(); if (fItems[fItem1].type == fItems[fItem2].type){ fState = NORMAL; finished = true; i = 0; while (i < fItems.length) { item = fItems[i]; finished = ((finished) && (item.isVisible())); i++; }; if (finished){ fState = FINISHED; }; return (RES_MATCH); } else { fState = MISMATCH; return (RES_MISMATCH); }; }; break; }; return (RES_NONE); } private function moveItems():void{ var i:int; var item:ItemSprite; if (fMovement != null){ if (fMovement.move()){ fMovement = null; i = 0; while (i < fItems.length) { item = fItems[i]; item.moving = false; i++; }; }; i = 0; while (i < fItems.length) { item = fItems[i]; item.locationChanged(); if (item.moving){ fItemsSprite.setChildIndex(item, (fItemsSprite.numChildren - 1)); }; i++; }; }; } } }//package wheresmypumpkin
Section 56
//BonusAnimation (wheresmypumpkin.BonusAnimation) package wheresmypumpkin { import flash.display.*; import smileygamer.*; import flash.geom.*; import smileygamer.util.*; import flash.text.*; public class BonusAnimation extends AAnimation { private var fSteps:int; public function BonusAnimation(aParent:DisplayObjectContainer, aText:String){ var bonusField:TextField = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true); bonusField.defaultTextFormat.italic = true; bonusField.text = aText; fSteps = (WheresMyPumpkin.LOWFPS) ? 40 : 60; super(bonusField); looping = false; aParent.addChild(bonusField); } override public function update():void{ if (frame == ((fSteps / 2) + 5)){ new MoveAnimation(displayObject, new Point((320 - (displayObject.width / 2)), 150), new Point((-(displayObject.width) - 10), 150), ((fSteps / 2) - 5), InterpolationUtil.TYPE_COSINE, 0, true); }; } override protected function get frameCount():int{ return (fSteps); } override public function reset():void{ super.reset(); new MoveAnimation(displayObject, new Point(650, 150), new Point((320 - (displayObject.width / 2)), 150), ((fSteps / 2) - 5), InterpolationUtil.TYPE_COSINE); } } }//package wheresmypumpkin
Section 57
//GameCompleteAnimation (wheresmypumpkin.GameCompleteAnimation) package wheresmypumpkin { import flash.display.*; import smileygamer.*; import flash.geom.*; import smileygamer.util.*; import flash.text.*; public class GameCompleteAnimation extends AAnimation { private var fLevelField:TextField; private var fCongrats:TextField; private var fScoreField:TextField; public function GameCompleteAnimation(aParent:DisplayObjectContainer, aScore:int, aTime:String, aThumbsUpLayer:ThumbsUpLayer){ var layer:Sprite; var timeField:TextField; var addThumbsLayer:Function; var aParent = aParent; var aScore = aScore; var aTime = aTime; var aThumbsUpLayer = aThumbsUpLayer; addThumbsLayer = function ():void{ layer.addChild(aThumbsUpLayer); }; layer = new Sprite(); fCongrats = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT); fCongrats.text = "You did it!"; layer.addChild(fCongrats); fScoreField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT); fScoreField.text = ("Score: " + aScore); layer.addChild(fScoreField); timeField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT); timeField.text = ("Time: " + aTime); layer.addChild(timeField); super(layer); looping = true; new MoveAnimation(fCongrats, new Point((300 - (fCongrats.width / 2)), -(fCongrats.height)), new Point((300 - (fCongrats.width / 2)), 15), 20, InterpolationUtil.TYPE_COSINE); new MoveAnimation(fScoreField, new Point(640, 110), new Point((300 - (fScoreField.width / 2)), 105), 20, InterpolationUtil.TYPE_COSINE, 5); var anim:MoveAnimation = new MoveAnimation(timeField, new Point(640, 180), new Point((300 - (timeField.width / 2)), 170), 20, InterpolationUtil.TYPE_COSINE, 10); aThumbsUpLayer.x = (310 - (aThumbsUpLayer.width / 2)); aThumbsUpLayer.y = 220; anim.addCallback(addThumbsLayer); aParent.addChild(layer); } override public function update():void{ if ((frame % 10) == 0){ if (fCongrats.textColor == TextFactory.COLOR_DEFAULT){ fCongrats.textColor = TextFactory.COLOR_SELECTED; } else { fCongrats.textColor = TextFactory.COLOR_DEFAULT; }; }; } override protected function get frameCount():int{ return (20); } public function endAnimation():void{ new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE); } } }//package wheresmypumpkin
Section 58
//GameOverAnimation (wheresmypumpkin.GameOverAnimation) package wheresmypumpkin { import flash.display.*; import smileygamer.*; import flash.geom.*; import smileygamer.util.*; import flash.text.*; public class GameOverAnimation extends AAnimation { private var fLevelField:TextField; private var fScoreField:TextField; public function GameOverAnimation(aParent:DisplayObjectContainer, aScore:int, aLevel:int, aTotalLevels:int){ var layer:Sprite = new Sprite(); var gameOver:TextField = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_DEFAULT); gameOver.text = "Game Over"; layer.addChild(gameOver); fLevelField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT); fLevelField.text = ((("Level " + aLevel) + " of ") + aTotalLevels); fLevelField.x = 650; fLevelField.y = 105; layer.addChild(fLevelField); fScoreField = TextFactory.createTextField(TextFactory.SIZE_LARGE, TextFactory.COLOR_DEFAULT); fScoreField.text = ("Score: " + aScore); fScoreField.x = 650; fScoreField.y = 170; layer.addChild(fScoreField); super(layer); looping = false; new MoveAnimation(gameOver, new Point((300 - (gameOver.width / 2)), -(gameOver.height)), new Point((300 - (gameOver.width / 2)), 20), 20, InterpolationUtil.TYPE_COSINE); aParent.addChild(layer); } public function endAnimation():void{ new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE); } override protected function get frameCount():int{ return (50); } override public function update():void{ if (frame == 20){ new MoveAnimation(fLevelField, new Point(650, fLevelField.y), new Point((300 - (fLevelField.width / 2)), fLevelField.y), 20, InterpolationUtil.TYPE_COSINE); }; if (frame == 30){ new MoveAnimation(fScoreField, new Point(650, fScoreField.y), new Point((300 - (fScoreField.width / 2)), fScoreField.y), 20, InterpolationUtil.TYPE_COSINE); }; } } }//package wheresmypumpkin
Section 59
//GameScreen (wheresmypumpkin.GameScreen) package wheresmypumpkin { import flash.events.*; import wheresmypumpkin.gameplay.*; import flash.display.*; import smileygamer.*; import flash.geom.*; import smileygamer.util.*; import flash.utils.*; import flash.text.*; import flash.ui.*; public class GameScreen extends Sprite implements ILogic { private var fSubmitSprite:Sprite; private var fStartTime:int; private var fBoardLayer:BoardLayer; private var fThumbsUpLayer:ThumbsUpLayer; private var fShowButton:SimpleButton; private var fPointsField:TextField; private var fTotalLife:int; private var fPointsFactor:Number;// = 1 private var fBoardFrame:BoardFrame; private var fLifeBar:LifeBar; private var fLevelCompleteAnimation:LevelCompleteAnimation; private var fMessageField:TextField; private var fEndShowingTimer:Timer; private var fLimitText:Sprite; private var fHelpLayer:Sprite; private var fState:int;// = 0 private var fLastAdTime:int;// = -300000 private var fLevelGame:ILevelGame; private var fTime:int; private var fClickField:TextField; private var fTriesField:TextField; private var fPoints:int; private var fTotalTime:int; private var fMatches:int;// = 0 private var fBoardBackground:Sprite; private var fNameField:TextField; private var fTickTimer:Timer; private var fDownloadSprite:Sprite; private var fLevelCompleteTimer:Timer; private var fTimeField:TextField; private var fGame:WheresMyPumpkin; private var fPausedLayer:Sprite; private static const STATE_LIMIT_REACHED:int = 10; private static const STATE_LEVEL_COMPLETE:int = 6; private static const STATE_PAUSED:int = 5; private static const STATE_INVALID:int = 0; private static const STATE_HELP:int = 2; private static const STATE_RUNNING:int = 4; private static const STATE_SHOWING:int = 3; private static const STATE_OUTRO:int = 9; private static const BONUS_POINTS:int = 500; private static const STATE_GAME_OVER:int = 7; private static const STATE_GAME_WON:int = 8; private static const MATCH_POINTS:int = 50; private static const STATE_INTRO:int = 1; private static var sHelpShown:Boolean = false; public function GameScreen(aGame:WheresMyPumpkin, aLevelGame:ILevelGame, aSaveGame:Object=null){ super(); fGame = aGame; fLevelGame = aLevelGame; if (aSaveGame != null){ fPoints = aSaveGame.score; fTotalLife = aSaveGame.totalLife; fTotalTime = aSaveGame.totalTime; } else { fPoints = 0; fTotalLife = 0; fTotalTime = 0; }; y = 480; addEventListener(Event.ADDED, added); addEventListener(Event.REMOVED, removed); } public function added(aEvent:Event):void{ removeEventListener(Event.ADDED, added); stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseUpdate); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpdate); stage.addEventListener(MouseEvent.CLICK, mouseUpdate); stage.addEventListener(KeyboardEvent.KEY_UP, doKey); init(); } private function endGame(e:Event):void{ var showTitle:Function; var e = e; showTitle = function ():void{ Mouse.hide(); fGame.showTitleScreen(); }; fState = STATE_OUTRO; var anim:MoveAnimation = new MoveAnimation(this, new Point(0, 0), new Point(0, 480), 15, InterpolationUtil.TYPE_LINEAR, 0, true); anim.addCallback(showTitle); } private function submitScore(e:Event):void{ var rankReceived:Function; var e = e; rankReceived = function (aRank:int):void{ if (aRank < 0){ fMessageField.text = "Not submitted"; } else { if (aRank == 0){ fMessageField.text = "Submitted"; } else { fMessageField.text = ("Rank " + aRank); }; }; }; fSubmitSprite.visible = false; fMessageField.visible = true; fMessageField.text = "Submitting..."; fShowButton.visible = true; var name:String = fNameField.text; SaveData.name = name; fGame.submitScore(name, fPoints, fLevelGame.id, rankReceived); } private function pauseGame(e:Event):void{ if (fState == STATE_RUNNING){ fState = STATE_PAUSED; fTickTimer.stop(); fPausedLayer = createPausedLayer(); new MoveAnimation(fPausedLayer, new Point(0, -480), new Point(0, 0), 15, InterpolationUtil.TYPE_COSINE); addChild(fPausedLayer); } else { if (fState == STATE_PAUSED){ unpauseGame(e); }; }; } private function unpauseGame(e:Event):void{ fState = STATE_RUNNING; fTickTimer.start(); new MoveAnimation(fPausedLayer, new Point(0, 0), new Point(0, -480), 15, InterpolationUtil.TYPE_COSINE, 0, true); } private function init():void{ var boardWidth:int = (fLevelGame.columns * fLevelGame.smileySize); fBoardFrame = new BoardFrame(boardWidth); addChild(fBoardFrame); fBoardLayer = new BoardLayer(fLevelGame.columns, fLevelGame.rows, fLevelGame.smileySize); fBoardLayer.init(); fBoardLayer.x = fBoardFrame.boardCorner.x; fBoardLayer.y = fBoardFrame.boardCorner.y; addChild(fBoardLayer); fLifeBar = new LifeBar(); fLifeBar.maxValue = fLevelGame.life; fLifeBar.value = fLevelGame.life; fLifeBar.x = fBoardFrame.lifeBarRect.x; fLifeBar.y = fBoardFrame.lifeBarRect.y; fLifeBar.width = fBoardFrame.lifeBarRect.width; fLifeBar.height = fBoardFrame.lifeBarRect.height; addChild(fLifeBar); var smileyButton:SmileyButton = new SmileyButton(0xFFAA00, true, 0xFFFFFF); smileyButton.x = 20; smileyButton.y = (470 - smileyButton.height); addChild(smileyButton); fTriesField = TextFactory.createTextField(TextFactory.SIZE_MEDIUM); fTriesField.x = 100; fTriesField.y = 413; fTriesField.width = 150; fTriesField.height = 30; fTriesField.text = (("TRIES: " + fBoardLayer.tries) + " "); addChild(fTriesField); fTimeField = TextFactory.createTextField(TextFactory.SIZE_MEDIUM); fTimeField.x = 100; fTimeField.y = 443; fTimeField.width = 150; fTimeField.height = 30; fTimeField.text = "TIME: 0:00 "; addChild(fTimeField); fPointsField = TextFactory.createTextField(TextFactory.SIZE_LARGE); fPointsField.autoSize = TextFieldAutoSize.RIGHT; fPointsField.x = 440; fPointsField.y = 420; fPointsField.width = 150; fPointsField.height = 60; fPointsField.text = "000000"; addChild(fPointsField); var pauseButton:PauseButton = new PauseButton(); pauseButton.x = 300; pauseButton.y = 430; addChild(pauseButton); pauseButton.addEventListener(MouseEvent.CLICK, pauseGame); var soundBtn:SoundButton = new SoundButton(); soundBtn.x = (625 - soundBtn.width); soundBtn.y = 425; addChild(soundBtn); fClickField = TextFactory.createTextField(TextFactory.SIZE_MEDIUM, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT); fClickField.autoSize = TextFieldAutoSize.CENTER; fClickField.text = "Click to continue..."; fClickField.x = (320 - (fClickField.width / 2)); fClickField.y = 350; fClickField.visible = false; fClickField.selectable = false; fClickField.mouseEnabled = true; addChild(fClickField); fClickField.addEventListener(MouseEvent.CLICK, nextLevel); fState = STATE_INTRO; var anim:MoveAnimation = new MoveAnimation(this, new Point(0, 480), new Point(0, 0), 20, InterpolationUtil.TYPE_LINEAR); anim.addCallback(startGame); } private function tick(e:TimerEvent):void{ fLifeBar.value = (fLifeBar.value - 0.1); checkBars(); } private function levelFinished():void{ fTickTimer.stop(); if (fMatches > 2){ fLevelCompleteTimer.delay = 2000; } else { fLevelCompleteTimer.delay = 1000; }; fTotalLife = (fTotalLife + fLifeBar.value); fTotalTime = (fTotalTime + fTime); fLevelCompleteTimer.start(); } public function doLogic():void{ switch (fState){ case STATE_RUNNING: if (((((getTimer() - fStartTime) > 1000)) && (fTickTimer.running))){ fStartTime = getTimer(); fTime++; fTimeField.text = ("TIME: " + formatTime(fTime)); }; break; case STATE_LEVEL_COMPLETE: if (((fLevelCompleteAnimation.finished) && ((fLifeBar.value > 0)))){ fLifeBar.value--; fThumbsUpLayer.count++; addPoints((10 * fThumbsUpLayer.rank)); if (((WheresMyPumpkin.LOWFPS) && ((fLifeBar.value > 0)))){ fLifeBar.value--; addPoints((10 * fThumbsUpLayer.rank)); fThumbsUpLayer.count++; }; if (fLifeBar.value <= 0){ fClickField.visible = true; }; }; break; }; } private function createPausedLayer():Sprite{ var layer:Sprite = new Sprite(); var paused:TextField = TextFactory.createTextField(TextFactory.SIZE_LARGEST, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true); paused.text = "PAUSED"; paused.x = (320 - (paused.width / 2)); paused.y = 35; layer.addChild(paused); var resumeButton:SimpleButton = TextFactory.createTextButton("resume game", TextFactory.SIZE_LARGE); resumeButton.x = (320 - (resumeButton.width / 2)); resumeButton.y = 180; layer.addChild(resumeButton); resumeButton.addEventListener(MouseEvent.CLICK, unpauseGame); var endgameButton:SimpleButton = TextFactory.createTextButton("save & end game", TextFactory.SIZE_LARGE); endgameButton.x = (320 - (endgameButton.width / 2)); endgameButton.y = 270; layer.addChild(endgameButton); endgameButton.addEventListener(MouseEvent.CLICK, endGame); return (layer); } private function showHighscores(e:Event):void{ fGame.showHighscoresPage(); } private function formatTime(aTime:int):String{ return ((((int((aTime / 60)) + ":") + (((aTime % 60) < 10)) ? "0" : "") + (aTime % 60))); } private function createEndGameButtonLayer():Sprite{ var lbclosed:Function; var other:Function; lbclosed = function ():void{ Mouse.hide(); }; other = function (e:Event):void{ fGame.showSponsorSite(); }; var layer:Sprite = new Sprite(); fGame.submitScore("", fPoints, fLevelGame.id, lbclosed); var otherButton:SimpleButton = TextFactory.createTextButton("more games", TextFactory.SIZE_LARGE); otherButton.x = (300 - (otherButton.width / 2)); otherButton.y = 290; layer.addChild(otherButton); otherButton.addEventListener(MouseEvent.CLICK, other); var menuButton:SimpleButton = TextFactory.createTextButton("menu", TextFactory.SIZE_LARGE); menuButton.x = (300 - (menuButton.width / 2)); menuButton.y = 350; layer.addChild(menuButton); menuButton.addEventListener(MouseEvent.CLICK, endGame); var adclip:Sprite = new Sprite(); adclip.x = 540; adclip.y = 90; SmileyGamerAPI.showSGMoreGamesTab(adclip, 64423427619); layer.addChild(adclip); return (layer); } private function submitMindJolt(e:Event):void{ } private function nextLevel(e:Event):void{ var buttons:Sprite; var thumbsUp:ThumbsUpLayer; var t:Timer; fLevelCompleteAnimation.endAnimation(); new FadeAnimation(fThumbsUpLayer, 5, FadeAnimation.MODE_FADE_OUT_REMOVE); fClickField.visible = false; if (fLevelGame.level < fLevelGame.levelCount){ SaveData.saveGame(fLevelGame.id, (fLevelGame.level + 1), fPoints, fTotalLife, fTotalTime); fLevelGame.nextLevel(); fBoardLayer.init(); fLifeBar.maxValue = fLevelGame.life; fLifeBar.value = fLevelGame.life; fState = STATE_SHOWING; new LevelAnimation(this, fLevelGame.level); fEndShowingTimer.start(); } else { addPoints(10000); buttons = createEndGameButtonLayer(); addChild(buttons); thumbsUp = new ThumbsUpLayer(fLevelGame.totalLife); thumbsUp.count = fTotalLife; new GameCompleteAnimation(this, fPoints, formatTime(fTotalTime), thumbsUp); SaveData.endGame(fLevelGame.id, fLevelGame.level, fPoints, thumbsUp.rank); SaveData.clearSavedGame(fLevelGame.id); fState = STATE_GAME_WON; SoundManager.playGameWon(); if (WheresMyPumpkin.MINDJOLT){ t = new Timer(1000, 1); t.addEventListener(TimerEvent.TIMER_COMPLETE, submitMindJolt); t.start(); }; }; } private function doKey(e:KeyboardEvent):void{ if ((((e.keyCode == 80)) || ((e.keyCode == 27)))){ pauseGame(e); }; if (e.keyCode == 83){ SoundManager.toggleSound(); }; } public function mouseUpdate(aEvent:MouseEvent):void{ var result:int; switch (fState){ case STATE_RUNNING: if (aEvent.type == MouseEvent.MOUSE_DOWN){ if (!fBoardLayer.isFinished()){ result = fBoardLayer.clicked(fBoardLayer.mouseX, fBoardLayer.mouseY); if (result == BoardLayer.RES_MISMATCH){ fLifeBar.value = (fLifeBar.value - fLevelGame.secondsPerTry); fMatches = 0; SoundManager.playMismatch(); fBoardLayer.doMovement(fLevelGame.moveType, fLevelGame.moveCount); } else { if (result == BoardLayer.RES_MATCH){ fMatches++; addPoints(MATCH_POINTS); if (fMatches > 2){ addPoints(BONUS_POINTS); new BonusAnimation(this, ("BONUS: " + (BONUS_POINTS * fPointsFactor))); SoundManager.playBonus(); } else { SoundManager.playMatch(); }; if (fBoardLayer.isFinished()){ levelFinished(); } else { fBoardLayer.doMovement(fLevelGame.moveType, fLevelGame.moveCount); }; }; }; fTriesField.text = ("TRIES: " + fBoardLayer.tries); checkBars(); }; }; break; case STATE_LEVEL_COMPLETE: if ((((aEvent.type == MouseEvent.CLICK)) && (fClickField.visible))){ nextLevel(aEvent); }; break; }; } public function removed(aEvent:Event):void{ removeEventListener(Event.REMOVED, removed); } private function addPoints(aPoints:int):void{ fPoints = (fPoints + (aPoints * fPointsFactor)); fPointsField.text = ("" + fPoints); } private function checkBars():void{ var buttons:Sprite; var t:Timer; if (fLifeBar.value <= 0){ fTickTimer.stop(); fState = STATE_GAME_OVER; new GameOverAnimation(this, fPoints, fLevelGame.level, fLevelGame.levelCount); SoundManager.playGameOver(); buttons = createEndGameButtonLayer(); addChild(buttons); SaveData.endGame(fLevelGame.id, fLevelGame.level, fPoints, 0); SaveData.clearSavedGame(fLevelGame.id); if (WheresMyPumpkin.MINDJOLT){ t = new Timer(1000, 1); t.addEventListener(TimerEvent.TIMER_COMPLETE, submitMindJolt); t.start(); }; }; } private function showLevelComplete(e:Event):void{ fLevelCompleteTimer.stop(); fLevelCompleteAnimation = new LevelCompleteAnimation(this, fLevelGame.level); fBoardLayer.turnAll(); fThumbsUpLayer = new ThumbsUpLayer(fLevelGame.life); fThumbsUpLayer.x = 140; fThumbsUpLayer.y = 260; new FadeAnimation(fThumbsUpLayer, 5, FadeAnimation.MODE_FADE_IN); addChild(fThumbsUpLayer); fState = STATE_LEVEL_COMPLETE; SoundManager.playLevelComplete(); } private function startGame():void{ fState = STATE_SHOWING; fPointsField.text = ("" + fPoints); fEndShowingTimer = new Timer((fLevelGame.showingTime * 1000), 1); fEndShowingTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endShowing); fEndShowingTimer.start(); new LevelAnimation(this, fLevelGame.level); fTickTimer = new Timer(100); fTickTimer.addEventListener(TimerEvent.TIMER, tick); fLevelCompleteTimer = new Timer(1000, 1); fLevelCompleteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, showLevelComplete); } private function endShowing(e:Event):void{ fBoardLayer.turnAll(); fState = STATE_RUNNING; fStartTime = getTimer(); fTime = 0; fTickTimer.start(); fMatches = 0; } } }//package wheresmypumpkin
Section 60
//HandSprite (wheresmypumpkin.HandSprite) package wheresmypumpkin { import smileygamer.*; import flash.filters.*; public class HandSprite extends SGSprite { private var fMouseDown:Boolean;// = false private var HandUp:Class; private var fHotspotX:int;// = 8 private var fHotspotY:int;// = 4 private var HandDown:Class; private static const STATE_DOWN:String = "down"; private static const STATE_NORMAL:String = "default"; public function HandSprite(){ HandUp = HandSprite_HandUp; HandDown = HandSprite_HandDown; super(); addAnimation(STATE_NORMAL, new ImageAnimation(new HandUp())); addAnimation(STATE_DOWN, new ImageAnimation(new HandDown())); var shadow:DropShadowFilter = new DropShadowFilter(2); shadow.alpha = 0.6; shadow.quality = BitmapFilterQuality.HIGH; var innershadow:DropShadowFilter = new DropShadowFilter(1, -135); innershadow.quality = BitmapFilterQuality.HIGH; innershadow.alpha = 0.8; innershadow.inner = true; filters = [innershadow, shadow]; mouseEnabled = false; } public function button(aDown:Boolean):void{ fMouseDown = aDown; if (fMouseDown){ state = STATE_DOWN; } else { state = STATE_NORMAL; }; } public function move(aX:int, aY:int):void{ x = (aX - fHotspotX); y = (aY - fHotspotY); } public function isMouseDown():Boolean{ return (fMouseDown); } } }//package wheresmypumpkin
Section 61
//HandSprite_HandDown (wheresmypumpkin.HandSprite_HandDown) package wheresmypumpkin { import mx.core.*; public class HandSprite_HandDown extends BitmapAsset { } }//package wheresmypumpkin
Section 62
//HandSprite_HandUp (wheresmypumpkin.HandSprite_HandUp) package wheresmypumpkin { import mx.core.*; public class HandSprite_HandUp extends BitmapAsset { } }//package wheresmypumpkin
Section 63
//ItemSprite (wheresmypumpkin.ItemSprite) package wheresmypumpkin { import flash.display.*; import smileygamer.*; import flash.geom.*; import smileygamer.util.*; public class ItemSprite extends SGSprite { private var fType:int; private var fBoard:Rectangle; private var fMoving:Boolean; private var fSize:int; private static const SIZE:int = 100; private static const STATE_HIDEITEM:String = "hideitem"; private static const STATE_COVER:String = "default"; private static const STATE_ITEM:String = "item"; private static const STATE_SHOWITEM:String = "showitem"; private static var sHat:Bitmap = new Hat(); private static var Pumpkins:Class = ItemSprite_Pumpkins; private static var sItems:Array = BitmapUtil.splitImage(new Pumpkins(), SIZE, SIZE); private static var Hat:Class = ItemSprite_Hat; public function ItemSprite(aType:int, aSize:int, aBoard:Rectangle){ var coverAnimation:ImageAnimation; var itemAnimation:ImageAnimation; var showItemAnimation:ImageTransitionAnimation; var hideItemAnimation:ImageTransitionAnimation; super(); fType = aType; fSize = aSize; fBoard = aBoard; var item:Bitmap = (sItems[fType] as Bitmap); coverAnimation = new ImageAnimation(sHat, true); itemAnimation = new ImageAnimation(item, true); showItemAnimation = new ImageTransitionAnimation(sHat, item, 16); hideItemAnimation = new ImageTransitionAnimation(item, sHat, 16); addAnimation(STATE_COVER, coverAnimation); addAnimation(STATE_ITEM, itemAnimation); addAnimation(STATE_SHOWITEM, showItemAnimation); addAnimation(STATE_HIDEITEM, hideItemAnimation); state = STATE_COVER; cacheAsBitmap = true; } public function containsPt(aX:Number, aY:Number):Boolean{ return ((((((((aX > x)) && ((aY > y)))) && ((aX < (x + fSize))))) && ((aY < (y + fSize))))); } public function isVisible():Boolean{ return ((((state == STATE_ITEM)) || ((state == STATE_SHOWITEM)))); } public function get moving():Boolean{ return (fMoving); } public function get type():int{ return (fType); } public function set moving(aMoving:Boolean):void{ fMoving = aMoving; } public function turn():void{ if ((((STATE_COVER == state)) || ((STATE_HIDEITEM == state)))){ state = STATE_SHOWITEM; } else { if ((((STATE_ITEM == state)) || ((STATE_SHOWITEM == state)))){ state = STATE_HIDEITEM; }; }; } override protected function nextState():String{ if (STATE_HIDEITEM == state){ return (STATE_COVER); }; if (STATE_SHOWITEM == state){ return (STATE_ITEM); }; return (STATE_COVER); } public function locationChanged():void{ } } }//package wheresmypumpkin
Section 64
//ItemSprite_Hat (wheresmypumpkin.ItemSprite_Hat) package wheresmypumpkin { import mx.core.*; public class ItemSprite_Hat extends BitmapAsset { } }//package wheresmypumpkin
Section 65
//ItemSprite_Pumpkins (wheresmypumpkin.ItemSprite_Pumpkins) package wheresmypumpkin { import mx.core.*; public class ItemSprite_Pumpkins extends BitmapAsset { } }//package wheresmypumpkin
Section 66
//LevelAnimation (wheresmypumpkin.LevelAnimation) package wheresmypumpkin { import flash.events.*; import flash.display.*; import smileygamer.*; import flash.geom.*; import smileygamer.util.*; import flash.utils.*; import flash.text.*; public class LevelAnimation extends AAnimation { public function LevelAnimation(aParent:DisplayObjectContainer, aLevel:int){ var levelField:TextField; var fade:Function; var aParent = aParent; var aLevel = aLevel; fade = function (e:Event):void{ new FadeAnimation(displayObject, frame, FadeAnimation.MODE_FADE_OUT_REMOVE); }; levelField = TextFactory.createTextField(TextFactory.SIZE_LARGEST, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true); levelField.text = ("LEVEL " + aLevel); super(levelField); looping = false; new MoveAnimation(displayObject, new Point((320 - (displayObject.width / 2)), -(displayObject.height)), new Point((320 - (displayObject.width / 2)), 160), 20, InterpolationUtil.TYPE_COSINE); var fader:Timer = new Timer(1000, 1); fader.addEventListener(TimerEvent.TIMER_COMPLETE, fade); fader.start(); aParent.addChild(levelField); } override protected function get frameCount():int{ return (60); } } }//package wheresmypumpkin
Section 67
//LevelCompleteAnimation (wheresmypumpkin.LevelCompleteAnimation) package wheresmypumpkin { import flash.display.*; import smileygamer.*; import flash.geom.*; import smileygamer.util.*; import flash.text.*; public class LevelCompleteAnimation extends AAnimation { public function LevelCompleteAnimation(aParent:DisplayObjectContainer, aLevel:int){ var tf:TextField = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true); tf.autoSize = TextFieldAutoSize.CENTER; tf.text = ("LEVEL " + aLevel); var tf2:TextField = TextFactory.createTextField(TextFactory.SIZE_LARGER, TextFactory.COLOR_DEFAULT, TextFactory.DEFAULT_FONT, true); tf2.autoSize = TextFieldAutoSize.CENTER; tf2.text = "COMPLETE!"; var sprite:Sprite = new Sprite(); sprite.addChild(tf); sprite.addChild(tf2); super(sprite); looping = false; new FadeAnimation(sprite, 15, FadeAnimation.MODE_FADE_IN); new MoveAnimation(tf, new Point(-(tf.width), 60), new Point((320 - (tf.width / 2)), 60), 20, InterpolationUtil.TYPE_COSINE); new MoveAnimation(tf2, new Point(640, 170), new Point((320 - (tf2.width / 2)), 170), 20, InterpolationUtil.TYPE_COSINE); aParent.addChild(sprite); } public function endAnimation():void{ new FadeAnimation(displayObject, 5, FadeAnimation.MODE_FADE_OUT_REMOVE); } override protected function get frameCount():int{ return (30); } } }//package wheresmypumpkin
Section 68
//LifeBar (wheresmypumpkin.LifeBar) package wheresmypumpkin { import flash.events.*; import smileygamer.*; import flash.filters.*; public class LifeBar extends AProgressBar { public function LifeBar(){ super(1, 1, false); filters = [new GlowFilter(0xFFFFFF, 1, 2, 2, 2, BitmapFilterQuality.HIGH)]; addEventListener(Event.ENTER_FRAME, drawProgress); } private function drawProgress(e:Event):void{ if (valueChanged){ graphics.clear(); graphics.beginFill(0xFFFFFF); graphics.drawRoundRect(0, (height - progress), width, progress, 4, 4); graphics.endFill(); }; } } }//package wheresmypumpkin
Section 69
//PauseButton (wheresmypumpkin.PauseButton) package wheresmypumpkin { import flash.events.*; import flash.display.*; import flash.filters.*; public class PauseButton extends SimpleButton { private static const COLOR_DEFAULT:int = 15695395; private static const COLOR_SELECTED:int = 16683837; public function PauseButton(){ var playSound:Function; playSound = function (e:Event):void{ SoundManager.playButton(); }; var normal:Shape = createPauseShape(COLOR_DEFAULT); var sel:Shape = createPauseShape(COLOR_SELECTED); var hit:Shape = new Shape(); hit.graphics.beginFill(0); hit.graphics.drawCircle(16, 16, 16); hit.graphics.endFill(); super(normal, sel, sel, hit); var bevel:BevelFilter = new BevelFilter(2, 45, 0xFFFFFF, 1, 0, 0.8, 2, 2, 0.7, BitmapFilterQuality.HIGH); var shadow:DropShadowFilter = new DropShadowFilter(2); shadow.alpha = 0.8; shadow.quality = BitmapFilterQuality.HIGH; filters = [shadow]; addEventListener(MouseEvent.MOUSE_OVER, playSound); } private function createPauseShape(aColor:int):Shape{ var s:Shape = new Shape(); s.graphics.beginFill(aColor); s.graphics.drawCircle(16, 16, 16); s.graphics.drawCircle(16, 16, 12); s.graphics.drawRect(10, 9, 5, 14); s.graphics.drawRect(17, 9, 5, 14); s.graphics.endFill(); return (s); } } }//package wheresmypumpkin
Section 70
//SaveData (wheresmypumpkin.SaveData) package wheresmypumpkin { import flash.net.*; public class SaveData { private static var fScoresObject:SharedObject = null; private static var fHighscores:Array = [0, 0]; private static var fName:String; private static var fRank:Array = [0, 0]; private static var fSavedGame:Array = [null, null]; private static var fLevel:Array = [1, 1]; public function SaveData(){ super(); } private static function writeScores(aFlush:Boolean=false):void{ if (fScoresObject != null){ fScoresObject.data.scores = fHighscores; fScoresObject.data.ranks = fRank; fScoresObject.data.levels = fLevel; fScoresObject.data.savedgames = fSavedGame; fScoresObject.data.name = fName; if (aFlush){ fScoresObject.flush(500); }; }; } public static function getSavedGame(aDifficulty:int):Object{ var game:Object; if (fSavedGame[aDifficulty] != null){ game = fSavedGame[aDifficulty]; return (game); }; return (null); } public static function get name():String{ return (fName); } public static function saveGame(aDifficulty:int, aLevel:int, aScore:int, aTotalLife:int, aTotalTime:int):void{ var saveGame:Object = new Object(); saveGame.level = aLevel; saveGame.score = aScore; saveGame.totalLife = aTotalLife; saveGame.totalTime = aTotalTime; fSavedGame[aDifficulty] = saveGame; writeScores(); } public static function init():void{ fScoresObject = SharedObject.getLocal("wheresmypumpkin-data", "/"); if (fScoresObject.data.levels != null){ fHighscores = fScoresObject.data.scores; fRank = fScoresObject.data.ranks; fLevel = fScoresObject.data.levels; fSavedGame = fScoresObject.data.savedgames; fName = fScoresObject.data.name; } else { writeScores(true); }; //unresolved jump var _slot1 = e; } public static function endGame(aDifficulty:int, aLevel:int, aScore:int, aRank:int):void{ if (aScore >= fHighscores[aDifficulty]){ fLevel[aDifficulty] = aLevel; fHighscores[aDifficulty] = aScore; fRank[aDifficulty] = aRank; writeScores(); }; } public static function set name(aName:String):void{ fName = aName; writeScores(); } public static function getStats(aDifficulty:int):Array{ return (new Array(fLevel[aDifficulty], fHighscores[aDifficulty], fRank[aDifficulty])); } public static function clearSavedGame(aDifficulty:int):void{ fSavedGame[aDifficulty] = null; writeScores(); } } }//package wheresmypumpkin
Section 71
//SoundButton (wheresmypumpkin.SoundButton) package wheresmypumpkin { import flash.events.*; import flash.display.*; 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); } 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 wheresmypumpkin
Section 72
//SoundButton_SoundOffImage (wheresmypumpkin.SoundButton_SoundOffImage) package wheresmypumpkin { import mx.core.*; public class SoundButton_SoundOffImage extends BitmapAsset { } }//package wheresmypumpkin
Section 73
//SoundButton_SoundOnImage (wheresmypumpkin.SoundButton_SoundOnImage) package wheresmypumpkin { import mx.core.*; public class SoundButton_SoundOnImage extends BitmapAsset { } }//package wheresmypumpkin
Section 74
//SoundManager (wheresmypumpkin.SoundManager) package wheresmypumpkin { import flash.events.*; import flash.media.*; public class SoundManager { private static var Music:Class = SoundManager_Music; private static var GameOver:Class = SoundManager_GameOver; private static var Yes:Class = SoundManager_Yes; private static var fSound:Boolean = true; private static var Beep:Class = SoundManager_Beep; private static var fApplause:Sound = (new Applause() as Sound); private static var Applause:Class = SoundManager_Applause; private static var fNo:Sound = (new No() as Sound); private static var fLevelComplete:Sound = (new LevelComplete() as Sound); private static var fBonus:Sound = (new Bonus() as Sound); private static var fMusic:Sound = (new Music() as Sound); private static var No:Class = SoundManager_No; private static var fMusicChannel:SoundChannel; private static var fYes:Sound = (new Yes() as Sound); private static var fGameOver:Sound = (new GameOver() as Sound); private static var fButtonSound:Sound = (new Beep() as Sound); private static var LevelComplete:Class = SoundManager_LevelComplete; private static var Bonus:Class = SoundManager_Bonus; public function SoundManager(){ super(); } public static function playGameOver():void{ if (fSound){ fGameOver.play(); }; } public static function playMismatch():void{ if (fSound){ fNo.play(); }; } public static function playBonus():void{ if (fSound){ fBonus.play(); }; } public static function toggleSound():void{ sound = !(sound); } public static function get sound():Boolean{ return (fSound); } public static function playMusic():void{ var replay:Function; replay = function (e:Event):void{ if (fMusic != null){ fMusicChannel = fMusic.play(); fMusicChannel.addEventListener(Event.SOUND_COMPLETE, replay); }; }; if (((fSound) && ((fMusicChannel == null)))){ replay(null); }; } public static function set sound(aSound:Boolean):void{ fSound = aSound; if (!fSound){ if (fMusicChannel != null){ fMusicChannel.stop(); }; } else { fMusicChannel = null; playMusic(); }; } public static function playLevelComplete():void{ if (fSound){ fLevelComplete.play(); }; } public static function playGameWon():void{ if (fSound){ fApplause.play(); }; } public static function playMatch():void{ if (fSound){ fYes.play(); }; } public static function playButton():void{ if (fSound){ fButtonSound.play(); }; } } }//package wheresmypumpkin
Section 75
//SoundManager_Applause (wheresmypumpkin.SoundManager_Applause) package wheresmypumpkin { import mx.core.*; public class SoundManager_Applause extends SoundAsset { } }//package wheresmypumpkin
Section 76
//SoundManager_Beep (wheresmypumpkin.SoundManager_Beep) package wheresmypumpkin { import mx.core.*; public class SoundManager_Beep extends SoundAsset { } }//package wheresmypumpkin
Section 77
//SoundManager_Bonus (wheresmypumpkin.SoundManager_Bonus) package wheresmypumpkin { import mx.core.*; public class SoundManager_Bonus extends SoundAsset { } }//package wheresmypumpkin
Section 78
//SoundManager_GameOver (wheresmypumpkin.SoundManager_GameOver) package wheresmypumpkin { import mx.core.*; public class SoundManager_GameOver extends SoundAsset { } }//package wheresmypumpkin
Section 79
//SoundManager_LevelComplete (wheresmypumpkin.SoundManager_LevelComplete) package wheresmypumpkin { import mx.core.*; public class SoundManager_LevelComplete extends SoundAsset { } }//package wheresmypumpkin
Section 80
//SoundManager_Music (wheresmypumpkin.SoundManager_Music) package wheresmypumpkin { import mx.core.*; public class SoundManager_Music extends SoundAsset { } }//package wheresmypumpkin
Section 81
//SoundManager_No (wheresmypumpkin.SoundManager_No) package wheresmypumpkin { import mx.core.*; public class SoundManager_No extends SoundAsset { } }//package wheresmypumpkin
Section 82
//SoundManager_Yes (wheresmypumpkin.SoundManager_Yes) package wheresmypumpkin { import mx.core.*; public class SoundManager_Yes extends SoundAsset { } }//package wheresmypumpkin
Section 83
//TextBalloon (wheresmypumpkin.TextBalloon) package wheresmypumpkin { import flash.display.*; public class TextBalloon extends Shape { public function TextBalloon(aWidth:int, aHeight:int){ super(); graphics.beginFill(0xFFFFFF, 0.75); graphics.lineStyle(2, 0x303030, 1); graphics.drawRoundRect(0, 0, aWidth, aHeight, (aWidth / 4), (aWidth / 6)); graphics.endFill(); cacheAsBitmap = true; } } }//package wheresmypumpkin
Section 84
//TextFactory (wheresmypumpkin.TextFactory) package wheresmypumpkin { import flash.display.*; import flash.text.*; import flash.filters.*; public class TextFactory { public static const SIZE_LARGER:int = 80; public static const COLOR_SELECTED:int = 15695395; public static const SIZE_LARGE:int = 56; public static const COLOR_DEFAULT:int = 15695395; public static const SIZE_SMALL:int = 16; public static const SIZE_NORMAL:int = 20; public static const DEFAULT_FONT:String = "default"; public static const SIZE_MEDIUM:int = 36; public static const SIZE_LARGEST:int = 96; private static var DefaultFont:Class = TextFactory_DefaultFont; public function TextFactory(){ super(); } public static function createCopyrightTextField(aText:String, aColor:int=0xFFFFFF):TextField{ var tf:TextField = 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.6, 4, 4); var shadow:DropShadowFilter = new DropShadowFilter(1); tf.filters = [glow, shadow]; tf.text = aText; return (tf); } public static function createTextButton(aText:String, aSize:int=20, aColor:int=15695395, aSelectedColor:int=15695395, aFont:String="default"):SimpleButton{ var normal:TextField = createTextField(aSize, aColor, aFont); normal.text = aText; var selected:TextField = createTextField(aSize, aSelectedColor, aFont, true); selected.text = aText; var button:SimpleButton = new SimpleButton(normal, selected, selected, selected); return (button); } private static function createFilters(aSize:int, aGlow:Boolean):Array{ var filters:Array = new Array(); switch (aSize){ case SIZE_SMALL: case SIZE_NORMAL: filters.push(new GlowFilter(0xFFFFFF, 1, 1, 1, 4, BitmapFilterQuality.LOW)); break; case SIZE_MEDIUM: case SIZE_LARGE: case SIZE_LARGER: case SIZE_LARGEST: filters.push(new DropShadowFilter(4, 90, 16683837, 1, 8, 8, 1, 1, true)); filters.push(new DropShadowFilter(4, -90, 0xDB6200, 1, 8, 8, 1, 1, true)); filters.push(new GradientGlowFilter(4, 60, [0xFFFFFF, 0], [0.75, 0], [0, 0xFF], 4, 4, 2, BitmapFilterQuality.HIGH, BitmapFilterType.INNER)); filters.push(new GlowFilter((aGlow) ? 0xFFFFFF : 0, 1, 8, 8, 2, BitmapFilterQuality.HIGH)); break; }; return (filters); } public static function createHelpTextField():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 createTextField(aSize:int=20, aColor:int=15695395, aFont:String="default", aGlow:Boolean=false):TextField{ var format:TextFormat; var tf:TextField = new TextField(); format = new TextFormat(aFont, aSize, aColor); format.letterSpacing = 4; tf.autoSize = TextFieldAutoSize.LEFT; tf.mouseEnabled = false; tf.embedFonts = true; tf.defaultTextFormat = format; tf.antiAliasType = AntiAliasType.ADVANCED; tf.multiline = false; tf.filters = createFilters(aSize, aGlow); return (tf); } public static function createEditableTextField(aSize:int=20, aColor:int=15695395, aFont:String="default"):TextField{ var tf:TextField = createTextField(aSize, aColor, aFont); tf.autoSize = TextFieldAutoSize.NONE; tf.defaultTextFormat.align = TextFormatAlign.CENTER; tf.mouseEnabled = true; tf.type = TextFieldType.INPUT; return (tf); } } }//package wheresmypumpkin
Section 85
//TextFactory_DefaultFont (wheresmypumpkin.TextFactory_DefaultFont) package wheresmypumpkin { import mx.core.*; public class TextFactory_DefaultFont extends FontAsset { } }//package wheresmypumpkin
Section 86
//ThumbsUpLayer (wheresmypumpkin.ThumbsUpLayer) package wheresmypumpkin { import flash.display.*; public class ThumbsUpLayer extends Sprite { private var fCount:int; private var fMax:int; private static var SmallPumpkin:Class = ThumbsUpLayer_SmallPumpkin; public function ThumbsUpLayer(aMax:int){ var pumpkin:DisplayObject; super(); fMax = aMax; fCount = 0; var i:int; while (i < 5) { pumpkin = new SmallPumpkin(); pumpkin.x = (i * 70); pumpkin.alpha = 0.5; addChild(pumpkin); i++; }; } public function set count(aCount:int):void{ fCount = aCount; if (fCount >= int((fMax / 20))){ getChildAt(0).alpha = 1; }; if (fCount >= (fMax / 8)){ getChildAt(1).alpha = 1; }; if (fCount >= (fMax / 4)){ getChildAt(2).alpha = 1; }; if (fCount >= (fMax / 2)){ getChildAt(3).alpha = 1; }; if (fCount >= ((2 * fMax) / 3)){ getChildAt(4).alpha = 1; }; } public function get rank():int{ var rank:int; if (fCount >= int((fMax / 20))){ rank++; }; if (fCount >= (fMax / 8)){ rank++; }; if (fCount >= (fMax / 4)){ rank++; }; if (fCount >= (fMax / 2)){ rank++; }; if (fCount >= ((2 * fMax) / 3)){ rank++; }; return (rank); } public function get count():int{ return (fCount); } } }//package wheresmypumpkin
Section 87
//ThumbsUpLayer_SmallPumpkin (wheresmypumpkin.ThumbsUpLayer_SmallPumpkin) package wheresmypumpkin { import mx.core.*; public class ThumbsUpLayer_SmallPumpkin extends BitmapAsset { } }//package wheresmypumpkin
Section 88
//TitleScreen (wheresmypumpkin.TitleScreen) package wheresmypumpkin { import flash.events.*; import flash.display.*; import smileygamer.*; import flash.geom.*; import smileygamer.util.*; import flash.text.*; public class TitleScreen extends Sprite implements ILogic { private var fHardButton:SimpleButton; private var fNewGameButton:SimpleButton; private var fGame:WheresMyPumpkin; private var fState:int;// = 0 private var fTitle:Sprite; private var fSavedGame:Boolean; private var fEasyButton:SimpleButton; private var fPlayButton:SimpleButton; private var fChosenDiff:int; private var fHighscoresButton:SimpleButton; private var fCreditsButton:SimpleButton; private var fBestResultLayer:Sprite; private var fCreditsLayer:Sprite; private var fAddToSiteButton:SimpleButton; private var fMoreGamesButton:SimpleButton; private var fContinueButton:SimpleButton; private static const STATE_INVALID:int = 0; private static const STATE_SHOWING:int = 1; private static var Title:Class = TitleScreen_Title; private static var BigPumpkin:Class = TitleScreen_BigPumpkin; public function TitleScreen(aGame:WheresMyPumpkin){ 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{ aNextFunction.call(this); } private function moreGames(e:Event):void{ fGame.showSponsorSite(); } private function init():void{ var continueGame:Function; var newGame:Function; var addgame:TextField; var addgameSel:TextField; var agButton:SimpleButton; continueGame = function (e:Event):void{ fSavedGame = true; startGame(); }; newGame = function (e:Event):void{ fSavedGame = false; startGame(); }; fTitle = new Sprite(); fTitle.addChild(new Title()); addChild(fTitle); var soundBtn:SoundButton = new SoundButton(); soundBtn.x = (625 - soundBtn.width); soundBtn.y = 15; addChild(soundBtn); var smileyButton:SmileyButton = new SmileyButton(0xFFAA00, true, 0xFFFFFF); smileyButton.x = 20; smileyButton.y = (470 - smileyButton.height); addChild(smileyButton); fPlayButton = TextFactory.createTextButton("play", TextFactory.SIZE_LARGER); fPlayButton.x = ((640 - fPlayButton.width) / 2); fPlayButton.y = 120; addChild(fPlayButton); fPlayButton.addEventListener(MouseEvent.CLICK, play); new MoveAnimation(fPlayButton, new Point((-10 - fPlayButton.width), fPlayButton.y), new Point(fPlayButton.x, fPlayButton.y), 15, InterpolationUtil.TYPE_COSINE); fCreditsButton = TextFactory.createTextButton("credits", TextFactory.SIZE_LARGE); fCreditsButton.x = ((640 - fCreditsButton.width) / 2); fCreditsButton.y = 310; addChild(fCreditsButton); fCreditsButton.addEventListener(MouseEvent.CLICK, credits); new MoveAnimation(fCreditsButton, new Point((-10 - fCreditsButton.width), fCreditsButton.y), new Point(fCreditsButton.x, fCreditsButton.y), 15, InterpolationUtil.TYPE_COSINE); if (!WheresMyPumpkin.BFG){ if (WheresMyPumpkin.SPONSORED){ } else { fMoreGamesButton = TextFactory.createTextButton("more games", TextFactory.SIZE_LARGE); fMoreGamesButton.addEventListener(MouseEvent.CLICK, moreGames); fMoreGamesButton.x = ((640 - fMoreGamesButton.width) / 2); fMoreGamesButton.y = 230; addChild(fMoreGamesButton); new MoveAnimation(fMoreGamesButton, new Point((-10 - fMoreGamesButton.width), fMoreGamesButton.y), new Point(fMoreGamesButton.x, fMoreGamesButton.y), 15, InterpolationUtil.TYPE_COSINE); addgame = TextFactory.createCopyrightTextField("Add this game to your site"); addgameSel = TextFactory.createCopyrightTextField("Add this game to your site", 0xFFAA00); agButton = new SimpleButton(addgame, addgameSel, addgameSel, addgameSel); agButton.addEventListener(MouseEvent.CLICK, showGamesForSite); agButton.x = 100; agButton.y = 425; addChild(agButton); }; } else { fPlayButton.y = 135; fCreditsButton.y = 225; }; var cologo:Sprite = CobrandingUtil.getSmallLogo(); if (cologo != null){ fCreditsButton.y = 220; fMoreGamesButton.y = 260; cologo.y = 295; cologo.x = (415 - (cologo.width / 2)); addChild(cologo); }; fEasyButton = TextFactory.createTextButton("easy", TextFactory.SIZE_LARGER); fEasyButton.x = (300 - fEasyButton.width); fEasyButton.y = 120; addChild(fEasyButton); fEasyButton.addEventListener(MouseEvent.CLICK, chooseDiff); fEasyButton.visible = false; fHardButton = TextFactory.createTextButton("hard", TextFactory.SIZE_LARGER); fHardButton.x = 340; fHardButton.y = 120; addChild(fHardButton); fHardButton.addEventListener(MouseEvent.CLICK, chooseDiff); fHardButton.visible = false; fContinueButton = TextFactory.createTextButton("continue", TextFactory.SIZE_LARGE); fContinueButton.x = 340; fContinueButton.y = 130; addChild(fContinueButton); fContinueButton.visible = false; fContinueButton.addEventListener(MouseEvent.CLICK, continueGame); fNewGameButton = TextFactory.createTextButton("new game", TextFactory.SIZE_LARGE); fNewGameButton.x = (300 - fNewGameButton.width); fNewGameButton.y = 130; addChild(fNewGameButton); fNewGameButton.visible = false; fNewGameButton.addEventListener(MouseEvent.CLICK, newGame); var _local2 = TextFactory.createCopyrightTextField("Copyright 2010 SmileyGamer"); var copyright:TextField = _local2; copyright = _local2; copyright.x = 100; copyright.y = 450; addChild(copyright); var pumpkin:DisplayObject = new BigPumpkin(); pumpkin.x = (630 - pumpkin.width); pumpkin.y = (470 - pumpkin.height); addChild(pumpkin); fState = STATE_SHOWING; } public function removed(aEvent:Event):void{ } private function startGame():void{ var showGame:Function; showGame = function ():void{ fGame.showGameScreen(fChosenDiff, fSavedGame); }; hideTitleScreen(showGame); } private function hideCredits(e:Event):void{ var anim:MoveAnimation = new MoveAnimation(fCreditsLayer, new Point(fCreditsLayer.x, fCreditsLayer.y), new Point(650, fCreditsLayer.y), 15, InterpolationUtil.TYPE_COSINE, 0, true); } private function showHighscores(e:Event):void{ fGame.showHighscoresPage(); } private function chooseDiff(e:Event):void{ fEasyButton.visible = false; fHardButton.visible = false; if (e.target == fEasyButton){ fChosenDiff = WheresMyPumpkin.DIFF_EASY; }; if (e.target == fHardButton){ fChosenDiff = WheresMyPumpkin.DIFF_HARD; }; var params:Object = SaveData.getSavedGame(fChosenDiff); if (params != null){ fNewGameButton.visible = true; fContinueButton.visible = true; } else { fSavedGame = false; startGame(); }; } public function doLogic():void{ } private function showGamesForSite(e:Event):void{ SmileyGamerAPI.showFreeContent(); } private function credits(e:Event):void{ fCreditsLayer = new Sprite(); fCreditsLayer.y = 130; var balloon:TextBalloon = new TextBalloon(250, 220); fCreditsLayer.addChild(balloon); var tf:TextField = TextFactory.createHelpTextField(); tf.text = ("Where's My Pumpkin?\n version 1.0 by SmileyGamer\n\nDesign and coding by\n Jochen De Schepper" + "\n\nArtwork by\n Icons-Land.com\n\nMusic by\n Kimken"); tf.x = (balloon.x + 20); tf.y = (balloon.y + 15); fCreditsLayer.addChild(tf); new MoveAnimation(fCreditsLayer, new Point(650, fCreditsLayer.y), new Point((320 - (fCreditsLayer.width / 2)), fCreditsLayer.y), 15, InterpolationUtil.TYPE_COSINE, 20); addChild(fCreditsLayer); fCreditsLayer.addEventListener(MouseEvent.CLICK, hideCredits); } private function showHome(e:Event):void{ fGame.showSGSite(); } private function play(e:Event):void{ fPlayButton.visible = false; fEasyButton.visible = true; fHardButton.visible = true; } } }//package wheresmypumpkin
Section 89
//TitleScreen_BigPumpkin (wheresmypumpkin.TitleScreen_BigPumpkin) package wheresmypumpkin { import mx.core.*; public class TitleScreen_BigPumpkin extends BitmapAsset { } }//package wheresmypumpkin
Section 90
//TitleScreen_Title (wheresmypumpkin.TitleScreen_Title) package wheresmypumpkin { import mx.core.*; public class TitleScreen_Title extends BitmapAsset { } }//package wheresmypumpkin
Section 91
//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 92
//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 93
//PreloaderFactory (PreloaderFactory) package { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.utils.*; import mochi.as3.*; import wheresmypumpkin.*; import SWFStats.*; import smileygamer.*; import smileygamer.util.*; import flash.filters.*; public dynamic class PreloaderFactory extends MovieClip { private var fStartTime:int; private var fIntro:Sprite; private var fProgress:Shape; private var fLoadTime:int; private var fPlayButton:SimpleButton; private var SGLogo:Class; private static const MAIN_CLASS:String = "WheresMyPumpkin"; public static const WIDTH:int = 640; public static const HEIGHT:int = 480; private static const SG_COLOR:int = 0xFFFFFF; public static const GAMEID:int = 7139; public function PreloaderFactory(){ var playgame:Function; SGLogo = PreloaderFactory_SGLogo; playgame = function (e:Event):void{ fPlayButton.removeEventListener(MouseEvent.CLICK, playgame); init(); }; super(); var _mochiads_game_id = "d59d3c17c46987d2"; stage.frameRate = 32; stage.scaleMode = StageScaleMode.NO_SCALE; stop(); SmileyGamerAPI.init(stage, GAMEID, "Where's My Pumpkin"); addChild(new Background()); fLoadTime = (((SmileyGamerAPI.isHome()) || (SmileyGamerAPI.isLocal()))) ? 5000 : 7000; fStartTime = getTimer(); addEventListener(Event.ENTER_FRAME, onEnterFrame); addEventListener(Event.ENTER_FRAME, displayed); showIntro(); fProgress = new Shape(); fProgress.filters = [new GlowFilter(SG_COLOR, 0.75, 2, 2, 2, BitmapFilterQuality.HIGH)]; addChild(fProgress); fPlayButton = TextFactory.createTextButton("play", TextFactory.SIZE_LARGE); fPlayButton.x = ((WIDTH - fPlayButton.width) / 2); fPlayButton.y = 400; fPlayButton.addEventListener(MouseEvent.CLICK, playgame); } private function displayed(e:Event):void{ removeEventListener(Event.ENTER_FRAME, displayed); MochiBot.track(this, "4de92de2"); Log.View(1136, "29769ad30a06", root.loaderInfo.loaderURL); MochiServices.connect("d59d3c17c46987d2", root); } private function showIntro():void{ fIntro = new Sprite(); fIntro.addChild(new SGLogo()); fIntro.x = ((WIDTH - 400) / 2); fIntro.y = ((HEIGHT - 320) / 2); addChild(fIntro); if (!SmileyGamerAPI.isHome()){ var clicked:Function = function (e:Event):void{ SmileyGamerAPI.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(e:Event=null):void{ var mainClass:Class; var app:Object; var e = e; nextFrame(); mainClass = (getDefinitionByName(MAIN_CLASS) as Class); app = new (mainClass); addChild((app as DisplayObject)); new MoveAnimation(fIntro, new Point(fIntro.x, fIntro.y), new Point((WIDTH + 10), fIntro.y), 15, InterpolationUtil.TYPE_COSINE, 0, true); removeChild(fPlayButton); //unresolved jump var _slot1 = re; addEventListener(Event.ENTER_FRAME, onEnterFrame); } 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 - 35), (WIDTH - 20), 10); fProgress.graphics.beginFill(SG_COLOR); fProgress.graphics.drawRect(11, (HEIGHT - 34), (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 - 35), (WIDTH - 20), 10); fProgress.graphics.beginFill(SG_COLOR); fProgress.graphics.drawRect(11, (HEIGHT - 34), ((WIDTH - 22) * percent), 8); fProgress.graphics.endFill(); }; }; } } }//package
Section 94
//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 = (5600 / 20); } override public function get movieClipData():ByteArray{ if (bytes == null){ bytes = ByteArray(new dataClass()); }; return (bytes); } } }//package
Section 95
//PreloaderFactory_SGLogo_dataClass (PreloaderFactory_SGLogo_dataClass) package { import mx.core.*; public class PreloaderFactory_SGLogo_dataClass extends ByteArrayAsset { } }//package
Section 96
//SmileyGamer (SmileyGamer) package { import flash.events.*; import flash.display.*; import flash.net.*; import flash.external.*; 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
Section 97
//SmileyGamerAPI (SmileyGamerAPI) package { import flash.events.*; import flash.display.*; import flash.net.*; import flash.external.*; import flash.system.*; public class SmileyGamerAPI { public static const MIXED:int = 2; public static const HOME:String = "http://www.smileygamer.com"; private static const ONLY_SG_AD_DOMAINS:Array = ["kaisergames.de", "y8.com", "kongregate.com", "freeonlinegames.com", "gamesclub.com", "media.jaludo.com"]; private static const NO_INTERLEVEL_AD_DOMAINS:Array = ["fizzlebot.com", "casualgameplay.com"]; private static const NO_AD_DOMAINS:Array = ["www8.agame.com", "addictinggames.com", "armorgames.com", "www.flashgamelicense.com"]; public static const NONE:int = 0; public static const SG_ONLY:int = 1; private static var sGame:String; private static var sStage:Stage; private static var sID:int; private static var sReferer:String; public function SmileyGamerAPI(){ 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 isHome():Boolean{ return (isDomain("smileygamer.com")); } public static function allowedClickAwayAdType():int{ if (isInDomains(NO_AD_DOMAINS)){ return (NONE); }; if (((isInDomains(ONLY_SG_AD_DOMAINS)) || (isInDomains(NO_INTERLEVEL_AD_DOMAINS)))){ return (SG_ONLY); }; return (MIXED); } public static function showSGMoreGamesTab(aClip:DisplayObjectContainer, aColor:uint=0):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 canShowPreloaderAd():Boolean{ return (!(((((isHome()) || (isInDomains(NO_AD_DOMAINS)))) || (isInDomains(ONLY_SG_AD_DOMAINS))))); } public static function init(aStage:Stage, aID:int, aGame:String):void{ sStage = aStage; sID = aID; sGame = aGame; sReferer = getReferer(); } public static function showPlayGamePage(aGameName:String=null, aID:int=0):void{ if (aGameName == null){ showURL((((((HOME + "/play/") + sID) + "/") + getGameSlug()) + ".html"), true); } else { showURL((((((HOME + "/play/") + aID) + "/") + getGameSlug(aGameName)) + ".html"), true); }; } 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 showSGMoreGamesAd(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 isLocal():Boolean{ return ((sReferer == "local")); } 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(aGameName:String=null):String{ var name:String = ((aGameName)!=null) ? aGameName : sGame; name = name.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(aEvent:Event=null):void{ showURL(HOME, true); } public static function showFreeContent(aEvent:Event=null):void{ showURL((HOME + "/freecontent.html"), true); } } }//package
Section 98
//WheresMyPumpkin (WheresMyPumpkin) package { import flash.events.*; import wheresmypumpkin.gameplay.*; import smileygamer.*; import wheresmypumpkin.*; import flash.utils.*; import flash.text.*; import mochi.as3.*; import flash.ui.*; import SWFStats.*; public dynamic class WheresMyPumpkin extends AGame { private var fMLTimer:Timer; private var fFrame:int;// = 0 private var fFPSTime:int; private var fHand:HandSprite; private var fFPSField:TextField; public static const DOWNLOADABLE:Boolean = false; public static const BFG:Boolean = false; public static const DIFF_HARD:int = 1; public static const GAMEID:int = 2116; public static const DIFF_EASY:int = 0; public static var NOSCORE:Boolean = false; public static var KAISERGAMES:Boolean = false; public static var LOWFPS:Boolean = false; public static var SPONSORED:Boolean = false; public static var MindJoltAPI:Object; public static var MINDJOLT:Boolean = false; public function WheresMyPumpkin(){ var added:Function; fHand = new HandSprite(); added = function (e:Event):void{ removeEventListener(Event.ADDED, added); NOSCORE = SmileyGamerAPI.isDomain("addictinggames.com"); fFPSTime = getTimer(); Mouse.show(); Mouse.hide(); stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseUpdate); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpdate); stage.addEventListener(MouseEvent.CLICK, mouseUpdate); addChild(fHand); fHand.x = mouseX; fHand.y = mouseY; showTitleScreen(); }; super(); SaveData.init(); addEventListener(Event.ADDED, added); } public function showGameScreen(aDifficulty:int, aSavedGame:Boolean):void{ var levelGame:ILevelGame; var screen:GameScreen; var params:Object; Log.Play(); if (aSavedGame){ params = SaveData.getSavedGame(aDifficulty); switch (aDifficulty){ case DIFF_EASY: levelGame = new EasyLevelGame(params.level); break; case DIFF_HARD: levelGame = new HardLevelGame(params.level); break; }; screen = new GameScreen(this, levelGame, params); } else { switch (aDifficulty){ case DIFF_EASY: levelGame = new EasyLevelGame(); break; case DIFF_HARD: levelGame = new HardLevelGame(); break; }; screen = new GameScreen(this, levelGame); }; removeChildAt(0); addChildAt(screen, 0); } public function showSponsorSite():void{ SmileyGamerAPI.showHome(); } public function mouseUpdate(aEvent:MouseEvent):void{ if (aEvent.type == MouseEvent.CLICK){ } else { fHand.button(aEvent.buttonDown); }; } public function showTitleScreen():void{ addChildAt(new TitleScreen(this), 0); SoundManager.playMusic(); } public function showSGSite():void{ SmileyGamerAPI.showHome(); } public function submitScore(aName:String, aScore:int, aMode:int=0, aListener:Function=null):void{ var closeML:Function; var aName = aName; var aScore = aScore; var aMode = aMode; var aListener = aListener; closeML = function (e:Event):void{ MochiScores.closeLeaderboard(); aListener.call(this); }; if (NOSCORE){ if (aListener != null){ aListener.call(this); }; return; }; fMLTimer = new Timer(7000, 1); fMLTimer.addEventListener(TimerEvent.TIMER_COMPLETE, closeML); fMLTimer.start(); Mouse.show(); var boardCode:Array = [12, 3, 8, 11, 7, 12, 13, 11, 14, 3, 3, 11, 2, 13, 10, 6]; if (aMode == DIFF_HARD){ boardCode = [1, 4, 8, 6, 5, 11, 4, 11, 9, 13, 2, 11, 11, 8, 4, 10]; }; var o:Object = {n:boardCode, f:function (i:Number, s:String):String{ if (s.length == 16){ return (s); }; return (this.f((i + 1), (s + this.n[i].toString(16)))); }}; var boardID:String = o.f(0, ""); MochiScores.showLeaderboard({boardID:boardID, score:aScore, onDisplay:function (){ fMLTimer.stop(); }, onClose:aListener, showTableRank:true, scoreMessage:{highscore:"Beat my highscore of ${highscore} on ${board} in ${game}!", latestscore:"I just scored ${score} on ${board} in ${game}!", gameinvite:"Come play ${game}!"}}); } override public function mainLoop(aEvent:Event):void{ var fps:int; super.mainLoop(aEvent); fHand.move(stage.mouseX, stage.mouseY); fFrame++; if ((fFrame % 30) == 0){ fps = int(((fFrame * 1000) / (getTimer() - fFPSTime))); LOWFPS = (fps < 20); fFrame = 0; fFPSTime = getTimer(); }; } public function isHomeSite():Boolean{ return (((SPONSORED) || (SmileyGamerAPI.isHome()))); } } }//package

Library Items

Symbol 1 Bitmap {wheresmypumpkin.Background_BackgroundImage} [wheresmypumpkin.Background_BackgroundImage]
Symbol 2 BinaryData {PreloaderFactory_SGLogo_dataClass} [PreloaderFactory_SGLogo_dataClass]
Symbol 3 Font {wheresmypumpkin.TextFactory_DefaultFont} [wheresmypumpkin.TextFactory_DefaultFont]
Symbol 4 MovieClip {PreloaderFactory_SGLogo}
Symbol 5 Bitmap {wheresmypumpkin.TitleScreen_Title} [wheresmypumpkin.TitleScreen_Title]
Symbol 6 Sound {wheresmypumpkin.SoundManager_No} [wheresmypumpkin.SoundManager_No]
Symbol 7 Sound {wheresmypumpkin.SoundManager_Applause} [wheresmypumpkin.SoundManager_Applause]
Symbol 8 Sound {wheresmypumpkin.SoundManager_Beep} [wheresmypumpkin.SoundManager_Beep]
Symbol 9 Sound {wheresmypumpkin.SoundManager_Bonus} [wheresmypumpkin.SoundManager_Bonus]
Symbol 10 Sound {wheresmypumpkin.SoundManager_LevelComplete} [wheresmypumpkin.SoundManager_LevelComplete]
Symbol 11 Sound {wheresmypumpkin.SoundManager_Yes} [wheresmypumpkin.SoundManager_Yes]
Symbol 12 Sound {wheresmypumpkin.SoundManager_Music} [wheresmypumpkin.SoundManager_Music]
Symbol 13 Sound {wheresmypumpkin.SoundManager_GameOver} [wheresmypumpkin.SoundManager_GameOver]
Symbol 14 Bitmap {wheresmypumpkin.HandSprite_HandDown} [wheresmypumpkin.HandSprite_HandDown]
Symbol 15 Bitmap {wheresmypumpkin.HandSprite_HandUp} [wheresmypumpkin.HandSprite_HandUp]
Symbol 16 Bitmap {smileygamer.SmileyButton_SmileySmall} [smileygamer.SmileyButton_SmileySmall]
Symbol 17 Bitmap {wheresmypumpkin.SoundButton_SoundOnImage} [wheresmypumpkin.SoundButton_SoundOnImage]
Symbol 18 Bitmap {wheresmypumpkin.SoundButton_SoundOffImage} [wheresmypumpkin.SoundButton_SoundOffImage]
Symbol 19 Bitmap {wheresmypumpkin.ThumbsUpLayer_SmallPumpkin} [wheresmypumpkin.ThumbsUpLayer_SmallPumpkin]
Symbol 20 Bitmap {wheresmypumpkin.ItemSprite_Pumpkins} [wheresmypumpkin.ItemSprite_Pumpkins]
Symbol 21 Bitmap {wheresmypumpkin.ItemSprite_Hat} [wheresmypumpkin.ItemSprite_Hat]
Symbol 22 Bitmap {wheresmypumpkin.TitleScreen_BigPumpkin}

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1459 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 1Symbol 1 as "wheresmypumpkin.Background_BackgroundImage"
ExportAssets (56)Timeline Frame 1Symbol 2 as "PreloaderFactory_SGLogo_dataClass"
ExportAssets (56)Timeline Frame 1Symbol 3 as "wheresmypumpkin.TextFactory_DefaultFont"
ExportAssets (56)Timeline Frame 2Symbol 5 as "wheresmypumpkin.TitleScreen_Title"
ExportAssets (56)Timeline Frame 2Symbol 6 as "wheresmypumpkin.SoundManager_No"
ExportAssets (56)Timeline Frame 2Symbol 7 as "wheresmypumpkin.SoundManager_Applause"
ExportAssets (56)Timeline Frame 2Symbol 8 as "wheresmypumpkin.SoundManager_Beep"
ExportAssets (56)Timeline Frame 2Symbol 9 as "wheresmypumpkin.SoundManager_Bonus"
ExportAssets (56)Timeline Frame 2Symbol 10 as "wheresmypumpkin.SoundManager_LevelComplete"
ExportAssets (56)Timeline Frame 2Symbol 11 as "wheresmypumpkin.SoundManager_Yes"
ExportAssets (56)Timeline Frame 2Symbol 12 as "wheresmypumpkin.SoundManager_Music"
ExportAssets (56)Timeline Frame 2Symbol 13 as "wheresmypumpkin.SoundManager_GameOver"
ExportAssets (56)Timeline Frame 2Symbol 14 as "wheresmypumpkin.HandSprite_HandDown"
ExportAssets (56)Timeline Frame 2Symbol 15 as "wheresmypumpkin.HandSprite_HandUp"
ExportAssets (56)Timeline Frame 2Symbol 16 as "smileygamer.SmileyButton_SmileySmall"
ExportAssets (56)Timeline Frame 2Symbol 17 as "wheresmypumpkin.SoundButton_SoundOnImage"
ExportAssets (56)Timeline Frame 2Symbol 18 as "wheresmypumpkin.SoundButton_SoundOffImage"
ExportAssets (56)Timeline Frame 2Symbol 19 as "wheresmypumpkin.ThumbsUpLayer_SmallPumpkin"
ExportAssets (56)Timeline Frame 2Symbol 20 as "wheresmypumpkin.ItemSprite_Pumpkins"
ExportAssets (56)Timeline Frame 2Symbol 21 as "wheresmypumpkin.ItemSprite_Hat"
EnableDebugger2 (64)Timeline Frame 131 bytes "u.$1$o5$8iASBsQdPB5RvX1Q7eO4B.."
DebugMX1 (63)Timeline Frame 1
SerialNumber (41)Timeline Frame 1

Labels

"PreloaderFactory"Frame 1
"WheresMyPumpkin"Frame 2




http://swfchan.com/24/116368/info.shtml
Created: 8/3 -2019 23:31:18 Last modified: 8/3 -2019 23:31:18 Server time: 20/05 -2024 17:24:24