Revision: 307
http://upstage.svn.sourceforge.net/upstage/?rev=307&view=rev
Author: aut-upstage
Date: 2011-07-30 06:20:37 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
re-added AS3.client to provide the option of using either.
Added Paths:
-----------
branches/2.4.1/AS3.client/
branches/2.4.1/AS3.client/upstage/
branches/2.4.1/AS3.client/upstage/org/
branches/2.4.1/AS3.client/upstage/org/App.as
branches/2.4.1/AS3.client/upstage/org/Auth.as
branches/2.4.1/AS3.client/upstage/org/Client.as
branches/2.4.1/AS3.client/upstage/org/Sender.as
branches/2.4.1/AS3.client/upstage/org/Transport.as
branches/2.4.1/AS3.client/upstage/org/classes.swf
branches/2.4.1/AS3.client/upstage/org/flex-config.xml
branches/2.4.1/AS3.client/upstage/org/history.txt
branches/2.4.1/AS3.client/upstage/org/main.mxml
branches/2.4.1/AS3.client/upstage/org/main.swf
branches/2.4.1/AS3.client/upstage/org/model/
branches/2.4.1/AS3.client/upstage/org/model/ModelAvatars.as
branches/2.4.1/AS3.client/upstage/org/model/ModelBackDropItems.as
branches/2.4.1/AS3.client/upstage/org/model/ModelChat.as
branches/2.4.1/AS3.client/upstage/org/model/ModelDrawing.as
branches/2.4.1/AS3.client/upstage/org/model/ModelInfo.as
branches/2.4.1/AS3.client/upstage/org/model/ModelSounds.as
branches/2.4.1/AS3.client/upstage/org/model/ModelSplashScreen.as
branches/2.4.1/AS3.client/upstage/org/model/TransportInterface.as
branches/2.4.1/AS3.client/upstage/org/thing/
branches/2.4.1/AS3.client/upstage/org/thing/Audio.as
branches/2.4.1/AS3.client/upstage/org/thing/Avatar.as
branches/2.4.1/AS3.client/upstage/org/thing/BackDrop.as
branches/2.4.1/AS3.client/upstage/org/thing/MoveableDrawing.as
branches/2.4.1/AS3.client/upstage/org/thing/Prop.as
branches/2.4.1/AS3.client/upstage/org/thing/Thing.as
branches/2.4.1/AS3.client/upstage/org/util/
branches/2.4.1/AS3.client/upstage/org/util/ButtonMc.as
branches/2.4.1/AS3.client/upstage/org/util/Color.as
branches/2.4.1/AS3.client/upstage/org/util/ColourPalette.as
branches/2.4.1/AS3.client/upstage/org/util/ColourPicker.as
branches/2.4.1/AS3.client/upstage/org/util/Construct.as
branches/2.4.1/AS3.client/upstage/org/util/Icon.as
branches/2.4.1/AS3.client/upstage/org/util/Key.as
branches/2.4.1/AS3.client/upstage/org/util/LayerPicker.as
branches/2.4.1/AS3.client/upstage/org/util/LayerPickerSet.as
branches/2.4.1/AS3.client/upstage/org/util/LoadTracker.as
branches/2.4.1/AS3.client/upstage/org/util/PictureButton.as
branches/2.4.1/AS3.client/upstage/org/util/ScrollButton.as
branches/2.4.1/AS3.client/upstage/org/util/SizeSlider.as
branches/2.4.1/AS3.client/upstage/org/util/Slider.as
branches/2.4.1/AS3.client/upstage/org/util/UiButton.as
branches/2.4.1/AS3.client/upstage/org/util/Vera.ttf
branches/2.4.1/AS3.client/upstage/org/util/VeraBd.ttf
branches/2.4.1/AS3.client/upstage/org/util/Web.as
branches/2.4.1/AS3.client/upstage/org/util/newSound.as
branches/2.4.1/AS3.client/upstage/org/util/vera-copyright.txt
branches/2.4.1/AS3.client/upstage/org/view/
branches/2.4.1/AS3.client/upstage/org/view/ActorButtons.as
branches/2.4.1/AS3.client/upstage/org/view/AuScrollBar.as
branches/2.4.1/AS3.client/upstage/org/view/AuScrollBarItem.as
branches/2.4.1/AS3.client/upstage/org/view/AudioSlot.as
branches/2.4.1/AS3.client/upstage/org/view/AvMenu.as
branches/2.4.1/AS3.client/upstage/org/view/AvScrollBar.as
branches/2.4.1/AS3.client/upstage/org/view/AvScrollBarItem.as
branches/2.4.1/AS3.client/upstage/org/view/Bubble.as
branches/2.4.1/AS3.client/upstage/org/view/Bubblev1.as
branches/2.4.1/AS3.client/upstage/org/view/ChatField.as
branches/2.4.1/AS3.client/upstage/org/view/ChatInput.as
branches/2.4.1/AS3.client/upstage/org/view/DEPRECIATED AudioTools.as
branches/2.4.1/AS3.client/upstage/org/view/DEPRECIATED ParseUrls.as
branches/2.4.1/AS3.client/upstage/org/view/DrawTools.as
branches/2.4.1/AS3.client/upstage/org/view/Info.as
branches/2.4.1/AS3.client/upstage/org/view/InfoAudience.as
branches/2.4.1/AS3.client/upstage/org/view/ItemGroup.as
branches/2.4.1/AS3.client/upstage/org/view/SplashScreen.as
branches/2.4.1/AS3.client/video-unused/
branches/2.4.1/AS3.client/video-unused/video.as
branches/2.4.1/config/templates/as3.stage.xhtml
branches/2.4.1/config/templates/as3.swf.inc
Property changes on: branches/2.4.1/AS3.client
___________________________________________________________________
Added: bugtraq:number
+ true
Property changes on: branches/2.4.1/AS3.client/upstage
___________________________________________________________________
Added: bugtraq:number
+ true
Property changes on: branches/2.4.1/AS3.client/upstage/org
___________________________________________________________________
Added: bugtraq:number
+ true
Added: branches/2.4.1/AS3.client/upstage/org/App.as
===================================================================
--- branches/2.4.1/AS3.client/upstage/org/App.as (rev 0)
+++ branches/2.4.1/AS3.client/upstage/org/App.as 2011-07-30 06:20:37 UTC (rev 307)
@@ -0,0 +1,152 @@
+package org
+{
+ /**
+ * Copyright (C) 2003-2006 Douglas Bagnall (douglas * paradise-net-nz)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+ /**
+ * Information following @mainpage gets put on documentation index.html
+ * Change version in Doxyfile PROJECT_NUMBER also
+ *
+ * @mainpage UpStage Documentation
+ * UpStage release 1.9 -
+ * A student team has contributed to the UpStage project as part of their
+ * final year project
+ *
+ * On a user level the following new features have changed from the
+ * Upstage-2004-09-28.tar.gz release:
+ * +Upstage now renders to 320x200 not 320x240.
+ * This gets around layout problems when users have many toolbars installed
+ * in their browsers.
+ *
+ * +A new /command has been added /wh or /whisper which allows players to
+ * send protected messages to each other no matter which stage the player
+ * may reside on.
+ *
+ * +Fonts are now embedded in the swf to provide a consistent layout no
+ * matter what the operating system or browser may be.
+ *
+ * +The avatars are now selected from a scrollbar rather than a wardrobe
+ * which makes names eaisier to read & allows more possible avatars on a
+ * stage.
+ *
+ * +Props and backdrop names now appear on mouse over to make things easier
+ * to read.
+ *
+ * +Misc bugs relating to syncronisation of all clients have been fixed.
+ *
+ * +Avatar voices now overlap. When more than four avatars attempt to speak
+ * at the same time, the voice with the least left to say is preempted.
+ *
+ * +Current player & audience count are displayed on screen.
+ * On a developer level, the entire client side code (ActionScript1) has
+ * been rebuilt using ActionScript2 and the Model/View/Controller pattern.
+ */
+
+ /**
+ * Entry point for application onLoad called automatically.
+ * See main.mxml
+ * @modified Shaun Narayan (Feb 2010) - Converted to AS3. Amongst usual changes(Package declaration,
+ * removal of _ prefix fields, new moviclip registration method,
+ * new event handling etc...) - also call to javascript to get init data.
+ * Shaun Narayan (Apr 2010) - Added scale variables to allow stage co-ords to be used in event handlers.
+ */
+
+ import org.util.Construct;
+ import flash.display.*;
+ import flash.events.*;
+ import flash.external.*;
+ import flash.text.*;
+ import flash.ui.Mouse;
+
+ public class App extends MovieClip
+ {
+ public static var transport : Transport;
+ public static var debugMsg : TextField;
+ //Shaun Narayan (04/27/10) - Allows conversion of stage co-ords to app
+ // co-ords
+ public static var scaleAmountX : Number;
+ public static var scaleAmountY : Number;
+
+ /**
+ * @brief Constructor
+ */
+ public function App() : void {}
+
+ /**
+ * @brief Called automatically when swf loads
+ * See application.xml
+ */
+ public function onLoad() : void
+ {
+ var url : String = ExternalInterface.call('function(){return document.getElementById("app").data;}');
+ //var url : String = root.loaderInfo.loaderURL;
+ //Application begins executing here
+ if(url.indexOf('mode=DEBUG') >= 0)
+ {
+ this.createLogger();
+ }
+ this.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
+ //Create the Transport object which gets things moving
+ App.transport = new Transport(this);
+ trace('Application constructor done...');
+ }
+
+ public function createLogger() : void
+ {
+ if(Client.LOG_TO_SCREEN)
+ {
+ var format : TextFormat;
+ // Create a text field for debug messages, covering most of the blank space.
+ //XXX Flash 8 returns a reference to the field, but Flash 7 does not.
+ debugMsg = Construct.formattedTextField(this, 'debugMessages',
+ Client.L_DEBUG, 5, 5, Client.RIGHT_BOUND - 10,
+ Client.BOTTOM_BOUND - 10, 0.9, false, {}, {});
+ debugMsg.border = true;
+ debugMsg.wordWrap = true;
+ debugMsg.borderColor = 0x0000cc;
+ debugMsg.alpha = 50;
+ debugMsg.text = 'debug messages...';
+ }
+ }
+
+ public static function debug(x : Object) : void
+ {
+ if(Client.LOG_TO_SCREEN && debugMsg != null)
+ {
+ var scrollV : Number = debugMsg.scrollV;
+ var bottomish : Boolean = (debugMsg.maxScrollV - scrollV < 5);
+ //replaceText is much faster than debugMsg.text += '\n' + x;
+ var len : Number = debugMsg.length;
+ debugMsg.replaceText(len, len, '\n' + x);
+ debugMsg.scrollV = (bottomish) ? debugMsg.maxScrollV : scrollV;
+ }
+ if(Client.LOG_TO_SERVER)
+ {
+ transport.sendDebug(x);
+ }
+ }
+
+ /**
+ * @brief Used to move the avatars around the stage
+ */
+ public function onMouseUp(e : MouseEvent) : void
+ {
+ App.transport.clicker(e.stageX / scaleAmountX, e.stageY / scaleAmountY);
+ }
+ }
+}
\ No newline at end of file
Added: branches/2.4.1/AS3.client/upstage/org/Auth.as
===================================================================
--- branches/2.4.1/AS3.client/upstage/org/Auth.as (rev 0)
+++ branches/2.4.1/AS3.client/upstage/org/Auth.as 2011-07-30 06:20:37 UTC (rev 307)
@@ -0,0 +1,158 @@
+package org {
+ /*
+ Copyright (C) 2003-2006 Douglas Bagnall (douglas * paradise-net-nz)
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+ /**
+ * Authorisation from server - the first step in handshaking Gets
+ * application talking to server when constructor called
+ * @modified Shaun Narayan (Feb 2010) - Converted to AS3. Amongst usual changes (Package declaration,
+ * removal of _ prefix fields, new moviclip registration method,
+ * new event handling etc...) - also changed loader to use URLRequest, URLVariables
+ * and URLLoader (as opposed to the depricated old methods).
+ */
+
+ import org.Client;
+ import flash.events.*;
+ import flash.net.*;
+
+
+ public class Auth {
+ private var loaded :Boolean; // .load() completed successfully
+ private var key :String; // MD5 key for session from server
+ private var player :String; // Who the user logged in as (may be '')
+ private var tries :Number; // How many times connection has been attempted
+
+ private var canAdmin :Boolean; // Can the player admin
+ private var canSu :Boolean; // Is the player a super user
+ private var canAct :Boolean; // Can the player act
+
+
+ /**
+ * @brief Constructor Calls Auth.load() implemented in LoadVars
+ */
+ function Auth()
+ {
+ // Constructor
+ trace('Auth constructor...');
+
+ // Server construtor has set weburl from _root.url
+ this.tries = 0;
+ this.canSu = false;
+ this.canAct = false;
+ this.canAdmin = false;
+ }
+
+ function load(drawer: Object){//draweer used for callback
+ var myLoader:URLLoader = new URLLoader();
+ var myRequest:URLRequest = new URLRequest(Client.AUTH_URL);
+
+ trace(' Auth about to load ' + Client.AUTH_URL);
+ var auth: Auth = this;
+ var decode: URLVariables = new URLVariables();
+ myLoader.addEventListener(Event.COMPLETE, function(evt:Event){
+ var loader:URLLoader = URLLoader(evt.target);
+ trace(loader.data.toString());
+ trace('Auth.decoder.onLoad() ' + !(loader.data==null));
+ if (loader.data != null){
+ trace(' auth is: ' + loader.data.toString());
+ var vars:URLVariables = new URLVariables();
+ vars.decode(loader.data);
+ auth.loaded = true;
+ auth.canAct = (vars.canAct == 'True');
+ auth.canSu = (vars.canSu == 'True');
+ auth.canAdmin = (vars.canAdmin == 'True');
+ auth.key = vars.key;
+ auth.player = vars.player;
+ trace("calling " + drawer.drawScreen);
+ drawer.drawScreen();
+ }
+ else
+ {
+ trace('auth failed to load!');
+ auth.tries++;
+ if (auth.tries <= Client.MAX_AUTH_ATTEMPTS)
+ {
+ trace('retry number ' + auth.tries);
+ auth.load(null);
+ }
+ else
+ {
+ trace('continuing with audience rights');
+ }
+
+ }
+ });
+ myRequest.method = URLRequestMethod.GET;
+ myRequest.data = decode;
+ myLoader.load(myRequest);
+ };
+
+
+
+ //-------------------------------------------------------------------------
+ // Accessor functions
+ /**
+ * @brief Client MD5 key
+ * @return MD5 key
+ */
+ function getKey() :String
+ {
+ return key;
+ }
+
+
+ /**
+ * @brief Can the current user act
+ * @return can the current user act
+ */
+ function getCanAct() :Boolean
+ {
+ return canAct;
+ };
+
+
+ /**
+ * @brief Can the current administer
+ * @return can admin
+ */
+ function getCanAdmin() : Boolean
+ {
+ return canAdmin;
+ };
+
+
+ /**
+ * @brief Can the current user su
+ * @return can su
+ */
+ function getCanSu() :Boolean
+ {
+ return canSu;
+ };
+
+
+ /**
+ * @brief Current users username
+ * @return username
+ */
+ function getUserName() :String
+ {
+ return player;
+ };
+ }
+}
Added: branches/2.4.1/AS3.client/upstage/org/Client.as
===================================================================
--- branches/2.4.1/AS3.client/upstage/org/Client.as (rev 0)
+++ branches/2.4.1/AS3.client/upstage/org/Client.as 2011-07-30 06:20:37 UTC (rev 307)
@@ -0,0 +1,653 @@
+package org {
+ /*
+ Copyright (C) 2003-2006 Douglas Bagnall (douglas * paradise-net-nz)
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+ /**
+ * Module: Client.as
+ * Author: Douglas Bagnall
+ * Modified by: Lauren Kilduff, Phillip Quinlan, Endre Bernhardt
+ * Modified by: Wendy, Candy and Aaron 30/10/2008
+ * Modified by: Vishaal Solanki 15/10/2009
+ * @modified Shaun Narayan (Feb 2010) - Converted to AS3.
+ * Shaun Narayan (Apr 2010) - Added scale proportionate, prop+avatar max size, avatar menu and various other variables.
+ * Constants go here. These are available to every module.
+ * Modules should never modify a value here.
+ */
+
+ public class Client {
+ // AC (27.05.08) - Port for receiving policy files.
+ public static var POLICY_PORT :Number = 3000;
+ public static var SCREEN_WIDTH :Number = 280;
+ public static var SCREEN_HEIGHT :Number = 240;
+ public static var SCALE_PROPORTIONATE :Boolean = true;
+ //----------- sizes --------------------------//
+
+ public static var ICON_SIZE :Number = 10; // In AvScrollBar & ItemGroup's
+ //Shaun Narayan - Images suffered from scaling problems so these values help get some relativity back
+ public static var AVATAR_MAX_WIDTH :Number = 100;
+ public static var AVATAR_MAX_HEIGHT :Number = 100;
+ public static var PROP_MAX_WIDTH :Number = 100;
+ public static var PROP_MAX_HEIGHT :Number = 100;
+ public static var BORDER_WIDTH :Number = 0.5;
+
+ public static var RIGHT_BOUND :Number = 225; // lefthand edge of chat
+ public static var BOTTOM_BOUND :Number = 189; // bottom edge of chat, just above top of background pickers.
+ public static var CHAT_WIDTH :Number = 88;
+ public static var ACTOR_CHAT_TOP :Number = 70;
+ public static var ACTOR_CHAT_HEIGHT:Number = 118;
+ public static var ANON_CHAT_TOP :Number = 1 +10; //VS - Change to allow for Audience view of player/audience count 08/10/09 - was 1
+
+ //LK modified to allow for applause button - was 186
+ //VS - Changed again to allow for Audience view of player/audience count - 08/10/09 - was 170
+ public static var ANON_CHAT_HEIGHT :Number = 179 -10;
+ public static var CHAT_SCROLL_X :Number = 313;
+ public static var ACT_SCROLL_UP_Y :Number = 70;
+ public static var ACT_SCROLL_DN_Y :Number = 181;
+ public static var ANON_SCROLL_UP_Y :Number = 11; // (14/10/09) Modified to account for Audience Tools
+ public static var ANON_SCROLL_DN_Y :Number = 173; // AC (21/04/08): Modified to be placed at the bottom of the chat log field
+ public static var CHAT_INPUT_X :Number = 225; //cf RIGHT_BOUND
+ public static var CHAT_INPUT_Y :Number = 190; //cf BOTTOM_BOUND
+ public static var CHAT_INPUT_W :Number = 88; //cf CHAT_WIDTH
+ public static var CHAT_INPUT_H :Number = 11;
+ public static var ANON_CHAT_INPUT_Y :Number = 180; //LK added 17/10/07
+
+ public static var BUBBLE_BASE_H :Number = 20;
+ public static var BUBBLE_MIN_W :Number = 60;
+ public static var BUBBLE_MAX_W :Number = 300;
+ public static var BUBBLE_FADE_STEP :Number = 0.03;
+
+ //base size of thought bubble polyps
+ public static var THOUGHT_POLYP_W :Number = 9;
+
+ public static var TF_WIDTH :Number = 40;
+ public static var TF_HEIGHT :Number = 12;
+
+ public static var INFO_WIDTH :Number = 30;
+ public static var INFO_HEIGHT :Number = 10;
+ public static var INFO_WIDTH2 :Number = 88; //Player/Audience Count - Audience View - Vishaal - 08/10/09
+ public static var INFO_HEIGHT2 :Number = 10; //Player/Audience Count - Audience View - Vishaal - 08/10/09
+ public static var INFO_X :Number = 240;
+ public static var INFO_Y :Number = 59;
+ public static var INFO_X2 :Number = 225; //Player/Audience Count - Audience View - Vishaal - 08/10/09
+ public static var INFO_Y2 :Number = 1; //Player/Audience Count - Audience View - Vishaal - 08/10/09
+
+ public static var MIRROR_ICON_W :Number = 48;
+ public static var MIRROR_ICON_H :Number = 22;
+
+ //where the prop box goes.
+ public static var PROP_BOX_X :Number = 124;
+ public static var PROP_BOX_Y :Number = 190; //cf BOTTOM_BOUND, CHAT_INPUT_Y
+ //LK added 25/6/07
+ public static var PROP_SCROLL_L_X :Number = 116.5;
+ public static var PROP_SCROLL_R_X :Number = PROP_BOX_X + 86.5;
+ public static var PROP_SCROLL_BAR_Y :Number = 192.25;
+
+ //backdrop box
+ public static var BACKDROP_BOX_X :Number = 15; //cf BOTTOM_BOUND, CHAT_INPUT_Y
+ public static var BACKDROP_BOX_Y :Number = PROP_BOX_Y; //cf BOTTOM_BOUND, CHAT_INPUT_Y
+ //LK added 25/6/07
+ public static var BKDROP_SCROLL_L_X :Number = 7.5;
+ public static var BKDROP_SCROLL_R_X :Number = BACKDROP_BOX_X + 86.5;
+ public static var BKDROP_SCROLL_BTN_Y :Number = 192.25;
+
+ // All other positions relative to control top left
+
+ public static var CONTROL_WIDTH :Number = CHAT_WIDTH; //players avatar controls
+ public static var CONTROL_HEIGHT :Number = 89;
+ public static var CONTROL_Y :Number = 2;
+
+ // PQ: Added 21.10.07
+ // The number of audio controls in the audio widget (left controls)
+ public static var AU_NO_OF_AUDIO_CONTROLS :Number = 3
+ // PQ: 23.9.07 - (Generalized) Changed from DRAW_BOX_W/H to WIDGET_BOX_W/H to accommodate new audio widget
+ public static var WIDGET_BOX_W :Number = 95; //chat width + scroll bar
+ public static var WIDGET_BOX_H :Number = 67;
+
+ public static var COLOUR_PICKER_X :Number = 1;
+ public static var COLOUR_PICKER_Y :Number = 1;
+ public static var COLOUR_PICKER_W :Number = 60;
+ public static var COLOUR_PICKER_H :Number = 21;
+ public static var COLOUR_PALETTE_Y :Number = COLOUR_PICKER_Y + COLOUR_PICKER_H + 2;
+ public static var COLOUR_PALETTE_W :Number = 5;
+ public static var COLOUR_PALETTE_H :Number = 5;
+ public static var ALPHA_SLIDER_Y :Number = COLOUR_PALETTE_Y + COLOUR_PALETTE_H + 1;
+ public static var ALPHA_SLIDER_H :Number = 4;
+ public static var SIZE_SLIDER_Y :Number = ALPHA_SLIDER_Y + ALPHA_SLIDER_H + 1;
+ public static var SIZE_SLIDER_GAP :Number = 22;
+
+ public static var LAYER_PICKER_X :Number = 70;
+ public static var LAYER_PICKER_Y :Number = COLOUR_PICKER_Y;
+ public static var LAYER_PICKER_W :Number = 24;
+ public static var LAYER_PICKER_H :Number = 65;
+ public static var LPICKER_LAYER_H :Number = 12;
+ public static var LPICKER_LABEL_H :Number = 8;
+
+ public static var AV_SCROLL_X :Number = 50; // Avatar selector scrollbar
+ public static var AV_SCROLL_Y :Number = 0;
+ public static var AV_SCROLL_WIDTH :Number = 38;
+ public static var AV_SCROLL_HEIGHT :Number = 67;
+
+ public static var AV_SCROLL_BTN_X :Number = CONTROL_WIDTH; //selector scrollbar buttons
+ public static var AV_SCROLL_UP_Y :Number = 0;
+ public static var AV_SCROLL_DN_Y :Number = 60;
+
+ public static var AV_SCROLL_NAME_W :Number = 29; // Avatar selector label
+ public static var AV_SCROLL_NAME_H :Number = 10;
+ //public static var AV_SCROLL_ITEM_W :Number = ICON_SIZE + AV_SCROLL_NAME_W;
+
+ public static var AV_MIRROR_X :Number = 0; // Avatar selector mirror
+ public static var AV_MIRROR_Y :Number = 0;
+ public static var AV_MIRROR_WIDTH :Number = 48;
+ public static var AV_MIRROR_HEIGHT :Number = 24;
+
+ public static var AV_LAYER_BTN_X :Number = 41;
+ public static var AV_LAYER_UP_Y :Number = 5;
+ public static var AV_LAYER_DOWN_Y :Number = 12;
+
+ //buttons below mirror
+ public static var AV_UI_BUTTON_Y :Number = 41;
+ public static var AV_UI_BUTTON_W :Number = 48;
+ public static var AV_UI_BUTTON_H :Number = 28;
+ //Shaun Narayan (04/25/10) - Avatar Menus
+ public static var AV_UI_MENU_CUSTOM :Boolean = false;
+ public static var AV_UI_MENU_ITEMS :Number = 5;
+ public static var AV_UI_MENU_COLOR :Number = 0xFFFFFF;
+ public static var AV_UI_MENU_PADDING :Number = 5;
+ public static var AV_UI_MENU_BUTTON_WIDTH :Number = 20;
+ public static var AV_UI_MENU_BUTTON_HEIGHT :Number = 8;
+ public static var AV_UI_MENU_W :Number = AV_UI_MENU_BUTTON_WIDTH+(AV_UI_MENU_PADDING*2);
+ public static var AV_UI_MENU_H :Number = AV_UI_MENU_BUTTON_HEIGHT*AV_UI_MENU_ITEMS+(AV_UI_MENU_PADDING*2);
+
+ public static var AV_NAME_WIDTH :Number = AV_MIRROR_WIDTH;
+ public static var AV_NAME_HEIGHT :Number = 12;
+ public static var AV_NAME_X :Number = 0;
+ public static var AV_NAME_Y :Number = 26;
+
+ // PQ: Added 21.10.07
+ // One audio control coords and size
+ public static var AU_CONTROL_X :Number = 0;
+ public static var AU_CONTROL_Y :Number = 0;
+ public static var AU_CONTROL_WIDTH :Number = 48;
+ public static var AU_CONTROL_HEIGHT :Number = (WIDGET_BOX_H - INFO_HEIGHT) / AU_NO_OF_AUDIO_CONTROLS;
+
+ // AC: 31.05.08
+ public static var AU_NAME_WIDTH :Number = 35;
+ public static var AU_NAME_HEIGHT :Number = AV_NAME_HEIGHT - 3;
+
+ // EB: Added - 22/10/07
+ // PQ: Edited below 29.10.07
+ public static var AU_SLIDER_X :Number = 15;
+ public static var AU_SLIDER_Y :Number = 13;
+ public static var AU_SLIDER_H :Number = 4;
+ public static var AU_SLIDER_W :Number = 31;
+
+ //standard slider height.
+ public static var UI_SLIDER_HEIGHT :Number = 4;
+
+ //splash screen dimensions
+ public static var SPLASH_TF_W :Number = 250;
+ public static var SPLASH_TF_H :Number = 30;
+
+ public static var SPLASH_MSG_W :Number = 200;
+ public static var SPLASH_MSG_H :Number = 50;
+ public static var SPLASH_MSG_Y :Number = 40;
+
+ public static var SPLASH_NAME_W :Number = 200;
+ public static var SPLASH_NAME_H :Number = 50;
+ public static var SPLASH_NAME_Y :Number = 20;
+
+
+ // splash title font scale
+ public static var SPLASH_TF_SCALE :Number = 3;
+ public static var SPLASH_MSG_SCALE :Number = 1;
+ public static var SPLASH_NAME_SCALE :Number = 2;
+
+ public static var SPLASH_BTN_SCALE :Number = 1.1;
+ public static var SPLASH_BTN_TF_INDENT :Number = -2; // PQ: Added 23.9.07 - Amount to further left the tf
+ //---------- misc --------------------------//
+
+ //how big are standard fonts?
+ public static var BASE_FONT_SIZE :Number = 5.1;
+
+ //alpha settings for icons
+ public static var INUSE_ICON_ALPHA :Number = 40;
+ public static var AVAIL_ICON_ALPHA :Number = 100;
+
+ //avatar stepping interval (ms)
+ public static var AV_STEP_TIME :Number = 150;
+
+ //from AvScrollBar.as
+ public static var DISPLAY_AV :Number = 6; // Number of avatars to show at once 22-Sep-2006
+ //LK added 25/6/07
+ public static var DISPLAY_PROP :Number = 8;
+
+ public static var VIDEO_INTERVAL_TARGET :Number = 1500; //tries to adapt wait time to reach this rate
+ public static var VIDEO_INTERVAL_MIN :Number = 500; //but never waits for less than this.
+ public static var VIDEO_MAX_FAILURES :Number = 10; // this many consequtive 404s before quitting
+
+ public static var BUBBLE_SOLID_T :Number = 300; //how long before bubble starts to fade
+ public static var SCROLL_REPEAT :Number = 120;
+
+ public static var POST_LOAD_WAIT :Number = 500; //wait after last thing loaded
+
+ //button colours and shapes
+ public static var UI_BUTTON_POINTS :Array = [01,02, 01,01, 02,01,
+ 14,01, 15,01, 15,02,
+ 15,07, 15,08, 14,08,
+ 02,08, 01,08, 01,07,
+ 01,02, 01,02, 01,02];
+ public static var UI_BUTTON_WIDTH :Number = 15;
+ public static var UI_BUTTON_HEIGHT :Number = 8;
+ public static var UI_BUTTON_SPACE_W :Number = 16;
+ public static var UI_BUTTON_SPACE_H :Number = 9;
+ public static var UI_BUTTON_TEXT_SCALE :Number = 0.7;
+
+ //LK added 15/10/07 for audience applause button
+ public static var APPLA_UI_BUTTON_POINTS :Array = [01,02, 01,01, 02,01,
+ 33,01, 34,01, 34,02,
+ 34,7, 34,8, 33,8,
+ 02,8, 01,8, 01,7,
+ 01,02, 01,02, 01,02];
+
+ public static var APPLA_UI_BUTTON_WIDTH :Number = 34;
+ public static var APPLA_UI_BUTTON_HEIGHT :Number = 8;
+ public static var APPLA_UI_BUTTON_TEXT_SCALE :Number = 1;
+
+ //LK added 15/10/07 for volunteer drop button
+ public static var DROP_UI_BUTTON_POINTS :Array = [01,02, 01,01, 02,01,
+ 19,01, 20,01, 20,02,
+ 20,7, 20,8, 19,8,
+ 02,8, 01,8, 01,7,
+ 01,02, 01,02, 01,02];
+ public static var DROP_UI_BUTTON_WIDTH :Number = 20;
+ public static var DROP_UI_BUTTON_HEIGHT :Number = 8;
+ public static var DROP_UI_BUTTON_TEXT_SCALE :Number = 1;
+
+ public static var SCROLL_BUTTON_POINTS :Array = [0,0, 7,0, 7,7, 0,7, 0,0];
+ public static var SCROLL_ARROW_UP :Array = [3.5,1, 6,6, 1,6, 3.5,1];
+ public static var SCROLL_ARROW_DOWN :Array = [1,1, 6,1, 3.5,6, 1,1];
+ //LK added 25/6/07
+ public static var SCROLL_ARROW_RIGHT :Array = [1,1, 6,3.5, 1,6, 1,1];
+ public static var SCROLL_ARROW_LEFT :Array = [1,3.5, 6,1, 6,6, 1,3.5];
+
+ // PQ: Added 23.9.07
+ public static var AUDIO_VOL_X :Number = 1;
+ public static var AUDIO_VOL_Y :Number = 10;
+ public static var AUDIO_VOL_H :Number = 40;
+ public static var AUDIO_VOL_W :Number = 5;
+ // PQ Added 30.10.07
+ // Default volume for all audios in Audio widget
+ public static var AUDIO_VOL_DEFAULT_VAL :Number = 50;
+
+
+ // PQ: Added 29.10.07 - Stop All Audio button sizes
+ public static var STOPALLAUDIO_UI_BUTTON_TEXT_WIDTH :Number = 25;//32;
+ public static var STOPALLAUDIO_UI_BUTTON_TEXT_HEIGHT :Number = 6;//10;
+ public static var STOPALLAUDIO_UI_BUTTON_TEXT_SCALE :Number = 0.8;
+
+ // PQ: Added 29.10.07 - How to draw the Stop All Audio button
+ // PQ: Edited 30.10.07 - Made sizing dynamic when change above BUTTON_TEXT_WIDTH
+ // so when change the text area width, the button size changes with it!
+ public static var STOPALLAUDIO_UI_BUTTON_POINTS :Array = [01,02, 01,01, 02,01,
+ STOPALLAUDIO_UI_BUTTON_TEXT_WIDTH-1,01,
+ STOPALLAUDIO_UI_BUTTON_TEXT_WIDTH,01,
+ STOPALLAUDIO_UI_BUTTON_TEXT_WIDTH,02,
+ STOPALLAUDIO_UI_BUTTON_TEXT_WIDTH,7,
+ STOPALLAUDIO_UI_BUTTON_TEXT_WIDTH,8,
+ STOPALLAUDIO_UI_BUTTON_TEXT_WIDTH-1,8,
+ 02,8, 01,8, 01,7,
+ 01,02, 01,02, 01,02];
+
+
+
+ // AC added (06/05/08)
+ public static var AUDIOSLOT_UI_BUTTON_POINTS :Array = [01,02, 01,01, 02,01,
+ 15,01, 16,01, 16,02,
+ /*16,07, 16,08, 15,08,
+ 02,08, 01,08, 01,07,*/
+ 16,06, 16,07, 15,07,
+ 02,07, 01,07, 01,06,
+ 01,02, 01,02, 01,02];
+
+ public static var AUDIOSLOT_UI_BUTTON_TEXT_WIDTH :Number = 19;//18.8;
+ public static var AUDIOSLOT_UI_BUTTON_TEXT_HEIGHT :Number = 8;
+ public static var AUDIOSLOT_UI_BUTTON_TEXT_SCALE :Number = 0.5;
+
+ // Natasha & Thomas: Added - Points for moveable drawing button
+ public static var MD_BUTTON_WIDTH :Number = 45;
+ public static var MD_BUTTON_HEIGHT :Number = 9;
+ public static var MD_BUTTON_POINTS :Array = [01,02, 01,01, 02,01,
+ MD_BUTTON_WIDTH - 1,01, MD_BUTTON_WIDTH,01, MD_BUTTON_WIDTH,02,
+ MD_BUTTON_WIDTH, MD_BUTTON_HEIGHT -1, MD_BUTTON_WIDTH, MD_BUTTON_HEIGHT, MD_BUTTON_WIDTH - 1, MD_BUTTON_HEIGHT,
+ 02,MD_BUTTON_HEIGHT, 01,MD_BUTTON_HEIGHT, 01, MD_BUTTON_HEIGHT - 1,
+ 01,02, 01,02, 01,02];
+
+
+ // PQ: Added
+ // Path to the music note and sfx icon that display in the audio widget
+ public static var MUSIC_ICON_IMAGE_URL :String = '/media/thumb/music.jpg';
+ public static var SFX_ICON_IMAGE_URL :String = '/media/thumb/sfx.jpg';
+
+ // PQ: Added 30.10.07
+ // Text to display on the audio widget's "Stop All Audio" button
+ public static var AUDIO_STOPALLAUDIO_TEXT :String= 'stop all';
+
+ //diamond, centred on y axis, unit size.
+ public static var SLIDER_DIAMOND :Array = [0,0, 0.35,0.5, 0,1, -0.35,0.5, 0,0];
+
+ public static var DRAWING_EYE_1 :Array = [9,10.4, 6,8, 5.6,4, 7,2, 9,1, 11,2, 12,5,
+ 11,8, 9,9, 9,10.4];
+
+
+ public static var DRAWING_EYE_2 :Array = [0,7, 2,6, 6,2, 7,1, 9,0.4, 11,1, 13,3,
+ 17,7, 15,5, 17,7, 15,7, 11,10, 9,10.4, 6,8,
+ 5.6,4, 7,2, 9,1, 11,2, 12,5, 11,8, 9,9,
+ 6,9, 3,8, 0,7];
+
+ public static var DRAWING_PENCIL :Array = [35,0, 185,150, 185,185, 150,185, 0,35, 12,22,
+ 160,170, 170,160, 160,170, 12,22 ];
+
+ public static var PALETTE_POINTS :Array = [0,0, COLOUR_PALETTE_W,0,
+ COLOUR_PALETTE_W,COLOUR_PALETTE_H,
+ 0,COLOUR_PALETTE_W, 0,0];
+
+ public static var DRAW_TRACE_POINTS :Array = [0,-3, 0,0, 2.5,-0.5, 0,0,
+ -2.5,-0.5, 0,0, -1,2, 0,0,
+ 1,2, 0,0, 0,-3];
+ public static var DRAW_TRACE_N :Number = 20;
+ public static var DRAW_TRACE_TIMEOUT :Number = 2000;
+
+ //colour transforms
+ //Shaun Narayan (02/24/10) - Alpha vals now -1,...0,...1 as opposed to +-100
+ // ra, ga, ba, aa -- how much of original colour to keep (+/- 1)
+ // rb, gb, bb, ab -- colour offset to mix in (+/- 255)
+ public static var BUTTON_UP_CT :Object = {ra: 1.00, rb: 0,
+ ga: 1.00, gb: 0,
+ ba: 1.00, bb: 0,
+ aa: 1.00, ab: 0};
+ public static var BUTTON_DOWN_CT :Object = {ra: 0.75, rb: 75,
+ ga: 0.75, gb: 75,
+ ba: 0.75, bb: 75,
+ aa: 1, ab: 0};
+ public static var BUTTON_OVER_CT :Object = {ra: 0.70, rb: 100,
+ ga: 0.70, gb: 90,
+ ba: 0.70, bb: 80,
+ aa: 1.00, ab: 0};
+ public static var BUTTON_GREY_CT :Object = {ra: 0.36, rb: 148,
+ ga: 0.36, gb: 148,
+ ba: 0.36, bb: 148,
+ aa: 0.65, ab: 0};
+
+
+
+
+ //---------------------------- colours ----------------------//
+
+ public static var BORDER_COLOUR :Number = 0x669900;
+
+ public static var TEXT_COLOUR :Number = 0x000000;
+ public static var UI_BACKGROUND :Number = 0xFFFFFF;
+ public static var BUBBLE_COLOUR :Number = 0xFFFFFF;
+ public static var SCROLL_COLOUR :Number = 0xccdd99;
+ public static var SCROLL_BORDER :Number = 0x336600;
+ public static var SCROLL_ARROW :Number = 0x669933;
+ public static var CHAT_BG_MISSED :Number = 0xEECCCC;
+ public static var CHAT_BG_BACK :Number = 0xCCCCCC;
+ public static var CHAT_THOUGHT :Number = 0x337799;
+ public static var SHOUT_COLOUR :Number = 0xFF0000;//Wendy, Candy and Aaron
+ public static var CHAT_SHOUT :Number = 0xFF0000; //Wendy, Candy and Aaron
+ public static var CHAT_ANON :Number = 0x999999;
+ public static var CHAT_ERROR :Number = 0xCC0000;
+ public static var CHAT_MSG :Number = 0xCC6600;
+ public static var CHAT_WHISPER :Number = 0x000099;
+ public static var CHAT_FRAME :Number = 0x0000ff;
+ public static var SLIDER_BORDER :Number = 0x000000;
+
+ public static var BTN_LINE_DROP :Number = 0x999900;
+ public static var BTN_FILL_DROP :Number = 0xCCCC00;
+ public static var BTN_LINE_CLEAR :Number = 0x999999;
+ public static var BTN_FILL_CLEAR :Number = 0xcccccc;
+ public static var BTN_LINE_NAME :Number = 0xcc0033;
+ public static var BTN_FILL_NAME :Number = 0xdd99aa;
+ public static var BTN_LINE_DRAW :Number = 0x006699;
+ public static var BTN_FILL_DRAW :Number = 0x0099cc;
+ public static var BTN_LINE_STOP :Number = 0xcc0000;
+ public static var BTN_FILL_STOP :Number = 0xff0000;
+ public static var BTN_LINE_FAST :Number = 0x006600;
+ public static var BTN_FILL_FAST :Number = 0x33cc00;
+ public static var BTN_LINE_SLOW :Number = 0x996600;
+ public static var BTN_FILL_SLOW :Number = 0xff9900;
+ public static var BTN_LINE_RESET :Number = 0x660033;
+ public static var BTN_FILL_RESET :Number = 0xcc0033;
+ public static var BTN_LINE_AUDIO :Number = 0x006699; // PQ: Added 22.9.07
+ public static var BTN_FILL_AUDIO :Number = 0xFAFF00; // PQ: Added 22.9.07
+ //Shaun Narayan (04/26/10) Avatar Menus
+ public static var BTN_LINE_RENAME :Number = 0x0000FF;
+ public static var BTN_FILL_RENAME :Number = 0x2222FF;
+ public static var BTN_LINE_SHADOW :Number = 0x444444;
+ public static var BTN_FILL_SHADOW :Number = 0x555555;
+ public static var BTN_LINE_VOICE :Number = 0xFFFF00;
+ public static var BTN_FILL_VOICE :Number = 0xDDDD00;
+
+ public static var BTN_LINE_RELOAD:Number = 0x006611;
+ public static var BTN_FILL_RELOAD:Number = 0x33cc88;
+ public static var BTN_LINE_CNCL :Number = 0x880000;
+ public static var BTN_FILL_CNCL :Number = 0xff0000;
+
+
+ public static var PROGRESS_FORE :Number = 0x000000;
+ public static var PROGRESS_LOAD_F:Number = 0x00cc33;
+ public static var PROGRESS_FAIL_F:Number = 0xcc0000;
+ public static var PROGRESS_START_F:Number= 0xddcc00;
+ public static var PROGRESS_LOAD_L:Number = 0x006600;
+ public static var PROGRESS_FAIL_L:Number = 0x660000;
+ public static var PROGRESS_START_L:Number= 0x776600;
+
+
+
+ // Layers
+ //-------------------------------------------------------------------------
+ // Stage lies on layer 10
+
+ // Be careful adding numbers to these values use Number(...) casts
+ // ActionScript seems to interpret them as string adds sometimes...
+ // max Layer is just over a million (2 ** 20)
+
+
+
+ /// Draw behind background images
+ public static var L_DRAW_0 :Number = 90;
+
+ /// Background images on stage
+ public static var L_BG_IMG :Number = 100;
+
+ /// Draw between background and avatars
+ public static var L_DRAW_1 :Number = 900;
+ public static var L_DRAW_2 :Number = 910;
+
+ // /Avatar images on screen (L_AV_IMG + ID)
+ public static var L_AV_IMG :Number = 10000;
+
+ /// Prop images on stage
+ public static var L_PROPS_IMG :Number = 200000;
+
+ /// Avatar names on stage (L_AV_NAME + ID)
+ public static var L_AV_NAME :Number = 210000;
+
+ /// Avatar speech bubbles on stage (base mc & tf on mc)
+ public static var L_AV_BUBBLES :Number = 250000;
+
+
+ /// Draw in from of avatars
+ public static var L_DRAW_3 :Number = 290000;
+
+
+ // -------------UI 300k - 699k-------------------
+ /// Prop items frame
+ public static var L_PROP_FRAME :Number = 300000;
+
+ /// Bg icons frame
+ public static var L_BG_FRAME :Number = 300100;
+
+ /// Background prop / icons
+ public static var L_UI_ICONS_BASE :Number = 310000;
+
+ public static var L_DRAW_TRACE :Number = 320000;
+
+ /// Actor buttons
+ public static var L_BUTTONS_FRAME :Number = 400000;
+
+ //drawing tools
+ public static var L_DRAW_TOOLS :Number = 400500;
+ public static var L_COLOUR_PICKER :Number = 401000;
+ public static var L_COLOUR_PALETTE :Number = 401500;
+ public static var L_LAYER_PICKER :Number = 402000;
+
+
+ /// Player / audience count frame
+ public static var L_INFO_FRAME :Number = 405000;
+
+
+ /// Avatar icons
+ public static var L_AV_ICON :Number = 410000;
+
+ // PQ: Added 7.10.07
+ // Audio list icons
+ public static var L_AUDIO_ICON_THUMB :Number = 420000;
+
+ public static var L_AUDIO_ICON :Number = 450000;
+ /// buttons created with ButtonMc (gets incremented)
+ public static var L_UI_BUTTONS :Number = 515000;
+
+ /// Avatar scrollbar
+ public static var L_SCROLL_FRAME :Number = 516000;
+
+ /// Player / audience count text
+ public static var L_INFO_TEXT :Number = 516200;
+ public static var L_INFO_TEXT2 :Number = 516400; //Added for Audience player/Audience count view - Vishaal - 08/10/09
+
+ // PQ: Added 23.9.07
+ // PQ: Edited 30.10.07 - value from 403000 to 517000 to make go over
+ // Player / audience count text
+ // Audio Tools Layer Number
+ public static var L_AUDIO_TOOLS :Number = 517000;
+
+ /// Chat text and input,
+ public static var L_CHAT_TEXT :Number = 600010;
+ public static var L_CHAT_INPUT :Number = 600030;
+
+
+ //---------splash screen and debug 700k - 1M
+
+ // Splash screen
+ public static var L_SPLASH_SCREEN :Number = 900000;
+
+ /// Debug log (top of everything ...
+
+ public static var L_DEBUG :Number = 999999;
+
+
+ //how many layers allocated per type ( making room for video, etc).
+ public static var AV_IMG_LAYERS :Number = 10;
+ public static var AV_ICON_LAYERS :Number = 5;
+ public static var THING_IMG_LAYERS :Number = 5;
+ public static var ICON_IMG_LAYERS :Number = 5;
+ public static var UI_BUTTON_LAYERS :Number = 5;
+ public static var BUBBLE_LAYERS :Number = 5;
+
+ //------------------where to log-------------------
+
+ //should debug messages get sent to the server
+ public static var LOG_TO_SERVER : Boolean = false;
+ //should debug messages go to screen
+ public static var LOG_TO_SCREEN : Boolean = true;
+
+ //how many times to try connecting.
+ public static var MAX_CONNECTION_ATTEMPTS: Number = 4;
+ public static var MAX_AUTH_ATTEMPTS : Number = 4;
+
+
+ //---------------------strings ------------------//
+
+ public static var AUTH_URL :String = '/admin/id';
+ // PQ & LK: Added 31.10.07
+ public static var APPLAUSE_URL :String = 'applause.mp3';
+
+ //-----------------drawing layer information .
+ public static var DRAWING_LAYERS :Array = [
+ {
+ type: 'layer',
+ description: 'back',
+ layer: Client.L_DRAW_0
+ },
+ {
+ type: 'label',
+ description: 'backdrops'
+ },
+ {
+ type: 'layer',
+ description: 'middle1',
+ layer: Client.L_DRAW_1
+ },
+ {
+ type: 'layer',
+ description: 'middle2',
+ layer: Client.L_DRAW_2
+ },
+ {
+ type: 'label',
+ description: 'avatars'
+ },
+ {
+ type: 'layer',
+ description: 'front',
+ layer: Client.L_DRAW_3
+ }
+ ];
+
+ public static var DRAWING_LAYERS_N :Number = 4;
+
+
+ public static var PALETTE_FIXED :Array = [0xffffff, 0x000000];
+
+ //-------------------------------- sound
+ /*8 slots are available -- these numbers need to ad up toi divvy them properly */
+ public static var SPEECH_SOUNDS :Number = 15; // Max concurrent sounds (0, 1, 2)
+ //public static var SFX_SOUNDS :Number = 2; // For sound effects (slot 3)
+ //public static var MUSIC_SOUNDS :Number = 1; // For music (slot 4)
+ // AC: 10.06.08
+ public static var AUDIO_SOUNDS :Number = 3;
+ // PQ & LK: 31.10.07
+ public static var APPLAUSE_SOUNDS :Number = 10; // Max concurrent applauses
+
+ //how many things get loaded for each media type (icons, etc count as a separate load)
+ public static var LOADS_PER_AVATAR :Number = 3;
+ public static var LOADS_PER_PROP :Number = 2;
+ public static var LOADS_PER_BACKDROP :Number = 2;
+
+
+ public static var PROGRESS_BAR_W :Number = 120;
+ public static var PROGRESS_BAR_H :Number = 8;
+ public static var PROGRESS_BAR_BORDER :Number = 2;
+
+ public static var CHAT_HISTORY_LENGTH :Number = 50;
+
+ // id 0 means no thing in communication (ie, drop the prop/ backdrop/av)
+ public static var NULL_THING_ID :Number = 0;
+ }
+}
Added: branches/2.4.1/AS3.client/upstage/org/Sender.as
===================================================================
--- branches/2.4.1/AS3.client/upstage/org/Sender.as (rev 0)
+++ branches/2.4.1/AS3.client/upstage/org/Sender.as 2011-07-30 06:20:37 UTC (rev 307)
@@ -0,0 +1,493 @@
+package org {
+ /*
+ Copyright (C) 2003-2006 Douglas Bagnall (douglas * paradise-net-nz)
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+ import org.Transport;
+ import flash.net.*;
+ /**
+ * Author:
+ * Purpose: Send messages to server.
+ * Modified by: Endre Bernhardt, Phillip Quinlan, Lauren Kilduff
+ * Modified by: Wendy, Candy and Aaron 30/10/2008
+ * @modified Shaun Narayan (Feb 2010) - Converted to AS3. Amongst usual changes (Package declaration,
+ * removal of _ prefix fields, new moviclip registration method,
+ * new event handling etc...) - also modified all methods to send data in an array rather
+ * than allowing variable length argument lists.
+ * Notes:
+ */
+
+
+ public class Sender {
+
+ private var transport :Transport; // Handle to transport
+ private var iCount :Number;
+
+ /**
+ * @brief Constructor
+ */
+ public function Sender(transport :Transport)
+ {
+ this.transport = transport;
+ trace('Sender constructor...');
+ this.iCount = 0;
+ }
+
+
+ /**
+ * @brief Encode a message & send via <code>Transport</code>
+ */
+ private function send(info :Array) :void
+
+ {
+ // Convert public function parameters into a LoadVars object
+ var msg: URLVariables = new URLVariables();
+
+ msg['mode'] = info[0];
+ var k :String, v :String;
+ var i: Number;
+ //note: starts at i=1, because mode is at 0
+ for(i = 1; i < info.length; i += 2)
+ {
+ k = info[i];
+ v = info[i + 1];
+ msg[k] = v;
+ }
+
+ trace('SENDING: ' + msg);
+ // Send message to server
+ this.transport.send(msg);
+ };
+
+
+
+ /**
+ * @brief Confirm identity with MD5 key
+ * MD5 Key received by auth, third step in handshaking
+ */
+ public function IDENT(msg :Object) :void
+ {
+ var info:Array = ['IDENT', 'MD5', msg];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief Request to join the named stage
+ * final step in handshaking
+ */
+ public function JOIN(stageID :Object) :void
+ {
+ var info:Array = ['JOIN', 'stage_ID', stageID];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief Send a message to server - does nothing, but does get written
+ * to server side log
+ */
+ public function NB(msg :String) :void
+
+ {
+ //var msg2 :String = arguments.join();
+ var info:Array = [ 'NB', 'msg', msg];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief Send text to the chat log (all users)
+ */
+ public function TEXT(msg :String) :void
+ {
+ var info:Array = [ 'TEXT', 'msg', msg];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief Select a new background for the stage
+ */
+ public function BACKDROP(bgID :Number) :void
+ {
+ var info:Array = [ 'BACKDROP', 'ID', bgID];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief User picked up an avatar
+ */
+ public function AV(avID :Number) :void
+ {
+ var info:Array = [ 'AV', 'ID', avID];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief User picked up a prop
+ */
+ public function PROP(propID :Number) :void
+ {
+ var info:Array = [ 'PROP', 'ID', propID];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief User placed an avatar
+ */
+ public function MOVE(x :Number , y :Number) :void
+ {
+ var info:Array = [ 'MOVE', 'X',x, 'Y',y];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief User sent an avatar on a walk to a destination
+ */
+ public function MOVETOWARD(x :Number, y :Number) :void
+ {
+ var info:Array = [ 'MOVETOWARD', 'X', x, 'Y', y];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief User renamed their current avatar
+ * NOTE changes last only until the stage is reset
+ */
+ public function RENAME(name :String) :void
+ {
+ var info:Array = [ 'RENAME', 'name', name];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief Used to change the properties of an avatar
+ * Toggle visibility of names for now
+ */
+ public function AVPROPERTIES(avID :Number, showName :Boolean) :void
+ {
+ //some day there might be more than 'showName'
+ var show_name :String = (showName==true ? 'show' : 'hide');
+ var info:Array = ['AVPROPERTIES', 'ID', avID, 'show_name', show_name];
+ this.send(info);
+ };
+
+ public function AVLAYER(id: Number, newLayer:Number) :void
+ {
+ var info:Array = ['AVLAYER', 'ID', id, 'newlayer', newLayer];
+ this.send(info);
+ }
+
+ /*------------ Moveable Drawing Methods ----------*/
+
+ /**
+ * @brief: Create moveable drawing ids
+ * Natasha & Thomas
+ */
+ public function CREATE_DRAWING_ID(avID :Number) :void
+ {
+ var info:Array = ['CREATE_DRAWING_ID','ID', avID];
+ this.send(info);
+ };
+
+ /**
+ * @brief Client requested to drop avatar
+ */
+ public function EXIT(avID :Number) :void
+ {
+ var info:Array = [ 'EXIT', 'ID', avID];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief Client asked for details of current stage
+ */
+ public function DETAILS() :void
+ {
+ var info:Array = ['DETAILS' ];
+ this.send(info);
+ };
+
+
+ /**
+ * @brief Client asked for license details
+ */
+ public function INFO() :void
+ {
+ var info:Array = ['INFO'];
+ this.send(info);
+ }
+
+ /**
+ * @brief Client asked to whisper to other client(s)
+ */
+ public function WHISPER(msg :String) :void
+ {
+ var info:Array = ['WHISPER', 'msg', msg];
+ this.send(info);
+ }
+
+ /**
+ * @brief Player has initiated a vote.
+ */
+ public function VOTE(msg :String) :void
+ {
+ var info :Array = ['VOTE', 'msg', msg];
+ this.send(info);
+ }
+
+ /**
+ * @breif send a thought
+ */
+ public function THINK(thought:String):void
+ {
+ var info:Array = ['THOUGHT', 'thought', thought];
+ this.send(info);
+ }
+
+ /**
+ * @brief send a shout
+ * Wendy, Candy and Aaron -30/10/08
+ * Shout Feature
+ */
+ public function SHOUT(shout:String):void
+ {
+ var info:Array = ['SHOUT', 'shout', shout];
+ this.send(info);
+ }
+
+ /**
+ * LK added 24/9/07
+ * @brief displays the volunteer btn
+ */
+ public function VOLUNTEER()
+ {
+ //var volunteer : Boolean;
+ //if (!Transport.isVolunteer()){
+ // this.transport.VOLUNTEER();
+ var info:Array = ['VOLUNTEER', 'volunteer', ''];
+ this.send(info);
+ //// Transport.volunteer = true;
+ // this.TEXT("Volunteer: " + Transport.volunteer);
+ //}else{
+ // this.NO_VOLUNTEER();
+ // this.TEXT("volunteer unavailable now");
+ //}
+ }
+
+ /**
+ * LK added 31/10/07
+ * @brief hides the volunteer btn
+ */
+ public function NO_VOLUNTEER()
+ {
+ //this.transport.send("volunteer unavailable now");
+ var info:Array = ['NOVOLUNTEER', 'novolunteer', ''];
+ this.send(info);
+ }
+
+
+ public function VOL_LET_GO()
+ {
+ Transport.volunteer = false;
+ this.transport.VOL_LET_GO();
+ this.iCount = 0;
+ }
+
+ /**
+ * LK added 31/10/07
+ * @brief Shows volunteer view
+ */
+ public function BecomeVolunteer(): void
+ {
+ //this.transport.send("volunteer unavailable now");
+ this.transport.VolunteerBtnClicked();
+ }
+
+ /**
+ * LK added 17/10/07
+ * @brief Show applause button
+ */
+ public function APPLAUSE()
+ {
+ //this.transport.APPLAUSE();
+ var info:Array = ['APPLAUSE', 'applaud', ''];
+ this.send(info);
+ }
+
+ /**
+ * LK added 29/10/07
+ * @brief Hide Applause button
+ */
+ public function NO_APPLAUSE()
+ {
+ //this.transport.APPLAUSE();
+ var info:Array = ['NOAPPLAUSE', 'noapplaud', ''];
+ this.send(info);
+ }
+
+ /**
+ * @brief Client asked to select the frame for avatar
+ */
+ public function FRAME(frameNumber: String): void
+ {
+ var info:Array = ['FRAME','frameNumber', frameNumber];
+ this.send(info);
+ }
+
+
+ /** Aaron 1/5/08
+ * @brief Client asked to change backdrop frame
+ */
+ public function BACKDROP_FRAME(frameNumber: String): void
+ {
+ var info:Array = ['BACKDROP_FRAME', 'frameNumber', frameNumber];
+ this.send(info);
+ }
+
+ // PQ & LK: Added to play the applause sound
+ public function PLAY_APPLAUSE(fileName: String): void
+ {
+ trace('got to PLAY_APPLAUSE in sender.as')
+ var info:Array = ['PLAY_APPLAUSE', 'file', fileName];
+ this.send(info);
+ }
+
+ // EB: Added to play sound effects
+ public function LOAD_EFFECT(fileName: String): void
+ {
+ trace('got to PLAY_EFFECT in sender.as') // PQ: Added
+ var info:Array = ['LOAD_EFFECT', 'file', fileName];
+ this.send(info);
+ }
+
+ // PQ: Added to play music
+ public function LOAD_MUSIC(fileName: String): void
+ {
+ trace('got to PLAY_MUSIC in sender.as') // PQ: Added
+ var info:Array = ['LOAD_MUSIC', 'file', fileName];
+ this.send(info);
+ }
+
+ public function PLAY_CLIP(array:String, url:String): void
+ {
+ var info:Array = ['PLAY_CLIP', 'array', array, 'url', url];
+ this.send(info);
+ }
+
+ // AC (03.06.08) - Spreads the word to pause a sound.
+ public function PAUSE_CLIP(array:String, url:String): void
+ {
+ var info:Array = ['PAUSE_CLIP', 'array', array, 'url', url];
+ this.send(info);
+ }
+
+ // AC (03.06.08) - Spreads the word to set a sound to loop.
+ public function LOOP_CLIP(array:String, url:String): void
+ {
+ var info:Array = ['LOOP_CLIP', 'array', array, 'url', url];
+ this.send(info);
+ }
+
+ // EB 22/10/07: For broadcasting volume changes
+ public function ADJUST_VOLUME(url:String, type:String, volume:Number):void
+ {
+ var info:Array = ['ADJUST_VOLUME', 'url', url, 'type', type, 'volume', volume];
+ this.send(info);
+ }
+
+ // PQ 29/10/07: For broadcasting stopping one certain audio playing on all clients
+ public function STOP_AUDIO(url:String, type:String):void
+ {
+ var info:Array = ['STOP_AUDIO', 'url', url, 'type', type];
+ this.send(info);
+ }
+
+ // AC 29.05.08 - Clears AudioSlot
+ public function CLEAR_AUDIOSLOT(type: String, url: String)
+ {
+ var info:Array = ['CLEAR_AUDIOSLOT', 'type', type, 'url', url];
+ this.send(info);
+ }
+
+ /** Drawing functions */
+
+ public function DRAW_LINE(x:Number, y:Number)
+ {
+ var info:Array = ['DRAW_LINE', 'x', x, 'y', y];
+ this.send(info);
+ }
+
+ public function DRAW_MOVE(x:Number, y:Number)
+ {
+ var info:Array = ['DRAW_MOVE', 'x', x, 'y', y];
+ this.send(info);
+ }
+
+ public function DRAW_STYLE(thickness:Number, colour:Number, alpha:Number)
+ {
+ var info:Array = ['DRAW_STYLE', 'thickness', thickness,
+ 'colour', colour, 'alpha', alpha];
+ this.send(info);
+ }
+
+ public function DRAW_VIS(layer:Number, alpha:Number, visible:Boolean)
+ {
+ var info:Array = ['DRAW_VIS', 'layer', layer,
+ 'alpha', alpha, 'visible', visible];
+ this.send(info);
+ }
+
+ public function DRAW_CLEAR(layer:Number)
+ {
+ var info:Array = ['DRAW_CLEAR', 'layer', layer];
+ this.send(info);
+ }
+
+ public function DRAW_LAYER(layer:Number)
+ {
+ var info:Array = ['DRAW_LAYER', 'layer', layer];
+ this.send(info);
+ }
+
+
+
+ /**
+ * @brief Client finished loading images
+ */
+ public function LOADED() :void
+ {
+ var info:Array = ['LOADED'];
+ this.send(info);
+ }
+
+ public function DEBUG(x:Object)
+ {
+ if (String(x).indexOf('DEBUG') == -1) //else eternal loop!
+ var info:Array = ['DEBUG', 'msg', x];
+ this.send(info);
+ }
+ }
+}
Added: branches/2.4.1/AS3.client/upstage/org/Transport.as
===================================================================
--- branches/2.4.1/AS3.client/upstage/org/Transport.as (rev 0)
+++ branches/2.4.1/AS3.client/upstage/org/Transport.as 2011-07-30 06:20:37 UTC (rev 307)
@@ -0,0 +1,1028 @@
+package org{
+ /*
+ Copyright (C) 2003-2006 Douglas Bagnall (douglas * paradise-net-nz)
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+ import org.Auth;
+ import org.Client;
+ import org.Sender;
+ import org.util.Construct;
+ import org.model.ModelChat;
+ import org.model.ModelInfo;
+ import org.model.ModelBackDropItems;
+ import org.model.ModelAvatars;
+ import org.model.ModelSplashScreen;
+ import org.model.ModelSounds;
+ import org.model.ModelDrawing;
+ import flash.net.XMLSocket;
+ import flash.display.*;
+ import flash.net.*;
+ import flash.system.*;
+ import flash.external.*;
+ import flash.events.*;
+ /**
+ * Author:
+ * Modified by: Phillip Quinlan, Lauren Kilduff, Endre Bernhardt, Alan Crow
+ * Modified by: Wendy, Candy and Aaron 30/10/2008
+ * Modified by: Vishaal Solanki 15/10/09
+ * @modified Shaun Narayan (01/29/10) - Modified LOAD_AUDIO so it can allow music playing
+ * on the server to be played on the clients computer.
+ * @modified Shaun Narayan (Feb 2010) - Converted to AS3. Amongst usual changes (Package declaration,
+ * removal of _ prefix fields, new moviclip registration method, event
+ * handling etc...) - also allowed for setting color of multiple stage item
+ * backgrounds, changed oldschool decoder to new URLVars, modified connect
+ * handler to avoid infinate loops.
+ * Shaun Narayan (Apr 2010) - Modified connection system to send one connection request and only
+ * attempt a reconnect after knowing it failed for sure, also dont assume
+ * connection failure until the event is triggered (Event.CLOSE) (This caused
+ * upstage to display connection failed until the connect event came through).
+ * Notes:
+ */
+
+
+ public class Transport extends XMLSocket {
+
+ {
+ // Internal variables
+ private var connectionTried :Number;
+
+ // Instances of classes
+ private var auth :Auth; // Auth object
+ private var sender :Sender; // Sender object
+
+ // Handlers for various onscreen objects
+ private var modelChat :ModelChat;
+ private var modelAvatars :ModelAvatars;
+ private var modelBackDropItems :ModelBackDropItems;
+ private var modelInfo :ModelInfo;
+ private var modelSplashScreen :ModelSplashScreen;
+ private var modelSounds :ModelSounds;
+ private var modelDrawing :ModelDrawing;
+
+ private var stage :MovieClip; // Handle to main stage movie clip
+
+ public var mode :String;
+ public var swfport :Number;
+ public var policyport :Number;
+ public var stageID :String;
+ //public var player :String;
+
+ static var volunteer :Boolean;
+
+ /**
+ * @brief Constructor
+ * Creates new Auth object which gets app talking to server
+ */
+ function Transport(stage :MovieClip)
+ {
+
+ trace('Transport constructor...');
+
+ this.stage = stage;
+ super(); // Call XMLSocket constructor
+
+ this.connectionTried = 0;
+
+ this.parseUrlVars();
+
+ this.sender = new Sender(this);
+ // Create new handlers for events
+ //---------------------------------------------------------------------
+
+ // Do splash screen first for loaded progress bar
+ this.modelSplashScreen = new ModelSplashScreen(sender);
+
+ // Order of other handlers doesn't really matter
+ /** EB 22/10/07: EXCEPT!! Make modelSounds before modelAvatars
+ *
+ * modelAvatars (for some reason known only to Douglas or the previous team)
+ * is responsible for the interface controls. When it is created, the
+ * audioScrollBar is created. To create linkage between the audioscrollbar
+ * and ModelSounds (so the AudioSlot objects have the MS object to update to),
+ * the ModelSounds object needs to be provided to the constructor for modelAvatars.
+ * Then the audioScrollBar needs to be passed back to ModelSounds after modelAvatars
+ * has been created. This kind of restriction may be indicative of an architectural
+ * problem but it's a bit late in the day for us to look at it indepth now.
+ * Sorry, it's what we have to work with for now..
+ *
+ */
+ //this.modelSounds = new ModelSounds(sender); //PQ: Added sender
+ //this.modelAvatars = new ModelAvatars(sender, stage, this.modelSounds);
+ //this.modelSounds.setAudioScrollbar(this.modelAvatars.audioScrollBar);
+
+ this.modelChat = new ModelChat(sender);
+ this.modelBackDropItems = new ModelBackDropItems(sender);
+ this.modelSounds = new ModelSounds(sender);//, this.modelChat); //PQ: Added sender
+ this.modelAvatars = new ModelAvatars(sender, stage, this.modelSounds);
+ this.modelInfo = new ModelInfo(sender);
+ this.modelDrawing = new ModelDrawing(sender);//, stage);
+ volunteer = false;
+
+ // True application execution begins when auth finishes load
+ this.auth = new Auth();
+ //this.auth.load(this.drawScreen);
+ this.auth.load(this);
+ }
+
+ function parseUrlVars(){
+ trace("parsing url vars");
+ //var url:String = stage.root.loaderInfo.loaderURL;
+ var url:String = ExternalInterface.call('function(){return document.getElementById("app").data;}');
+ var args:String = url.split('?')[1];
+ var decoder:URLVariables = new URLVariables();
+ trace("loading args of "+ args);
+ decoder.decode(args);
+ this.mode = decoder.mode;
+ this.swfport = Number(decoder.swfport);
+ this.policyport = Number(decoder.policyport);
+ this.stageID = decoder.stageID;
+ }
+
+
+ /**
+ * @brief EventHandler
+ * This onConnect function is used to check and return if the connection
+ * successful or not, if not try a maximum of Client.MAX_CONNECTION_ATTEMPTS
+ * (probably 4) times.
+ */
+ function onConnect(e :Event) : void
+ {
+ trace('Transport.onConnect()...');
+ trace('ok, connected');
+ this.sender.IDENT(this.auth.getKey());
+ this.sender.JOIN(this.stageID);
+
+ trace('Transport.onConnect() done...');
+ }
+
+
+
+ /**
+ * EventHandler
+ * This onClose function is used for XMLSocket callback
+ */
+ function onClose(e:Event) : void
+ {
+ trace('Connection to XMLTransport lost');
+ this.displayConnectionLost("Connection failed");
+ this.connectionTried++;
+ if(connectionTried < Client.MAX_CONNECTION_ATTEMPTS) attemptConnect;
+ }
+
+
+
+ /**
+ * @brief Tries to connect to application (twistd) port
+ * Retries a fixed number of times
+ */
+ private function attemptConnect() : void
+ {
+ // tries to connect to server as specified in server object
+ // fails very plainly - there's not much that can be done.
+ this.addEventListener(Event.CONNECT, onConnect);
+ this.addEventListener(Event.CLOSE, onClose);
+ this.addEventListener(DataEvent.DATA, onDataWrap);
+ var lc: LocalConnection = new LocalConnection();
+ var domain: String = lc.domain;
+ connectionTried = 0;
+ // AC - Get required policy file
+ Security.loadPolicyFile('xmlsocket://' + domain + ':' + Client.POLICY_PORT.toString());
+ //Security.allowDomain('http://' + domain + ':' + this.swfport);
+ trace('attemptConnect() - trying to connect to ' + this.swfport);
+ this.connect(null, this.swfport);
+ trace(this.connected);
+ }
+
+
+ /**
+ * @brief Bugfix some flash players
+ * EventHandler for XMLSocket
+ */
+ function onDataWrap(msg :DataEvent) :void
+
+ {
+ //workaround apparent bug in players
+ this.onData(msg);
+ }
+
+ /**
+ * @brief EventHandler
+ * Called when data received from server
+ * Data dispatched to Receiver class
+ * Event Handler for XMLSocket
+ */
+ function onData(msg :DataEvent) :void
+
+ {
+ trace('GOT "' + msg +'"');
+ var vars:URLVariables = new URLVariables();
+
+ //convert the a variable string to a property of specified LoadVars object
+ vars.decode(msg.data);
+
+ var mode :String = vars.mode.toUpperCase();
+ trace(mode);
+ if (mode && this[mode])
+ {
+ // Get the reciever functions below to handle the message
+ this[mode](vars);
+ }
+ else if (msg)
+ {
+ trace('\nreceived mystery message:\n' + msg );
+ }
+ }
+
+
+ /**
+ * @brief Gets application underway after inital Auth / Server
+ * handshaling is complete
+ */
+ function startPlay() :void
+
+ {
+ this.attemptConnect();
+ trace('********************* started! *********************');
+ }
+
+
+ /**
+ * @brief Draw all child movie clips
+ */
+ public function drawScreen() :void
+
+ {
+ trace('transport.drawScreen()');
+ // Display the splashscreen
+ trace(this.stage);
+ this.modelSplashScreen.drawScreen(this.stage);
+
+ // Set the username for the welcome message
+ this.modelSplashScreen.GET_USER_NAME(this.auth.getUserName());
+
+ // Will draw appropriate screen for
+ // Players and audience.
+ this.modelDrawing.drawScreen(this.stage);
+
+ if (this.auth.getCanAct()){
+ trace("can act...");
+ this.modelChat.drawScreen(this.stage);
+ this.modelInfo.drawScreen(this.stage);
+ }
+ else {
+ //Display Audience View player/audience count - Vishaal 15/10/09
+ this.modelInfo.drawScreenAudience(this.stage);
+
+ if (volunteer) {
+ // LK added 24/9/07`
+ this.modelChat.drawScreen(this.stage);
+ this.modelAvatars.setDrawMode(false);
+ this.modelAvatars.setAudioMode(false);
+ trace('transport has redrawscreen');
+ }
+
+ else {
+ this.modelChat.drawScreenAudience(this.stage);
+ }
+
+ }
+ this.modelChat.focus();
+ this.startPlay();
+ trace('transport.drawScreen() done.');
+ }
+
+ /**
+ * LK added 31/10/07
+ * @brief Shows volunteer view
+ */
+ function VolunteerBtnClicked() : void
+ {
+ trace('Volunteer button clicked');
+ volunteer = true;
+ this.drawScreen();
+ }
+
+
+ //-------------------------------------------------------------------------
+ /**
+ * @brief Handle when server/auth dies...
+ */
+ function displayConnectionLost(str:String)
+ {
+ this.modelChat.displayConnectionLost(str);
+ }
+
+
+ /**
+ * LK added 24/9/07
+ * @brief Testing volunteer av
+ */
+ function VOLUNTEER() :void
+
+ {
+ this.modelChat.DISP_VOLUNTEER_BTN();
+ }
+
+ function VOL_LET_GO()
+ {
+ volunteer = false;
+ this.drawScreen();
+ }
+
+ /**
+ * LK added 30/10/07
+ * @brief Hide volunteer button
+ */
+ function NO_VOLUNTEER() :void
+
+ {
+ this.modelChat.HIDE_VOLUNTEER_BTN();
+ }
+
+ static function isVolunteer():Boolean
+ {
+ return volunteer;
+ }
+
+ /**
+ * LK added 17/10/07
+ * @brief Display applause button
+ */
+ function APPLAUSE(x :Object) :void
+
+ {
+ this.modelChat.DISP_APPLA();
+ }
+
+ /**
+ * LK added 29/10/07
+ * @brief Hide applause button
+ */
+ function NO_APPLAUSE(x :Object) :void
+
+ {
+ this.modelChat.HIDE_APPLA();
+ }
+
+ /**
+ * @brief An avatars speech - writes to ChatField and makes a speech bubble
+ */
+ private function TEXT(x :Object) :void
+
+ {
+ var avID :Number = x.ID;
+
+ // Modified by Endre to account for htmlText, and to delimit the
+ // actor name from the message when parsing text (primarily for
+ // when the url is the only/first string in the text
+ var logtext: String = '<' + x.name + '> ' + x.text;
+
+ // Send text to chat field
+ this.modelChat.GET_TEXT(x.name, x.text);
+
+ // Send text to avatar speech bubble
+ this.modelAvatars.GET_TEXT(avID, x.text);
+ }
+
+
+ /**
+ * @brief A non avatars speech (usually audience) - writes to ChatField
+ */
+ private function ANONTEXT(x :Object) :void
+
+ {
+ this.modelChat.GET_ANONSPEAK(x.text);
+ }
+
+ private function THINK(x :Object):void
+
+ {
+ var avID:Number = x.ID;
+ var thought:String = x.thought;
+ var name:String = this.modelAvatars.avatars[avID].name;
+
+ this.modelChat.GET_THOUGHT(name, thought);
+ this.modelAvatars.GET_THOUGHT(avID, thought);
+ }
+
+ /**
+ * Shout Feature
+ * Wendy, Candy and Aaron
+ * 30/10/08
+ */
+ private function SHOUT(x :Object):void
+
+ {
+ var avID:Number = x.ID;
+ var shout:String = x.shout;
+ var name:String = this.modelAvatars.avatars[avID].name;
+
+ this.modelChat.GET_SHOUT(name, shout);
+ this.modelAvatars.GET_SHOUT(avID, shout);
+ }
+
+
+
+ /**
+ * @brief Call back to server for mp3, over http
+ * arguably should attach the sound to correct avatar.
+ */
+ private function WAVE(x :Object) :void
+
+ {
+ this.modelSounds.playSound(x.url);
+ }
+
+
+ /**
+ * @brief Call back to server for mp3 music, over http
+ */
+ private function MUSIC(x :Object) :void
+
+ {
+ // Music NOT IMPLEMENTED on server side
+ trace("!MUSIC! url = " + x.url);
+ this.modelSounds.loadMusic(x.url);
+ }
+
+ private function EFFECT(x :Object) :void
+
+ {
+ // Effects NOT IMPLEMENTED on server side
+ this.modelSounds.loadEffect(x.url);
+ }
+
+ private function PLAY_CLIP(x :Object): void
+ {
+ this.modelSounds.remotePlayClip(x.array, x.url, 0);
+ }
+
+ private function PAUSE_CLIP(x :Object): void
+ {
+ this.modelSounds.remotePauseClip(x.array, x.url);
+ }
+
+ private function LOOP_CLIP(x :Object): void
+ {
+ this.modelSounds.remoteLoopClip(x.array, x.url);
+ }
+
+ // PQ & LK: Added 31.10.07 - Play the applause sound
+ private function APPLAUSE_PLAY(x :Object): void
+ {
+ this.modelSounds.playApplause(x.url);
+ }
+
+ //EB 22/10/07 - to handle broadcast volume messages
+ private function VOLUME(x :Object): void
+ {
+ var type:String = x.type;
+ var url:String = x.url;
+ var volume:Number = Number(x.volume);
+
+ this.modelSounds.remoteVolumeControl(type, url, volume);
+ }
+
+ // PQ: 29.10.07 - To handle broadcast stop audio messages
+ private function STOPAUDIO(x :Object): void
+ {
+ var type:String = x.type;
+ var url:String = x.url;
+
+ trace("STOPAUDIO MESSAGE RECIEVED!!!");
+
+ this.modelSounds.remoteStopAudio(type, url);
+ }
+
+
+ // AC: 29.05.08 - Clear Audio Slot
+ private function CLEAR_AUDIOSLOT(x: Object): void
+ {
+ var type: String = x.type;
+ var url: String = x.url;
+ this.modelSounds.clearSlot(type, url);
+ }
+
+ /**
+ * @brief Called by server when client tries to login to same stage twice
+ */
+ private function ERR_DOUBLE_LOGIN(x :Object) :void
+
+ {
+ // Can't close the transport (will kill both client windows)
+
+ // Tell the client all about it
+ this.modelSplashScreen.GET_ERR_DOUBLE_LOGIN(x.msg);
+ }
+
+
+ /**
+ * @brief Writes to ChatField in different color with 'Quoth server' message
+ */
+ private function ERR(x :Object) :void
+
+ {
+ // Show error in chat field
+ this.modelChat.GET_ERR(x.error);
+ }
+
+
+ /**
+ * @brief Same as per ERR writes to ChatField in a different color
+ */
+ private function MSG(x :Object) :void
+
+ {
+ this.modelChat.GET_MSG(x.message);
+ }
+
+ /**
+ * @brief Tell the client to load messages alread typed in the ChatField
+ * before they joined
+ */
+ private function LOAD_CHAT (x :Object) :void
+
+ {
+ this.modelChat.GET_LOAD_CHAT(x.chat);
+ }
+
+
+ /**
+ * @brief Tell the client to load a new Avatar
+ */
+ private function LOAD_AV (x :Object) :void
+ {
+ trace(x.medium);
+ var ID :Number = Number(x.ID);
+ var allowed :Boolean = (x.allowed == 'True');
+ var available :Boolean = (x.available == 'True');
+ this.modelAvatars.GET_LOAD_AV(ID, x.name, x.url, x.thumbnail, allowed,
+ available, x.medium, x.frame);
+ }
+
+
+ /**
+ * @brief Tell the client to load a new Backdrop
+ */
+ private function LOAD_BACKDROP (x :Object) :void
+ {
+ var ID : Number = x.ID;
+ var show:Boolean = (x.show == 'True');
+ this.modelBackDropItems.GET_LOAD_BACKDROP(ID, x.name, x.url, x.thumbnail,
+ x.medium, show, x.frame);
+ }
+
+
+ /**
+ * @brief Tell the client to select a backdrop
+ */
+ private function SHOW_BACKDROP (x :Object) :void
+
+ {
+ var ID : Number = x.ID;
+ this.modelBackDropItems.GET_SHOW_BACKDROP(ID);
+ }
+
+
+ /**
+ * @brief Tell the client to load a new Prop
+ */
+ private function LOAD_PROP (x :Object) :void
+
+ {
+ var ID : Number = x.ID;
+ var show :Boolean = (x.show == 'True');
+ this.modelAvatars.GET_LOADPROP(ID, x.name, x.url, x.thumbnail, x.medium, show);
+ }
+
+ /**
+ * Shaun Narayan (01/28/10)- Updated method to allow
+ * running music to play for new players.
+ *
+ */
+ private function LOAD_AUDIO (x :Object) :void
+ {
+ trace("Loading audio");
+ if(x != null) {
+ var ID : Number = x.ID;
+ var name : String = x.name;
+ var url :String = x.url;
+ var type : String = x.type;
+ var position : Number = x.position;
+
+ trace("loaded audio - ID: " +ID +" Name: "+name+" URL: "+url+" Type: "+type+" Position: "+position);
+
+ if(position > 0)
+ {
+ var newURL :String = "/media/audio/"+url;
+ this.modelSounds.GET_LOAD_AUDIO(ID, name, url, type);
+ this.modelSounds.addWait(newURL,position);
+ }
+ else
+ {
+ this.modelSounds.GET_LOAD_AUDIO(ID, name, url, type);
+ }
+ }
+ else{
+ trace("LOAD_AUDIO transport.as line 639 is null")
+ }
+ }
+
+
+ /**
+ * @brief Server is saying how much of each kind of thing needs loading
+ */
+ private function SPLASH_DETAILS(x :Object) :void
+
+ {
+ this.modelSplashScreen.GET_SPLASH_DETAILS(x.avatars, x.props, x.backdrops, x.msg);
+ }
+
+
+ /**
+ * @brief A client put down the avatar they were holding
+ */
+ private function AV_DISCONNECT (x :Object) :void
+
+ {
+ var avID :Number = x.ID;
+ this.modelAvatars.GET_AV_DISCONNECT(avID, x.client);
+ }
+
+
+ /**
+ * @brief A client picked up an avatar
+ */
+ private function AV_CONNECT (x :Object) :void
+
+ {
+ var avID : Number = x.ID;
+ this.modelAvatars.GET_AV_CONNECT(avID, x.client);
+ }
+
+
+ /**
+ * @brief A client moved an avatar to a new position (fast button)
+ * Or a client joined late and the avatar is already on screen
+ */
+ private function AV_POS (x :Object) :void
+
+ {
+ var avID :Number = x.ID;
+ var avX :Number = x.X;
+ var avY :Number = x.Y;
+ var avZ :Number = x.Z;
+ this.modelAvatars.GET_AV_POS(avID, avX, avY, avZ);
+ }
+
+
+ /**
+ * @brief A client walked an avatar toward a point (slow button)
+ */
+ private function AV_MOVETOWARD (x :Object) :void
+
+ {
+ var avID :Number = x.ID;
+ var avX :Number = x.X;
+ var avY :Number = x.Y;
+ var avDuration :Number = x.duration;
+ this.modelAvatars.GET_AV_MOVETOWARD(avID, avX, avY, avDuration);
+ }
+
+
+ /**
+ * @brief Server requested that all avatars return to the scrollbar
+ */
+ private function PUT_AWAY(x :Object) :void
+
+ {
+ var avID :Number = x.ID;
+ this.modelAvatars.GET_PUT_AWAY(avID);
+ }
+
+
+ /**
+ * @brief An avatar picked up a prop
+ */
+ private function BINDPROP (x :Object) :void
+
+ {
+ var avID :Number = x.ID;
+ var propID :Number = x.prop;
+ this.modelAvatars.GET_BINDPROP(avID, propID);
+ }
+
+ /**
+ * @brief An avatar moved layer, get the model to update their display
+ * @author Endre
+ */
+ private function AVLAYER(x : Object) :void
+
+ {
+ var avID:Number = x.ID;
+ var layer:Number = x.newLayer;
+ this.modelAvatars.GET_AVLAYER(avID, layer);
+ }
+
+
+ /**
+ * @brief A client renamed an avatar (for duration of performance)
+ * Changes are lost after stage reset
+ */
+ private function RENAME (x :Object) :void
+
+ {
+ var avID : Number = x.ID;
+ var name :String = x.name;
+ this.modelAvatars.GET_AV_RENAME(avID, name);
+ }
+
+
+ /**
+ * @brief An avatars properties were changed (currenly only name visibility)
+ * Maybe more later
+ */
+ private function AVPROPERTIES (x :Object) :void
+
+ {
+ var avID :Number = x.ID;
+ var showName :Boolean = (x.showName=='show' ? true : false);
+ this.modelAvatars.GET_AVPROPERTIES(avID, showName);
+ }
+
+
+ /**
+ * @brief A player pressed the reset button
+ * Server has cleaned out it variables and wants this client to reload
+ */
+ private function RELOAD (x :Object) :void
+
+ {
+ // Terminate the connection to the server
+ this.close();
+ // BH 29-Aug-2006 Safe reload now in Construct
+ // Reload the stage
+ Construct.reloadStage();
+ }
+
+
+ /**
+ * @brief Server is confirming players identity
+ */
+ private function SET(x :Object) :void
+
+ {
+ // Pass user information to various models
+ // Should have really called these functions GET_XXX
+ trace("setting player " + auth.getUserName());
+ this.modelChat.setPlayer(auth.getUserName());
+ trace("setting avatar user id " + x.ID);
+ this.modelAvatars.setUserID(x.ID);
+ }
+
+
+ /**
+ * @brief A player or an auidence member joined the current stage
+ */
+ private function JOINED(x :Object) :void
+
+ {
+ var pCount :Number = x.pCount;
+ var aCount :Number = x.aCount;
+ this.modelInfo.GET_JOINED(aCount, pCount);
+ }
+
+
+ /**
+ * @brief The server is telling the client what the long (human readable name)
+ * for the current stage is
+ */
+ // XXX should ber STAGE_INIT, also telling client how many avatars, etc to expect.
+ private function STAGE_NAME(x: Object) :void
+
+ {
+ Construct.stageUrl = ('/stages/' + x.stageID);
+ this.modelSplashScreen.GET_STAGE_NAME(x.stageName);
+ }
+
+ private function CHAT_COLOUR(x: Object) :void
+
+ {
+ this.modelChat.SET_CHAT_PANE_COLOUR(x.bgcolour);
+ if (this.auth.getCanAct())
+ {
+ this.modelChat.drawScreen(this.stage);
+ }
+ else
+ {
+ this.modelChat.drawScreenAudience(this.stage);
+ }
+ }
+ private function TOOLS_COLOUR(x: Object) :void
+
+ {
+ if (this.auth.getCanAct())
+ {
+ this.modelAvatars.SET_BG_COLOR(x.bgcolour);
+ this.modelAvatars.drawScreen(this.stage);
+ }
+ }
+ private function PAGE_COLOUR(x: Object) :void
+
+ {
+ stage.graphics.beginFill (x.bgcolour, 100);
+ stage.graphics.drawRect(0, 0, stage.width, stage.height);
+ stage.graphics.endFill();
+ }
+
+ /**
+ * @brief The server is telling the client what the background Colour of the
+ * Props and Background toolbar will be
+ */
+ // AB: 2.08.08 - Set Props and Background toolbar Color
+ private function BACKDROPANDPROP_COLOUR(x: Object) :void
+
+ {
+ //Set the Avatar and Backdrop BG Color
+ this.modelAvatars.SET_PROP_PANE_COLOR(x.bgcolour)
+ this.modelBackDropItems.SET_BACKDROP_PANE_COLOR(x.bgcolour)
+
+ //Draw the Rectangles on stage If user is Actor
+ this.modelAvatars.drawScreen(this.stage);
+ this.modelBackDropItems.drawScreen(this.stage);
+ trace("CAN ACT = " + this.auth.getCanAct() + "-" + this.auth.getUserName());
+ if (this.auth.getCanAct()){
+ //If they Are actors - Do not hide Prop or backdrop Panes
+ }
+ else {
+ this.modelBackDropItems.hide();
+ this.modelAvatars.hidePropScrollButtons(true);
+ this.modelBackDropItems.hideBackDropScrollButtons(true);
+
+ if (volunteer) {
+ this.modelChat.drawScreen(this.stage);
+ this.modelAvatars.setDrawMode(false);
+ this.modelAvatars.setAudioMode(false);
+ trace('transport has redrawscreen');
+ }
+ else {
+ this.modelAvatars.hide();
+ this.modelBackDropItems.hide();
+ }
+ }
+ }
+
+
+ /**
+ * @brief A player send a whisper message to this player
+ */
+ private function WHISPER(x :Object) :void
+
+ {
+ this.modelChat.GET_WHISPER(x.senderID, x.text);
+ }
+
+ /**
+ * @brief A player selects a freame for avatar
+ */
+ private function FRAME(x :Object): void
+ {
+ var avID :Number = x.avID;
+ var frameNumber :Number = x.frameNumber;
+
+ trace('I got it on transport' + avID + "/" + frameNumber);
+ this.modelAvatars.GET_FRAME(avID, frameNumber);
+ }
+
+ // Aaron
+ /*
+ * @brief Change the backdrop frame
+ */
+ private function BACKDROP_FRAME(x :Object): void
+ {
+ var frameNumber :Number = x.frameNumber;
+ this.modelBackDropItems.SET_BACKDROP_FRAME(frameNumber);
+
+ }
+
+ /**
+ * @brief Called by the server when it recevies a LOADED from the client
+ */
+ private function CONFIRM_LOADED(x:Object)
+ {
+ this.modelAvatars.GET_CONFIRM_LOADED();
+ this.modelSplashScreen.GET_CONFIRM_LOADED();
+ this.modelChat.GET_CONFIRM_LOADED();
+ this.modelSounds.confirmReady();
+ trace('Server Confirmed ready');
+ }
+
+
+ /**-------------drawing tools ----------------**/
+
+ function DRAW_LINE(msg:Object){
+ this.modelDrawing.GET_DRAW_LINE(Number(msg.layer),
+ Number(msg.x),
+ Number(msg.y));
+ }
+
+ function DRAW_MOVE(msg:Object){
+ this.modelDrawing.GET_DRAW_MOVE(Number(msg.layer),
+ Number(msg.x),
+ Number(msg.y));
+
+ }
+
+
+ function DRAW_STYLE(msg:Object){
+ this.modelDrawing.GET_DRAW_STYLE(Number(msg.layer),
+ Number(msg.thickness),
+ Number(msg.colour),
+ Number(msg.alpha)
+ );
+ }
+
+ /* set the style of the users tools unused*/
+ function DRAW_TOOLS(msg:Object){
+ this.modelAvatars.GET_DRAW_TOOLS(Number(msg.colour),
+ Number(msg.alpha),
+ Number(msg.thickness)
+ );
+ }
+
+
+ function DRAW_VIS(msg:Object){
+ this.modelDrawing.GET_DRAW_VIS(Number(msg.layer),
+ msg.visible == 'True',
+ Number(msg.alpha));
+
+ //so DrawTools can show proper visibility in controls
+ this.modelAvatars.GET_DRAW_VIS(Number(msg.layer),
+ msg.visible == 'True',
+ Number(msg.alpha));
+ }
+
+ function DRAW_CLEAR(msg:Object){
+ this.modelDrawing.GET_DRAW_CLEAR(Number(msg.layer));
+ }
+
+ function DRAW_LAYER_STATE(msg:Object){
+ var i:Number;
+ var layers: Array = [];
+ for (i = 0; i < Client.DRAWING_LAYERS_N; i++){
+ var ID:String = msg['L' + i];
+ if (ID){
+ if (ID == this.auth.getUserName())
+ layers.push(2);
+ else
+ layers.push(1);
+ }
+ else
+ layers.push(0);
+ }
+ this.modelAvatars.GET_DRAW_LAYER_STATE(layers);
+ }
+
+ /*------------- Moveable Drawing Functions --------------*/
+
+ /**
+ * @brief: Send the id from the server to the drawing
+ * Modified by: Natasha
+ */
+ function SET_DRAW_ID(msg:Object)
+ {
+ this.modelAvatars.CREATE_MOVEABLE_DRAWING(msg.ID, msg.drawid);
+ }
+
+ /**
+ * @brief Clicks on the main stage (eventually) get passed here
+ * Dispatch to as many Models as need it
+ */
+ function clicker(mouseX :Number, mouseY :Number) :void
+
+ {
+ this.modelAvatars.clicker(mouseX, mouseY);
+ this.modelChat.focus();
+ }
+
+ function sendDebug(x:Object){
+ this.sender.DEBUG(x);
+ }
+
+ }
+}
+}
\ No newline at end of file
Added: branches/2.4.1/AS3.client/upstage/org/classes.swf
===================================================================
(Binary files differ)
Property changes on: branches/2.4.1/AS3.client/upstage/org/classes.swf
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: branches/2.4.1/AS3.client/upstage/org/flex-config.xml
===================================================================
--- branches/2.4.1/AS3.client/upstage/org/flex-config.xml (rev 0)
+++ branches/2.4.1/AS3.client/upstage/org/flex-config.xml 2011-07-30 06:20:37 UTC (rev 307)
@@ -0,0 +1,230 @@
+<flex-config>
+ <compiler>
+ <!-- Turn on generatation of accessible swfs. -->
+ <accessible>false</accessible>
+ <!-- Specifies the locale for internationalization. -->
+ <!-- not set -->
+ <!--
+ <locale>en_US</locale>
+ -->
+ <!-- List of path elements that form the roots of ActionScript class hierarchies. -->
+ <!-- not set -->
+ <source-path></source-path>
+
+ <!-- Run the AS3 compiler in a mode that detects legal but potentially incorrect -->
+ <!-- code. -->
+ <show-actionscript-warnings>false</show-actionscript-warnings>
+ <!-- Turn on generatation of debuggable swfs. False by default for mxmlc, -->
+ <!-- but true by default for compc. -->
+ <!--
+ <debug>true</debug>
+ -->
+ <!-- List of SWC files or directories to compile against but to omit from -->
+ <!-- linking. -->
+ <external-library-path>
+ <path-element>libs/playerglobal.swc</path-element>
+ </external-library-path>
+ <!-- Turn on writing of generated/*.as files to disk. These files are generated by -->
+ <!-- the compiler during mxml translation and are helpful with understanding and -->
+ <!-- debugging Flex applications. -->
+ <keep-generated-actionscript>false</keep-generated-actionscript>
+ <!-- not set -->
+ <!--
+ <include-libraries>
+ <library>string</library>
+ </include-libraries>
+ -->
+ <!-- List of SWC files or directories that contain SWC files. -->
+ <library-path>
+ <path-element>libs</path-element>
+ <path-element>locale/{locale}</path-element>
+ </library-path>
+ <namespaces>
+ <!-- Specify a URI to associate with a manifest of components for use as MXML -->
+ <!-- elements. -->
+ <namespace>
+ <uri>http://www.adobe.com/2006/mxml</uri>
+ <manifest>mxml-manifest.xml</manifest>
+ </namespace>
+ </namespaces>
+ <!-- Enable post-link SWF optimization. -->
+ <optimize>true</optimize>
+
+ <!-- Keep the following AS3 metadata in the bytecodes. -->
+ <!-- Warning: For the data binding feature in the Flex framework to work properly, -->
+ <!-- the following metadata must be kept: -->
+ <!-- 1. Bindable -->
+ <!-- 2. Managed -->
+ <!-- 3. ChangeEvent -->
+ <!-- 4. NonCommittingChangeEvent -->
+ <!-- 5. Transient -->
+ <keep-as3-metadata>
+ <name>Bindable</name>
+ <name>Managed</name>
+ <name>ChangeEvent</name>
+ <name>NonCommittingChangeEvent</name>
+ <name>Transient</name>
+ </keep-as3-metadata>
+
+ <!-- Turn on reporting of data binding warnings. For example: Warning: Data binding -->
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|