Section 1
//AnimatedBitmap (fai.common.AnimatedBitmap)
package fai.common {
import flash.display.*;
import flash.geom.*;
public class AnimatedBitmap extends Bitmap {
private var initial_height:int;// = 0
private var point:Point;// = null
private var rect:Rectangle;// = null
private var initial_width:int;// = 0
public var curbuffer:BitmapData;// = null
public var nframes:uint;// = 0
public var framen:uint;// = 0
public function AnimatedBitmap(_arg1:BitmapData, _arg2:int, _arg3:int):void{
nframes = 0;
curbuffer = null;
framen = 0;
point = null;
rect = null;
initial_width = 0;
initial_height = 0;
initial_width = _arg2;
initial_height = _arg3;
super(new BitmapData(_arg2, _arg3, true, 0), "auto", true);
point = new Point(0, 0);
setBuffer(_arg1);
}
public function setBuffer(_arg1:BitmapData):void{
if (((_arg1) && (!((curbuffer == _arg1))))){
curbuffer = _arg1;
nframes = (curbuffer.width / initial_width);
framen = 0;
draw();
};
}
public function setFrame(_arg1:uint):void{
if (_arg1 == framen){
return;
};
framen = _arg1;
draw();
}
private function draw():void{
var _local1:BitmapData;
_local1 = bitmapData;
rect = new Rectangle((framen * initial_width), 0, initial_width, initial_height);
_local1.copyPixels(curbuffer, rect, point);
bitmapData = _local1;
smoothing = true;
}
}
}//package fai.common
Section 2
//Position (fai.common.Position)
package fai.common {
public final class Position {
public var x:int;// = 0
public var y:int;// = 0
public function Position(_arg1:int=0, _arg2:int=0):void{
x = 0;
y = 0;
super();
set(_arg1, _arg2);
}
public function copy(_arg1:Position):void{
x = _arg1.x;
y = _arg1.y;
}
public function set(_arg1:int, _arg2:int):void{
x = _arg1;
y = _arg2;
}
public function isequal(_arg1:Position):Boolean{
return ((((x == _arg1.x)) && ((y == _arg1.y))));
}
public function isSameXY(_arg1:int, _arg2:int):Boolean{
return ((((x == _arg1)) && ((y == _arg2))));
}
}
}//package fai.common
Section 3
//Utils (fai.common.Utils)
package fai.common {
import flash.text.*;
public class Utils {
public static function setTextColor(_arg1:TextField, _arg2:int):void{
var _local3:TextFormat;
_local3 = new TextFormat();
_local3.color = _arg2;
_arg1.defaultTextFormat = _local3;
}
}
}//package fai.common
Section 4
//BuildingGoal (fai.goals.BuildingGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.common.*;
import fai.goalsystem.*;
import fai.*;
public class BuildingGoal extends Goal {
private var engine:Engine;// = null
private var max:int;// = 0
private var ticks:int;// = 0
private var shop_item:ShopItem;// = null
public function BuildingGoal(_arg1:Engine, _arg2):void{
engine = null;
shop_item = null;
ticks = 0;
max = 0;
super();
engine = _arg1;
shop_item = _arg2;
shop_item.setLevel(Consts.ShopBuilding);
shop_item.gotoAndStop("building_progress");
shop_item.building_bar.visible = true;
max = (ticks = DataProxy.getShopBuildingTicks(_arg2.shopType));
engine.playWindow.ui.for_sale_signs.visible = false;
}
public function advance():void{
if (ticks <= 0){
buildShop();
deactivate();
return;
};
if (shop_item.building_bar){
shop_item.building_bar.bar.scaleX = (1 - (ticks / max));
shop_item.building_bar.percents.text = ((" " + int(((1 - (ticks / max)) * 100))) + "%");
};
ticks--;
}
private function buildShop():void{
var _local1:ShopBuilding;
engine.playSound(SoundConsts.build);
shop_item.gotoAndStop("shopping");
shop_item.building_bar.visible = false;
shop_item.setLevel(Consts.ShopLevel1);
_local1 = DataProxy.createShopBuilding(shop_item);
_local1.y = 0;
_local1.x = 5;
shop_item.setShopIcon(_local1);
_local1.play();
engine.playWindow.stats.built++;
if ((((((engine.lastLevel.number == 0)) && ((engine.scenario.currentDay == 0)))) && ((shop_item.shopType == StringConsts.boutique)))){
engine.playWindow.ui.click_next_day_button.visible = true;
};
}
}
}//package fai.goals
Section 5
//BusPeopleGoal (fai.goals.BusPeopleGoal)
package fai.goals {
import fai.logic.*;
import fai.*;
public class BusPeopleGoal extends Goal {
private var engine:Engine;// = null
private var buyer_queue:Array;
private var generate_pause:int;// = 0
private static const GENERATE_PAUSE:int = 20;
public function BusPeopleGoal(_arg1:Engine):void{
engine = null;
buyer_queue = [];
generate_pause = 0;
super();
engine = _arg1;
generateCustomers();
}
private function generateCustomers():void{
var _local1:int;
var _local2:Customer;
var _local3:int;
_local1 = Consts.BusPeopleCount;
_local2 = null;
_local3 = 0;
_local3 = 0;
while (_local3 < _local1) {
_local2 = DataProxy.getCustomer(engine.scenario.currentDay);
buyer_queue.push(_local2);
_local3++;
};
}
public function advance():void{
var _local1:Customer;
var _local2:BuyerGoal;
if (generate_pause > 0){
generate_pause--;
return;
};
generate_pause = GENERATE_PAUSE;
if (buyer_queue.length > 0){
_local1 = buyer_queue.shift();
_local2 = new BuyerGoal(engine, _local1, true);
engine.goal_system.add(_local2);
};
}
override public function deactivate():void{
super.deactivate();
if (buyer_queue){
buyer_queue.length = 0;
buyer_queue = null;
};
}
}
}//package fai.goals
Section 6
//BuyerGoal (fai.goals.BuyerGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.common.*;
import fai.goalsystem.*;
import fai.*;
public class BuyerGoal extends Goal {
private var engine:Engine;// = null
private var extra_goal:ExtraGoal;// = null
private var buyer:Customer;// = null
private var extra_using:Boolean;// = false
private var buying_goal:BuyingGoal;// = null
private var buying:Boolean;// = false
public function BuyerGoal(_arg1:Engine, _arg2:Customer, _arg3:Boolean=false):void{
engine = null;
buyer = null;
buying = false;
buying_goal = null;
extra_using = false;
extra_goal = null;
super();
engine = _arg1;
buyer = _arg2;
if (_arg3){
buyer.suit.x = 40;
buyer.suit.y = ((Consts.CustomerWalkLine + Consts.CustomerWalkRange) + (Math.random() * Consts.CustomerWalkRange));
} else {
buyer.suit.x = -25;
buyer.suit.y = (Consts.CustomerWalkLine + (Math.random() * Consts.CustomerWalkRange));
};
engine.playWindow.ui.customers.addChild(buyer.suit);
buyer.character.play();
engine.customers.add(buyer);
}
public function advance():void{
if (buying){
if (((buying_goal) && (buying_goal.active))){
return;
};
buying = false;
if (buyer.money <= 0){
buyer.velocity = (buyer.velocity * 1.4);
};
advance();
} else {
if (extra_using){
if (((extra_goal) && (extra_goal.active))){
return;
};
extra_using = false;
advance();
} else {
buyer.suit.x = (buyer.suit.x + buyer.velocity);
checkShops();
if (buyer.suit.x > (Consts.ScreenWidth + buyer.suit.width)){
engine.customerPassed(buyer);
deactivate();
};
};
};
}
override public function deactivate():void{
super.deactivate();
if (((buyer) && (engine.playWindow))){
engine.customers.remove(buyer);
engine.playWindow.ui.customers.removeChild(buyer.suit);
if (buyer.money > 0){
engine.not_spent = true;
};
if ((((engine.customers.size() == 0)) && ((engine.not_spent == false)))){
engine.playWindow.showBonus(1000);
};
engine.playWindow.updateResources();
buyer = null;
};
}
private function checkShops():void{
var _local1:int;
var _local2:ShopItem;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:ExtraItem;
_local1 = (buyer.suit.x / (Consts.ScreenWidth / 8));
if ((((_local1 >= 0)) && ((_local1 < engine.shops.size())))){
_local2 = engine.shops.getItem(_local1);
if (((((((_local2) && ((((((_local2.currentLevel == Consts.ShopLevel1)) || ((_local2.currentLevel == Consts.ShopLevel2)))) || ((_local2.currentLevel == Consts.ShopLevel3)))))) && (!(buyer.hasBuyings(_local2.shopType))))) && ((buyer.money > 0)))){
if (_local2.shopBar.hasRoom()){
buying = true;
buying_goal = new BuyingGoal(engine, buyer, _local2);
engine.goal_system.add(buying_goal);
};
};
};
if (!buying){
_local3 = (engine.extras.getItem((engine.extras.size() - 1)).x + engine.extras.getItem((engine.extras.size() - 1)).width);
_local4 = (engine.extras.getItem(1).x - engine.extras.getItem(0).x);
_local5 = 0;
if ((((buyer.suit.x > (engine.extras.getItem(0).x - 15))) && ((buyer.suit.x < _local3)))){
_local5 = ((buyer.suit.x - engine.extras.getItem(0).x) / _local4);
} else {
return;
};
if ((((_local5 >= 0)) && ((_local5 < engine.extras.size())))){
_local6 = engine.extras.getItem(_local5);
if (((((((((_local6) && (!(_local6.isAwaiting)))) && (!((_local6.currentState == StringConsts.empty))))) && (!(buyer.extraUsed(_local6))))) && ((buyer.money > 0)))){
if (_local6.hasRoom()){
extra_using = true;
extra_goal = new ExtraGoal(engine, buyer, _local6);
engine.goal_system.add(extra_goal);
};
};
};
};
}
}
}//package fai.goals
Section 7
//BuyingGoal (fai.goals.BuyingGoal)
package fai.goals {
import fai.logic.*;
import fai.common.*;
import fai.*;
public class BuyingGoal extends Goal {
private var engine:Engine;// = null
private var odx:Number;// = 0
private var unloading:Boolean;// = false
private var ody:Number;// = 0
private var step:int;// = 0
private var was_hungry:Boolean;// = false
private var steps:int;// = 30
private var target_pos:Position;// = null
private var finished:Boolean;// = false
private var buyer:Customer;// = null
private var shop:ShopItem;// = null
private var loading:Boolean;// = false
public function BuyingGoal(_arg1:Engine, _arg2:Customer, _arg3:ShopItem):void{
engine = null;
buyer = null;
shop = null;
target_pos = null;
odx = 0;
ody = 0;
steps = 30;
step = 0;
loading = false;
unloading = false;
finished = false;
was_hungry = false;
super();
engine = _arg1;
buyer = _arg2;
shop = _arg3;
target_pos = new Position((shop.x + (shop.width / 2)), Consts.CustomerShopEnteringLine);
startGoing();
loading = true;
}
public function advance():void{
if (loading){
go();
return;
};
if (unloading){
go();
return;
};
if (!buyer.buying){
if (finished){
if (was_hungry){
buyer.customer_money.gotoAndStop("money_label");
};
deactivate();
} else {
unload();
};
};
}
private function tryToLoad():void{
var _local1:ShopSeat;
if (((shop) && ((((((shop.currentLevel == Consts.ShopLevel1)) || ((shop.currentLevel == Consts.ShopLevel2)))) || ((shop.currentLevel == Consts.ShopLevel3)))))){
_local1 = shop.shopBar.load(buyer);
if (_local1){
buyer.suit.visible = false;
shop.shopBar.update();
return;
};
};
buyer.customer_money.gotoAndStop("hungry_label");
was_hungry = true;
unload();
}
private function unload():void{
target_pos.x = (shop.x + shop.width);
target_pos.y = ((Consts.CustomerWalkLine + (Math.random() * 20)) - 10);
buyer.suit.visible = true;
unloading = true;
shop.shopBar.update();
startGoing();
}
private function go():void{
if (step > 0){
buyer.suit.x = (buyer.suit.x + odx);
buyer.suit.y = (buyer.suit.y + ody);
step--;
} else {
if (unloading){
finished = true;
};
if (loading){
tryToLoad();
};
loading = false;
unloading = false;
};
}
override public function deactivate():void{
super.deactivate();
}
private function startGoing():void{
odx = ((target_pos.x - buyer.suit.x) / steps);
ody = ((target_pos.y - buyer.suit.y) / steps);
step = steps;
}
}
}//package fai.goals
Section 8
//CoinGoal (fai.goals.CoinGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.common.*;
import fai.goalsystem.*;
import fai.*;
public class CoinGoal extends Goal {
private var engine:Engine;// = null
private var coin:CoinMotion;// = null
private var shop;// = null
public function CoinGoal(_arg1:Engine, _arg2):void{
engine = null;
shop = null;
coin = null;
super();
engine = _arg1;
shop = _arg2;
coin = new CoinMotion();
coin.x = (shop.x + (Math.random() * shop.width));
coin.y = shop.y;
engine.playWindow.ui.addChild(coin);
coin.play();
}
override public function deactivate():void{
super.deactivate();
if (((coin) && (engine.playWindow))){
coin.stop();
engine.playWindow.ui.removeChild(coin);
coin = null;
};
}
public function advance():void{
if (coin.finished){
deactivate();
};
}
}
}//package fai.goals
Section 9
//CustomerZIndexGoal (fai.goals.CustomerZIndexGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.common.*;
import fai.goalsystem.*;
import fai.*;
public class CustomerZIndexGoal extends Goal {
private var engine:Engine;// = null
private var pause:int;// = 0
private static const PAUSE:int = 5;
public function CustomerZIndexGoal(_arg1:Engine):void{
engine = null;
pause = 0;
super();
engine = _arg1;
}
public function advance():void{
if (pause > 0){
pause--;
return;
};
pause = PAUSE;
checkZIndexes();
}
public function checkZIndexes():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Customer;
var _local5:Customer;
var _local6:int;
var _local7:int;
_local1 = 0;
_local2 = 0;
_local3 = engine.customers.size();
_local4 = null;
_local5 = null;
_local6 = 0;
_local7 = 0;
_local1 = 0;
while (_local1 < (_local3 - 1)) {
_local4 = engine.customers.getItem(_local1);
_local2 = (_local1 + 1);
while (_local2 < _local3) {
_local5 = engine.customers.getItem(_local2);
if ((((_local5.suit.x > (_local4.suit.x - Consts.SpriteWidth))) && ((_local5.suit.x < (_local4.suit.x + Consts.SpriteWidth))))){
_local6 = engine.playWindow.ui.customers.getChildIndex(_local4.suit);
_local7 = engine.playWindow.ui.customers.getChildIndex(_local5.suit);
if ((((((_local4.suit.y > _local5.suit.y)) && ((_local6 < _local7)))) || ((((_local4.suit.y < _local5.suit.y)) && ((_local6 > _local7)))))){
engine.playWindow.ui.customers.swapChildren(_local4.suit, _local5.suit);
};
};
_local2++;
};
_local1++;
};
}
}
}//package fai.goals
Section 10
//ExtraGoal (fai.goals.ExtraGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.common.*;
import fai.goalsystem.*;
import fai.*;
public class ExtraGoal extends Goal {
private var engine:Engine;// = null
private var odx:Number;// = 0
private var unloading:Boolean;// = false
private var ody:Number;// = 0
private var extra:ExtraItem;// = null
private var step:int;// = 0
private var counter:int;// = 0
private var free_seat_pos:int;// = 0
private var steps:int;// = 30
private var target_pos:Position;// = null
private var buyer:Customer;// = null
private var loading:Boolean;// = false
private var extra_steps:int;// = 0
public function ExtraGoal(_arg1:Engine, _arg2:Customer, _arg3:ExtraItem):void{
engine = null;
buyer = null;
extra = null;
target_pos = null;
odx = 0;
ody = 0;
steps = 30;
step = 0;
loading = false;
unloading = false;
extra_steps = 0;
counter = 0;
free_seat_pos = 0;
super();
engine = _arg1;
buyer = _arg2;
extra = _arg3;
free_seat_pos = extra.loadCustomer(_arg2);
if (-1 == free_seat_pos){
deactivate();
return;
};
extra_steps = DataProxy.getExtraCounterSteps(_arg3.currentState);
setTargetPos();
startGoing();
loading = true;
}
public function advance():void{
if (counter > 0){
counter--;
if (counter == 0){
if (extra.currentState == StringConsts.news_box){
dropCoins();
engine.payMoney(-(Consts.NewspaperCost));
};
unload();
};
return;
};
if (loading){
go();
return;
};
if (unloading){
go();
return;
};
}
private function setTargetPos():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
switch (extra.currentState){
case StringConsts.bench:
_local1 = (extra.x + 1);
_local2 = (extra.y + 15);
break;
case StringConsts.music_box:
_local1 = (extra.x + 1);
_local2 = extra.y;
break;
case StringConsts.news_box:
_local1 = (extra.x + 1);
_local2 = extra.y;
break;
};
target_pos = new Position((_local1 + (Consts.SpriteWidth * free_seat_pos)), _local2);
}
private function dropCoins():void{
engine.goal_system.add(new CoinGoal(engine, extra));
}
private function startGoing():void{
odx = ((target_pos.x - buyer.suit.x) / steps);
ody = ((target_pos.y - buyer.suit.y) / steps);
step = steps;
}
private function go():void{
if (step > 0){
buyer.suit.x = (buyer.suit.x + odx);
buyer.suit.y = (buyer.suit.y + ody);
step--;
} else {
if (unloading){
buyer.addExtra(extra);
deactivate();
};
if (loading){
loadAnimation();
counter = extra_steps;
};
loading = false;
unloading = false;
};
}
private function unload():void{
target_pos.x = ((extra.x + extra.width) - (Math.random() * 5));
target_pos.y = ((Consts.CustomerWalkLine + (Math.random() * 20)) - 10);
buyer.suit.visible = true;
unloading = true;
buyer.character.gotoAndPlay("walking");
extra.unloadCustomer(buyer);
startGoing();
}
override public function deactivate():void{
super.deactivate();
}
private function loadAnimation():void{
switch (extra.currentState){
case StringConsts.bench:
buyer.character.gotoAndPlay("sitting");
break;
case StringConsts.news_box:
buyer.character.gotoAndPlay("reading");
break;
case StringConsts.music_box:
buyer.character.gotoAndPlay("listening");
break;
};
}
}
}//package fai.goals
Section 11
//Goal (fai.goals.Goal)
package fai.goals {
public class Goal {
public var priority:int;// = 100
public var active:Boolean;// = true
public function Goal(){
active = true;
priority = 100;
super();
}
public function deactivate():void{
active = false;
}
}
}//package fai.goals
Section 12
//ParticleGoal (fai.goals.ParticleGoal)
package fai.goals {
import fai.common.*;
public class ParticleGoal extends Goal {
private var odx:Number;// = 0
private var ody:Number;// = 0
private var parent_item;// = null
private var max_steps:Number;// = 0
private var dx:Number;// = 0
private var dy:Number;// = 0
public var velocity:int;// = 10
private var particle;// = null
private var use_alpha:Boolean;// = false
private var steps:Number;// = 0
private var distance:Number;// = 0
private var dest_pos:Position;// = null
public function ParticleGoal(_arg1, _arg2, _arg3:Position, _arg4:Boolean=true, _arg5:int=0):void{
var _local6:Object;
parent_item = null;
dest_pos = null;
dx = 0;
dy = 0;
steps = 0;
velocity = 10;
distance = 0;
odx = 0;
ody = 0;
max_steps = 0;
particle = null;
use_alpha = false;
super();
dest_pos = _arg3;
particle = _arg1;
parent_item = _arg2;
use_alpha = _arg4;
if (_arg5 > 0){
velocity = _arg5;
};
parent_item.addChild(particle);
dx = (dest_pos.x - particle.x);
dy = (dest_pos.y - particle.y);
distance = Math.sqrt(((dx * dx) + (dy * dy)));
steps = (distance / velocity);
_local6 = getNormalOffset(dx, dy, ((Math.random() > 0.5)) ? true : false);
dx = (dx / steps);
dy = (dy / steps);
odx = (((_local6.dx / steps) * Math.random()) / 2);
ody = (((_local6.dy / steps) * Math.random()) / 2);
max_steps = steps;
}
public function advance():void{
var _local1:Number;
if (steps > 0){
_local1 = (((2 * steps) / max_steps) - 1);
if (steps > 1){
particle.x = (particle.x + (dx + (odx * _local1)));
particle.y = (particle.y + (dy + (ody * _local1)));
} else {
particle.x = (particle.x + ((dx + (odx * _local1)) * steps));
particle.y = (particle.y + ((dy + (ody * _local1)) * steps));
};
if (use_alpha){
particle.alpha = (steps / max_steps);
};
steps--;
} else {
deactivate();
};
}
private function getNormalOffset(_arg1:Number, _arg2:Number, _arg3:Boolean):Object{
var _local4:Object;
_local4 = new Object();
if ((((_arg1 <= 0)) && ((_arg2 < 0)))){
if (_arg3){
_local4.dx = _arg2;
_local4.dy = Math.abs(_arg1);
} else {
_local4.dx = Math.abs(_arg2);
_local4.dy = _arg1;
};
} else {
if ((((_arg1 > 0)) && ((_arg2 <= 0)))){
if (_arg3){
_local4.dx = -(Math.abs(_arg2));
_local4.dy = -(Math.abs(_arg1));
} else {
_local4.dx = Math.abs(_arg2);
_local4.dy = Math.abs(_arg1);
};
} else {
if ((((_arg1 >= 0)) && ((_arg2 > 0)))){
if (_arg3){
_local4.dx = Math.abs(_arg2);
_local4.dy = -(Math.abs(_arg1));
} else {
_local4.dx = -(Math.abs(_arg2));
_local4.dy = Math.abs(_arg1);
};
} else {
if ((((_arg1 < 0)) && ((_arg2 >= 0)))){
if (_arg3){
_local4.dx = Math.abs(_arg2);
_local4.dy = Math.abs(_arg1);
} else {
_local4.dx = -(Math.abs(_arg2));
_local4.dy = -(Math.abs(_arg1));
};
};
};
};
};
return (_local4);
}
override public function deactivate():void{
super.deactivate();
parent_item.removeChild(particle);
}
}
}//package fai.goals
Section 13
//SeatsGoal (fai.goals.SeatsGoal)
package fai.goals {
import fai.logic.*;
import fai.*;
public class SeatsGoal extends Goal {
private var engine:Engine;// = null
private var loaded:int;// = 0
private var seats:Array;// = null
private var shop:ShopItem;// = null
public function SeatsGoal(_arg1:Engine, _arg2:Array, _arg3:ShopItem):void{
engine = null;
seats = null;
loaded = 0;
shop = null;
super();
engine = _arg1;
seats = _arg2;
shop = _arg3;
}
public function advance():void{
var _local1:ShopSeat;
var _local2:int;
_local1 = null;
_local2 = 0;
_local2 = 0;
while (_local2 < seats.length) {
_local1 = seats[_local2];
if (_local1.loaded){
_local1.percents = (_local1.percents + _local1.velocity);
if (_local1.percents > 100){
unloadSeat(_local1);
};
};
_local2++;
};
}
public function loadCustomer(_arg1:Customer):ShopSeat{
var _local2:int;
var _local3:ShopSeat;
if (loaded >= seats.length){
return (null);
};
_local2 = 0;
_local2 = 0;
while (_local2 < seats.length) {
_local3 = seats[_local2];
if (_local3.loaded == false){
loadSeat(_local3);
_local3.customer = _arg1;
_local3.velocity = DataProxy.getShopBuyingTicks(shop.shopType);
if ((((shop.shopType == StringConsts.boutique)) && ((shop.currentLevel > 1)))){
_local3.velocity = 0.7;
};
if (_local3.velocity <= 0){
_local3.velocity = 1;
};
_arg1.buying = true;
return (_local3);
};
_local2++;
};
return (null);
}
private function loadSeat(_arg1:ShopSeat):void{
_arg1.loaded = true;
_arg1.percents = 0;
loaded++;
}
override public function deactivate():void{
var _local1:int;
var _local2:ShopSeat;
super.deactivate();
if (loaded > 0){
_local1 = 0;
_local1 = 0;
while (_local1 < seats.length) {
_local2 = seats[_local1];
if (_local2.loaded){
unloadSeat(_local2);
};
_local1++;
};
};
}
private function dropCoins():void{
engine.goal_system.add(new CoinGoal(engine, shop));
}
private function moneyValue(_arg1:ShopSeat):int{
return (((_arg1.customer.money > shop.moneyValue)) ? shop.moneyValue : _arg1.customer.money);
}
public function get loadedCount():int{
return (loaded);
}
private function unloadSeat(_arg1:ShopSeat):void{
var _local2:int;
_arg1.loaded = false;
_local2 = moneyValue(_arg1);
_arg1.customer.money = (_arg1.customer.money - _local2);
_arg1.customer.updateMoney();
_arg1.customer.addBuying(shop.shopType);
_arg1.customer.buying = false;
_arg1.customer = null;
if (engine.playWindow){
engine.score = (engine.score + (_local2 / 5));
engine.payMoney(-(_local2));
engine.playWindow.updateResources();
dropCoins();
};
loaded--;
}
}
}//package fai.goals
Section 14
//UpgradingGoal (fai.goals.UpgradingGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.common.*;
import fai.goalsystem.*;
import fai.*;
public class UpgradingGoal extends Goal {
private var engine:Engine;// = null
private var max:int;// = 0
private var ticks:int;// = 0
private var save_var_pos:int;// = 0
private var shop_item:ShopItem;// = null
private var current_level:int;// = 0
public function UpgradingGoal(_arg1:Engine, _arg2):void{
engine = null;
shop_item = null;
ticks = 0;
max = 0;
current_level = 0;
save_var_pos = 0;
super();
engine = _arg1;
shop_item = _arg2;
current_level = shop_item.currentLevel;
shop_item.setLevel(Consts.ShopUpgrading);
shop_item.building_bar.visible = true;
max = (ticks = DataProxy.getShopUpgradingTicks(shop_item.shopType, current_level));
}
private function finish():void{
engine.playSound(SoundConsts.build);
shop_item.setLevel((current_level + 1));
shop_item.getShopSprite().play();
shop_item.updateState();
engine.playWindow.stats.built++;
}
public function advance():void{
if (ticks <= 0){
finish();
deactivate();
return;
};
if (shop_item.building_bar){
shop_item.building_bar.bar.scaleX = (1 - (ticks / max));
shop_item.building_bar.percents.text = ((" " + int(((1 - (ticks / max)) * 100))) + "%");
};
ticks--;
}
public function cancel():void{
deactivate();
shop_item.setLevel(current_level);
}
override public function deactivate():void{
super.deactivate();
shop_item.building_bar.visible = false;
shop_item.building_bar.bar.scaleX = 1;
}
}
}//package fai.goals
Section 15
//VParticleEffectGoal (fai.goals.VParticleEffectGoal)
package fai.goals {
import fai.common.*;
import fai.goalsystem.*;
public class VParticleEffectGoal extends Goal {
private var particle_parent;// = null
private var goal_system:GoalSystem;// = null
private var pause:int;// = 0
public function VParticleEffectGoal(_arg1):void{
particle_parent = null;
goal_system = null;
pause = 0;
super();
particle_parent = _arg1;
goal_system = new GoalSystem();
}
public function advance():void{
var _local1:Position;
var _local2:WhiteStar;
var _local3:ParticleGoal;
goal_system.tick();
if (pause > 0){
pause--;
return;
};
_local1 = new Position((20 + ((particle_parent.width / 2) * Math.random())), (0 - (Math.random() * 10)));
_local2 = new WhiteStar();
_local2.x = (20 + ((particle_parent.width / 2) * Math.random()));
_local2.y = (particle_parent.height - 25);
_local3 = new ParticleGoal(_local2, particle_parent, _local1);
goal_system.add(_local3);
}
override public function deactivate():void{
super.deactivate();
goal_system.deactivateAll();
goal_system = null;
particle_parent = null;
}
}
}//package fai.goals
Section 16
//GoalSystem (fai.goalsystem.GoalSystem)
package fai.goalsystem {
import fai.*;
public class GoalSystem {
public var goals:Array;
private var active_count:int;// = 0
private var counter:int;// = 0
public function GoalSystem(){
goals = [];
counter = 0;
active_count = 0;
super();
}
public function add(_arg1):void{
goals.push(_arg1);
}
public function activeCount():int{
return (active_count);
}
public function deactivateAll():void{
var _local1:int;
_local1 = 0;
while (_local1 < goals.length) {
if (goals[_local1].active){
goals[_local1].deactivate();
};
_local1++;
};
goals.length = 0;
}
private function cleanGoals():void{
var _local1:int;
_local1 = 0;
while (_local1 < goals.length) {
if (!goals[_local1].active){
delete goals[_local1];
goals.splice(_local1, 1);
} else {
_local1++;
};
};
}
public function tick():void{
var _local1:uint;
_local1 = 0;
active_count = 0;
while (_local1 < goals.length) {
if (goals[_local1].active){
goals[_local1].advance();
active_count++;
};
_local1++;
};
if (!counter){
cleanGoals();
counter = Consts.GOALSCLEANPAUSE;
} else {
counter--;
};
}
}
}//package fai.goalsystem
Section 17
//Buttons (fai.logic.Buttons)
package fai.logic {
import flash.events.*;
import fai.ui.*;
import fai.*;
public class Buttons {
private var engine:Engine;// = null
private var extras:Array;
private var buttons:Array;
public function Buttons(_arg1:Engine):void{
engine = null;
buttons = [];
extras = [];
super();
engine = _arg1;
}
public function size():int{
return (buttons.length);
}
public function update():void{
var _local1:*;
var _local2:int;
var _local3:*;
updateExtras();
reassignButtons();
_local1 = null;
_local2 = 0;
_local2 = 0;
while (_local2 < buttons.length) {
_local1 = buttons[_local2];
if (((!(_local1)) || (!(_local1.assigned)))){
_local1.icon_holder.gotoAndStop((_local1.buttonType + "1"));
};
_local2++;
};
_local3 = null;
if (engine.shops.buildingType != ""){
_local3 = getButtonByType(engine.shops.buildingType);
if (_local3){
_local3.gotoAndStop("cancel_action");
_local3.icon_holder.visible = false;
};
};
_local2 = 0;
while (_local2 < buttons.length) {
_local1 = buttons[_local2];
if (_local3 != _local1){
updateButtonState(_local1, _local1.assigned);
};
_local2++;
};
}
private function updateExtras():void{
var _local1:Boolean;
var _local2:int;
var _local3:ExtraItem;
if (!engine.upgrades){
return;
};
if (engine.upgrades.bus_stop){
engine.playWindow.ui.extra_buttons.bus_stop.visible = false;
} else {
engine.playWindow.ui.extra_buttons.bus_stop.visible = (engine.playerMoney >= DataProxy.getExtraBuildCost(StringConsts.bus_stop));
};
_local1 = true;
_local2 = 0;
_local2 = 0;
while (_local2 < engine.extras.size()) {
_local3 = engine.extras.getItem(_local2);
if ((((_local3.currentState == StringConsts.empty)) || (_local3.isAwaiting))){
_local1 = false;
break;
};
_local2++;
};
if (_local1){
engine.playWindow.ui.extra_buttons.news_box.visible = false;
engine.playWindow.ui.extra_buttons.music_box.visible = false;
engine.playWindow.ui.extra_buttons.benches.visible = false;
} else {
engine.playWindow.ui.extra_buttons.news_box.visible = (engine.playerMoney >= DataProxy.getExtraBuildCost(StringConsts.news_box));
engine.playWindow.ui.extra_buttons.music_box.visible = (engine.playerMoney >= DataProxy.getExtraBuildCost(StringConsts.music_box));
engine.playWindow.ui.extra_buttons.benches.visible = (engine.playerMoney >= DataProxy.getExtraBuildCost(StringConsts.bench));
};
engine.extras.update();
}
public function getExtraItem(_arg1:int){
return (extras[_arg1]);
}
public function extraSize():int{
return (extras.length);
}
public function destroy():void{
}
public function addItem(_arg1):void{
switch (_arg1){
case engine.playWindow.ui.boutique_button:
_arg1.setType(StringConsts.boutique);
break;
case engine.playWindow.ui.pet_shop_button:
_arg1.setType(StringConsts.pet_shop);
break;
case engine.playWindow.ui.jewelry_button:
_arg1.setType(StringConsts.jewelry);
break;
case engine.playWindow.ui.restaurant_button:
_arg1.setType(StringConsts.food);
break;
case engine.playWindow.ui.toy_store_button:
_arg1.setType(StringConsts.toy_store);
break;
case engine.playWindow.ui.furniture_button:
_arg1.setType(StringConsts.furniture);
break;
case engine.playWindow.ui.market_button:
_arg1.setType(StringConsts.super_market);
break;
case engine.playWindow.ui.electronics_button:
_arg1.setType(StringConsts.electronics);
break;
case engine.playWindow.ui.extra_buttons.benches:
case engine.playWindow.ui.extra_buttons.news_box:
case engine.playWindow.ui.extra_buttons.music_box:
case engine.playWindow.ui.extra_buttons.bus_stop:
extras.push(_arg1);
return;
};
_arg1.setEngine(engine);
buttons.push(_arg1);
_arg1.gotoAndStop("enabled");
_arg1.buttonMode = true;
_arg1.icon_holder.visible = true;
}
private function updateButtonState(_arg1, _arg2:ShopItem):void{
if (_arg2){
if (_arg2.awaitsBuilding){
_arg1.gotoAndStop("cancel_action");
_arg1.icon_holder.visible = false;
return;
};
if (_arg2.currentLevel == 0){
_arg1.gotoAndStop("enabled");
_arg1.icon_holder.visible = true;
updateButtonCost(_arg1);
return;
};
switch (_arg2.currentLevel){
case Consts.ShopBuilding:
case Consts.ShopUpgrading:
_arg1.gotoAndStop("cancel_action");
_arg1.icon_holder.visible = false;
break;
case Consts.ShopLevel1:
case Consts.ShopLevel2:
_arg1.gotoAndStop("enabled");
_arg1.icon_holder.visible = true;
updateButtonCost(_arg1);
break;
case Consts.ShopLevel3:
_arg1.gotoAndStop("done");
_arg1.icon_holder.visible = true;
updateButtonCost(_arg1);
break;
};
} else {
_arg1.gotoAndStop("enabled");
_arg1.icon_holder.visible = true;
updateButtonCost(_arg1);
};
}
private function updateButtonCost(_arg1):void{
var _local2:Boolean;
var _local3:*;
_local2 = true;
if (_arg1.assigned){
_local3 = _arg1.assigned;
if (((((_local3.awaitsBuilding) || ((_local3.currentLevel == Consts.ShopBuilding)))) || ((_local3.currentLevel == Consts.ShopUpgrading)))){
return;
};
if ((((_local3.currentLevel == Consts.ShopLevel1)) || ((_local3.currentLevel == Consts.ShopLevel2)))){
_local2 = (DataProxy.getBuildCost(_arg1.buttonType, (_local3.currentLevel + 1)) <= engine.playerMoney);
};
} else {
_local2 = (DataProxy.getBuildCost(_arg1.buttonType, 0) <= engine.playerMoney);
};
if (!_local2){
_arg1.gotoAndStop("disabled");
};
}
public function getItem(_arg1:int){
return (buttons[_arg1]);
}
public function getButtonByType(_arg1:String){
switch (_arg1){
case StringConsts.boutique:
return (engine.playWindow.ui.boutique_button);
case StringConsts.food:
return (engine.playWindow.ui.restaurant_button);
case StringConsts.pet_shop:
return (engine.playWindow.ui.pet_shop_button);
case StringConsts.toy_store:
return (engine.playWindow.ui.toy_store_button);
case StringConsts.furniture:
return (engine.playWindow.ui.furniture_button);
case StringConsts.electronics:
return (engine.playWindow.ui.electronics_button);
case StringConsts.super_market:
return (engine.playWindow.ui.market_button);
case StringConsts.jewelry:
return (engine.playWindow.ui.jewelry_button);
};
return (null);
}
public function getItemByType(_arg1:String){
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < buttons.length) {
if (buttons[_local2].buttonType == _arg1){
return (buttons[_local2]);
};
_local2++;
};
return (null);
}
private function reassignButtons():void{
var _local1:int;
var _local2:ShopItem;
var _local3:*;
_local1 = 0;
_local1 = 0;
while (_local1 < engine.shops.size()) {
_local2 = engine.shops.getItem(_local1);
_local3 = getButtonByType(_local2.shopType);
if (_local3){
_local3.assign(_local2);
};
_local1++;
};
}
}
}//package fai.logic
Section 18
//Customer (fai.logic.Customer)
package fai.logic {
import fai.ui.*;
import flash.display.*;
public class Customer {
public var money:int;// = 0
private var initial_money:int;// = 0
public var suit:Sprite;// = null
private var buyings:Array;
private var init_scale:Number;// = 0
public var buying:Boolean;// = false
public var velocity:Number;// = 2
public var customer_money:CustomerMoney;// = null
private var extras:Array;
public var character;// = null
public function Customer():void{
money = 0;
initial_money = 0;
suit = null;
velocity = 2;
customer_money = null;
character = null;
buying = false;
buyings = [];
extras = [];
init_scale = 0;
super();
}
public function init(_arg1:int):void{
initial_money = (money = _arg1);
init_scale = customer_money.bar.bar.scaleX;
}
public function hasBuyings(_arg1:String):Boolean{
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < buyings.length) {
if (buyings[_local2] == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function addBuying(_arg1:String):void{
buyings.push(_arg1);
}
public function extraUsed(_arg1:ExtraItem):Boolean{
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < extras.length) {
if (extras[_local2] == _arg1.currentState){
return (true);
};
_local2++;
};
return (false);
}
public function addExtra(_arg1:ExtraItem):void{
extras.push(_arg1.currentState);
}
public function updateMoney():void{
if (money > 0){
customer_money.gotoAndStop("money_label");
} else {
customer_money.gotoAndStop("happy_face");
customer_money.bar.visible = false;
};
customer_money.bar.bar.scaleX = (init_scale * (money / initial_money));
}
}
}//package fai.logic
Section 19
//Customers (fai.logic.Customers)
package fai.logic {
public class Customers {
private var engine:Engine;// = null
private var people:Array;
public function Customers(_arg1:Engine):void{
engine = null;
people = [];
super();
engine = _arg1;
}
public function size():int{
return (people.length);
}
public function getItem(_arg1:int):Customer{
return (people[_arg1]);
}
public function remove(_arg1:Customer):void{
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < people.length) {
if (people[_local2] == _arg1){
delete people[_local2];
people.splice(_local2, 1);
return;
};
_local2++;
};
}
public function add(_arg1:Customer):void{
people.push(_arg1);
}
public function destroy():void{
if (people){
people.length = 0;
people = null;
};
}
}
}//package fai.logic
Section 20
//DataProxy (fai.logic.DataProxy)
package fai.logic {
import fai.ui.*;
import flash.display.*;
import flash.filters.*;
import fai.common.*;
import fai.*;
public class DataProxy {
private var levels:Array;
public function DataProxy():void{
var _local1:Level;
levels = [];
super();
_local1 = new Level(StringConsts.level1);
addLevel(_local1);
_local1 = new Level(StringConsts.level2);
addLevel(_local1);
_local1 = new Level(StringConsts.level3);
addLevel(_local1);
_local1 = new Level(StringConsts.level4);
addLevel(_local1);
_local1 = new Level(StringConsts.level5);
addLevel(_local1);
_local1 = new Level(StringConsts.level6);
addLevel(_local1);
_local1 = new Level(StringConsts.level7);
addLevel(_local1);
_local1 = new Level(StringConsts.level8);
addLevel(_local1);
_local1 = new Level(StringConsts.level9);
addLevel(_local1);
_local1 = new Level(StringConsts.level10);
addLevel(_local1);
_local1 = new Level(StringConsts.level11);
addLevel(_local1);
_local1 = new Level(StringConsts.level12);
addLevel(_local1);
_local1 = new Level(StringConsts.level13);
addLevel(_local1);
_local1 = new Level(StringConsts.level14);
addLevel(_local1);
_local1 = new Level(StringConsts.level15);
addLevel(_local1);
_local1 = new Level(StringConsts.level16);
addLevel(_local1);
}
public function getLevels():Array{
return (levels);
}
private function addLevel(_arg1:Level):void{
_arg1.number = levels.length;
levels.push(_arg1);
}
public function getLevel(_arg1:int):Level{
return (levels[_arg1]);
}
public static function getExtraBuildCost(_arg1:String):int{
switch (_arg1){
case StringConsts.bench:
return (150);
case StringConsts.news_box:
return (1000);
case StringConsts.music_box:
return (800);
case StringConsts.bus_stop:
return (5000);
};
return (0);
}
public static function getShopIcon(_arg1:String){
var _local2:*;
_local2 = null;
switch (_arg1){
case StringConsts.boutique:
_local2 = new BoutiqueShop();
break;
case StringConsts.jewelry:
_local2 = new JewelryShop();
break;
case StringConsts.food:
_local2 = new RestaurantShop();
break;
case StringConsts.pet_shop:
_local2 = new PetShopShop();
break;
case StringConsts.toy_store:
_local2 = new ToyStoreShop();
break;
case StringConsts.electronics:
_local2 = new ElectronicsShop();
break;
case StringConsts.furniture:
_local2 = new FurnitureShop();
break;
case StringConsts.super_market:
_local2 = new SuperMarketShop();
break;
};
return (_local2);
}
public static function createShopBuilding(_arg1:ShopItem){
var _local2:*;
var _local3:ShopBuilding;
_local2 = createShopIcon(_arg1);
_local3 = new ShopBuilding(_arg1, _local2);
_local3.stop();
return (_local3);
}
public static function getExtraCounterSteps(_arg1:String):int{
switch (_arg1){
case StringConsts.bench:
return (100);
case StringConsts.music_box:
return (200);
case StringConsts.news_box:
return (350);
};
return (0);
}
public static function getShopUpgradingTicks(_arg1:String, _arg2:int):int{
switch (_arg1){
case StringConsts.boutique:
return (50);
case StringConsts.jewelry:
return (60);
case StringConsts.food:
return (70);
case StringConsts.pet_shop:
return (70);
case StringConsts.toy_store:
return (80);
case StringConsts.electronics:
return (90);
case StringConsts.furniture:
return (100);
case StringConsts.super_market:
return (115);
};
return (50);
}
public static function createShopIcon(_arg1:ShopItem){
return (getShopIcon(_arg1.shopType));
}
public static function getIconLabel(_arg1:ShopItem):String{
switch (_arg1.currentLevel){
case 0:
return ((_arg1.shopType + "1"));
case Consts.ShopLevel1:
return ((_arg1.shopType + "2"));
case Consts.ShopLevel2:
return ((_arg1.shopType + "3"));
case Consts.ShopLevel3:
return ((_arg1.shopType + "3"));
};
return ("");
}
public static function getGoodsCost(_arg1:String, _arg2:int):int{
var _local3:int;
var _local4:int;
_local3 = 0;
switch (_arg1){
case StringConsts.boutique:
_local3 = 50;
break;
case StringConsts.pet_shop:
_local3 = 75;
break;
case StringConsts.toy_store:
_local3 = 40;
break;
case StringConsts.jewelry:
_local3 = 70;
break;
case StringConsts.food:
_local3 = 25;
break;
case StringConsts.electronics:
_local3 = 80;
break;
case StringConsts.furniture:
_local3 = 100;
break;
case StringConsts.super_market:
_local3 = 150;
break;
};
_local4 = _local3;
if ((((_arg2 == Consts.ShopLevel2)) || ((_arg2 == Consts.ShopLevel3)))){
_local4 = (_local4 + (int((_local3 / 2)) * (_arg2 - 1)));
};
return (_local4);
}
public static function getShopBuyingTicks(_arg1:String):Number{
var _local2:Number;
_local2 = 0;
switch (_arg1){
case StringConsts.boutique:
_local2 = 1;
break;
case StringConsts.pet_shop:
_local2 = 0.8;
break;
case StringConsts.toy_store:
_local2 = 0.6;
break;
case StringConsts.jewelry:
_local2 = 0.2;
break;
case StringConsts.food:
_local2 = 0.1;
break;
case StringConsts.electronics:
_local2 = 0.4;
break;
case StringConsts.furniture:
_local2 = 0.3;
break;
case StringConsts.super_market:
_local2 = 0.15;
break;
};
return (_local2);
}
public static function getCustomerInitialMoney(_arg1:int):int{
var _local2:Number;
var _local3:int;
_local2 = ((_arg1 > 5)) ? ((_arg1 - 5) * 0.35) : 1;
_local3 = (30 * _arg1);
if (_local3 > 1178){
_local3 = 1178;
};
return (_local3);
}
public static function getBuyerCount(_arg1:int):int{
var _local2:int;
var _local3:int;
_local2 = ((_arg1 - 1) * 2);
_local3 = (((_arg1 > 5)) ? (_arg1 - 5) : 0 * 2);
return (((20 + ((_local2 > 35)) ? 35 : _local2) + _local3));
}
public static function getCustomer(_arg1:int):Customer{
var _local2:Customer;
var _local3:*;
var _local4:int;
var _local5:BitmapFilter;
var _local6:Array;
var _local7:CustomerMoney;
_local2 = null;
_local3 = null;
_local4 = (Math.random() * 8);
switch (_local4){
case 0:
_local3 = new Customer1();
break;
case 1:
_local3 = new Customer2();
break;
case 2:
_local3 = new Customer3();
break;
case 3:
_local3 = new Customer4();
break;
case 4:
_local3 = new Customer5();
break;
case 5:
_local3 = new Customer6();
break;
case 6:
_local3 = new Customer7();
break;
case 7:
_local3 = new Customer8();
break;
};
_local3.scaleX = (Consts.SpriteWidth / _local3.width);
_local3.scaleY = (Consts.SpriteHeight / _local3.height);
_local2 = new Customer();
_local2.suit = new Sprite();
_local2.suit.addChild(_local3);
_local2.character = _local3;
_local2.velocity = 2;
_local5 = getShadowFilter();
_local6 = new Array();
_local6.push(_local5);
_local2.suit.filters = _local6;
_local7 = new CustomerMoney();
_local7.x = -20;
_local7.y = ((_local2.character.y - _local7.height) - 25);
_local2.suit.addChild(_local7);
_local2.customer_money = _local7;
_local2.init(getCustomerInitialMoney(_arg1));
_local2.updateMoney();
return (_local2);
}
private static function getShadowFilter():BitmapFilter{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Boolean;
var _local9:Boolean;
var _local10:Number;
_local1 = 0;
_local2 = 45;
_local3 = 1;
_local4 = 1;
_local5 = 1;
_local6 = 1;
_local7 = 0.65;
_local8 = false;
_local9 = false;
_local10 = BitmapFilterQuality.LOW;
return (new DropShadowFilter(_local6, _local2, _local1, _local3, _local4, _local5, _local7, _local10, _local8, _local9));
}
public static function getShopBuildingTicks(_arg1:String):int{
switch (_arg1){
case StringConsts.boutique:
return (50);
case StringConsts.jewelry:
return (90);
case StringConsts.food:
return (90);
case StringConsts.pet_shop:
return (70);
case StringConsts.toy_store:
return (80);
case StringConsts.electronics:
return (110);
case StringConsts.furniture:
return (150);
case StringConsts.super_market:
return (250);
};
return (50);
}
public static function getSeatsCount(_arg1:String, _arg2:int):int{
var _local3:int;
var _local4:int;
_local3 = 0;
switch (_arg1){
case StringConsts.boutique:
_local3 = 4;
break;
case StringConsts.pet_shop:
_local3 = 5;
break;
case StringConsts.toy_store:
_local3 = 6;
break;
case StringConsts.jewelry:
_local3 = 8;
break;
case StringConsts.food:
_local3 = 10;
break;
case StringConsts.electronics:
_local3 = 9;
break;
case StringConsts.furniture:
_local3 = 8;
break;
case StringConsts.super_market:
_local3 = 20;
break;
};
_local4 = _local3;
if ((((_arg2 == Consts.ShopLevel2)) || ((_arg2 == Consts.ShopLevel3)))){
_local4 = (_local4 + (int(_local3) * (_arg2 - 1)));
};
return (_local4);
}
public static function getBuildCost(_arg1:String, _arg2:int):int{
var _local3:int;
var _local4:int;
_local3 = 0;
switch (_arg1){
case StringConsts.boutique:
_local3 = 2500;
break;
case StringConsts.pet_shop:
_local3 = 3000;
break;
case StringConsts.toy_store:
_local3 = 7000;
break;
case StringConsts.jewelry:
_local3 = 15000;
break;
case StringConsts.food:
_local3 = 20000;
break;
case StringConsts.electronics:
_local3 = 25000;
break;
case StringConsts.furniture:
_local3 = 35000;
break;
case StringConsts.super_market:
_local3 = 55000;
break;
};
_local4 = _local3;
if ((((_arg2 == Consts.ShopLevel2)) || ((_arg2 == Consts.ShopLevel3)))){
_local4 = (_local4 + (_local3 * (_arg2 - 1)));
};
return (_local4);
}
public static function showTooltip(_arg1:Engine, _arg2:ShopButton):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Boolean;
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = false;
_arg1.playWindow.ui.shop_tooltip.title_txt.text = _arg2.buttonType;
Utils.setTextColor(_arg1.playWindow.ui.shop_tooltip.params_txt, 0xFFFFFF);
if (_arg2.assigned){
if (_arg2.assigned.currentLevel == Consts.ShopLevel3){
Utils.setTextColor(_arg1.playWindow.ui.shop_tooltip.params_txt, 0xFFCC00);
_local6 = true;
};
_local3 = getBuildCost(_arg2.assigned.shopType, (_arg2.assigned.currentLevel + 1));
_local4 = getSeatsCount(_arg2.assigned.shopType, (_arg2.assigned.currentLevel + 1));
_local5 = getGoodsCost(_arg2.assigned.shopType, (_arg2.assigned.currentLevel + 1));
} else {
_local3 = getBuildCost(_arg2.buttonType, 0);
_local4 = getSeatsCount(_arg2.buttonType, 0);
_local5 = getGoodsCost(_arg2.buttonType, 0);
};
if (!_local6){
_arg1.playWindow.ui.shop_tooltip.params_txt.text = (((((("Build Cost: " + _local3.toString()) + "$\nCapacity: ") + _local4.toString()) + "\nGoods Cost: ") + _local5.toString()) + "$");
} else {
_arg1.playWindow.ui.shop_tooltip.params_txt.text = "Maximum upgrade level had reached.";
};
}
public static function showExtraTooltip(_arg1:Engine, _arg2):void{
var _local3:int;
var _local4:String;
var _local5:String;
_local3 = 0;
_local4 = "";
_local5 = "";
switch (_arg2){
case _arg1.playWindow.ui.extra_buttons.benches:
_local5 = "Bench";
_local3 = getExtraBuildCost(StringConsts.bench);
_local4 = "Bench slows down customers.";
break;
case _arg1.playWindow.ui.extra_buttons.news_box:
_local5 = "Newspaper Box";
_local3 = getExtraBuildCost(StringConsts.news_box);
_local4 = "Place where customers can buy newspapers.";
break;
case _arg1.playWindow.ui.extra_buttons.music_box:
_local5 = "Music Box";
_local3 = getExtraBuildCost(StringConsts.music_box);
_local4 = "Music box attracts customers with ads.";
break;
case _arg1.playWindow.ui.extra_buttons.bus_stop:
_local5 = "Bus Stop";
_local3 = getExtraBuildCost(StringConsts.bus_stop);
_local4 = "Bus stop delivers new customers every day.";
break;
};
_arg1.playWindow.ui.shop_tooltip.title_txt.text = _local5;
_arg1.playWindow.ui.shop_tooltip.params_txt.text = ((("Build Cost: " + _local3.toString()) + "$\n") + _local4);
}
}
}//package fai.logic
Section 21
//Engine (fai.logic.Engine)
package fai.logic {
import flash.media.*;
import flash.events.*;
import fai.ui.*;
import fai.common.*;
import fai.goalsystem.*;
import flash.utils.*;
import fai.*;
import fai.goals.*;
import flash.geom.*;
public class Engine {
public var buttons:Buttons;// = null
public var not_spent:Boolean;// = false
public var scenario:Scenario;// = null
public var score:int;// = 0
public var events:GameEvents;// = null
public var volume:Number;// = 1
private var game_finished:Boolean;// = false
public var fast_mode:Boolean;// = false
private var last_tooltip_button:ShopButton;// = null
private var money_goal:int;// = 0
public var shops:Shops;// = null
private var money:int;// = 0
private var level_life_points:int;// = 0
public var paused:Boolean;// = false
private var last_loaded_level:Level;// = null
public var customers:Customers;// = null
private var game_data:DataProxy;// = null
public var play_window:PlayWindow;// = null
public var upgrades:Upgrades;// = null
private var global_stage;// = null
public var extras:Extras;// = null
public var music_channel:SoundChannel;// = null
public var goal_system:GoalSystem;// = null
private var vd_timer:Timer;// = null
private var music_sound:Sound;// = null
public var volumeOff:Boolean;// = false
public function Engine(_arg1):void{
var _local2:int;
var _local3:int;
var _local4:int;
game_data = null;
global_stage = null;
money = 0;
money_goal = 0;
score = 0;
paused = false;
goal_system = null;
events = null;
play_window = null;
last_loaded_level = null;
volume = 1;
volumeOff = false;
shops = null;
buttons = null;
level_life_points = 0;
scenario = null;
upgrades = null;
extras = null;
customers = null;
not_spent = false;
last_tooltip_button = null;
vd_timer = null;
music_sound = null;
music_channel = null;
game_finished = false;
fast_mode = false;
super();
global_stage = _arg1;
game_data = new DataProxy();
_local2 = 0;
_local3 = 0;
_local4 = 40;
}
public function playSoundData(_arg1:Sound):void{
var _local2:SoundTransform;
if (volumeOff){
return;
};
_local2 = new SoundTransform();
_local2.volume = volume;
_arg1.play(0, 0, _local2);
}
public function customerPassed(_arg1:Customer):void{
if (_arg1.money > 0){
if (level_life_points > 0){
level_life_points--;
};
};
playWindow.updateResources();
}
public function get lastLevel():Level{
return (last_loaded_level);
}
public function clearAll():void{
if (!play_window){
return;
};
stopMusic();
events.unregister();
events = null;
shops.destroy();
shops = null;
buttons.destroy();
buttons = null;
scenario = null;
upgrades.destroy();
upgrades = null;
customers.destroy();
customers = null;
extras.destroy();
extras = null;
play_window.destroy();
GameStage.play_holder.removeChild(play_window.ui);
play_window = null;
last_tooltip_button = null;
goal_system.deactivateAll();
goal_system = null;
game_finished = false;
paused = false;
}
private function defeatHandler(_arg1:TimerEvent):void{
game_finished = true;
vd_timer.stop();
vd_timer.removeEventListener(TimerEvent.TIMER, defeatHandler);
vd_timer = null;
predeactivateGoals();
if (!paused){
pause();
};
play_window.stats.final_victory.visible = false;
play_window.stats.defeat();
play_window.stats.start();
play_window.stats.visible = true;
}
public function get gameBoard():GameBoard{
if (!play_window){
return (null);
};
return (play_window.gameBoard);
}
public function victory():void{
if (game_finished){
return;
};
game_finished = true;
vd_timer = new Timer(1000, 1);
vd_timer.addEventListener(TimerEvent.TIMER, victoryHandler);
vd_timer.start();
}
public function get levelLifePoints():int{
return (level_life_points);
}
public function predeactivateGoals():void{
var _local1:int;
var _local2:*;
_local1 = 0;
_local1 = 0;
while (_local1 < goal_system.goals.length) {
_local2 = goal_system.goals[_local1];
if ((_local2 is CoinGoal)){
_local2.deactivate();
};
_local1++;
};
}
public function playLevel(_arg1:Level):void{
if (!_arg1){
return;
};
clearAll();
money = _arg1.initial_money;
money_goal = 0;
score = 0;
level_life_points = 5;
fast_mode = false;
goal_system = new GoalSystem();
events = new GameEvents(this);
shops = new Shops(this);
buttons = new Buttons(this);
extras = new Extras(this);
last_loaded_level = _arg1;
play_window = new PlayWindow(this);
play_window.initialize();
GameStage.play_holder.addChild(play_window.ui);
scenario = new Scenario(this, _arg1);
upgrades = new Upgrades(this);
customers = new Customers(this);
goal_system.add(new CustomerZIndexGoal(this));
events.register();
play_window.updateAll();
music_sound = new Sound_level_selection();
playMusic();
}
public function switchSound(_arg1:Boolean):void{
volumeOff = !(_arg1);
if (volumeOff){
stopMusic();
GameStage.welcomeScreen.levelSelection.stopMusic();
} else {
playMusic();
};
}
public function get gameData():DataProxy{
return (game_data);
}
public function playSound(_arg1:int):void{
switch (_arg1){
case SoundConsts.victory:
playSoundData(new Sound_tada());
break;
case SoundConsts.build:
playSoundData(new Sound_build());
break;
case SoundConsts.click:
playSoundData(new Sound_click3());
break;
case SoundConsts.coins:
playSoundData(new Sound_coins());
break;
case SoundConsts.new_day:
playSoundData(new Sound_new_day());
break;
};
}
public function stopMusic():void{
if (music_channel){
music_channel.stop();
music_channel = null;
};
}
public function showTooltip(_arg1):void{
if (((!(_arg1)) || ((_arg1 is ShopButton)))){
if (_arg1){
last_tooltip_button = _arg1;
DataProxy.showTooltip(this, _arg1);
} else {
DataProxy.showTooltip(this, last_tooltip_button);
};
} else {
DataProxy.showExtraTooltip(this, _arg1);
};
}
public function playMusic():void{
var _local1:SoundTransform;
stopMusic();
if (!volumeOff){
_local1 = new SoundTransform();
_local1.volume = volume;
music_channel = music_sound.play(0, 25, _local1);
};
}
public function finalVictory():void{
score = (score + 1900000);
play_window.stats.final_victory.visible = true;
}
private function victoryHandler(_arg1:TimerEvent):void{
var _local2:LevelSelection;
vd_timer.stop();
vd_timer.removeEventListener(TimerEvent.TIMER, victoryHandler);
vd_timer = null;
predeactivateGoals();
game_finished = true;
if (!paused){
pause();
};
_local2 = GameStage.welcomeScreen.levelSelection;
play_window.stats.final_victory.visible = false;
if (lastLevel.number == (gameData.getLevels().length - 1)){
finalVictory();
};
if (_local2.current_level == lastLevel.number){
_local2.current_level++;
};
play_window.stats.victory();
play_window.stats.start();
play_window.stats.visible = true;
}
public function get playerMoney():int{
return (money);
}
public function get playWindow():PlayWindow{
return (play_window);
}
public function get goalMoney():int{
return (money_goal);
}
public function returnMoney(_arg1:int):void{
playWindow.stats.spent = (playWindow.stats.spent - Math.abs(_arg1));
money = (money + _arg1);
playWindow.updateAll();
}
public function pause():void{
if (!paused){
stopMusic();
play_window.ui.pause_mc.visible = true;
play_window.ui.pause_mc.gotoAndPlay("pause");
play_window.ui.car_motion.stop();
upgrades.pause(true);
events.unregister();
} else {
playMusic();
play_window.ui.pause_mc.stop();
play_window.ui.pause_mc.visible = false;
play_window.ui.car_motion.play();
upgrades.pause(false);
events.register();
};
paused = !(paused);
}
public function payMoney(_arg1:int):void{
if (_arg1 < 0){
playSound(SoundConsts.coins);
money_goal = (money_goal + Math.abs(_arg1));
playWindow.stats.earned = (playWindow.stats.earned + Math.abs(_arg1));
} else {
playWindow.stats.spent = (playWindow.stats.spent + Math.abs(_arg1));
};
money = (money - _arg1);
playWindow.updateAll();
}
public function log(_arg1:String):void{
playWindow.ui.output_message.msg.msg_txt.text = _arg1;
playWindow.ui.output_message.gotoAndPlay("show_animation");
playWindow.ui.output_message.visible = true;
}
public function gameOver():void{
if (game_finished){
return;
};
game_finished = true;
vd_timer = new Timer(1000, 1);
vd_timer.addEventListener(TimerEvent.TIMER, defeatHandler);
vd_timer.start();
}
}
}//package fai.logic
Section 22
//Extras (fai.logic.Extras)
package fai.logic {
import fai.ui.*;
import fai.*;
public class Extras {
private var engine:Engine;// = null
private var await_type:String;
private var extras:Array;
private var awaits:Boolean;// = false
public function Extras(_arg1:Engine):void{
engine = null;
extras = [];
awaits = false;
super();
engine = _arg1;
}
public function size():int{
return (extras.length);
}
public function getItem(_arg1:int){
return (extras[_arg1]);
}
public function setAwaiting(_arg1:Boolean):void{
awaits = _arg1;
}
public function update():void{
if (((awaits) && ((engine.playerMoney < DataProxy.getExtraBuildCost(await_type))))){
cancelSketchyState();
};
}
public function addItem(_arg1):void{
extras.push(_arg1);
_arg1.visible = false;
}
public function extraMusicBox():void{
if (engine.playerMoney < DataProxy.getExtraBuildCost(StringConsts.music_box)){
engine.log(StringConsts.not_enough_money);
return;
};
showSketchyState(StringConsts.music_box);
}
public function extraNewsBox():void{
if (engine.playerMoney < DataProxy.getExtraBuildCost(StringConsts.news_box)){
engine.log(StringConsts.not_enough_money);
return;
};
showSketchyState(StringConsts.news_box);
}
public function extraClick(_arg1):void{
if ((((_arg1 is ExtraItem)) && (_arg1.isAwaiting))){
if (engine.playerMoney < DataProxy.getExtraBuildCost(_arg1.currentState)){
engine.log(StringConsts.not_enough_money);
return;
};
setAwaiting(false);
engine.payMoney(DataProxy.getExtraBuildCost(_arg1.currentState));
_arg1.setAwaiting(false);
_arg1.setNormalState();
engine.playWindow.stats.built++;
engine.score = (engine.score + DataProxy.getExtraBuildCost(_arg1.currentState));
engine.playWindow.updateAll();
cancelSketchyState();
};
}
public function get isAwaiting():Boolean{
return (awaits);
}
public function cancelSketchyState():void{
var _local1:int;
var _local2:ExtraItem;
awaits = false;
_local1 = 0;
_local1 = 0;
while (_local1 < extras.length) {
_local2 = extras[_local1];
if (_local2.isAwaiting){
_local2.setCurrentState(StringConsts.empty);
_local2.setAwaiting(false);
_local2.visible = false;
};
_local1++;
};
}
private function showSketchyState(_arg1:String):void{
var _local2:int;
var _local3:Boolean;
var _local4:ExtraItem;
if (((awaits) && ((await_type == _arg1)))){
cancelSketchyState();
return;
};
_local2 = 0;
_local3 = false;
_local2 = 0;
while (_local2 < extras.length) {
_local4 = extras[_local2];
if ((((_local4.currentState == StringConsts.empty)) || (extras[_local2].isAwaiting))){
_local4.setCurrentState(_arg1);
_local4.setAwaiting(true);
_local4.setSketchyState();
_local4.visible = true;
_local3 = true;
};
_local2++;
};
if (_local3){
awaits = true;
await_type = _arg1;
engine.shops.hideBuildingIcons();
};
}
public function extraBenches():void{
if (engine.playerMoney < DataProxy.getExtraBuildCost(StringConsts.bench)){
engine.log(StringConsts.not_enough_money);
return;
};
showSketchyState(StringConsts.bench);
}
public function extraBusStop():void{
if (engine.playerMoney < DataProxy.getExtraBuildCost(StringConsts.bus_stop)){
engine.log(StringConsts.not_enough_money);
return;
};
engine.payMoney(DataProxy.getExtraBuildCost(StringConsts.bus_stop));
engine.playWindow.stats.built++;
engine.score = (engine.score + DataProxy.getExtraBuildCost(StringConsts.bus_stop));
engine.playWindow.updateAll();
engine.upgrades.upgradeBusStop();
}
public function destroy():void{
if (extras){
extras.length = 0;
extras = null;
};
}
}
}//package fai.logic
Section 23
//GameBoard (fai.logic.GameBoard)
package fai.logic {
import flash.display.*;
public class GameBoard extends Sprite {
private var engine:Engine;// = null
public function GameBoard(_arg1:Engine):void{
engine = null;
super();
}
}
}//package fai.logic
Section 24
//GameEvents (fai.logic.GameEvents)
package fai.logic {
import flash.events.*;
import fai.ui.*;
import fai.*;
import flash.ui.*;
public class GameEvents {
private var engine:Engine;// = null
private var scenario_pause:int;// = 0
public function GameEvents(_arg1:Engine):void{
engine = null;
scenario_pause = 0;
super();
engine = _arg1;
}
private function modeChangeButtonHandler(_arg1:MouseEvent):void{
engine.fast_mode = !(engine.fast_mode);
engine.playWindow.ui.fast_mode_button.visible = !(engine.fast_mode);
engine.playWindow.ui.slow_mode_button.visible = engine.fast_mode;
}
private function extraButtonHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
switch (_arg1.currentTarget){
case engine.playWindow.ui.extra_buttons.benches:
engine.extras.extraBenches();
break;
case engine.playWindow.ui.extra_buttons.news_box:
engine.extras.extraNewsBox();
break;
case engine.playWindow.ui.extra_buttons.music_box:
engine.extras.extraMusicBox();
break;
case engine.playWindow.ui.extra_buttons.bus_stop:
engine.extras.extraBusStop();
break;
};
}
private function onKeyDown(_arg1:KeyboardEvent):void{
if (Keyboard.ESCAPE == _arg1.keyCode){
};
}
private function shopButtonOutHandler(_arg1:MouseEvent):void{
engine.playWindow.ui.shop_tooltip.visible = false;
}
private function clickShopHandler(_arg1:MouseEvent):void{
var _local2:*;
if ((_arg1.currentTarget is ShopItem)){
if (((engine.shops.awaitBuilding()) && (_arg1.currentTarget.awaitsBuilding))){
engine.playSound(SoundConsts.click);
_arg1.currentTarget.handleClick();
} else {
if (engine.shops.awaitBuilding()){
engine.shops.hideBuildingIcons();
};
_local2 = engine.buttons.getButtonByType(_arg1.currentTarget.shopType);
shopPressed(_local2, _arg1.currentTarget.shopType);
};
};
}
private function playWindowMenuHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
engine.pause();
engine.play_window.ui.visible = false;
GameStage.welcomeScreen.showWelcome();
}
private function shopPressed(_arg1, _arg2:String):void{
var _local3:ShopItem;
var _local4:Boolean;
var _local5:String;
engine.playSound(SoundConsts.click);
if (engine.shops.hasType(_arg2) == false){
if (engine.playerMoney < DataProxy.getBuildCost(_arg2, 0)){
engine.log(StringConsts.not_enough_money);
} else {
engine.shops.showBuildingIcons(_arg2);
};
} else {
_local3 = engine.shops.getItemByType(_arg2);
if (((_local3.underBuilding()) || (_local3.underUpgrading()))){
_local4 = _local3.underBuilding();
_local3.cancel();
if (engine.shops.awaitBuilding()){
_local5 = engine.shops.buildingType;
engine.shops.hideBuildingIcons();
engine.shops.showBuildingIcons(_local5);
};
if (_local4){
_arg1.assign(null);
};
} else {
if (_local3.currentLevel < Consts.ShopLevel3){
if (engine.playerMoney < DataProxy.getBuildCost(_arg2, (_local3.currentLevel + 1))){
engine.log(StringConsts.not_enough_money);
} else {
_local3.startUpgrading();
};
};
};
};
}
private function playWindowPauseHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
engine.pause();
}
private function registerShops():void{
var _local1:int;
_local1 = 0;
_local1 = 0;
while (_local1 < engine.shops.size()) {
engine.shops.getItem(_local1).addEventListener(MouseEvent.MOUSE_DOWN, clickShopHandler);
_local1++;
};
}
private function soundOnHandler(_arg1:MouseEvent):void{
engine.switchSound(true);
engine.playWindow.ui.mute_button.visible = true;
engine.playWindow.ui.sound_button.visible = false;
}
public function tick(_arg1:Event):void{
var _local2:int;
var _local3:int;
_local2 = 1;
if (engine.fast_mode){
_local2 = 4;
};
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
engine.goal_system.tick();
engine.scenario.generate();
if (scenario_pause == 20){
engine.scenario.think();
scenario_pause = 0;
};
scenario_pause++;
_local3++;
};
}
private function nextDayButtonHandler(_arg1:MouseEvent):void{
if (engine.playWindow.next_day_blocked){
return;
};
engine.playWindow.ui.click_next_day_button.visible = false;
engine.playSound(SoundConsts.new_day);
engine.scenario.nextDay();
}
private function extraItemHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
engine.extras.extraClick(_arg1.currentTarget);
}
private function unregisterShops():void{
var _local1:int;
_local1 = 0;
_local1 = 0;
while (_local1 < engine.shops.size()) {
engine.shops.getItem(_local1).removeEventListener(MouseEvent.MOUSE_DOWN, clickShopHandler);
_local1++;
};
}
private function soundMuteHandler(_arg1:MouseEvent):void{
engine.switchSound(false);
engine.playWindow.ui.mute_button.visible = false;
engine.playWindow.ui.sound_button.visible = true;
}
public function register():void{
var _local1:int;
var _local2:*;
GameStage.main_stage.addEventListener(Event.ENTER_FRAME, tick);
GameStage.main_stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
registerShops();
_local1 = 0;
_local2 = null;
_local1 = 0;
while (_local1 < engine.buttons.size()) {
_local2 = engine.buttons.getItem(_local1);
_local2.addEventListener(MouseEvent.MOUSE_DOWN, shopButtonHandler);
_local2.addEventListener(MouseEvent.MOUSE_OVER, shopButtonOverHandler);
_local2.addEventListener(MouseEvent.MOUSE_OUT, shopButtonOutHandler);
_local2.buttonMode = true;
_local2.mouseChildren = false;
_local1++;
};
_local1 = 0;
while (_local1 < engine.extras.size()) {
_local2 = engine.extras.getItem(_local1);
_local2.addEventListener(MouseEvent.MOUSE_DOWN, extraItemHandler);
_local2.buttonMode = true;
_local2.mouseChildren = false;
_local1++;
};
_local1 = 0;
while (_local1 < engine.buttons.extraSize()) {
_local2 = engine.buttons.getExtraItem(_local1);
_local2.addEventListener(MouseEvent.MOUSE_DOWN, extraButtonHandler);
_local2.addEventListener(MouseEvent.MOUSE_OVER, shopButtonOverHandler);
_local2.addEventListener(MouseEvent.MOUSE_OUT, shopButtonOutHandler);
_local1++;
};
engine.playWindow.ui.next_day_button.addEventListener(MouseEvent.MOUSE_DOWN, nextDayButtonHandler);
engine.playWindow.ui.menu_button.addEventListener(MouseEvent.MOUSE_DOWN, playWindowMenuHandler);
engine.playWindow.ui.pause_button.addEventListener(MouseEvent.MOUSE_DOWN, playWindowPauseHandler);
engine.playWindow.ui.mute_button.addEventListener(MouseEvent.MOUSE_DOWN, soundMuteHandler);
engine.playWindow.ui.sound_button.addEventListener(MouseEvent.MOUSE_DOWN, soundOnHandler);
engine.playWindow.ui.click_next_day_button.addEventListener(MouseEvent.MOUSE_DOWN, nextDayButtonHandler);
engine.playWindow.ui.fast_mode_button.addEventListener(MouseEvent.MOUSE_DOWN, modeChangeButtonHandler);
engine.playWindow.ui.slow_mode_button.addEventListener(MouseEvent.MOUSE_DOWN, modeChangeButtonHandler);
}
private function shopButtonHandler(_arg1:MouseEvent):void{
if (engine.shops.awaitBuilding()){
if (_arg1.currentTarget.buttonType == engine.shops.buildingType){
engine.shops.hideBuildingIcons();
return;
};
engine.shops.hideBuildingIcons();
};
shopPressed(_arg1.currentTarget, _arg1.currentTarget.buttonType);
}
private function shopButtonOverHandler(_arg1:MouseEvent):void{
engine.showTooltip(_arg1.currentTarget);
engine.playWindow.ui.shop_tooltip.visible = true;
engine.playWindow.ui.shop_tooltip.gotoAndPlay("show_animation");
if ((_arg1.currentTarget is ShopButton)){
engine.playWindow.ui.shop_tooltip.x = _arg1.currentTarget.x;
} else {
engine.playWindow.ui.shop_tooltip.x = (engine.playWindow.ui.extra_buttons.x + _arg1.currentTarget.x);
};
if ((engine.playWindow.ui.shop_tooltip.x + engine.playWindow.ui.shop_tooltip.width) > Consts.ScreenWidth){
engine.playWindow.ui.shop_tooltip.x = ((Consts.ScreenWidth - engine.playWindow.ui.shop_tooltip.width) - 5);
};
}
public function unregister():void{
var _local1:int;
var _local2:*;
GameStage.main_stage.removeEventListener(Event.ENTER_FRAME, tick);
GameStage.main_stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
unregisterShops();
_local1 = 0;
_local2 = null;
_local1 = 0;
while (_local1 < engine.buttons.size()) {
_local2 = engine.buttons.getItem(_local1);
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, shopButtonHandler);
_local2.removeEventListener(MouseEvent.MOUSE_OVER, shopButtonOverHandler);
_local2.removeEventListener(MouseEvent.MOUSE_OUT, shopButtonOutHandler);
_local1++;
};
_local1 = 0;
while (_local1 < engine.extras.size()) {
_local2 = engine.extras.getItem(_local1);
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, extraItemHandler);
_local1++;
};
_local1 = 0;
while (_local1 < engine.buttons.extraSize()) {
_local2 = engine.buttons.getExtraItem(_local1);
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, extraButtonHandler);
_local2.removeEventListener(MouseEvent.MOUSE_OVER, shopButtonOverHandler);
_local2.removeEventListener(MouseEvent.MOUSE_OUT, shopButtonOutHandler);
_local1++;
};
engine.playWindow.ui.next_day_button.removeEventListener(MouseEvent.MOUSE_DOWN, nextDayButtonHandler);
engine.playWindow.ui.menu_button.removeEventListener(MouseEvent.MOUSE_DOWN, playWindowMenuHandler);
engine.playWindow.ui.pause_button.removeEventListener(MouseEvent.MOUSE_DOWN, playWindowPauseHandler);
engine.playWindow.ui.pause_mc.removeEventListener(MouseEvent.MOUSE_DOWN, playWindowPauseHandler);
engine.playWindow.ui.mute_button.removeEventListener(MouseEvent.MOUSE_DOWN, soundMuteHandler);
engine.playWindow.ui.sound_button.removeEventListener(MouseEvent.MOUSE_DOWN, soundOnHandler);
engine.playWindow.ui.click_next_day_button.removeEventListener(MouseEvent.MOUSE_DOWN, nextDayButtonHandler);
engine.playWindow.ui.fast_mode_button.removeEventListener(MouseEvent.MOUSE_DOWN, modeChangeButtonHandler);
engine.playWindow.ui.slow_mode_button.removeEventListener(MouseEvent.MOUSE_DOWN, modeChangeButtonHandler);
}
}
}//package fai.logic
Section 25
//Level (fai.logic.Level)
package fai.logic {
import fai.*;
public class Level {
public var initial_money:int;// = 0
public var number:int;// = 0
public var days:int;// = 0
public var money_goal:int;// = 0
public var type:String;
public var description:String;
public function Level(_arg1:String):void{
number = 0;
days = 0;
initial_money = 0;
money_goal = 0;
super();
type = _arg1;
switch (type){
case StringConsts.level1:
days = 5;
initial_money = 5050;
money_goal = 7600;
description = "Study how to operate your shops in this tiny tutorial level.";
break;
case StringConsts.level2:
days = 8;
money_goal = 21000;
description = "Grow your retail business in the Houston suburbs.";
break;
case StringConsts.level3:
days = 10;
money_goal = 42000;
description = "Closer to the downtown of Houston.";
break;
case StringConsts.level4:
days = 12;
money_goal = 81000;
description = "Finally the downtown. Show what you've learnt.";
break;
case StringConsts.level5:
days = 14;
money_goal = 138000;
description = "Growing the business in Chicago.";
break;
case StringConsts.level6:
days = 16;
money_goal = 190000;
description = "Another area of Chicago.";
break;
case StringConsts.level7:
days = 18;
money_goal = 285000;
description = "Growing the business.";
break;
case StringConsts.level8:
days = 20;
money_goal = 390000;
description = "Growing the business.";
break;
case StringConsts.level9:
days = 22;
money_goal = 530000;
description = "Growing the business in Los Angeles.";
break;
case StringConsts.level10:
days = 24;
money_goal = 670000;
description = "Growing the business.";
break;
case StringConsts.level11:
days = 25;
money_goal = 750000;
description = "Growing the business.";
break;
case StringConsts.level12:
days = 26;
money_goal = 840000;
description = "Los Angeles downtown.";
break;
case StringConsts.level13:
days = 27;
money_goal = 940000;
description = "Finally, the New York city!";
break;
case StringConsts.level14:
days = 28;
money_goal = 1000000;
description = "Growing the business.";
break;
case StringConsts.level15:
days = 29;
initial_money = 150000;
money_goal = 1100000;
description = "Growing the business.";
break;
case StringConsts.level16:
days = 30;
initial_money = 150000;
money_goal = 1220000;
description = "Manhattan.";
break;
};
initial_money = 5050;
}
public function copy(_arg1:Level):void{
type = _arg1.type;
description = _arg1.description;
days = _arg1.days;
initial_money = _arg1.initial_money;
money_goal = _arg1.money_goal;
}
}
}//package fai.logic
Section 26
//PlayWindow (fai.logic.PlayWindow)
package fai.logic {
import flash.events.*;
import fai.ui.*;
import flash.display.*;
import fai.*;
public class PlayWindow {
private var engine:Engine;// = null
private var game_ui:PlayWindowUI;// = null
public var next_day_blocked:Boolean;// = false
public var game_board:GameBoard;// = null
public var stats:Statistics;// = null
private var initial_bar_scale:Number;// = 0
public var build_buttons:Array;// = null
private var shop_items:Array;// = null
public function PlayWindow(_arg1:Engine):void{
engine = null;
game_board = null;
game_ui = null;
shop_items = null;
build_buttons = null;
initial_bar_scale = 0;
stats = null;
next_day_blocked = false;
super();
engine = _arg1;
}
private function unpauseHandler(_arg1:MouseEvent):void{
engine.pause();
}
public function initialize():void{
var _local1:int;
game_ui = new PlayWindowUI();
shop_items = [game_ui.shop_ground1, game_ui.shop_ground2, game_ui.shop_ground3, game_ui.shop_ground4, game_ui.shop_ground5, game_ui.shop_ground6, game_ui.shop_ground7, game_ui.shop_ground8];
engine.buttons.addItem(game_ui.boutique_button);
engine.buttons.addItem(game_ui.pet_shop_button);
engine.buttons.addItem(game_ui.electronics_button);
engine.buttons.addItem(game_ui.furniture_button);
engine.buttons.addItem(game_ui.jewelry_button);
engine.buttons.addItem(game_ui.restaurant_button);
engine.buttons.addItem(game_ui.market_button);
engine.buttons.addItem(game_ui.toy_store_button);
engine.buttons.addItem(game_ui.extra_buttons.benches);
engine.buttons.addItem(game_ui.extra_buttons.news_box);
engine.buttons.addItem(game_ui.extra_buttons.music_box);
engine.buttons.addItem(game_ui.extra_buttons.bus_stop);
engine.extras.addItem(game_ui.extra1);
engine.extras.addItem(game_ui.extra2);
engine.extras.addItem(game_ui.extra3);
engine.extras.addItem(game_ui.extra4);
engine.extras.addItem(game_ui.extra5);
engine.extras.addItem(game_ui.extra6);
engine.extras.addItem(game_ui.extra7);
_local1 = 0;
_local1 = 0;
while (_local1 < shop_items.length) {
engine.shops.addItem(shop_items[_local1]);
engine.shops.getItem(_local1).initialize(engine);
_local1++;
};
initial_bar_scale = game_ui.resources.goal_bar.bar.scaleX;
game_ui.shop_tooltip.visible = false;
game_ui.shop_tooltip.stop();
game_ui.output_message.visible = false;
game_ui.car_motion.engine = engine;
game_ui.bus_clip.engine = engine;
game_ui.bus_clip.stop();
game_ui.bus_stop.stop();
game_ui.bus_stop_sign.stop();
game_ui.bonus_animation.visible = false;
game_ui.pause_mc.stop();
game_ui.pause_mc.buttonMode = true;
game_ui.pause_mc.mouseChildren = false;
game_ui.pause_mc.visible = false;
stats = new Statistics();
stats.setEngine(engine);
stats.visible = false;
game_ui.addChild(stats);
game_ui.pause_mc.addEventListener(MouseEvent.MOUSE_DOWN, unpauseHandler);
ui.sound_button.visible = false;
game_ui.tutorial_mc.init(engine);
if (engine.lastLevel.number != 0){
game_ui.removeChild(game_ui.tutorial_mc);
game_ui.tutorial_mc.destroy();
game_ui.tutorial_mc = null;
} else {
game_ui.tutorial_mc.gotoAndStop("page1");
};
ui.click_next_day_button.visible = false;
ui.slow_mode_button.visible = false;
engine.buttons.update();
}
public function destroy():void{
if (game_ui.tutorial_mc){
game_ui.tutorial_mc.destroy();
game_ui.tutorial_mc = null;
};
game_ui.pause_mc.removeEventListener(MouseEvent.MOUSE_DOWN, unpauseHandler);
}
public function get ui(){
return (game_ui);
}
public function updateAll():void{
engine.buttons.update();
updateResources();
}
public function get gameBoard():GameBoard{
return (game_board);
}
public function updateResources():void{
var _local1:int;
game_ui.resources.score_txt.text = engine.score.toString();
game_ui.resources.money_txt.text = (engine.playerMoney.toString() + "$");
_local1 = int(((engine.goalMoney / engine.lastLevel.money_goal) * 100));
game_ui.resources.goal_bar.goal_txt.text = (_local1.toString() + "%");
if (_local1 <= 100){
game_ui.resources.goal_bar.bar.scaleX = ((engine.goalMoney / engine.lastLevel.money_goal) * initial_bar_scale);
} else {
game_ui.resources.goal_bar.bar.scaleX = initial_bar_scale;
};
game_ui.resources.wave_txt.text = ((engine.scenario.currentDay.toString() + "/") + engine.lastLevel.days.toString());
next_day_blocked = ((!((engine.customers.size() == 0))) || (!(engine.upgrades.busWent())));
if (next_day_blocked){
engine.playWindow.ui.next_day_button.alpha = 0.5;
} else {
engine.playWindow.ui.next_day_button.alpha = 1;
};
}
public function showBonus(_arg1:int):void{
ui.bonus_animation.visible = true;
ui.bonus_animation.gotoAndPlay("start_animation");
stats.bonus = (stats.bonus + _arg1);
engine.payMoney(-(_arg1));
}
public function show():void{
ui.visible = true;
}
}
}//package fai.logic
Section 27
//Scenario (fai.logic.Scenario)
package fai.logic {
import fai.*;
import fai.goals.*;
public class Scenario {
private var engine:Engine;// = null
private var buyer_queue:Array;
private var level:Level;// = null
private var generate_pause:int;// = 0
private var current_day:int;// = 0
private static const GENERATE_PAUSE:int = 20;
public function Scenario(_arg1:Engine, _arg2:Level):void{
engine = null;
buyer_queue = [];
level = null;
current_day = 0;
generate_pause = 0;
super();
engine = _arg1;
level = _arg2;
}
private function generateCustomers():void{
var _local1:int;
var _local2:Customer;
var _local3:int;
_local1 = DataProxy.getBuyerCount(current_day);
_local2 = null;
_local3 = 0;
_local3 = 0;
while (_local3 < _local1) {
_local2 = DataProxy.getCustomer(current_day);
buyer_queue.push(_local2);
_local3++;
};
}
public function get currentDay():int{
return (current_day);
}
private function victoryCondition():Boolean{
return ((engine.goalMoney >= level.money_goal));
}
public function nextDay():void{
if (current_day >= level.days){
return;
};
engine.not_spent = false;
current_day++;
generateCustomers();
engine.upgrades.nextDay();
engine.playWindow.updateResources();
engine.playWindow.next_day_blocked = true;
engine.playWindow.ui.next_day_button.alpha = 0.5;
}
public function think():void{
if (gameOverCondition()){
engine.gameOver();
return;
};
if (victoryCondition()){
engine.victory();
return;
};
}
private function gameOverCondition():Boolean{
return ((((((((((buyer_queue.length == 0)) && ((engine.customers.size() == 0)))) && (engine.upgrades.busWent()))) && ((current_day >= level.days)))) && ((engine.goalMoney < level.money_goal))));
}
public function generate():void{
var _local1:Customer;
var _local2:BuyerGoal;
if (generate_pause > 0){
generate_pause--;
return;
};
generate_pause = GENERATE_PAUSE;
if (buyer_queue.length > 0){
_local1 = buyer_queue.shift();
_local2 = new BuyerGoal(engine, _local1);
engine.goal_system.add(_local2);
};
}
}
}//package fai.logic
Section 28
//ShopItem (fai.logic.ShopItem)
package fai.logic {
import fai.ui.*;
import flash.display.*;
import flash.filters.*;
import fai.*;
import fai.goals.*;
public class ShopItem extends MovieClip {
public var building_bar:MovieClip;
private var building_icon;// = null
private var color_matrix:Array;// = null
private var shop_sprite;// = null
private var customer_bar:ShopCustomerBar;// = null
private var number:int;// = 0
private var money_value:int;// = 0
private var engine:Engine;// = null
private var particles_goal;// = null
private var type:String;
private var level:int;// = 0
private var upgrading_goal:UpgradingGoal;// = null
private var building_goal:BuildingGoal;// = null
public var building_light:MovieClip;
private var awaits_building:Boolean;// = false
public function ShopItem():void{
engine = null;
level = 0;
building_icon = null;
color_matrix = null;
number = 0;
particles_goal = null;
awaits_building = false;
building_goal = null;
upgrading_goal = null;
shop_sprite = null;
customer_bar = null;
money_value = 0;
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function hideBuildingState():void{
awaits_building = false;
stopParticles();
if (building_icon){
removeChild(building_icon);
building_icon = null;
};
}
public function setShopIcon(_arg1):void{
if (shop_sprite){
removeChild(shop_sprite);
shop_sprite = null;
};
shop_sprite = _arg1;
addChild(shop_sprite);
}
public function startBuilding():void{
building_light.visible = false;
engine.payMoney(DataProxy.getBuildCost(type, 0));
building_goal = new BuildingGoal(engine, this);
engine.goal_system.add(building_goal);
}
public function get itemNumber():int{
return (number);
}
public function get shopBar():ShopCustomerBar{
return (customer_bar);
}
public function get shopType():String{
return (type);
}
function frame3(){
stop();
}
public function getShopSprite(){
return (shop_sprite);
}
public function updateState():void{
customer_bar.destroy();
customer_bar.create(DataProxy.getSeatsCount(type, level));
customer_bar.x = building_bar.x;
switch (level){
case 0:
case Consts.ShopLevel1:
customer_bar.y = 12;
building_bar.y = (customer_bar.y - building_bar.height);
break;
case Consts.ShopLevel2:
customer_bar.y = -20;
break;
case Consts.ShopLevel3:
customer_bar.y = -45;
break;
};
building_bar.y = ((customer_bar.y - building_bar.height) - 5);
money_value = DataProxy.getGoodsCost(type, level);
engine.showTooltip(null);
}
public function setNumber(_arg1:int):void{
number = _arg1;
}
public function setBuildingState(_arg1:String):void{
var _local2:ColorMatrixFilter;
var _local3:Array;
if (!color_matrix){
color_matrix = new Array();
color_matrix = color_matrix.concat([1, 0, 0, 0, 0]);
color_matrix = color_matrix.concat([1, 0, 0, 0, 0]);
color_matrix = color_matrix.concat([1, 0, 0, 0, 0]);
color_matrix = color_matrix.concat([0, 0, 0, 1, 0]);
};
hideBuildingState();
awaits_building = true;
gotoAndStop("building_state");
building_icon = DataProxy.getShopIcon(_arg1);
building_icon.scaleX = (building_icon.scaleY = (60 / building_icon.width));
building_icon.x = ((width / 2) - (building_icon.width / 2));
building_icon.y = ((height - building_icon.height) + 70);
addChild(building_icon);
_local2 = new ColorMatrixFilter(color_matrix);
_local3 = new Array();
_local3.push(_local2);
building_icon.filters = _local3;
visible = true;
building_light.visible = true;
building_bar.visible = false;
particles_goal = new VParticleEffectGoal(building_light);
engine.goal_system.add(particles_goal);
}
public function initialize(_arg1:Engine):void{
engine = _arg1;
customer_bar = new ShopCustomerBar();
customer_bar.assign(engine, this);
customer_bar.visible = false;
addChild(customer_bar);
visible = false;
building_bar.visible = false;
stop();
buttonMode = true;
mouseChildren = false;
building_bar.x = 5;
}
public function startUpgrading():void{
if (!customer_bar.wereCreated()){
return;
};
if (!customer_bar.isFree()){
engine.log("You can't upgrade the shop when the customers are shopping.");
return;
};
engine.payMoney(DataProxy.getBuildCost(type, (level + 1)));
upgrading_goal = new UpgradingGoal(engine, this);
engine.goal_system.add(upgrading_goal);
}
public function get moneyValue():int{
return (money_value);
}
public function get currentLevel():int{
return (level);
}
public function cancel():void{
if (underBuilding()){
building_goal.deactivate();
building_goal = null;
visible = false;
gotoAndStop("building_state");
building_bar.bar.scaleX = 1;
engine.returnMoney(DataProxy.getBuildCost(type, 0));
type = "";
awaits_building = false;
setLevel(0);
level = 0;
} else {
if (underUpgrading()){
upgrading_goal.cancel();
upgrading_goal = null;
engine.returnMoney(DataProxy.getBuildCost(type, (level + 1)));
};
};
}
public function get awaitsBuilding():Boolean{
return (awaits_building);
}
public function handleClick():void{
if (awaits_building){
setType(engine.shops.buildingType);
engine.shops.hideBuildingIcons();
visible = true;
startBuilding();
};
}
public function setLevel(_arg1:int):void{
if (level != _arg1){
level = _arg1;
engine.playWindow.updateAll();
};
}
public function underBuilding():Boolean{
return (((building_goal) && (building_goal.active)));
}
public function setUpgradingState():void{
setLevel(Consts.ShopUpgrading);
}
public function setType(_arg1:String):void{
type = _arg1;
}
function frame1(){
stop();
}
private function stopParticles():void{
if (particles_goal){
particles_goal.deactivate();
particles_goal = null;
};
}
public function underUpgrading():Boolean{
return (((upgrading_goal) && (upgrading_goal.active)));
}
function frame2(){
stop();
}
}
}//package fai.logic
Section 29
//Shops (fai.logic.Shops)
package fai.logic {
import flash.events.*;
public class Shops {
private var engine:Engine;// = null
private var building_type:String;
private var shops:Array;
public function Shops(_arg1:Engine):void{
engine = null;
shops = [];
super();
engine = _arg1;
}
public function size():int{
return (shops.length);
}
public function getItem(_arg1:int):ShopItem{
return (shops[_arg1]);
}
public function hideBuildingIcons():void{
var _local1:int;
building_type = "";
_local1 = 0;
_local1 = 0;
while (_local1 < size()) {
if (shops[_local1].awaitsBuilding){
shops[_local1].hideBuildingState();
shops[_local1].visible = false;
};
_local1++;
};
engine.playWindow.updateAll();
}
public function get buildingType():String{
return (building_type);
}
public function showBuildingIcons(_arg1:String):void{
var _local2:int;
building_type = _arg1;
_local2 = 0;
_local2 = 0;
while (_local2 < size()) {
if (shops[_local2].currentLevel == 0){
shops[_local2].setBuildingState(_arg1);
};
_local2++;
};
engine.playWindow.updateAll();
engine.extras.cancelSketchyState();
}
public function awaitBuilding():Boolean{
var _local1:int;
_local1 = 0;
_local1 = 0;
while (_local1 < size()) {
if (shops[_local1].awaitsBuilding){
return (true);
};
_local1++;
};
return (false);
}
public function getItemByType(_arg1:String):ShopItem{
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < shops.length) {
if (shops[_local2].shopType == _arg1){
return (shops[_local2]);
};
_local2++;
};
return (null);
}
public function addItem(_arg1:ShopItem):void{
_arg1.setNumber(shops.length);
shops.push(_arg1);
}
public function hasType(_arg1:String):Boolean{
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < shops.length) {
if (((((!((shops[_local2] == null))) && ((shops[_local2].currentLevel > 0)))) && ((shops[_local2].shopType == _arg1)))){
return (true);
};
_local2++;
};
return (false);
}
public function destroy():void{
}
}
}//package fai.logic
Section 30
//ShopSeat (fai.logic.ShopSeat)
package fai.logic {
public class ShopSeat {
public var loaded:Boolean;// = false
public var percents:Number;// = 0
public var velocity:Number;// = 1
public var customer:Customer;// = null
public function ShopSeat():void{
loaded = false;
percents = 0;
velocity = 1;
customer = null;
super();
}
}
}//package fai.logic
Section 31
//Upgrades (fai.logic.Upgrades)
package fai.logic {
import fai.*;
public class Upgrades {
public var bus_stop:Boolean;// = false
private var engine:Engine;// = null
private var bus_went:Boolean;// = false
public function Upgrades(_arg1:Engine):void{
bus_stop = false;
bus_went = false;
engine = null;
super();
engine = _arg1;
}
public function busWentAlready():void{
bus_went = true;
engine.playWindow.updateResources();
}
public function upgradeBusStop():void{
if (bus_stop){
return;
};
bus_stop = true;
engine.playWindow.ui.bus_stop.gotoAndPlay("start_animation");
engine.playWindow.ui.bus_stop_sign.gotoAndPlay("start_animation");
if (engine.scenario.currentDay > 0){
runBusRun();
};
}
public function nextDay():void{
if (bus_stop){
bus_went = false;
runBusRun();
};
}
public function destroy():void{
engine.playWindow.ui.bus_clip.stop();
bus_went = false;
}
public function busWent():Boolean{
if (((!(bus_stop)) || (bus_went))){
return (true);
};
return (false);
}
public function runBusRun():void{
if (bus_went){
return;
};
engine.playWindow.ui.bus_clip.gotoAndPlay("start_animation");
}
public function pause(_arg1:Boolean):void{
if (_arg1){
if (((bus_stop) && (!(bus_went)))){
engine.playWindow.ui.bus_clip.stop();
};
} else {
if (((bus_stop) && (!(bus_went)))){
engine.playWindow.ui.bus_clip.play();
};
};
}
}
}//package fai.logic
Section 32
//BusClip (fai.ui.BusClip)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import fai.goals.*;
public class BusClip extends MovieClip {
public var engine:Engine;// = null
public function BusClip():void{
engine = null;
super();
addFrameScript(0, frame1, 99, frame100, 327, frame328);
stop();
}
function frame328(){
busLeft();
}
private function busStopped():void{
if (engine.goal_system){
engine.goal_system.add(new BusPeopleGoal(engine));
};
}
function frame1(){
stop();
}
function frame100(){
busStopped();
}
private function busLeft():void{
if (engine.playWindow){
engine.upgrades.busWentAlready();
};
}
}
}//package fai.ui
Section 33
//CoinMotion (fai.ui.CoinMotion)
package fai.ui {
import flash.display.*;
public class CoinMotion extends MovieClip {
public var finished:Boolean;// = false
public function CoinMotion():void{
finished = false;
super();
addFrameScript(31, frame32);
}
function frame32(){
finished = true;
}
}
}//package fai.ui
Section 34
//CustomersBar (fai.ui.CustomersBar)
package fai.ui {
import flash.display.*;
public dynamic class CustomersBar extends Sprite {
public var bar:MovieClip;
}
}//package fai.ui
Section 35
//ExtraItem (fai.ui.ExtraItem)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import fai.*;
public class ExtraItem extends MovieClip {
private var loaded:int;// = 0
private var seats:Array;
private var seats_length:int;// = 0
private var current_state:String;
private var engine:Engine;// = null
private var awaits:Boolean;// = false
public var inner_extra:MovieClip;
public function ExtraItem():void{
var _local1:int;
engine = null;
awaits = false;
loaded = 0;
seats = [];
seats_length = 0;
super();
addFrameScript(0, frame1, 1, frame2);
current_state = StringConsts.empty;
seats.length = 10;
_local1 = 0;
_local1 = 0;
while (_local1 < seats.length) {
seats[_local1] = null;
_local1++;
};
}
public function loadCustomer(_arg1:Customer):int{
var _local2:int;
if (hasRoom()){
_local2 = 0;
_local2 = 0;
while (_local2 < seats_length) {
if (seats[_local2] == null){
seats[_local2] = _arg1;
loaded++;
return ((_local2 + 1));
};
_local2++;
};
};
return (-1);
}
public function setCurrentState(_arg1:String):void{
current_state = _arg1;
correctState();
}
public function get isAwaiting():Boolean{
return (awaits);
}
public function setAwaiting(_arg1:Boolean):void{
awaits = _arg1;
}
public function correctState():void{
switch (current_state){
case StringConsts.bench:
inner_extra.gotoAndStop(StringConsts.bench);
seats_length = Consts.BenchSpace;
break;
case StringConsts.music_box:
inner_extra.gotoAndStop(StringConsts.music_box);
seats_length = Consts.MusicBoxSpace;
break;
case StringConsts.news_box:
inner_extra.gotoAndStop(StringConsts.news_box);
seats_length = Consts.NewsBoxSpace;
break;
};
}
function frame1(){
stop();
correctState();
}
public function setNormalState():void{
gotoAndStop("normal");
correctState();
}
function frame2(){
correctState();
}
public function hasRoom():Boolean{
switch (current_state){
case StringConsts.bench:
if (loaded >= Consts.BenchSpace){
return (false);
};
break;
case StringConsts.music_box:
if (loaded >= Consts.MusicBoxSpace){
return (false);
};
break;
case StringConsts.news_box:
if (loaded >= Consts.NewsBoxSpace){
return (false);
};
break;
};
return (true);
}
public function get currentState():String{
return (current_state);
}
public function setSketchyState():void{
gotoAndStop("sketchy");
correctState();
}
public function unloadCustomer(_arg1:Customer):void{
var _local2:int;
if (loaded > 0){
_local2 = 0;
_local2 = 0;
while (_local2 < seats_length) {
if (seats[_local2] == _arg1){
seats[_local2] = null;
loaded--;
return;
};
_local2++;
};
};
}
}
}//package fai.ui
Section 36
//LevelButton (fai.ui.LevelButton)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import flash.filters.*;
public class LevelButton extends MovieClip {
public var filter_back:MovieClip;
private var engine:Engine;// = null
private var level_id:int;// = 0
public var red_back:MovieClip;
public var won_back:MovieClip;
public function LevelButton():void{
engine = null;
level_id = 0;
super();
}
public function select(_arg1:Boolean):void{
var _local2:BitmapFilter;
var _local3:Array;
if (_arg1){
_local2 = getBitmapFilter();
_local3 = new Array();
_local3.push(_local2);
filter_back.filters = _local3;
} else {
filter_back.filters = new Array();
};
}
public function levelClosed():void{
clear();
red_back.visible = true;
won_back.visible = false;
}
public function levelCurrent():void{
clear();
red_back.visible = true;
won_back.visible = false;
startAnimation();
}
public function levelWon():void{
clear();
won_back.visible = true;
red_back.visible = false;
}
public function initialize(_arg1:Engine, _arg2:int):void{
engine = _arg1;
level_id = _arg2;
buttonMode = true;
mouseChildren = false;
}
public function clear():void{
stopAnimation();
}
public function stopAnimation():void{
}
public function startAnimation():void{
stopAnimation();
}
public function get levelId():int{
return (level_id);
}
private function getBitmapFilter():BitmapFilter{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Boolean;
var _local7:Boolean;
var _local8:Number;
_local1 = 9540095;
_local2 = 1;
_local3 = 35;
_local4 = 35;
_local5 = 3;
_local6 = false;
_local7 = false;
_local8 = BitmapFilterQuality.HIGH;
return (new GlowFilter(_local1, _local2, _local3, _local4, _local5, _local8, _local6, _local7));
}
}
}//package fai.ui
Section 37
//LevelInfoPanel (fai.ui.LevelInfoPanel)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import flash.text.*;
public class LevelInfoPanel extends MovieClip {
public var resume_game_button:SimpleButton;
public var title:TextField;
public var desc:TextField;
public var days_txt:TextField;
public var play_button:SimpleButton;
public var goal_amount_txt:TextField;
public function showLevelInfo(_arg1:Level):void{
if (_arg1){
title.text = _arg1.type;
desc.text = _arg1.description;
days_txt.text = _arg1.days.toString();
goal_amount_txt.text = (_arg1.money_goal.toString() + "$");
};
}
}
}//package fai.ui
Section 38
//LevelSelection (fai.ui.LevelSelection)
package fai.ui {
import fai.logic.*;
import flash.media.*;
import flash.events.*;
import flash.display.*;
import fai.common.*;
import flash.text.*;
import flash.utils.*;
import fai.*;
import flash.net.*;
public class LevelSelection extends Sprite {
private var level_msg_timer:Timer;// = null
public var instructions_button:SimpleButton;
public var hello_mc:MovieClip;
public var sound_control:MovieClip;
public var level2:MovieClip;
public var level5:MovieClip;
public var level6:MovieClip;
public var level7:MovieClip;
public var level1:MovieClip;
public var level9:MovieClip;
public var level3:MovieClip;
public var level4:MovieClip;
public var level8:MovieClip;
public var current_level:int;// = 0
public var dedegames_button:SimpleButton;
private var engine:Engine;// = null
private var music_sound:Sound;// = null
public var level_info:MovieClip;
private var hello_closed:Boolean;// = false
public var level_msg:MovieClip;
public var level11:MovieClip;
public var level13:MovieClip;
public var level14:MovieClip;
public var level15:MovieClip;
public var level16:MovieClip;
public var level12:MovieClip;
public var level10:MovieClip;
private var level_array:Array;
public var music_channel:SoundChannel;// = null
public function LevelSelection():void{
engine = null;
current_level = 0;
level_array = [];
level_msg_timer = null;
hello_closed = false;
music_sound = null;
music_channel = null;
super();
}
private function resumeGameClickHandler(_arg1:MouseEvent):void{
visible = false;
stopMusic();
engine.playSound(SoundConsts.click);
engine.play_window.show();
engine.pause();
}
public function loadLevels():void{
var _local1:*;
_local1 = SharedObject.getLocal("shopping_mogul_4", "/");
current_level = _local1.data.current_level;
}
public function initializeLevelButtons(_arg1:Array):void{
var _local2:int;
var _local3:LevelButton;
_local2 = 0;
_local2 = 0;
while (_local2 < level_array.length) {
_local3 = level_array[_local2];
_local3.initialize(engine, _local2);
_local3.addEventListener(MouseEvent.MOUSE_DOWN, levelClickHandler);
_local3.addEventListener(MouseEvent.MOUSE_OVER, levelOverHandler);
_local3.addEventListener(MouseEvent.MOUSE_OUT, levelOutHandler);
_local2++;
};
}
public function stopMusic():void{
if (music_channel){
music_channel.stop();
music_channel = null;
};
}
public function saveLevels():void{
var _local1:*;
_local1 = SharedObject.getLocal("shopping_mogul_4", "/");
_local1.data.current_level = current_level;
_local1.flush();
}
public function playMusic():void{
var _local1:SoundTransform;
stopMusic();
if (!engine.volumeOff){
_local1 = new SoundTransform();
_local1.volume = engine.volume;
music_channel = music_sound.play(0, 99999, _local1);
};
}
public function initialize(_arg1:Engine):void{
var _local2:Array;
engine = _arg1;
level_info.play_button.addEventListener(MouseEvent.MOUSE_DOWN, playNextClickHanler);
level_info.resume_game_button.addEventListener(MouseEvent.MOUSE_DOWN, resumeGameClickHandler);
level_info.resume_game_button.visible = false;
hello_mc.start_button.addEventListener(MouseEvent.MOUSE_DOWN, startHelloHandler);
level_msg_timer = new Timer(1000, 0);
level_msg_timer.addEventListener(TimerEvent.TIMER, levelMsgTimer);
level_msg_timer.stop();
level_msg.visible = false;
level_msg.stop();
level_array = [level1, level2, level3, level4, level5, level6, level7, level8, level9, level10, level11, level12, level13, level14, level15, level16];
music_sound = new Sound_music();
sound_control.setEngine(engine);
_local2 = engine.gameData.getLevels();
initializeLevelButtons(_local2);
setLevel(0);
loadLevels();
updateLevels();
dedegames_button.addEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
}
public function updateLevels():void{
var _local1:int;
_local1 = 0;
_local1 = 0;
while (_local1 < level_array.length) {
if (_local1 < current_level){
level_array[_local1].levelWon();
} else {
if (_local1 == current_level){
level_array[_local1].levelCurrent();
} else {
level_array[_local1].levelClosed();
};
};
_local1++;
};
}
private function playNextClickHanler(_arg1:MouseEvent):void{
hello_closed = true;
hello_mc.visible = false;
engine.playSound(SoundConsts.click);
playLevel(current_level);
}
public function clear():void{
}
private function showLevelMessage():void{
level_msg_timer.stop();
level_msg.msg.text = (("Level " + (current_level + 1).toString()) + " wasn't completed");
level_msg.visible = true;
level_msg_timer.start();
}
private function playLevel(_arg1:int):void{
hello_closed = true;
hello_mc.visible = false;
visible = false;
stopMusic();
if (_arg1 < engine.gameData.getLevels().length){
engine.playLevel(engine.gameData.getLevel(_arg1));
} else {
engine.playLevel(engine.gameData.getLevel((engine.gameData.getLevels().length - 1)));
};
}
public function setLevel(_arg1:int):void{
var _local2:Level;
_local2 = engine.gameData.getLevel(_arg1);
level_info.showLevelInfo(_local2);
current_level = _arg1;
}
private function levelOverHandler(_arg1:MouseEvent):void{
if ((_arg1.currentTarget is LevelButton)){
_arg1.currentTarget.select(true);
};
}
private function levelOutHandler(_arg1:MouseEvent):void{
if ((_arg1.currentTarget is LevelButton)){
_arg1.currentTarget.select(false);
};
}
private function startHelloHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
hello_closed = true;
hello_mc.visible = false;
}
private function instructionsHandler(_arg1:MouseEvent):void{
}
private function levelMsgTimer(_arg1:TimerEvent):void{
level_msg.visible = false;
}
private function levelClickHandler(_arg1:MouseEvent):void{
var _local2:int;
if ((_arg1.currentTarget is LevelButton)){
engine.playSound(SoundConsts.click);
_local2 = (_arg1.currentTarget as LevelButton).levelId;
if (_local2 <= current_level){
playLevel(_local2);
} else {
showLevelMessage();
};
};
}
public function show():void{
if (engine.playWindow != null){
level_info.play_button.visible = false;
level_info.resume_game_button.visible = true;
} else {
level_info.play_button.visible = true;
level_info.resume_game_button.visible = false;
};
updateLevels();
saveLevels();
setLevel(current_level);
playMusic();
if ((((0 == current_level)) && (!(hello_closed)))){
hello_mc.visible = true;
} else {
hello_mc.visible = false;
};
visible = true;
}
}
}//package fai.ui
Section 39
//ShopBuilding (fai.ui.ShopBuilding)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import fai.*;
public class ShopBuilding extends MovieClip {
public var shop_holder:MovieClip;
private var shop_sprite;// = null
private var parent_item:ShopItem;// = null
public function ShopBuilding(_arg1:ShopItem, _arg2):void{
shop_sprite = null;
parent_item = null;
super();
addFrameScript(29, frame30);
shop_sprite = _arg2;
parent_item = _arg1;
if (shop_holder){
shop_sprite.x = (-(shop_sprite.width) / 2);
shop_holder.addChild(shop_sprite);
};
}
function frame30(){
stop();
finish();
}
public function finish():void{
shop_sprite.x = 3;
shop_sprite.y = ((parent_item.height - shop_sprite.height) + 20);
parent_item.setShopIcon(shop_sprite);
parent_item.setLevel(Consts.ShopLevel1);
parent_item.updateState();
}
}
}//package fai.ui
Section 40
//ShopButton (fai.ui.ShopButton)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import fai.common.*;
import flash.text.*;
import fai.*;
public class ShopButton extends MovieClip {
public var button_stars:MovieClip;
public var icon_holder:MovieClip;
private var engine:Engine;// = null
private var type:String;
public var assigned:ShopItem;// = null
public function ShopButton():void{
engine = null;
assigned = null;
super();
}
public function setEngine(_arg1:Engine):void{
engine = _arg1;
}
public function updateButton(_arg1, _arg2):void{
if (assigned){
switch (assigned.currentLevel){
case 0:
_arg1.gotoAndStop("one_star");
break;
case Consts.ShopLevel1:
_arg1.gotoAndStop("two_stars");
break;
case Consts.ShopLevel2:
_arg1.gotoAndStop("three_stars");
break;
case Consts.ShopLevel3:
_arg1.gotoAndStop("three_stars");
break;
};
_arg2.visible = true;
if (assigned.shopType != ""){
_arg2.gotoAndStop(DataProxy.getIconLabel(assigned));
} else {
_arg2.gotoAndStop((type + "1"));
};
};
}
public function get buttonType():String{
return (type);
}
public function setType(_arg1:String):void{
type = _arg1;
}
public function assign(_arg1:ShopItem):void{
assigned = _arg1;
}
}
}//package fai.ui
Section 41
//ShopCustomerBar (fai.ui.ShopCustomerBar)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import flash.text.*;
import fai.goals.*;
public class ShopCustomerBar extends Sprite {
private var shop_capacity:int;// = 0
private var seats:Array;// = null
public var bar:MovieClip;
private var engine:Engine;// = null
public var count_txt:TextField;
private var seats_goal:SeatsGoal;// = null
private var shop:ShopItem;// = null
public function ShopCustomerBar():void{
engine = null;
seats_goal = null;
shop = null;
seats = null;
shop_capacity = 0;
super();
}
public function create(_arg1:int):void{
var _local2:int;
destroy();
seats = new Array();
shop_capacity = _arg1;
_local2 = 0;
_local2 = 0;
while (_local2 < shop_capacity) {
seats.push(new ShopSeat());
_local2++;
};
seats_goal = new SeatsGoal(engine, seats, shop);
engine.goal_system.add(seats_goal);
visible = true;
bar.visible = false;
update();
}
public function wereCreated():Boolean{
return (!((seats_goal == null)));
}
public function hasRoom():Boolean{
if (!seats_goal){
return (false);
};
return ((seats_goal.loadedCount < shop_capacity));
}
public function isFree():Boolean{
if (!seats_goal){
return (true);
};
return ((seats_goal.loadedCount == 0));
}
public function update():void{
if (seats_goal){
count_txt.text = ((seats_goal.loadedCount.toString() + "/") + shop_capacity.toString());
if (seats_goal.loadedCount){
bar.visible = true;
bar.scaleX = (seats_goal.loadedCount / shop_capacity);
} else {
bar.visible = false;
};
};
}
public function load(_arg1:Customer):ShopSeat{
return (seats_goal.loadCustomer(_arg1));
}
public function assign(_arg1:Engine, _arg2:ShopItem):void{
engine = _arg1;
shop = _arg2;
}
public function destroy():void{
if (seats_goal){
seats_goal.deactivate();
seats_goal = null;
seats.length = 0;
seats = null;
};
}
}
}//package fai.ui
Section 42
//SoundControlMC (fai.ui.SoundControlMC)
package fai.ui {
import fai.logic.*;
import flash.media.*;
import fl.controls.*;
import flash.display.*;
import fai.common.*;
import flash.text.*;
import fl.events.*;
public class SoundControlMC extends MovieClip {
private var sound_slider:Slider;// = null
public var engine:Engine;// = null
public function SoundControlMC():void{
engine = null;
sound_slider = null;
super();
sound_slider = new Slider();
sound_slider.liveDragging = true;
sound_slider.setSize(100, 0);
sound_slider.maximum = 100;
sound_slider.minimum = 0;
sound_slider.tickInterval = 5;
sound_slider.addEventListener(SliderEvent.CHANGE, musicChange);
sound_slider.x = 60;
sound_slider.y = -10;
addChild(sound_slider);
sound_slider.value = 100;
}
public function destroy():void{
sound_slider.removeEventListener(SliderEvent.CHANGE, musicChange);
removeChild(sound_slider);
sound_slider = null;
}
private function musicChange(_arg1:SliderEvent):void{
var _local2:SoundTransform;
engine.volume = (sound_slider.value / 100);
if (GameStage.welcomeScreen.levelSelection.music_channel){
_local2 = GameStage.welcomeScreen.levelSelection.music_channel.soundTransform;
_local2.volume = engine.volume;
GameStage.welcomeScreen.levelSelection.music_channel.soundTransform = _local2;
};
}
public function setEngine(_arg1:Engine):void{
engine = _arg1;
sound_slider.value = (engine.volume * 100);
}
}
}//package fai.ui
Section 43
//Statistics (fai.ui.Statistics)
package fai.ui {
import fai.logic.*;
import flash.media.*;
import flash.events.*;
import flash.display.*;
import fai.common.*;
import flash.text.*;
import flash.utils.*;
import fai.*;
public class Statistics extends Sprite {
public var dede_games:SimpleButton;
public var stat_caption:MovieClip;
public var bonus:int;// = 0
public var spent_txt:TextField;
public var built_txt:TextField;
public var score_txt:TextField;
private var engine:Engine;// = null
public var bonus_txt:TextField;
public var final_victory:MovieClip;
public var spent:int;// = 0
private var music_sound:Sound;// = null
public var earned:int;// = 0
public var built:int;// = 0
private var score:int;// = 0
public var earned_txt:TextField;
private var counterTimer:Timer;// = null
public var sad_smileys:MovieClip;
public var happy_smileys:MovieClip;
public var continue_button:SimpleButton;
public var firework1:MovieClip;
public var firework2:MovieClip;
public var music_channel:SoundChannel;// = null
private var back:AnimatedBitmap;// = null
public function Statistics():void{
earned = 0;
spent = 0;
built = 0;
bonus = 0;
score = 0;
engine = null;
counterTimer = null;
back = null;
music_sound = null;
music_channel = null;
super();
}
public function victory():void{
firework1.play();
firework2.play();
stat_caption.innerc.stat_title.text = "Well Done!";
continue_button.visible = true;
happy_smileys.visible = true;
sad_smileys.visible = false;
music_sound = new Sound_tada();
}
private function counter(_arg1, _arg2:int):int{
var _local3:int;
if (_arg2 > 0){
_local3 = ((_arg2 > 30)) ? (_arg2 / 30) : _arg2;
_arg1.text = (int(_arg1.text) + _local3).toString();
return (_local3);
};
return (0);
}
public function setEngine(_arg1:Engine):void{
engine = _arg1;
continue_button.addEventListener(MouseEvent.MOUSE_DOWN, showLevels);
dede_games.addEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
happy_smileys.visible = false;
sad_smileys.visible = false;
firework1.stop();
firework2.stop();
}
public function stopMusic():void{
if (music_channel){
music_channel.stop();
music_channel = null;
};
}
public function start():void{
playMusic();
earned_txt.text = "0";
spent_txt.text = "0";
built_txt.text = "0";
bonus_txt.text = "0";
score_txt.text = "0";
score = engine.score;
counterTimer = new Timer(30, 0);
counterTimer.addEventListener(TimerEvent.TIMER, counterTick);
counterTimer.start();
}
public function playMusic():void{
var _local1:SoundTransform;
stopMusic();
if (((!(engine.volumeOff)) && (music_sound))){
_local1 = new SoundTransform();
_local1.volume = engine.volume;
music_channel = music_sound.play(0, 1, _local1);
};
}
public function defeat():void{
stat_caption.innerc.stat_title.text = "Failed. Try Again!";
happy_smileys.visible = false;
sad_smileys.visible = true;
music_sound = new Sound_sigh();
}
private function playAgain(_arg1:MouseEvent):void{
visible = false;
engine.playSound(SoundConsts.click);
engine.playLevel(engine.lastLevel);
}
private function mainMenu(_arg1:MouseEvent):void{
visible = false;
engine.playSound(SoundConsts.click);
engine.clearAll();
GameStage.welcomeScreen.showWelcome();
}
private function counterTick(_arg1:TimerEvent):void{
earned = (earned - counter(earned_txt, earned));
spent = (spent - counter(spent_txt, spent));
built = (built - counter(built_txt, built));
bonus = (bonus - counter(bonus_txt, bonus));
score = (score - counter(score_txt, score));
if (((((earned + spent) + built) + bonus) + score) == 0){
counterTimer.stop();
counterTimer.removeEventListener(TimerEvent.TIMER, counterTick);
counterTimer = null;
};
}
private function showLevels(_arg1:MouseEvent):void{
visible = false;
engine.playSound(SoundConsts.click);
engine.clearAll();
if (engine.lastLevel.number >= (engine.gameData.getLevels().length - 1)){
GameStage.welcomeScreen.showWelcome();
} else {
GameStage.welcomeScreen.showLevelSelection();
};
}
public function destroy():void{
if (counterTimer){
counterTimer.stop();
counterTimer.removeEventListener(TimerEvent.TIMER, counterTick);
counterTimer = null;
};
stopMusic();
dede_games.removeEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
continue_button.removeEventListener(MouseEvent.MOUSE_DOWN, showLevels);
}
}
}//package fai.ui
Section 44
//TutorialMC (fai.ui.TutorialMC)
package fai.ui {
import fai.logic.*;
import flash.events.*;
import flash.display.*;
import fai.*;
public class TutorialMC extends MovieClip {
public var next_button:SimpleButton;
public var close_button:SimpleButton;
private var engine:Engine;// = null
public var current_page:String;// = "page1"
public function TutorialMC():void{
engine = null;
current_page = "page1";
super();
addFrameScript(0, frame1);
}
public function destroy():void{
next_button.removeEventListener(MouseEvent.MOUSE_DOWN, continueClick);
close_button.removeEventListener(MouseEvent.MOUSE_DOWN, skipClick);
}
public function init(_arg1:Engine):void{
engine = _arg1;
next_button.addEventListener(MouseEvent.MOUSE_DOWN, continueClick);
close_button.addEventListener(MouseEvent.MOUSE_DOWN, skipClick);
}
private function continueClick(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
switch (current_page){
case "page1":
gotoPage("page2");
break;
case "page2":
gotoPage("page3");
break;
default:
hideTutorial();
break;
};
}
private function skipClick(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
hideTutorial();
}
function frame1(){
stop();
}
public function showTutorial():void{
gotoPage("page1");
visible = true;
}
public function gotoPage(_arg1:String):void{
current_page = _arg1;
gotoAndStop(_arg1);
}
private function hideTutorial():void{
destroy();
visible = false;
}
}
}//package fai.ui
Section 45
//WelcomeScreen (fai.ui.WelcomeScreen)
package fai.ui {
import fai.logic.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fai.*;
public dynamic class WelcomeScreen extends MovieClip {
public var more_games_button:SimpleButton;
private var engine:Engine;// = null
private var level_selection:LevelSelection;// = null
public var start_game_button:SimpleButton;
private var initialized:Boolean;// = false
public function WelcomeScreen():void{
level_selection = null;
engine = null;
initialized = false;
super();
}
private function startGameHandler(_arg1:MouseEvent):void{
showLevelSelection();
}
public function get levelSelection():LevelSelection{
return (level_selection);
}
public function initialize():void{
start_game_button.addEventListener(MouseEvent.MOUSE_DOWN, startGameHandler);
more_games_button.addEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
GameStage.play_holder = new Sprite();
addChild(GameStage.play_holder);
engine = new Engine(GameStage.main_stage);
level_selection = new LevelSelection();
level_selection.initialize(engine);
level_selection.visible = false;
GameStage.play_holder.addChild(level_selection);
}
public function clear():void{
if (engine){
level_selection.stopMusic();
removeChild(GameStage.play_holder);
engine.clearAll();
engine = null;
};
}
public function showWelcome():void{
visible = true;
level_selection.visible = false;
}
public function showLevelSelection():void{
if (!level_selection){
return;
};
level_selection.show();
}
private function hsHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
}
private function instructionsHandler(_arg1:MouseEvent):void{
}
}
}//package fai.ui
Section 46
//Consts (fai.Consts)
package fai {
public class Consts {
public static const Down:uint = 3;
public static const BusPeopleCount:int = 10;
public static const CustomerShopEnteringLine:int = 275;
public static const ScreenHeight:int = 525;
public static const NewsBoxSpace:int = 5;
public static const BenchSpace:int = 3;
public static const SpriteHeight:int = 35;
public static const CustomerWalkRange:int = 25;
public static const MusicBoxSpace:int = 5;
public static const ScreenWidth:int = 700;
public static const ShopLevel1:int = 1;
public static const ShopLevel2:int = 2;
public static const ShopLevel3:int = 3;
public static const Left:uint = 0;
public static const SpriteWidth:int = 15;
public static const GOALSCLEANPAUSE:uint = 10;
public static const ShopBuilding:int = 4;
public static const ShopUpgrading:int = 5;
public static const Top:uint = 2;
public static const CustomerWalkLine:int = 290;
public static const Right:uint = 1;
public static const NewspaperCost:int = 5;
}
}//package fai
Section 47
//SoundConsts (fai.SoundConsts)
package fai {
public final class SoundConsts {
public static var coins:int = 4;
public static var click:int = 3;
public static var victory:int = 0;
public static var build:int = 1;
public static var sigh:int = 2;
public static var new_day:int = 5;
}
}//package fai
Section 48
//StringConsts (fai.StringConsts)
package fai {
public class StringConsts {
public static const super_market:String = "Super Market";
public static const pet_shop:String = "Pet Shop";
public static const not_enough_money:String = "You don't have enough money.";
public static const level10:String = "Level 10";
public static const level11:String = "Level 11";
public static const level12:String = "Level 12";
public static const level13:String = "Level 13";
public static const level14:String = "Level 14";
public static const level15:String = "Level 15";
public static const level16:String = "Level 16";
public static const level1:String = "Level 1";
public static const level2:String = "Level 2";
public static const level3:String = "Level 3";
public static const level4:String = "Level 4";
public static const level5:String = "Level 5";
public static const level6:String = "Level 6";
public static const level7:String = "Level 7";
public static const level8:String = "Level 8";
public static const level9:String = "Level 9";
public static const bench:String = "Benches";
public static const music_box:String = "Music Box";
public static const toy_store:String = "Toy Store";
public static const empty:String = "Empty";
public static const jewelry:String = "Jewelry";
public static const news_box:String = "News Box";
public static const bus_stop:String = "Bus Stop";
public static const food:String = "Food";
public static const furniture:String = "Furniture Store";
public static const boutique:String = "Boutique";
public static const electronics:String = "Electronics";
}
}//package fai
Section 49
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import fl.events.*;
import flash.utils.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 50
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 51
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 52
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import flash.text.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 53
//Slider (fl.controls.Slider)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class Slider extends UIComponent implements IFocusManagerComponent {
protected var _direction:String;
protected var _liveDragging:Boolean;// = false
protected var _value:Number;// = 0
protected var _snapInterval:Number;// = 0
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var track:BaseButton;
protected var _tickInterval:Number;// = 0
protected var tickContainer:Sprite;
protected var thumb:BaseButton;
protected static const TICK_STYLES:Object = {upSkin:"tickSkin"};
protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"};
protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"};
protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null};
public function Slider(){
_direction = SliderDirection.HORIZONTAL;
_minimum = 0;
_maximum = 10;
_value = 0;
_tickInterval = 0;
_snapInterval = 0;
_liveDragging = false;
super();
setStyles();
}
public function get minimum():Number{
return (_minimum);
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
this.value = Math.max(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
protected function positionThumb():void{
thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? ((maximum - minimum) - value) : (value - minimum) / (maximum - minimum)) * _width);
}
protected function clearTicks():void{
if (((!(tickContainer)) || (!(tickContainer.parent)))){
return;
};
removeChild(tickContainer);
}
protected function onTrackClick(_arg1:MouseEvent):void{
calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK);
if (!liveDragging){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE));
};
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
this.value = Math.min(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get liveDragging():Boolean{
return (_liveDragging);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_width / snapInterval);
_local3 = track.mouseX;
calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:uint;
var _local3:Number;
var _local4:Boolean;
if (!enabled){
return;
};
_local2 = ((snapInterval)>0) ? snapInterval : 1;
_local4 = (direction == SliderDirection.HORIZONTAL);
if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){
_local3 = (value - _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){
_local3 = (value + _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){
_local3 = minimum;
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){
_local3 = maximum;
};
};
};
};
if (!isNaN(_local3)){
_arg1.stopPropagation();
doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode);
};
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
super.enabled = _arg1;
track.enabled = (thumb.enabled = _arg1);
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
}
public function get snapInterval():Number{
return (_snapInterval);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
public function set liveDragging(_arg1:Boolean):void{
_liveDragging = _arg1;
}
public function set value(_arg1:Number):void{
doSetValue(_arg1);
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
_direction = _arg1;
_local2 = (_direction == SliderDirection.VERTICAL);
if (isLivePreview){
if (_local2){
setScaleY(-1);
y = track.height;
} else {
setScaleY(1);
y = 0;
};
positionThumb();
return;
};
if (((_local2) && (componentInspectorSetting))){
if ((rotation % 90) == 0){
setScaleY(-1);
};
};
if (!componentInspectorSetting){
rotation = (_local2) ? 90 : 0;
};
}
public function set tickInterval(_arg1:Number):void{
_tickInterval = _arg1;
invalidate(InvalidationType.SIZE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
track.setSize(_width, track.height);
track.drawNow();
thumb.drawNow();
};
if (tickInterval > 0){
drawTicks();
} else {
clearTicks();
};
positionThumb();
super.draw();
}
override protected function configUI():void{
super.configUI();
thumb = new BaseButton();
thumb.setSize(13, 13);
thumb.autoRepeat = false;
addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
track = new BaseButton();
track.move(0, 0);
track.setSize(80, 4);
track.autoRepeat = false;
track.useHandCursor = false;
track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
addChildAt(track, 0);
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
}
public function get value():Number{
return (_value);
}
public function get direction():String{
return (_direction);
}
public function get tickInterval():Number{
return (_tickInterval);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
invalidate(InvalidationType.SIZE);
}
protected function drawTicks():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:uint;
var _local5:DisplayObject;
clearTicks();
tickContainer = new Sprite();
_local1 = ((maximum)<1) ? (tickInterval / 100) : tickInterval;
_local2 = ((maximum - minimum) / _local1);
_local3 = (_width / _local2);
_local4 = 0;
while (_local4 <= _local2) {
_local5 = getDisplayObjectInstance(getStyleValue("tickSkin"));
_local5.x = (_local3 * _local4);
_local5.y = ((track.y - _local5.height) - 2);
tickContainer.addChild(_local5);
_local4++;
};
addChild(tickContainer);
}
protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{
var _local5:Number;
_local5 = ((_arg1 / _width) * (maximum - minimum));
if (_direction == SliderDirection.VERTICAL){
_local5 = (maximum - _local5);
} else {
_local5 = (minimum + _local5);
};
doSetValue(_local5, _arg2, _arg3, _arg4);
}
protected function getPrecision(_arg1:Number):Number{
var _local2:String;
_local2 = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local5 = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local6 = Math.pow(10, getPrecision(snapInterval));
_local7 = (_snapInterval * _local6);
_local8 = Math.round((_arg1 * _local6));
_local9 = (Math.round((_local8 / _local7)) * _local7);
_arg1 = (_local9 / _local6);
_value = Math.max(minimum, Math.min(maximum, _arg1));
} else {
_value = Math.max(minimum, Math.min(maximum, Math.round(_arg1)));
};
if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4));
};
positionThumb();
}
protected function setStyles():void{
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 54
//SliderDirection (fl.controls.SliderDirection)
package fl.controls {
public class SliderDirection {
public static var HORIZONTAL:String = "horizontal";
public static var VERTICAL:String = "vertical";
}
}//package fl.controls
Section 55
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 56
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 57
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.managers.*;
import fl.events.*;
import flash.utils.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 58
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 59
//InteractionInputType (fl.events.InteractionInputType)
package fl.events {
public class InteractionInputType {
public static const MOUSE:String = "mouse";
public static const KEYBOARD:String = "keyboard";
}
}//package fl.events
Section 60
//SliderEvent (fl.events.SliderEvent)
package fl.events {
import flash.events.*;
public class SliderEvent extends Event {
protected var _triggerEvent:String;
protected var _keyCode:Number;
protected var _value:Number;
protected var _clickTarget:String;
public static const CHANGE:String = "change";
public static const THUMB_PRESS:String = "thumbPress";
public static const THUMB_DRAG:String = "thumbDrag";
public static const THUMB_RELEASE:String = "thumbRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){
_value = _arg2;
_keyCode = _arg5;
_triggerEvent = _arg4;
_clickTarget = _arg3;
super(_arg1);
}
public function get clickTarget():String{
return (_clickTarget);
}
override public function clone():Event{
return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode));
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget"));
}
public function get triggerEvent():String{
return (_triggerEvent);
}
public function get value():Number{
return (_value);
}
public function get keyCode():Number{
return (_keyCode);
}
}
}//package fl.events
Section 61
//SliderEventClickTarget (fl.events.SliderEventClickTarget)
package fl.events {
public class SliderEventClickTarget {
public static const TRACK:String = "track";
public static const THUMB:String = "thumb";
}
}//package fl.events
Section 62
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import flash.events.*;
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 63
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 64
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 65
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 66
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.text.*;
import flash.utils.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 67
//af7_42 (shopping_street_fla.af7_42)
package shopping_street_fla {
import flash.display.*;
public dynamic class af7_42 extends MovieClip {
public function af7_42(){
addFrameScript(16, frame17);
}
function frame17(){
stop();
}
}
}//package shopping_street_fla
Section 68
//BonusAnimation_140 (shopping_street_fla.BonusAnimation_140)
package shopping_street_fla {
import flash.display.*;
public dynamic class BonusAnimation_140 extends MovieClip {
public var inner:MovieClip;
public function BonusAnimation_140(){
addFrameScript(0, frame1, 89, frame90);
}
function frame90(){
stop();
visible = false;
}
function frame1(){
stop();
}
}
}//package shopping_street_fla
Section 69
//BonusAnimationInner_141 (shopping_street_fla.BonusAnimationInner_141)
package shopping_street_fla {
import flash.display.*;
import flash.text.*;
public dynamic class BonusAnimationInner_141 extends MovieClip {
public var bonus_txt:TextField;
}
}//package shopping_street_fla
Section 70
//BusStopMotion_119 (shopping_street_fla.BusStopMotion_119)
package shopping_street_fla {
import flash.display.*;
public dynamic class BusStopMotion_119 extends MovieClip {
public function BusStopMotion_119(){
addFrameScript(0, frame1, 34, frame35);
}
function frame1(){
stop();
}
function frame35(){
stop();
}
}
}//package shopping_street_fla
Section 71
//BusStopSignMotion_130 (shopping_street_fla.BusStopSignMotion_130)
package shopping_street_fla {
import flash.display.*;
public dynamic class BusStopSignMotion_130 extends MovieClip {
public function BusStopSignMotion_130(){
addFrameScript(0, frame1, 34, frame35);
}
function frame1(){
stop();
}
function frame35(){
stop();
}
}
}//package shopping_street_fla
Section 72
//ButtonStars_154 (shopping_street_fla.ButtonStars_154)
package shopping_street_fla {
import flash.display.*;
public dynamic class ButtonStars_154 extends MovieClip {
public function ButtonStars_154(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package shopping_street_fla
Section 73
//CustomerFace_100 (shopping_street_fla.CustomerFace_100)
package shopping_street_fla {
import flash.display.*;
public dynamic class CustomerFace_100 extends MovieClip {
public function CustomerFace_100(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package shopping_street_fla
Section 74
//ExtraButtons_166 (shopping_street_fla.ExtraButtons_166)
package shopping_street_fla {
import flash.display.*;
public dynamic class ExtraButtons_166 extends MovieClip {
public var news_box:SimpleButton;
public var bus_stop:SimpleButton;
public var music_box:SimpleButton;
public var benches:SimpleButton;
}
}//package shopping_street_fla
Section 75
//ExtraItemInner_123 (shopping_street_fla.ExtraItemInner_123)
package shopping_street_fla {
import flash.display.*;
public dynamic class ExtraItemInner_123 extends MovieClip {
public function ExtraItemInner_123(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package shopping_street_fla
Section 76
//fb_head_mc_298 (shopping_street_fla.fb_head_mc_298)
package shopping_street_fla {
import flash.display.*;
public dynamic class fb_head_mc_298 extends MovieClip {
public function fb_head_mc_298(){
addFrameScript(0, frame1, 12, frame13, 22, frame23);
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame23(){
gotoAndStop("turnhead_stop");
}
}
}//package shopping_street_fla
Section 77
//fb_head_mc_335 (shopping_street_fla.fb_head_mc_335)
package shopping_street_fla {
import flash.display.*;
public dynamic class fb_head_mc_335 extends MovieClip {
public function fb_head_mc_335(){
addFrameScript(0, frame1, 12, frame13, 22, frame23);
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame23(){
gotoAndStop("turnhead_stop");
}
}
}//package shopping_street_fla
Section 78
//flonga_button3_307 (shopping_street_fla.flonga_button3_307)
package shopping_street_fla {
import flash.display.*;
public dynamic class flonga_button3_307 extends MovieClip {
public var fButton:SimpleButton;
}
}//package shopping_street_fla
Section 79
//flongabot_296 (shopping_street_fla.flongabot_296)
package shopping_street_fla {
import flash.display.*;
public dynamic class flongabot_296 extends MovieClip {
public var fbHead:MovieClip;
public function flongabot_296(){
addFrameScript(0, frame1, 75, frame76, 88, frame89, 99, frame100);
}
public function doEndFly(){
this.gotoAndPlay("flying_end");
}
function frame76(){
gotoAndPlay("normal");
}
function frame89(){
gotoAndPlay("flying");
}
public function doNormal(){
this.gotoAndPlay("normal");
}
function frame1(){
}
function frame100(){
gotoAndPlay("normal");
}
public function doTurnhead(){
this.fbHead.gotoAndPlay("turnhead");
}
public function doNormalHead(){
this.fbHead.gotoAndPlay("normal");
}
public function doWink(){
this.fbHead.gotoAndPlay("wink_start");
}
public function doFly(){
this.gotoAndPlay("flying_start");
}
}
}//package shopping_street_fla
Section 80
//flongabot_333 (shopping_street_fla.flongabot_333)
package shopping_street_fla {
import flash.display.*;
public dynamic class flongabot_333 extends MovieClip {
public var fbHead:MovieClip;
public function flongabot_333(){
addFrameScript(0, frame1, 75, frame76, 88, frame89, 99, frame100);
}
public function doEndFly(){
this.gotoAndPlay("flying_end");
}
function frame76(){
gotoAndPlay("normal");
}
function frame89(){
gotoAndPlay("flying");
}
public function doNormal(){
this.gotoAndPlay("normal");
}
function frame1(){
}
function frame100(){
gotoAndPlay("normal");
}
public function doTurnhead(){
this.fbHead.gotoAndPlay("turnhead");
}
public function doNormalHead(){
this.fbHead.gotoAndPlay("normal");
}
public function doWink(){
this.fbHead.gotoAndPlay("wink_start");
}
public function doFly(){
this.gotoAndPlay("flying_start");
}
}
}//package shopping_street_fla
Section 81
//FlongaIntro_331 (shopping_street_fla.FlongaIntro_331)
package shopping_street_fla {
import flash.media.*;
import flash.events.*;
import flash.display.*;
import flash.filters.*;
import flash.text.*;
import flash.utils.*;
import flash.geom.*;
import flash.ui.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class FlongaIntro_331 extends MovieClip {
public var flobot:MovieClip;
public function FlongaIntro_331(){
addFrameScript(0, frame1, 29, frame30, 62, frame63, 72, frame73, 92, frame93, 200, frame201, 0xFF, frame256);
}
function frame73(){
flobot.doTurnhead();
}
function frame201(){
flobot.doWink();
}
function frame93(){
flobot.doWink();
}
function frame1(){
}
function frame30(){
flobot.doFly();
}
function frame256(){
stop();
GameStage.itself.flongaFinished();
}
function frame63(){
flobot.doEndFly();
}
}
}//package shopping_street_fla
Section 82
//HelloMC_290 (shopping_street_fla.HelloMC_290)
package shopping_street_fla {
import flash.display.*;
public dynamic class HelloMC_290 extends MovieClip {
public var start_button:SimpleButton;
}
}//package shopping_street_fla
Section 83
//LevelClosedMessageMC_286 (shopping_street_fla.LevelClosedMessageMC_286)
package shopping_street_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LevelClosedMessageMC_286 extends MovieClip {
public var msg:TextField;
}
}//package shopping_street_fla
Section 84
//LevelGoalBar_139 (shopping_street_fla.LevelGoalBar_139)
package shopping_street_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LevelGoalBar_139 extends MovieClip {
public var bar:MovieClip;
public var goal_txt:TextField;
}
}//package shopping_street_fla
Section 85
//OutputMessage_190 (shopping_street_fla.OutputMessage_190)
package shopping_street_fla {
import flash.display.*;
public dynamic class OutputMessage_190 extends MovieClip {
public var msg:MovieClip;
public function OutputMessage_190(){
addFrameScript(34, frame35);
}
function frame35(){
visible = false;
stop();
}
}
}//package shopping_street_fla
Section 86
//OutputMessageInner_191 (shopping_street_fla.OutputMessageInner_191)
package shopping_street_fla {
import flash.display.*;
import flash.text.*;
public dynamic class OutputMessageInner_191 extends MovieClip {
public var msg_txt:TextField;
}
}//package shopping_street_fla
Section 87
//Page1_199 (shopping_street_fla.Page1_199)
package shopping_street_fla {
import flash.display.*;
public dynamic class Page1_199 extends MovieClip {
public var button_stars:MovieClip;
public var icon_holder:MovieClip;
}
}//package shopping_street_fla
Section 88
//PauseMC_196 (shopping_street_fla.PauseMC_196)
package shopping_street_fla {
import flash.display.*;
public dynamic class PauseMC_196 extends MovieClip {
public function PauseMC_196(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package shopping_street_fla
Section 89
//PreloaderBibbs_9 (shopping_street_fla.PreloaderBibbs_9)
package shopping_street_fla {
import flash.display.*;
public dynamic class PreloaderBibbs_9 extends MovieClip {
public function PreloaderBibbs_9(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package shopping_street_fla
Section 90
//Resources_138 (shopping_street_fla.Resources_138)
package shopping_street_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Resources_138 extends MovieClip {
public var wave_txt:TextField;
public var score_txt:TextField;
public var money_txt:TextField;
public var goal_bar:MovieClip;
}
}//package shopping_street_fla
Section 91
//ShopButtonIconHolder_152 (shopping_street_fla.ShopButtonIconHolder_152)
package shopping_street_fla {
import flash.display.*;
public dynamic class ShopButtonIconHolder_152 extends MovieClip {
public function ShopButtonIconHolder_152(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16, 16, frame17, 17, frame18, 18, frame19, 19, frame20, 20, frame21, 21, frame22, 22, frame23, 23, frame24);
}
function frame10(){
stop();
}
function frame14(){
stop();
}
function frame18(){
stop();
}
function frame12(){
stop();
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame19(){
stop();
}
function frame13(){
stop();
}
function frame17(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame9(){
stop();
}
function frame22(){
stop();
}
function frame16(){
stop();
}
function frame8(){
stop();
}
function frame21(){
stop();
}
function frame2(){
stop();
}
function frame15(){
stop();
}
function frame23(){
stop();
}
function frame24(){
stop();
}
function frame20(){
stop();
}
function frame11(){
stop();
}
}
}//package shopping_street_fla
Section 92
//ShopSeat_315 (shopping_street_fla.ShopSeat_315)
package shopping_street_fla {
import flash.display.*;
public dynamic class ShopSeat_315 extends MovieClip {
public var fill_square:MovieClip;
public function ShopSeat_315(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package shopping_street_fla
Section 93
//ShopTooltip_194 (shopping_street_fla.ShopTooltip_194)
package shopping_street_fla {
import flash.display.*;
import flash.text.*;
public dynamic class ShopTooltip_194 extends MovieClip {
public var title_txt:TextField;
public var params_txt:TextField;
public var tooltip_back:MovieClip;
public function ShopTooltip_194(){
addFrameScript(0, frame1, 1, frame2, 10, frame11);
}
function frame1(){
title_txt.visible = false;
params_txt.visible = false;
stop();
}
function frame2(){
title_txt.visible = false;
params_txt.visible = false;
tooltip_back.gotoAndPlay("show_animation");
}
function frame11(){
title_txt.visible = true;
params_txt.visible = true;
stop();
tooltip_back.stop();
}
}
}//package shopping_street_fla
Section 94
//ShopTooltipBack_195 (shopping_street_fla.ShopTooltipBack_195)
package shopping_street_fla {
import flash.display.*;
public dynamic class ShopTooltipBack_195 extends MovieClip {
public function ShopTooltipBack_195(){
addFrameScript(7, frame8);
}
function frame8(){
stop();
}
}
}//package shopping_street_fla
Section 95
//Sit_233 (shopping_street_fla.Sit_233)
package shopping_street_fla {
import flash.display.*;
public dynamic class Sit_233 extends MovieClip {
public function Sit_233(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package shopping_street_fla
Section 96
//SitGreenW_252 (shopping_street_fla.SitGreenW_252)
package shopping_street_fla {
import flash.display.*;
public dynamic class SitGreenW_252 extends MovieClip {
public function SitGreenW_252(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package shopping_street_fla
Section 97
//SoundsBibb_309 (shopping_street_fla.SoundsBibb_309)
package shopping_street_fla {
import flash.display.*;
public dynamic class SoundsBibb_309 extends MovieClip {
public function SoundsBibb_309(){
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
}
}//package shopping_street_fla
Section 98
//StatCaption_94 (shopping_street_fla.StatCaption_94)
package shopping_street_fla {
import flash.display.*;
public dynamic class StatCaption_94 extends MovieClip {
public var innerc:MovieClip;
}
}//package shopping_street_fla
Section 99
//StatCaptionInner_95 (shopping_street_fla.StatCaptionInner_95)
package shopping_street_fla {
import flash.display.*;
import flash.text.*;
public dynamic class StatCaptionInner_95 extends MovieClip {
public var stat_title:TextField;
}
}//package shopping_street_fla
Section 100
//UNDER_CONSTRUCTION_MC_34 (shopping_street_fla.UNDER_CONSTRUCTION_MC_34)
package shopping_street_fla {
import flash.display.*;
public dynamic class UNDER_CONSTRUCTION_MC_34 extends MovieClip {
public function UNDER_CONSTRUCTION_MC_34(){
addFrameScript(34, frame35);
}
function frame35(){
gotoAndPlay(1);
}
}
}//package shopping_street_fla
Section 101
//WalkingBlackManSits_218 (shopping_street_fla.WalkingBlackManSits_218)
package shopping_street_fla {
import flash.display.*;
public dynamic class WalkingBlackManSits_218 extends MovieClip {
public function WalkingBlackManSits_218(){
addFrameScript(17, frame18);
}
function frame18(){
stop();
}
}
}//package shopping_street_fla
Section 102
//WalkingBoySits_222 (shopping_street_fla.WalkingBoySits_222)
package shopping_street_fla {
import flash.display.*;
public dynamic class WalkingBoySits_222 extends MovieClip {
public function WalkingBoySits_222(){
addFrameScript(17, frame18);
}
function frame18(){
stop();
}
}
}//package shopping_street_fla
Section 103
//WalkingBoySits_238 (shopping_street_fla.WalkingBoySits_238)
package shopping_street_fla {
import flash.display.*;
public dynamic class WalkingBoySits_238 extends MovieClip {
public function WalkingBoySits_238(){
addFrameScript(17, frame18);
}
function frame18(){
stop();
}
}
}//package shopping_street_fla
Section 104
//WalkingBoySits_242 (shopping_street_fla.WalkingBoySits_242)
package shopping_street_fla {
import flash.display.*;
public dynamic class WalkingBoySits_242 extends MovieClip {
public function WalkingBoySits_242(){
addFrameScript(17, frame18);
}
function frame18(){
stop();
}
}
}//package shopping_street_fla
Section 105
//WalkingGirlSits_227 (shopping_street_fla.WalkingGirlSits_227)
package shopping_street_fla {
import flash.display.*;
public dynamic class WalkingGirlSits_227 extends MovieClip {
public function WalkingGirlSits_227(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package shopping_street_fla
Section 106
//BlueStar (BlueStar)
package {
import flash.display.*;
public dynamic class BlueStar extends Sprite {
}
}//package
Section 107
//BoutiqueIcon (BoutiqueIcon)
package {
import fai.ui.*;
public dynamic class BoutiqueIcon extends ShopButton {
public function BoutiqueIcon(){
addFrameScript(0, frame1, 1, frame2, 3, frame4);
}
function frame4(){
stop();
updateButton(button_stars, icon_holder);
}
function frame1(){
stop();
updateButton(button_stars, icon_holder);
}
function frame2(){
stop();
updateButton(button_stars, icon_holder);
}
}
}//package
Section 108
//BoutiqueShop (BoutiqueShop)
package {
import flash.display.*;
public dynamic class BoutiqueShop extends MovieClip {
public function BoutiqueShop(){
addFrameScript(0, frame1, 10, frame11, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 109
//BuildingProgressBar (BuildingProgressBar)
package {
import flash.display.*;
import flash.text.*;
public dynamic class BuildingProgressBar extends MovieClip {
public var bar:MovieClip;
public var percents:TextField;
}
}//package
Section 110
//Customer1 (Customer1)
package {
import flash.display.*;
public dynamic class Customer1 extends MovieClip {
public function Customer1(){
addFrameScript(7, frame8, 9, frame10, 11, frame12, 13, frame14);
}
function frame10(){
stop();
}
function frame14(){
stop();
}
function frame12(){
stop();
}
function frame8(){
gotoAndPlay("walking");
}
}
}//package
Section 111
//Customer2 (Customer2)
package {
import flash.display.*;
public dynamic class Customer2 extends MovieClip {
public function Customer2(){
addFrameScript(7, frame8, 9, frame10, 11, frame12, 13, frame14);
}
function frame10(){
stop();
}
function frame14(){
stop();
}
function frame12(){
stop();
}
function frame8(){
gotoAndPlay("walking");
}
}
}//package
Section 112
//Customer3 (Customer3)
package {
import flash.display.*;
public dynamic class Customer3 extends MovieClip {
public function Customer3(){
addFrameScript(15, frame16, 17, frame18, 19, frame20, 21, frame22);
}
function frame18(){
stop();
}
function frame16(){
gotoAndPlay("walking");
}
function frame20(){
stop();
}
function frame22(){
stop();
}
}
}//package
Section 113
//Customer4 (Customer4)
package {
import flash.display.*;
public dynamic class Customer4 extends MovieClip {
public function Customer4(){
addFrameScript(15, frame16, 17, frame18, 38, frame39, 40, frame41, 42, frame43);
}
function frame18(){
stop();
}
function frame16(){
gotoAndPlay("walking");
}
function frame39(){
stop();
}
function frame43(){
stop();
}
function frame41(){
stop();
}
}
}//package
Section 114
//Customer5 (Customer5)
package {
import flash.display.*;
public dynamic class Customer5 extends MovieClip {
public function Customer5(){
addFrameScript(7, frame8, 9, frame10, 11, frame12, 13, frame14);
}
function frame10(){
stop();
}
function frame14(){
stop();
}
function frame12(){
stop();
}
function frame8(){
gotoAndPlay("walking");
}
}
}//package
Section 115
//Customer6 (Customer6)
package {
import flash.display.*;
public dynamic class Customer6 extends MovieClip {
public function Customer6(){
addFrameScript(7, frame8, 9, frame10, 11, frame12, 13, frame14);
}
function frame10(){
stop();
}
function frame14(){
stop();
}
function frame12(){
stop();
}
function frame8(){
gotoAndPlay("walking");
}
}
}//package
Section 116
//Customer7 (Customer7)
package {
import flash.display.*;
public dynamic class Customer7 extends MovieClip {
public function Customer7(){
addFrameScript(14, frame15, 34, frame35, 92, frame93, 109, frame110);
}
function frame93(){
stop();
}
function frame15(){
gotoAndPlay("walking");
}
function frame110(){
stop();
}
function frame35(){
stop();
}
}
}//package
Section 117
//Customer8 (Customer8)
package {
import flash.display.*;
public dynamic class Customer8 extends MovieClip {
public function Customer8(){
addFrameScript(14, frame15, 16, frame17, 18, frame19, 20, frame21);
}
function frame15(){
gotoAndPlay("walking");
}
function frame17(){
stop();
}
function frame19(){
stop();
}
function frame21(){
stop();
}
}
}//package
Section 118
//CustomerMoney (CustomerMoney)
package {
import fai.ui.*;
import flash.display.*;
public dynamic class CustomerMoney extends MovieClip {
public var bar:CustomersBar;
public function CustomerMoney(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 119
//CustomerStar (CustomerStar)
package {
import flash.display.*;
public dynamic class CustomerStar extends MovieClip {
}
}//package
Section 120
//ElectronicsIcon (ElectronicsIcon)
package {
import fai.ui.*;
public dynamic class ElectronicsIcon extends ShopButton {
public function ElectronicsIcon(){
addFrameScript(0, frame1, 1, frame2, 3, frame4);
}
function frame4(){
stop();
updateButton(button_stars, icon_holder);
}
function frame1(){
stop();
updateButton(button_stars, icon_holder);
}
function frame2(){
stop();
updateButton(button_stars, icon_holder);
}
}
}//package
Section 121
//ElectronicsShop (ElectronicsShop)
package {
import flash.display.*;
public dynamic class ElectronicsShop extends MovieClip {
public function ElectronicsShop(){
addFrameScript(0, frame1, 10, frame11, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 122
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 123
//FurnitureIcon (FurnitureIcon)
package {
import fai.ui.*;
public dynamic class FurnitureIcon extends ShopButton {
public function FurnitureIcon(){
addFrameScript(0, frame1, 1, frame2, 3, frame4);
}
function frame4(){
stop();
updateButton(button_stars, icon_holder);
}
function frame1(){
stop();
updateButton(button_stars, icon_holder);
}
function frame2(){
stop();
updateButton(button_stars, icon_holder);
}
}
}//package
Section 124
//FurnitureShop (FurnitureShop)
package {
import flash.display.*;
public dynamic class FurnitureShop extends MovieClip {
public function FurnitureShop(){
addFrameScript(0, frame1, 10, frame11, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 125
//GameStage (GameStage)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
public class GameStage extends MovieClip {
public var sponsor_games:SimpleButton;
private var atimer:Timer;// = null
public var wscreen:MovieClip;
public var loadingMC:MovieClip;
private var initialized:Boolean;// = false
public var flonga_clip:MovieClip;
private static var linkTimer:Timer = null;
private static var goto_window:String;
private static var goto_url:String;
private static var link1Timer:Timer = null;
public static var play_holder = null;
public static var main_stage = null;
public static var welcomeScreen;
public static var itself = null;
public function GameStage():void{
initialized = false;
atimer = null;
super();
addFrameScript(0, frame1, 4, frame5);
Security.allowDomain("*");
itself = this;
}
public function progressUpdate(_arg1:Event):void{
var _local2:Number;
_local2 = Math.round(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100));
if ((loadingMC is MovieClip)){
loadingMC.progress_mc.gotoAndStop(_local2);
loadingMC.loaded_txt.text = (("Loading: " + _local2.toString()) + "%");
};
if (!!((this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal))){
loadingMC.removeEventListener(Event.ENTER_FRAME, progressUpdate);
loadingMC.progress_mc.stop();
loadingMC.progress_mc.visible = false;
removeChild(loadingMC);
loadingMC = null;
gotoAndStop("start_game");
};
}
private function handleUnload(_arg1:Event):void{
welcomeScreen.clear();
}
public function flongaFinished():void{
flonga_clip.visible = false;
this.removeChild(flonga_clip);
}
function frame1(){
loadingMC.addEventListener(Event.ENTER_FRAME, progressUpdate);
sponsor_games.addEventListener(MouseEvent.MOUSE_DOWN, sponsorClick);
stop();
if (initialized){
loadingMC.removeEventListener(Event.ENTER_FRAME, progressUpdate);
sponsor_games.removeEventListener(MouseEvent.MOUSE_DOWN, sponsorClick);
gotoAndStop(5);
};
}
function frame5(){
flonga_clip.addEventListener(MouseEvent.MOUSE_DOWN, sponsorClick);
this.initTheGame();
stop();
}
public function loadEnded():void{
wscreen.loadEnded();
}
public function initTheGame():void{
var _local1:ContextMenu;
if (initialized){
return;
};
main_stage = this.stage;
welcomeScreen = wscreen;
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
contextMenu = _local1;
initialized = true;
wscreen.initialize();
root.loaderInfo.addEventListener(Event.UNLOAD, handleUnload);
}
public static function sponsorClick(_arg1:MouseEvent):void{
var urlRequest:URLRequest;
var evt = _arg1;
try {
urlRequest = new URLRequest("http://www.flonga.com/");
navigateToURL(urlRequest, "_blank");
} catch(e:Error) {
};
}
}
}//package
Section 126
//JewelryIcon (JewelryIcon)
package {
import fai.ui.*;
public dynamic class JewelryIcon extends ShopButton {
public function JewelryIcon(){
addFrameScript(0, frame1, 1, frame2, 3, frame4);
}
function frame4(){
stop();
updateButton(button_stars, icon_holder);
}
function frame1(){
stop();
updateButton(button_stars, icon_holder);
}
function frame2(){
stop();
updateButton(button_stars, icon_holder);
}
}
}//package
Section 127
//JewelryShop (JewelryShop)
package {
import flash.display.*;
public dynamic class JewelryShop extends MovieClip {
public function JewelryShop(){
addFrameScript(0, frame1, 10, frame11, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 128
//LoadingMC (LoadingMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LoadingMC extends MovieClip {
public var loaded_txt:TextField;
public var error_txt:TextField;
public var progress_mc:MovieClip;
}
}//package
Section 129
//PetShopIcon (PetShopIcon)
package {
import fai.ui.*;
public dynamic class PetShopIcon extends ShopButton {
public function PetShopIcon(){
addFrameScript(0, frame1, 1, frame2, 3, frame4);
}
function frame4(){
stop();
updateButton(button_stars, icon_holder);
}
function frame1(){
stop();
updateButton(button_stars, icon_holder);
}
function frame2(){
stop();
updateButton(button_stars, icon_holder);
}
}
}//package
Section 130
//PetShopShop (PetShopShop)
package {
import flash.display.*;
public dynamic class PetShopShop extends MovieClip {
public function PetShopShop(){
addFrameScript(0, frame1, 10, frame11, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 131
//PlayWindowUI (PlayWindowUI)
package {
import fai.logic.*;
import fai.ui.*;
import flash.display.*;
public dynamic class PlayWindowUI extends MovieClip {
public var next_day_button:SimpleButton;
public var slow_mode_button:SimpleButton;
public var menu_button:SimpleButton;
public var tutorial_mc:TutorialMC;
public var mute_button:SimpleButton;
public var extra1:ExtraItem;
public var extra2:ExtraItem;
public var extra3:ExtraItem;
public var extra4:ExtraItem;
public var resources:MovieClip;
public var extra6:ExtraItem;
public var extra7:ExtraItem;
public var extra5:ExtraItem;
public var furniture_button:FurnitureIcon;
public var extra_buttons:MovieClip;
public var bus_stop:MovieClip;
public var sound_button:SimpleButton;
public var boutique_button:BoutiqueIcon;
public var restaurant_button:RestaurantIcon;
public var customers:MovieClip;
public var pause_mc:MovieClip;
public var car_motion:MovieClip;
public var graffiti_button:SimpleButton;
public var market_button:SuperMarketIcon;
public var output_message:MovieClip;
public var bus_stop_sign:MovieClip;
public var electronics_button:ElectronicsIcon;
public var shop_ground2:ShopItem;
public var shop_ground3:ShopItem;
public var shop_ground4:ShopItem;
public var shop_ground5:ShopItem;
public var jewelry_button:JewelryIcon;
public var shop_ground1:ShopItem;
public var shop_ground6:ShopItem;
public var shop_ground7:ShopItem;
public var shop_ground8:ShopItem;
public var click_next_day_button:SimpleButton;
public var bonus_animation:MovieClip;
public var pet_shop_button:PetShopIcon;
public var toy_store_button:ToyStoreIcon;
public var for_sale_signs:MovieClip;
public var pause_button:SimpleButton;
public var bus_clip:BusClip;
public var shop_tooltip:MovieClip;
public var background_holder:MovieClip;
public var fast_mode_button:SimpleButton;
}
}//package
Section 132
//RestaurantIcon (RestaurantIcon)
package {
import fai.ui.*;
public dynamic class RestaurantIcon extends ShopButton {
public function RestaurantIcon(){
addFrameScript(0, frame1, 1, frame2, 3, frame4);
}
function frame4(){
stop();
updateButton(button_stars, icon_holder);
}
function frame1(){
stop();
updateButton(button_stars, icon_holder);
}
function frame2(){
stop();
updateButton(button_stars, icon_holder);
}
}
}//package
Section 133
//RestaurantShop (RestaurantShop)
package {
import flash.display.*;
public dynamic class RestaurantShop extends MovieClip {
public function RestaurantShop(){
addFrameScript(0, frame1, 10, frame11, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 134
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 135
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 136
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 137
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 138
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 139
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 140
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 141
//Sound_build (Sound_build)
package {
import flash.media.*;
public dynamic class Sound_build extends Sound {
}
}//package
Section 142
//Sound_click3 (Sound_click3)
package {
import flash.media.*;
public dynamic class Sound_click3 extends Sound {
}
}//package
Section 143
//Sound_coins (Sound_coins)
package {
import flash.media.*;
public dynamic class Sound_coins extends Sound {
}
}//package
Section 144
//Sound_level_selection (Sound_level_selection)
package {
import flash.media.*;
public dynamic class Sound_level_selection extends Sound {
}
}//package
Section 145
//Sound_music (Sound_music)
package {
import flash.media.*;
public dynamic class Sound_music extends Sound {
}
}//package
Section 146
//Sound_new_day (Sound_new_day)
package {
import flash.media.*;
public dynamic class Sound_new_day extends Sound {
}
}//package
Section 147
//Sound_sigh (Sound_sigh)
package {
import flash.media.*;
public dynamic class Sound_sigh extends Sound {
}
}//package
Section 148
//Sound_tada (Sound_tada)
package {
import flash.media.*;
public dynamic class Sound_tada extends Sound {
}
}//package
Section 149
//Star (Star)
package {
import flash.display.*;
public dynamic class Star extends MovieClip {
}
}//package
Section 150
//SuperMarketIcon (SuperMarketIcon)
package {
import fai.ui.*;
public dynamic class SuperMarketIcon extends ShopButton {
public function SuperMarketIcon(){
addFrameScript(0, frame1, 1, frame2, 3, frame4);
}
function frame4(){
stop();
updateButton(button_stars, icon_holder);
}
function frame1(){
stop();
updateButton(button_stars, icon_holder);
}
function frame2(){
stop();
updateButton(button_stars, icon_holder);
}
}
}//package
Section 151
//SuperMarketShop (SuperMarketShop)
package {
import flash.display.*;
public dynamic class SuperMarketShop extends MovieClip {
public function SuperMarketShop(){
addFrameScript(0, frame1, 10, frame11, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 152
//ToyStoreIcon (ToyStoreIcon)
package {
import fai.ui.*;
public dynamic class ToyStoreIcon extends ShopButton {
public function ToyStoreIcon(){
addFrameScript(0, frame1, 1, frame2, 3, frame4);
}
function frame4(){
stop();
updateButton(button_stars, icon_holder);
}
function frame1(){
stop();
updateButton(button_stars, icon_holder);
}
function frame2(){
stop();
updateButton(button_stars, icon_holder);
}
}
}//package
Section 153
//ToyStoreShop (ToyStoreShop)
package {
import flash.display.*;
public dynamic class ToyStoreShop extends MovieClip {
public function ToyStoreShop(){
addFrameScript(0, frame1, 10, frame11, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 154
//WhiteStar (WhiteStar)
package {
import flash.display.*;
public dynamic class WhiteStar extends MovieClip {
}
}//package