Section 1
//bg_39 (room_fla.bg_39)
package room_fla {
import flash.display.*;
public dynamic class bg_39 extends MovieClip {
public var bg:MovieClip;
}
}//package room_fla
Section 2
//buttonBar_25 (room_fla.buttonBar_25)
package room_fla {
import flash.display.*;
public dynamic class buttonBar_25 extends MovieClip {
public var italic:btn;
public var palette:Palette;
public var bold:btn;
public var underline:btn;
}
}//package room_fla
Section 3
//color_33 (room_fla.color_33)
package room_fla {
import flash.display.*;
public dynamic class color_33 extends MovieClip {
public var tint:MovieClip;
}
}//package room_fla
Section 4
//colors_32 (room_fla.colors_32)
package room_fla {
import flash.display.*;
public dynamic class colors_32 extends MovieClip {
public var c0:MovieClip;
public var c1:MovieClip;
public var c3:MovieClip;
public var c4:MovieClip;
public var c5:MovieClip;
public var c6:MovieClip;
public var c8:MovieClip;
public var c2:MovieClip;
public var c7:MovieClip;
public var c9:MovieClip;
public var c10:MovieClip;
public var c11:MovieClip;
public var c13:MovieClip;
public var c14:MovieClip;
public var c15:MovieClip;
public var c12:MovieClip;
}
}//package room_fla
Section 5
//headBg_13 (room_fla.headBg_13)
package room_fla {
import flash.display.*;
public dynamic class headBg_13 extends MovieClip {
public var bg:MovieClip;
}
}//package room_fla
Section 6
//label_41 (room_fla.label_41)
package room_fla {
import flash.display.*;
import flash.text.*;
public dynamic class label_41 extends MovieClip {
public var textField:TextField;
}
}//package room_fla
Section 7
//scroll_18 (room_fla.scroll_18)
package room_fla {
import flash.display.*;
public dynamic class scroll_18 extends MovieClip {
public var left:scrollBtn;
public var right:scrollBtn;
}
}//package room_fla
Section 8
//ScrollBar (tv.ustream.gui.ScrollBar)
package tv.ustream.gui {
import flash.display.*;
import flash.events.*;
import tv.ustream.tools.*;
import flash.filters.*;
public dynamic class ScrollBar extends MovieClip {
private var _grabYpercent:Number;// = 0
private var _yPercent:Number;// = 0
private var _xPercent:Number;// = 0
public var _grab:MovieClip;
public var drag:Drag;
private var _grabXpercent:Number;// = 0
private var grab:Sprite;
private var track:Sprite;
public function ScrollBar(_arg1:Sprite=null){
_xPercent = 0;
_yPercent = 0;
_grabXpercent = 0;
_grabYpercent = 0;
super();
this.doubleClickEnabled = true;
if (this._grab){
grab = this._grab;
} else {
if (_arg1){
grab = _arg1;
} else {
draw((grab = new Sprite()));
grab.filters = [new DropShadowFilter(0, 0, 0, 1)];
grab.buttonMode = true;
};
};
draw((track = new Sprite())).visible = false;
drag = new Drag(grab, grab);
drag.top = 0;
drag.bottom = 0;
drag.left = 0;
drag.right = 0;
drag.addEventListener("drag", onDrag);
drag.addEventListener("startDrag", sDrag);
drag.addEventListener("stopDrag", eDrag);
}
override public function get height():Number{
return (track.height);
}
private function draw(_arg1:Sprite):Sprite{
_arg1.graphics.beginFill(0xFFFFFF);
_arg1.graphics.drawRect(0, 0, 14, 14);
addChild(_arg1);
return (_arg1);
}
private function eDrag(... _args):void{
dispatchEvent(new Event("stopdrag"));
}
override public function set height(_arg1:Number):void{
track.height = _arg1;
grab.height = Math.max((_arg1 * _grabYpercent), 10);
drag.bottom = (_arg1 - grab.height);
grab.y = (_yPercent * drag.bottom);
}
public function get grabXpercent():Number{
return (_grabXpercent);
}
private function sDrag(... _args):void{
dispatchEvent(new Event("startdrag"));
}
public function set xPercent(_arg1:Number):void{
var _local2:DynamicEvent;
if (_arg1.toString() != "NaN"){
_arg1 = Math.min(Math.max(_arg1, 0), 1);
grab.x = (_arg1 * drag.right);
_local2 = new DynamicEvent("xPercent");
_local2.percent = (_xPercent = _arg1);
this.dispatchEvent(_local2);
};
}
public function get dragEnabled():Boolean{
return (drag.mouseEnabled);
}
public function set grabYpercent(_arg1:Number):void{
_grabYpercent = _arg1;
grab.height = int(Math.max((track.height * _arg1), 10));
height = track.height;
}
public function set yPercent(_arg1:Number):void{
var _local2:DynamicEvent;
if (_arg1.toString() != "NaN"){
_arg1 = Math.min(Math.max(_arg1, 0), 1);
grab.y = (_arg1 * drag.bottom);
_local2 = new DynamicEvent("yPercent");
_local2.percent = (_yPercent = _arg1);
this.dispatchEvent(_local2);
};
}
public function set grabXpercent(_arg1:Number):void{
_grabXpercent = _arg1;
grab.width = int(Math.max((track.width * _arg1), 10));
width = track.width;
}
override public function set width(_arg1:Number):void{
track.width = _arg1;
grab.width = Math.max((_arg1 * _grabXpercent), 10);
drag.right = (_arg1 - grab.width);
grab.x = (_xPercent * drag.right);
}
public function get xPercent():Number{
return (_xPercent);
}
private function onDrag(... _args):void{
var _local2:DynamicEvent;
xPercent = (grab.x / int((track.width - grab.width)));
yPercent = (grab.y / int((track.height - grab.height)));
_local2 = new DynamicEvent("drag");
_local2.xPercent = xPercent;
_local2.yPercent = yPercent;
dispatchEvent(_local2);
}
public function get yPercent():Number{
return (_yPercent);
}
public function get grabYpercent():Number{
return (_grabYpercent);
}
override public function get width():Number{
return (track.width);
}
public function set dragEnabled(_arg1:Boolean):void{
drag.mouseEnabled = _arg1;
}
}
}//package tv.ustream.gui
Section 9
//Color (tv.ustream.tools.Color)
package tv.ustream.tools {
public class Color {
public static function random(_arg1:int=-1, _arg2:int=1, _arg3:int=0):Number{
var _local4:Number;
var _local5:int;
if (_arg1 == -1){
_arg1 = int((Math.random() * 3));
};
_local4 = (((0xFF - _arg3) / _arg2) << (_arg1 * 8));
_local5 = 3;
while (_local5--) {
if (_arg1 != _local5){
_local4 = (_local4 + ((((0xFF - _arg3) * Math.random()) / _arg2) << (_local5 * 8)));
};
};
return (_local4);
}
}
}//package tv.ustream.tools
Section 10
//Drag (tv.ustream.tools.Drag)
package tv.ustream.tools {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Drag extends EventDispatcher {
private var _mouseEnabled:Boolean;// = true
public var left:Number;
private var target:Sprite;
private var _hit:Sprite;
public var right:Number;// = INF
public var grid:Number;// = 1
public var top:Number;
public var bottom:Number;// = INF
private var parent;
private var y:Number;
private var x:Number;
public function Drag(_arg1:Sprite=null, _arg2:Sprite=null):void{
top = -(Infinity);
right = Infinity;
bottom = Infinity;
left = -(Infinity);
grid = 1;
_mouseEnabled = true;
super();
this.target = _arg1;
this.hit = _arg2;
}
public function set mouseEnabled(_arg1:Boolean):void{
hit.buttonMode = (_mouseEnabled = _arg1);
}
public function get hit():Sprite{
return (_hit);
}
private function mouseUp(_arg1:MouseEvent):void{
if (mouseEnabled){
dispatchEvent(new Event("stopDrag"));
if (_hit.stage){
_hit.stage.removeEventListener("mouseMove", mouseMove);
_hit.stage.removeEventListener("mouseUp", mouseUp);
};
};
}
public function get mouseEnabled():Boolean{
return (_mouseEnabled);
}
public function set hit(_arg1:Sprite):void{
_hit = _arg1;
if (!target){
target = _hit;
};
_hit.addEventListener("mouseDown", mouseDown);
}
private function mouseDown(_arg1:MouseEvent):void{
if (mouseEnabled){
x = (_arg1.localX * _arg1.target.scaleX);
y = (_arg1.localY * _arg1.target.scaleY);
_hit.stage.addEventListener("mouseMove", mouseMove);
_hit.stage.addEventListener("mouseUp", mouseUp);
dispatchEvent(new Event("startDrag"));
};
}
private function mouseMove(_arg1:MouseEvent):void{
var _local2:Rectangle;
var _local3:Number;
var _local4:Number;
if (mouseEnabled){
_local2 = target.getBounds(_arg1.target.stage);
_local3 = ((_arg1.stageX - x) - (_local2.x - target.x));
_local4 = ((_arg1.stageY - y) - (_local2.y - target.y));
target.x = int(Math.max(left, Math.min(right, (_local3 - (_local3 % grid)))));
target.y = int(Math.max(top, Math.min(bottom, (_local4 - (_local4 % grid)))));
_arg1.updateAfterEvent();
dispatchEvent(new Event("drag"));
};
}
}
}//package tv.ustream.tools
Section 11
//DynamicEvent (tv.ustream.tools.DynamicEvent)
package tv.ustream.tools {
import flash.events.*;
public dynamic class DynamicEvent extends Event {
private var data:Object;
public function DynamicEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Object=null){
var _local5:String;
if ((this.data = _arg4)){
for (_local5 in _arg4) {
this[_local5] = _arg4[_local5];
};
};
super(_arg1, _arg2, _arg3);
}
override public function clone():Event{
return (new DynamicEvent(type, bubbles, cancelable, data));
}
}
}//package tv.ustream.tools
Section 12
//Register (tv.ustream.tools.Register)
package tv.ustream.tools {
import flash.display.*;
public class Register extends MovieClip {
protected var itemClass:Class;
protected var holder:MovieClip;
public var limit:uint;
public var items:Array;
public function Register():void{
items = [];
if (!holder){
holder = this;
};
}
public function addUniqueItem(_arg1:Object, _arg2:String){
if (findItem(_arg2, _arg1[_arg2]) == -1){
addItem(_arg1);
};
}
public function addItem(_arg1:Object){
var _local2:*;
var _local3:*;
var _local4:DynamicEvent;
if (((((limit) && ((items.length < limit)))) || (!(limit)))){
_local2 = new itemClass();
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
_arg1.instance = _local2;
holder.addChild(_local2);
items.push(_arg1);
_local4 = new DynamicEvent("addItem");
_local4.item = _arg1;
this.dispatchEvent(_local4);
return (_local2);
};
return (null);
}
public function findItem(_arg1:String, _arg2):int{
var _local3:*;
for (_local3 in items) {
if (items[_local3][_arg1] == _arg2){
return (_local3);
};
};
return (-1);
}
public function updateItem(_arg1:uint, _arg2:Object):void{
var _local3:Object;
var _local4:*;
_local3 = items[_arg1];
if (_local3){
for (_local4 in _arg2) {
_local3[_local4] = (_local3.instance[_local4] = _arg2[_local4]);
};
};
}
public function removeItemAt(_arg1:String, _arg2):Boolean{
var _local3:*;
_local3 = findItem(_arg1, _arg2);
if (_local3 != -1){
removeItem(_local3);
};
return (!((_local3 == -1)));
}
public function removeItem(_arg1:uint){
var _local2:Object;
var _local3:DynamicEvent;
_local2 = items[_arg1];
if (_local2){
_local3 = new DynamicEvent("removeItem");
_local3.item = _local2;
items.splice(_arg1, 1);
this.dispatchEvent(_local3);
_local2.instance.visible = false;
holder.removeChild(_local2.instance);
_local2.instance = null;
};
}
public function updateItemAt(_arg1:String, _arg2, _arg3:Object):void{
var _local4:*;
_local4 = findItem(_arg1, _arg2);
if (_local4 != null){
updateItem(_local4, _arg3);
};
}
}
}//package tv.ustream.tools
Section 13
//btn (btn)
package {
public dynamic class btn extends Button {
}
}//package
Section 14
//Button (Button)
package {
import flash.display.*;
import flash.events.*;
public class Button extends MovieClip {
public var toggleMode:Boolean;// = false
public var toggle:Boolean;// = false
public function Button(){
toggleMode = false;
toggle = false;
super();
buttonMode = true;
mouseChildren = false;
addEventListener("mouseOver", over);
addEventListener("mouseOut", out);
addEventListener("mouseDown", down);
addEventListener("mouseUp", up);
this.stop();
}
private function out(... _args):void{
if (((enabled) && (!(toggleMode)))){
gotoAndStop("up");
};
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
this.gotoAndStop((_arg1) ? "up" : "disabled");
}
private function down(... _args):void{
if (enabled){
gotoAndStop((toggleMode) ? ((toggle = !(toggle))) ? "down" : "up" : "down");
};
}
private function up(... _args):void{
if (((enabled) && (!(toggleMode)))){
gotoAndStop("over");
};
}
private function over(_arg1:MouseEvent):void{
if (((enabled) && (!(toggleMode)))){
if (!_arg1.buttonDown){
gotoAndStop("over");
} else {
gotoAndStop("down");
};
};
}
}
}//package
Section 15
//Id (Id)
package {
public dynamic class Id {
public static var brandId:String;
}
}//package
Section 16
//InputField (InputField)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import tv.ustream.tools.*;
public dynamic class InputField extends MovieClip {
public var caretIndex:uint;// = 0
public var bg:MovieClip;
private var _bold:Boolean;// = false
private var _italic:Boolean;// = false
private var textFormat:TextFormat;
public var send:Button;
private var _underline:Boolean;// = false
public var textField:TextField;
private var _colorIndex:int;// = -1
static var colors:Array = TextArea.colors;
static var separators:Object = TextArea.separators;
public function InputField(){
var _local1:Room;
_bold = false;
_underline = false;
_italic = false;
_colorIndex = -1;
caretIndex = 0;
super();
_local1 = (parent as Room);
_local1.inputField = this;
textFormat = new TextFormat("verdana", 13, 0);
textField = new TextField();
textField.type = "input";
textField.defaultTextFormat = textFormat;
textField.height = 20;
textField.maxChars = 300;
textField.addEventListener("keyDown", onKeyDown);
textField.addEventListener("keyUp", onKeyUp);
textField.addEventListener("focusOut", onFocusOut);
addChild(textField);
if (this.send){
send.addEventListener("mouseDown", sendLine);
};
}
public function set bold(_arg1:Boolean):void{
_bold = _arg1;
textFormat.bold = _arg1;
textField.setTextFormat(textFormat);
textField.defaultTextFormat = textFormat;
}
override public function set height(_arg1:Number):void{
bg.height = (textField.height = _arg1);
}
private function onFocusOut(_arg1:Event):void{
caretIndex = textField.caretIndex;
}
public function set colorIndex(_arg1:uint):void{
_colorIndex = ((_arg1)==1) ? -1 : _arg1;
textFormat.color = colors[_arg1];
textField.setTextFormat(textFormat);
textField.defaultTextFormat = textFormat;
}
public function set underline(_arg1:Boolean):void{
_underline = _arg1;
textFormat.underline = _arg1;
textField.setTextFormat(textFormat);
textField.defaultTextFormat = textFormat;
}
public function set italic(_arg1:Boolean):void{
_italic = _arg1;
textFormat.italic = _arg1;
textField.setTextFormat(textFormat);
textField.defaultTextFormat = textFormat;
}
override public function set width(_arg1:Number):void{
bg.width = (textField.width = (_arg1 - send.width));
send.x = bg.width;
}
private function onKeyUp(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 13){
send.gotoAndStop("up");
};
}
private function onKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 13){
sendLine();
send.gotoAndStop("down");
};
}
private function sendLine(... _args):void{
var _local2:DynamicEvent;
if (textField.text){
_local2 = new DynamicEvent("send", true);
_local2.line = "";
if (textField.text.charAt(0) != "/"){
_local2.line = (_local2.line + ((_colorIndex)!=-1) ? (separators.color + _colorIndex) : "");
_local2.line = (_local2.line + (_bold) ? separators.bold : "");
_local2.line = (_local2.line + (_underline) ? separators.underline : "");
_local2.line = (_local2.line + (_italic) ? separators.italic : "");
};
_local2.line = (_local2.line + textField.text);
dispatchEvent(_local2);
};
textField.text = "";
if (stage){
stage.focus = textField;
};
}
}
}//package
Section 17
//LoginPanel (LoginPanel)
package {
import flash.display.*;
import flash.events.*;
public dynamic class LoginPanel extends MovieClip {
public var bg:MovieClip;
public function LoginPanel(){
this.addEventListener("addedToStage", onAddedToStage);
}
protected function onStageResize(... _args):void{
if (this.bg){
this.bg.width = stage.stageWidth;
this.bg.height = stage.stageHeight;
};
}
private function reset():void{
}
private function onAddedToStage(... _args):void{
stage.scaleMode = "noScale";
stage.align = "TL";
stage.addEventListener("resize", onStageResize);
stage.dispatchEvent(new Event("resize"));
this.visible = true;
new Menu(this);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
trace(_arg1);
if (_arg1.keyCode == 27){
this.visible = false;
this.reset();
};
}
override public function set visible(_arg1:Boolean):void{
trace(("!!!! " + _arg1));
super.visible = _arg1;
if (_arg1){
trace("a");
stage.addEventListener("keyDown", onKeyDown);
} else {
trace("b");
stage.removeEventListener("keyDown", onKeyDown);
};
reset();
}
}
}//package
Section 18
//Menu (Menu)
package {
import flash.display.*;
import flash.ui.*;
import flash.net.*;
public class Menu {
private var ustreamCmi:ContextMenuItem;
public var labelCmi:ContextMenuItem;
private var menu:ContextMenu;
public function Menu(_arg1:MovieClip){
menu = new ContextMenu();
ustreamCmi = new ContextMenuItem("uStream.tv");
ustreamCmi.addEventListener("menuItemSelect", onAbout);
labelCmi = new ContextMenuItem("", true, false, false);
menu.hideBuiltInItems();
trace(("??? " + Id.brandId));
if (Id.brandId == "1"){
menu.customItems = [ustreamCmi, labelCmi];
} else {
menu.customItems = [labelCmi];
};
_arg1.contextMenu = menu;
}
public function set label(_arg1:String):void{
labelCmi.caption = _arg1;
labelCmi.visible = true;
}
public static function onAbout(... _args):void{
navigateToURL(new URLRequest("http://ustream.tv"), "_blank");
}
}
}//package
Section 19
//MessageParser (MessageParser)
package {
import flash.text.*;
public class MessageParser {
public static var bold:TextFormat;
public static var normal:TextFormat;
public static var dummy:TextFormat;
public static var underline:TextFormat;
public static var italic:TextFormat;
public static var colors:Array = [0xFFFFFF, 0, 0xFF, 0xFF00, 0xFF0000, 0x7F0000, 0x9C009C, 0xFC7F00, 0xFFFF00, 0xFC00, 0x9393, 0xFFFF, 252, 0xFF00FF, 0x7F7F7F, 0xD2D2D2];
public static var separators:Object = {bold:String.fromCharCode(2), color:String.fromCharCode(3), underline:String.fromCharCode(31), italic:String.fromCharCode(22), dummy:String.fromCharCode(30)};
public static var action:TextFormat;
private static var formats:Array;
public static var timestamp:TextFormat;
public static function setFormats():void{
var _local1:uint;
var _local2:TextFormat;
if (!formats){
formats = [];
normal = new TextFormat();
normal.bold = false;
normal.italic = false;
normal.underline = false;
normal.color = 0;
normal.size = 12;
bold = new TextFormat();
bold.bold = true;
formats.bold = bold;
action = new TextFormat();
action.italic = true;
action.color = 280418;
action.size = 13;
italic = new TextFormat();
italic.italic = true;
formats.italic = italic;
underline = new TextFormat();
underline.underline = true;
formats.underline = underline;
dummy = new TextFormat();
dummy.italic = true;
formats.dummy = dummy;
timestamp = new TextFormat();
timestamp.italic = true;
timestamp.size = 10;
timestamp.color = 0x666666;
_local1 = 0;
while (_local1 < colors.length) {
_local2 = new TextFormat();
_local2.color = colors[_local1];
formats.push(_local2);
_local1++;
};
};
}
public static function lookUpUrl(_arg1:TextField):void{
var _local2:String;
var _local3:RegExp;
var _local4:int;
var _local5:Object;
_local2 = _arg1.text;
_local3 = /(((ftp|http|https)\:\/\/)|(www\.))([a-zA-Z0-9]\.)*[a-zA-Z0-9\-\.\/]+\.(com|edu|gov|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2})\b(\:[0-9]{1,5})?[a-zA-Z0-9\-\.\/%\?=&;@_~']*/ig;
_local4 = _local2.search(_local3);
_local5 = _local3.exec(_local2);
while (_local5 != null) {
if (_local5.index > -1){
formatUrl(_local5, _arg1);
};
_local5 = _local3.exec(_local2);
};
}
public static function addText(_arg1:String, _arg2:TextField):void{
var _local3:uint;
var _local4:*;
var _local5:String;
var _local6:Array;
var _local7:Array;
var _local8:Array;
var _local9:uint;
var _local10:Number;
var _local11:*;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:int;
_local3 = _arg2.text.length;
_local4 = new Array();
for (_local5 in separators) {
if (_arg1.indexOf(separators[_local5]) != -1){
_local7 = new Array();
_local4.push(_local7);
_local8 = _arg1.split(separators[_local5]);
_local9 = 0;
for (_local11 in _local8) {
_local12 = 1;
_local10 = NaN;
if ((((_local5 == "color")) && (_local11))){
_local12 = 2;
_local10 = Number(_local8[_local11].substr(0, 2));
if (isNaN(_local10)){
_local10 = Number(_local8[_local11].substr(0, 1));
_local12 = 1;
if (isNaN(_local10)){
_local12 = 0;
_local10 = NaN;
_local5 = undefined;
};
};
_local8[_local11] = _local8[_local11].substr(_local12);
};
_local13 = 0;
while (_local13 < _local4.length) {
_local14 = 0;
while (_local14 < _local4[_local13].length) {
if (_local4[_local13][_local14].pos > _local9){
_local4[_local13][_local14].pos = (_local4[_local13][_local14].pos - _local12);
};
_local14++;
};
_local13++;
};
_local7.push({pos:_local9, format:((_local10.toString())!="NaN") ? _local10 : _local5});
_local9 = (_local9 + _local8[_local11].length);
};
_arg1 = _local8.join("");
} else {
_local4.push([]);
};
};
_arg2.appendText(_arg1);
_arg2.setTextFormat(normal, _local3, _arg2.text.length);
lookUpUrl(_arg2);
for each (_local6 in _local4) {
_local15 = 0;
while (_local15 < _local6.length) {
if (formats[_local6[_local15].format]){
if ((((_local15 % 2)) || (!((Number(_local6[_local15].format).toString() == "NaN"))))){
if (_local6[(_local15 + 1)]){
_local16 = (_local3 + _local6[(_local15 + 1)].pos);
if (_local16 > _arg2.text.length){
_local16 = _arg2.text.length;
};
_arg2.setTextFormat(formats[_local6[_local15].format], (_local3 + _local6[_local15].pos), _local16);
} else {
if ((_local3 + _local6[_local15].pos) < _arg2.text.length){
_arg2.setTextFormat(formats[_local6[_local15].format], (_local3 + _local6[_local15].pos), _arg2.text.length);
};
};
};
};
_local15++;
};
};
}
private static function formatUrl(_arg1:Object, _arg2:TextField):void{
var _local3:String;
var _local4:int;
var _local5:int;
var _local6:TextFormat;
var _local7:RegExp;
var _local8:String;
_local3 = _arg2.text;
_local4 = _arg1.index;
_local5 = (_local4 + _arg1[0].length);
_local6 = _arg2.getTextFormat();
_local6.underline = true;
_local7 = /(ftp|http|https)\:\/\//;
_local8 = _local3.substring(_local4, _local5);
if (_local8.search(_local7) == -1){
_local8 = ("http://" + _local8);
};
_local6.url = _local8;
_local6.target = "_blank";
_arg2.setTextFormat(_local6, _local4, _local5);
}
setFormats();
}
}//package
Section 20
//Palette (Palette)
package {
import flash.display.*;
import flash.events.*;
import tv.ustream.tools.*;
import flash.geom.*;
public dynamic class Palette extends MovieClip {
public var colors:MovieClip;
public var tint:MovieClip;
public var icon:MovieClip;
public function Palette(){
this.addEventListener("addedToStage", onAddedToStage);
}
private function open(... _args):void{
this.gotoAndStop("open");
this.colors.visible = true;
this.icon.visible = false;
}
private function onAddedToStage(... _args):void{
var _local2:uint;
var _local3:MovieClip;
var _local4:ColorTransform;
close();
_local2 = 0;
while (_local2 < TextArea.colors.length) {
_local3 = this.colors[("c" + _local2)].tint;
_local4 = new ColorTransform();
_local4.color = TextArea.colors[_local2];
_local3.transform.colorTransform = _local4;
_local3.buttonMode = true;
_local3.index = _local2;
_local3.color = TextArea.colors[_local2];
_local3.addEventListener("mouseDown", onMouseDown);
_local2++;
};
this.addEventListener("mouseOut", close);
this.addEventListener("mouseOver", open);
}
private function onMouseDown(_arg1:MouseEvent):void{
var _local2:DynamicEvent;
var _local3:ColorTransform;
_local2 = new DynamicEvent("color");
_local2.index = _arg1.target.index;
_local2.color = _arg1.target.color;
dispatchEvent(_local2);
_local3 = new ColorTransform();
_local3.color = _arg1.target.color;
this.tint.transform.colorTransform = _local3;
}
private function close(... _args):void{
this.gotoAndStop("close");
this.colors.visible = false;
this.icon.visible = true;
}
}
}//package
Section 21
//Room (Room)
package {
import flash.display.*;
import flash.events.*;
import tv.ustream.tools.*;
import flash.geom.*;
public dynamic class Room extends MovieClip {
public var roomName:String;
private var userListOpen:Boolean;// = true
public var userList:UserList;
private var channel:Boolean;// = true
private var logUsers:Object;
private var oldHeight:Number;
public var _topic:String;
public var roomList:RoomList;
public var modes:Object;
public var headBg:MovieClip;
public var bg:MovieClip;
public var textArea:TextArea;
public var toggleUserList:ToggleUserList;
public var buttonBar:MovieClip;
private var autoHide:Boolean;// = false
private var enableNickColors:Boolean;// = false
public var ids:Object;
public var home:Boolean;
private var oldWidth:Number;
public function Room(){
channel = true;
autoHide = false;
userListOpen = true;
enableNickColors = false;
logUsers = new Object();
trace("[Room{Sprite}] - Room() :: ");
super();
this.addEventListener("addedToStage", onAddedToStage);
this.addEventListener("removedFromStage", onRemovedFromStage);
}
public function focus():void{
this.stage.focus = this.inputField.textField;
this.inputField.textField.setSelection(this.inputField.textField.caretIndex, this.inputField.textField.caretIndex);
}
public function userMode(_arg1:String, _arg2:String):void{
this.userList.updateItemAt("nick", _arg1, {mode:_arg2});
this.userList.sort();
this.userList.update();
}
public function init(_arg1:Object):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
trace("[Room{Sprite}] - init() :: ");
trace("room init A");
channel = _arg1.channel;
roomName = _arg1.roomName;
topic = _arg1.topic;
modes = _arg1.modes;
home = _arg1.home;
enableNickColors = _arg1.enableNickColors;
autoHide = !((_arg1.canHideUserList == 0));
userListOpen = (_arg1.canHideUserList == 1);
trace("room init B");
Id.brandId = _arg1.ids.brandId;
trace("room init C");
new Menu(this);
trace("room init D");
userList.visible = channel;
if (channel){
_local4 = 0;
while (_local4 < _arg1.users.length) {
this.userList.addUniqueItem(_arg1.users[_local4], "nick");
_local4++;
};
this.userList.sort();
this.userList.update();
} else {
this.onStageResize();
};
trace("room init E");
_local2 = 0;
while (_local2 < _arg1.rooms.length) {
roomList.addUniqueItem({roomName:_arg1.rooms[_local2].name, channel:_arg1.rooms[_local2].channel, own:(_arg1.rooms[_local2].name == roomName), roomCount:_arg1.rooms.length, userCount:((_arg1.rooms[_local2].name == roomName)) ? userList.items.length : 0}, "roomName");
trace(("[Room{Sprite}] - init() :: " + [roomName, userList.items.length]));
_local2++;
};
trace("room init F");
roomList.sort();
roomList.update();
trace("room init G");
_local3 = 0;
while (_local3 < _arg1.chatCache.length) {
privmsg(_arg1.chatCache[_local3]);
_local3++;
};
trace("room init H");
onStageResize();
trace("room init I finish");
}
private function onToggleItalic(_arg1:Event):void{
this.inputField.italic = _arg1.target.toggle;
focus();
}
public function onCreateRoom(_arg1:DynamicEvent):void{
roomList.addUniqueItem({roomName:_arg1.roomName, channel:_arg1.channel, own:_arg1.own}, "roomName");
roomList.sort();
roomList.update();
}
private function onToggleBold(_arg1:Event):void{
this.inputField.bold = _arg1.target.toggle;
focus();
}
private function onToggleUserList(... _args):void{
userListOpen = !(userListOpen);
this.toggleUserList.gotoAndStop((userListOpen) ? "open" : "close");
onStageResize();
}
public function get topic():String{
return (_topic);
}
public function join(_arg1:Object):void{
this.userList.addUniqueItem(_arg1, "nick");
this.userList.sort();
this.userList.update();
if (visible){
roomList.updateItemAt("roomName", roomName, {userCount:userList.items.length});
};
}
public function part(_arg1:Object):void{
this.userList.removeItemAt("nick", _arg1.nick);
this.userList.update();
if (visible){
roomList.updateItemAt("roomName", roomName, {userCount:userList.items.length});
};
}
public function nick(_arg1:String, _arg2:String, _arg3:String=null):void{
if (!_arg3){
this.userList.updateItemAt("nick", _arg1, {nick:_arg2});
this.userList.sort();
this.userList.update();
} else {
this.userList.updateItemAt("nick", _arg1, {host:_arg3});
};
}
public function setBgColor(_arg1:Number, _arg2:Number, _arg3:Number=1, _arg4:Number=0):void{
var _local5:ColorTransform;
var _local6:ColorTransform;
_local5 = new ColorTransform();
_local5.color = _arg1;
_local5.alphaMultiplier = _arg3;
this["bg"].transform.colorTransform = _local5;
_local6 = new ColorTransform();
_local6.color = _arg2;
_local6.alphaMultiplier = _arg4;
this["headBg"].bg.transform.colorTransform = _local6;
}
public function set topic(_arg1:String):void{
_topic = _arg1;
this.textArea.setTopic(_arg1);
}
protected function onStageResize(... _args):void{
var _local2:Number;
var _local3:Number;
_local2 = stage.stageWidth;
_local3 = stage.stageHeight;
if (((parent) && (parent.parent))){
_local2 = parent.parent.width;
_local3 = parent.parent.height;
};
if (((!((oldWidth == _local2))) || (!((oldHeight == _local3))))){
oldWidth = _local2;
oldHeight = _local3;
if (this.bg){
this.bg.width = _local2;
this.bg.height = _local3;
};
if (this.headBg){
this.headBg.width = _local2;
};
if (userList){
if (channel){
if (autoHide){
if (userListOpen){
userList.x = (((_local2 - userList.width) - this.toggleUserList.bg.width) - 8);
userList.visible = true;
} else {
userList.x = (_local2 - this.toggleUserList.bg.width);
userList.visible = false;
};
} else {
userList.x = ((_local2 - userList.width) - 8);
userList.visible = true;
};
} else {
userList.x = _local2;
userList.visible = false;
};
userList.height = ((_local3 - userList.y) - 36);
};
if (this.buttonBar){
this.buttonBar.x = ((_local2 - this.buttonBar.width) - 8);
this.buttonBar.y = ((_local3 - this.buttonBar.height) - 8);
};
if (this.inputField){
this.inputField.width = (this.buttonBar.x - 16);
this.inputField.y = this.buttonBar.y;
};
if (this.textArea){
if (channel){
textArea.width = (userList.x - 16);
} else {
textArea.width = (_local2 - 16);
};
textArea.height = ((_local3 - textArea.y) - 36);
};
if (this.roomList){
roomList.width = this.inputField.width;
};
if (this.toggleUserList){
this.toggleUserList.bg.height = userList.height;
this.toggleUserList.x = (_local2 - this.toggleUserList.width);
this.toggleUserList.visible = ((autoHide) && (channel));
this.toggleUserList.gotoAndStop((userListOpen) ? "open" : "close");
};
};
}
public function onUpdateRoom(_arg1:DynamicEvent):void{
if (_arg1.oldName){
if (_arg1.oldName == roomName){
roomName = _arg1.newName;
};
roomList.updateItemAt("roomName", _arg1.oldName, {roomName:_arg1.newName});
} else {
if (((_arg1.roomName) && ((_arg1.roomName == roomName)))){
modes[_arg1.mode] = _arg1.value;
};
};
}
public function privmsg(_arg1:Object):void{
var _local2:Object;
if (enableNickColors){
_local2 = new Object();
if (!logUsers[_arg1.nick]){
_local2.nick = _arg1.nick;
_local2.nickColor = Color.random(-1, 1, 102);
logUsers[_arg1.nick] = _local2;
} else {
_local2 = logUsers[_arg1.nick];
};
_arg1.nickColor = _local2.nickColor;
};
textArea.addMsg(_arg1);
}
private function onAddedToStage(... _args):void{
trace("[Room{Sprite}] - onAddedToStage() :: ");
stage.scaleMode = "noScale";
stage.align = "TL";
stage.addEventListener("resize", onStageResize);
stage.dispatchEvent(new Event("resize"));
if (this.buttonBar){
this.buttonBar.bold.toggleMode = true;
this.buttonBar.bold.addEventListener("mouseDown", onToggleBold);
this.buttonBar.underline.toggleMode = true;
this.buttonBar.underline.addEventListener("mouseDown", onToggleUnderline);
this.buttonBar.italic.toggleMode = true;
this.buttonBar.italic.addEventListener("mouseDown", onToggleItalic);
this.buttonBar.palette.addEventListener("color", onSetColor);
};
this.toggleUserList.addEventListener("mouseDown", onToggleUserList);
this.toggleUserList.gotoAndStop((userListOpen) ? "open" : "close");
this.toggleUserList.buttonMode = true;
focus();
onStageResize();
}
private function onRemovedFromStage(_arg1:Event):void{
stage.removeEventListener("resize", onStageResize);
delete ??getglobalscope
[this];
}
private function onSetColor(_arg1:DynamicEvent):void{
this.inputField.colorIndex = _arg1.index;
focus();
}
public function onRemoveRoom(_arg1:DynamicEvent):void{
if (_arg1.roomName != roomName){
this.roomList.removeItemAt("roomName", _arg1.roomName);
};
roomList.update();
}
override public function set visible(_arg1:Boolean):void{
super.visible = _arg1;
if (_arg1){
roomList.updateItemAt("roomName", roomName, {userCount:userList.items.length});
roomList.update();
focus();
};
}
private function onToggleUnderline(_arg1:Event):void{
this.inputField.underline = _arg1.target.toggle;
focus();
}
}
}//package
Section 22
//RoomList (RoomList)
package {
import flash.display.*;
import flash.events.*;
import tv.ustream.tools.*;
import flash.utils.*;
import flash.geom.*;
public dynamic class RoomList extends Register {
private var left:uint;// = 20
private var right:uint;// = 20
private var scrollDirection:Number;
public var bg:MovieClip;
private var maxX:Number;// = 0
private var scrollTimer:Timer;
private var mustMask:Boolean;// = false
private var scrollSpeed:Number;// = 1
private var minX:Number;// = 0
private var matrix:Matrix;
public var scroll:MovieClip;
private var _mask:Sprite;
private var itemsWidth:Number;// = 0
public function RoomList(){
var _local1:Room;
left = 20;
right = 20;
itemsWidth = 0;
mustMask = false;
scrollSpeed = 1;
minX = 0;
maxX = 0;
super();
holder = new MovieClip();
holder.cacheAsBitmap = true;
holder.y = 4;
addChild(holder);
this.itemClass = RoomListItem;
_local1 = (parent as Room);
_local1.roomList = this;
_mask = new Sprite();
_mask.visible = false;
addChild(_mask);
addEventListener("addItem", update);
addEventListener("removeItem", update);
if (this.scroll){
scrollTimer = new Timer(10);
scrollTimer.addEventListener("timer", onScroll);
this.scroll.left.addEventListener("mouseDown", onMouseDown);
this.scroll.right.addEventListener("mouseDown", onMouseDown);
this.scroll.left.addEventListener("mouseOver", onMouseOver);
this.scroll.right.addEventListener("mouseOver", onMouseOver);
this.scroll.left.addEventListener("mouseUp", onMouseUp);
this.scroll.right.addEventListener("mouseUp", onMouseUp);
this.scroll.left.addEventListener("mouseOut", onMouseOut);
this.scroll.right.addEventListener("mouseOut", onMouseOut);
};
}
private function onMouseOver(_arg1:MouseEvent):void{
if (_arg1.buttonDown){
onMouseDown();
} else {
onMouseUp();
};
scrollDirection = ((_arg1.target.name)=="left") ? 1 : -1;
scrollTimer.start();
}
override public function get height():Number{
return (bg.height);
}
private function onMouseUp(... _args):void{
scrollSpeed = 0.5;
}
private function chkScrollPos():void{
if (holder.x > maxX){
holder.x = maxX;
};
if (holder.x < minX){
holder.x = minX;
};
chkScrollBtns();
}
override public function set height(_arg1:Number):void{
bg.height = _arg1;
}
public function sort():void{
items.sortOn("roomName");
}
private function onMouseOut(... _args):void{
if (scrollTimer.running){
scrollTimer.stop();
};
onMouseUp();
}
override public function set width(_arg1:Number):void{
bg.width = _arg1;
this.scroll.x = (_arg1 - this.scroll.width);
chkMask();
}
private function chkScrollBtns():void{
if (holder.x == maxX){
this.scroll.left.enabled = false;
} else {
if (!this.scroll.left.enabled){
this.scroll.left.enabled = true;
};
};
if (holder.x == minX){
this.scroll.right.enabled = false;
} else {
if (!this.scroll.right.enabled){
this.scroll.right.enabled = true;
};
};
}
private function renderMask():void{
var _local1:Number;
_local1 = (width - this.scroll.width);
_mask.cacheAsBitmap = false;
_mask.graphics.clear();
matrix = new Matrix();
matrix.createGradientBox(left, height);
_mask.graphics.beginGradientFill("linear", [0xFFFFFF, 0xFF0000], [0, 1], [0, 0xFF], matrix);
_mask.graphics.drawRect(0, 0, left, height);
_mask.graphics.beginFill(0xFF00);
_mask.graphics.drawRect(left, 0, ((_local1 - left) - right), height);
matrix = new Matrix();
matrix.createGradientBox(right, height, 0, (_local1 - right));
_mask.graphics.beginGradientFill("linear", [0xFF0000, 0xFFFFFF], [1, 0], [0, 0xFF], matrix);
_mask.graphics.drawRect((_local1 - right), 0, right, height);
_mask.cacheAsBitmap = true;
}
private function onScroll(... _args):void{
holder.x = (holder.x + (scrollDirection * scrollSpeed));
chkScrollPos();
}
override public function get width():Number{
return (bg.width);
}
public function update(... _args):void{
var _local2:Object;
itemsWidth = 8;
for each (_local2 in items) {
_local2.instance.roomCount = items.length;
_local2.instance.x = itemsWidth;
itemsWidth = (itemsWidth + (_local2.instance.width + 4));
};
chkMask();
}
private function chkMask():void{
var _local1:Number;
_local1 = ((width - this.scroll.width) / itemsWidth);
mustMask = (_local1 < 1);
minX = ((_mask.width - holder.width) - right);
if (mustMask){
renderMask();
holder.mask = _mask;
chkScrollPos();
} else {
holder.mask = null;
if (holder.x < 0){
holder.x = 0;
};
};
this.scroll.visible = mustMask;
}
private function onMouseDown(... _args):void{
scrollSpeed = 2;
}
}
}//package
Section 23
//RoomListItem (RoomListItem)
package {
import flash.display.*;
import tv.ustream.tools.*;
import flash.ui.*;
public dynamic class RoomListItem extends MovieClip {
public var label:MovieClip;
public var bg:MovieClip;
private var partCmi:ContextMenuItem;
private var menu:Menu;
private var _roomCount:int;
private var _roomName:String;
private var _userCount:Number;// = 0
public var close:SimpleButton;
static var itemHeight:uint = 20;
static var itemWidth:uint;
public function RoomListItem(){
_userCount = 0;
super();
addFrameScript(0, frame1);
itemWidth = width;
itemHeight = height;
if (this.close){
this.close.addEventListener("click", onPart);
};
if (this.label){
this.label.mouseEnabled = false;
this.label.textField.mouseEnabled = false;
};
}
public function set channel(_arg1:Boolean):void{
if (_arg1){
if (_roomName){
roomName = _roomName;
};
};
}
public function set userCount(_arg1:Number):void{
_userCount = _arg1;
roomName = _roomName;
}
public function set roomName(_arg1:String):void{
_roomName = _arg1;
if (label){
label.textField.autoSize = "left";
label.textField.text = (_arg1 + ((_userCount == 0)) ? "" : ((" (" + _userCount) + ")"));
if (close){
close.x = (label.width + 8);
close.visible = !((_roomCount == 1));
};
if (bg){
bg.bg.width = (((close) && (close.visible))) ? ((close.x + close.width) + 6) : (label.width + (2 * label.x));
};
};
}
public function set own(_arg1:Boolean):void{
if (!_arg1){
this.gotoAndStop(2);
this.bg.addEventListener("click", onClick);
this.useHandCursor = true;
};
}
function frame1(){
stop();
}
private function onPart(... _args):void{
var _local2:DynamicEvent;
_local2 = new DynamicEvent("part", true);
_local2.roomName = _roomName;
this.dispatchEvent(_local2);
if (close){
close.visible = false;
roomName = _roomName;
};
}
private function initMenu():void{
menu = new Menu(this);
}
override public function get width():Number{
return (bg.width);
}
private function onClick(... _args):void{
var _local2:DynamicEvent;
_local2 = new DynamicEvent("changeRoom", true);
_local2.roomName = _roomName;
this.dispatchEvent(_local2);
}
public function set roomCount(_arg1:int):void{
_roomCount = _arg1;
if (_roomName){
roomName = _roomName;
};
}
}
}//package
Section 24
//scrollBtn (scrollBtn)
package {
public dynamic class scrollBtn extends Button {
public function scrollBtn(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 25
//TextArea (TextArea)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import tv.ustream.gui.*;
public dynamic class TextArea extends MovieClip {
private var scrollBar:ScrollBar;
public var topic:Topic;
public var bg:MovieClip;
private var maxLines:Number;// = 200
private var textFormat:TextFormat;
private var oldValue:Number;
private var begin:uint;
private var textField:TextField;
public var nickColor:Number;// = NAN
public var scrollBg:MovieClip;
public static var colors:Array = MessageParser.colors;
public static var separators:Object = MessageParser.separators;
public function TextArea(){
textFormat = new TextFormat("Verdana", 12);
maxLines = 200;
nickColor = NaN;
super();
textField = new TextField();
textField.multiline = true;
textField.wordWrap = true;
textField.defaultTextFormat = textFormat;
textField.text = "";
textField.useRichTextClipboard = true;
textField.addEventListener("mouseWheel", updateScrollBar);
textField.addEventListener(TextEvent.LINK, linkHandler, false, 0, true);
addChild(textField);
scrollBar = new ScrollBar();
scrollBar.addEventListener("addedToStage", onAddedToStage);
scrollBar.addEventListener("yPercent", onScrollBar);
scrollBar.yPercent = 1;
addChild(scrollBar);
updateScrollBarDrag();
}
private function updateScrollBarDrag():void{
scrollBar.grabYpercent = ((textField.numLines - textField.maxScrollV) / (textField.numLines - 1));
scrollBar.visible = !(((textField.numLines - textField.maxScrollV) == (textField.numLines - 1)));
}
private function onChkTf(... _args):void{
this.tfChkTimer.stop();
}
public function addMsg(_arg1:Object):void{
var _local2:Number;
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:TextFormat;
_local2 = textField.scrollV;
_local3 = (_arg1.line + "\n");
_local4 = Math.max((textField.numLines - maxLines), 0);
_local5 = 0;
while (_local5 < _local4) {
textField.replaceText(0, textField.getLineText(0).length, "");
_local5++;
};
_local6 = textField.text.length;
if (_arg1.type == "action"){
_local7 = textField.text.length;
textField.appendText(((" " + _arg1.when) + " "));
textField.setTextFormat(MessageParser.timestamp, _local7, (textField.text.length - 1));
_local8 = textField.text.length;
textField.appendText((((" * " + _arg1.nick) + " ") + _local3));
textField.setTextFormat(MessageParser.action, _local8, textField.text.length);
} else {
if (_arg1.type == "info"){
textField.htmlText = (textField.htmlText + (("<font face=\"Verdana\">" + _local3) + "</font>"));
textField.appendText("");
} else {
if (_arg1.type == "privmsg"){
_local9 = textField.text.length;
textField.appendText(((" " + _arg1.when) + " "));
textField.setTextFormat(MessageParser.timestamp, _local9, (textField.text.length - 1));
_local10 = textField.text.length;
if (isNaN(_arg1.nickColor)){
textField.appendText((("<" + _arg1.nick) + ">"));
} else {
textField.appendText(_arg1.nick);
};
_local11 = textField.text.length;
textField.appendText(" : ");
textField.setTextFormat(MessageParser.normal, _local10, (_local11 + 3));
textField.setTextFormat(MessageParser.bold, _local10, _local11);
if (!isNaN(_arg1.nickColor)){
_local12 = textField.getTextFormat(_local10, _local11);
_local12.color = _arg1.nickColor;
textField.setTextFormat(_local12, _local10, _local11);
};
MessageParser.addText(_local3, textField);
};
};
};
textField.scrollV = _local2;
updateScrollBarDrag();
if (scrollBar.yPercent == 1){
onScrollBar();
};
}
private function updateScrollBar(... _args):void{
scrollBar.yPercent = ((textField.scrollV - 1) / (textField.maxScrollV - 1));
}
override public function set height(_arg1:Number):void{
bg.height = _arg1;
textField.height = _arg1;
textField.y = 0;
if (((this.topic) && (this.topic.visible))){
textField.height = ((_arg1 - 20) - this.topic.height);
textField.y = (this.topic.height + 20);
};
scrollBar.height = _arg1;
updateScrollBarDrag();
onScrollBar();
if (this.scrollBg){
this.scrollBg.height = _arg1;
};
}
override public function set width(_arg1:Number):void{
bg.width = _arg1;
textField.width = (_arg1 - this.scrollBg.width);
scrollBar.x = ((_arg1 - scrollBar.width) - 1);
updateScrollBarDrag();
onScrollBar();
if (this.scrollBg){
this.scrollBg.x = (_arg1 - this.scrollBg.width);
};
if (((this.topic) && (this.topic.visible))){
this.topic.width = (_arg1 - 16);
};
}
private function onAddedToStage(... _args):void{
updateScrollBarDrag();
addEventListener("enterFrame", onEnterFrame);
}
private function onEnterFrame(_arg1:Event):void{
if (oldValue != textField.maxScrollV){
updateScrollBarDrag();
if (scrollBar.yPercent == 1){
onScrollBar();
};
};
oldValue = textField.maxScrollV;
}
public function setTopic(_arg1:String):void{
if (this.topic){
this.topic.value = _arg1;
};
}
private function onScrollBar(... _args):void{
textField.scrollV = (textField.maxScrollV * scrollBar.yPercent);
}
private function linkHandler(_arg1:TextEvent):void{
}
}
}//package
Section 26
//ToggleUserList (ToggleUserList)
package {
import flash.display.*;
public dynamic class ToggleUserList extends MovieClip {
public var bg:MovieClip;
public function ToggleUserList(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 27
//Topic (Topic)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Topic extends MovieClip {
private var _topic:String;
public var bg:MovieClip;
private var textFormat:TextFormat;
private var textField:TextField;
private var _width:Number;
public function Topic(){
this.visible = false;
textField = new TextField();
textField.autoSize = "center";
textField.multiline = true;
textField.wordWrap = true;
textFormat = new TextFormat("Verdana", 10, 404540);
textFormat.align = "center";
textField.defaultTextFormat = textFormat;
this.addChild(textField);
super();
}
public function get value():String{
return (_topic);
}
override public function set width(_arg1:Number):void{
_width = _arg1;
textField.width = (this.bg.width = (_arg1 - 20));
this.bg.height = textField.height;
}
override public function get width():Number{
return (_width);
}
public function set value(_arg1:String):void{
this.visible = (_arg1) ? true : false;
if (_arg1){
textField.text = "";
MessageParser.addText(_arg1, textField);
_topic = _arg1;
this.bg.height = textField.height;
};
parent.width = parent.width;
parent.height = parent.height;
}
}
}//package
Section 28
//UserList (UserList)
package {
import flash.display.*;
import flash.events.*;
import tv.ustream.tools.*;
import tv.ustream.gui.*;
public dynamic class UserList extends Register {
private var scrollBar:ScrollBar;
public var bg:MovieClip;
private var visibleItems:uint;// = 0
private var selected:UserListItem;
private var index:uint;// = 0
public var room:Room;
public var scrollBg:MovieClip;
public function UserList(){
visibleItems = 0;
index = 0;
super();
trace(("[UserList] - UserList() :: " + filters));
scrollBar = new ScrollBar();
scrollBar.addEventListener("yPercent", onScrollBar);
addChild(scrollBar);
itemClass = UserListItem;
room = (parent as Room);
room.userList = this;
addEventListener("addItem", onAddItem);
addEventListener("removeItem", onRemoveItem);
width = width;
height = height;
}
override public function get height():Number{
return (bg.height);
}
private function getVisibleItems():void{
visibleItems = (height / itemClass.itemHeight);
update();
}
override public function set height(_arg1:Number):void{
bg.height = _arg1;
getVisibleItems();
scrollBar.height = _arg1;
if (this.scrollBg){
this.scrollBg.height = _arg1;
};
}
private function onAddItem(_arg1:DynamicEvent):void{
_arg1.item.instance.addEventListener("mouseDown", onItemSelected);
_arg1.item.nickColor = Color.random(-1, 1, 102);
update();
}
private function onItemSelected(_arg1:Event):void{
if (selected){
selected.gotoAndStop(1);
selected.selected = false;
selected.updateLabel();
};
selected = _arg1.target.parent;
selected.gotoAndStop(2);
selected.selected = true;
selected.updateLabel();
}
override public function set width(_arg1:Number):void{
trace(("[UserList] - set width() :: " + _arg1));
bg.width = _arg1;
scrollBar.x = ((_arg1 - scrollBar.width) - 1);
}
public function sort():void{
items.sortOn(["mode", "nick"], [Array.DESCENDING, Array.CASEINSENSITIVE]);
}
override public function removeItem(_arg1:uint){
if (((selected) && ((selected.nick == items[_arg1].nick)))){
selected = undefined;
};
return (super.removeItem(_arg1));
}
override public function get width():Number{
return (bg.width);
}
public function update(... _args):void{
var _local2:uint;
var _local3:Number;
var _local4:uint;
var _local5:Number;
var _local6:uint;
var _local7:uint;
_local2 = (items.length - visibleItems);
if ((((_local2 >= 0)) && ((index > _local2)))){
index = _local2;
};
_local3 = 0;
if (index > 0){
_local6 = 0;
while (_local6 < index) {
if (items[_local6]){
items[_local6].instance.visible = false;
};
_local6++;
};
};
_local4 = index;
while (_local4 < (index + visibleItems)) {
if (items[_local4]){
items[_local4].instance.y = _local3;
items[_local4].instance.visible = true;
_local3 = (_local3 + itemClass.itemHeight);
};
_local4++;
};
_local5 = (items.length - (index + visibleItems));
if (_local5 > 0){
_local7 = (index + visibleItems);
while (_local7 < items.length) {
if (items[_local7]){
items[_local7].instance.visible = false;
};
_local7++;
};
};
scrollBar.grabYpercent = (visibleItems / items.length);
scrollBar.visible = (scrollBar.grabYpercent < 1);
}
private function onScrollBar(... _args):void{
index = Math.max(int(((items.length - visibleItems) * scrollBar.yPercent)), 0);
update();
}
private function onRemoveItem(_arg1:DynamicEvent):void{
update();
}
}
}//package
Section 29
//UserListItem (UserListItem)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import tv.ustream.tools.*;
import flash.ui.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public dynamic class UserListItem extends MovieClip {
private var _selected:Boolean;// = false
private var userList:UserList;
private var opHelpCmi:ContextMenuItem;
private var devoiceCmi:ContextMenuItem;
private var kickCmi:ContextMenuItem;
private var _me:Boolean;
public var bg:MovieClip;
private var uid:Number;
private var queryCmi:ContextMenuItem;
private var menu:Menu;
private var _nick:String;
private var vModeCmi:ContextMenuItem;
private var _host:String;// = ""
private var _mode:String;// = ""
private var cmiSep:String;
private var textFormat:TextFormat;
private var upper:Sprite;
private var opCmi:ContextMenuItem;
private var banCmi:ContextMenuItem;
private var _over:Boolean;
private var deopCmi:ContextMenuItem;
private var removed:Boolean;// = false
private var voiceCmi:ContextMenuItem;
private var textField:TextField;
private static var modes:Object = {op:"+o", deop:"-o", voice:"+v", devoice:"-v"};
static var itemWidth:uint;
static var itemHeight:uint = 20;
public function UserListItem(){
_mode = "";
_host = "";
_selected = false;
removed = false;
uid = int((Math.random() * 1000));
super();
cmiSep = ((Capabilities.version.substr(0, 3).toLowerCase() == "win")) ? "- " : "";
this.addEventListener("addedToStage", onAddedToStage);
this.addEventListener("removedFromStage", onRemovedFromStage);
itemWidth = width;
itemHeight = height;
textFormat = new TextFormat("Verdana", 10, 17504);
textField = new TextField();
textField.autoSize = "left";
textField.defaultTextFormat = textFormat;
textField.text = "hi";
textField.y = 2;
addChild(textField);
upper = new Sprite();
upper.graphics.beginFill(0xFF0000, 0);
upper.graphics.drawRect(0, 0, width, height);
addChild(upper);
textField.mask = upper;
bg.mouseEnabled = true;
bg.doubleClickEnabled = true;
bg.addEventListener("mouseOver", onMouseOver);
bg.addEventListener("mouseOut", onMouseOut);
bg.addEventListener("doubleClick", onQuery);
this.stop();
this.textField.autoSize = "left";
this.textField.mouseEnabled = false;
}
private function onRemovedFromStage(_arg1:Event):void{
this.removeChild(textField);
textField = null;
}
public function remove():void{
var _local1:Timer;
_local1 = new Timer(2000);
_local1.addEventListener("timer", onTimer);
_local1.start();
}
private function onMouseOver(... _args):void{
_over = true;
updateLabel();
}
private function onMode(_arg1:ContextMenuEvent):void{
var _local2:DynamicEvent;
_local2 = new DynamicEvent("mode", true);
_local2.nick = _nick;
_local2.mode = modes[_arg1.currentTarget.caption.substr(cmiSep.length)];
if (_arg1.target == opCmi){
_local2.mode = modes["op"];
};
_local2.room = userList.room.roomName;
this.dispatchEvent(_local2);
}
private function initMenu():void{
menu = new Menu(this);
this.contextMenu.customItems.push((queryCmi = new ContextMenuItem((cmiSep + "private message"))));
this.contextMenu.customItems.push((kickCmi = new ContextMenuItem((cmiSep + "kick"))));
this.contextMenu.customItems.push((banCmi = new ContextMenuItem((cmiSep + "ban"))));
this.contextMenu.customItems.push((opCmi = new ContextMenuItem((cmiSep + "make op"))));
this.contextMenu.customItems.push((deopCmi = new ContextMenuItem((cmiSep + "deop"))));
this.contextMenu.customItems.push((voiceCmi = new ContextMenuItem((cmiSep + "voice"))));
this.contextMenu.customItems.push((devoiceCmi = new ContextMenuItem((cmiSep + "devoice"))));
this.contextMenu.customItems.push((vModeCmi = new ContextMenuItem("", true)));
this.contextMenu.customItems.push((opHelpCmi = new ContextMenuItem("operator help", true)));
queryCmi.addEventListener("menuItemSelect", onQuery);
kickCmi.addEventListener("menuItemSelect", onKick);
banCmi.addEventListener("menuItemSelect", onBan);
opCmi.addEventListener("menuItemSelect", onMode);
deopCmi.addEventListener("menuItemSelect", onMode);
voiceCmi.addEventListener("menuItemSelect", onMode);
devoiceCmi.addEventListener("menuItemSelect", onMode);
opHelpCmi.addEventListener("menuItemSelect", onOpHelp);
vModeCmi.addEventListener("menuItemSelect", onVmode);
this.contextMenu.addEventListener("menuSelect", onMenuSelect);
}
private function onQuery(... _args):void{
var _local2:DynamicEvent;
if (!_me){
_local2 = new DynamicEvent("query", true);
_local2.nick = _nick;
this.dispatchEvent(_local2);
};
}
public function set me(_arg1:Boolean):void{
_me = _arg1;
if (_arg1){
updateLabel();
};
}
public function set selected(_arg1:Boolean):void{
if (((((_arg1) && (!(_me)))) && (!(_host)))){
whois();
};
_selected = _arg1;
}
public function get nick():String{
return (_nick);
}
private function onMouseOut(... _args):void{
_over = false;
updateLabel();
}
private function onOpHelp(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("http://www.ustream.tv/faq#faq18"), "_blank");
}
private function whois():void{
var _local1:DynamicEvent;
_local1 = new DynamicEvent("whois", true);
_local1.nick = _nick;
this.dispatchEvent(_local1);
}
public function get me():Boolean{
return (_me);
}
public function get host():String{
return (_host);
}
private function onAddedToStage(_arg1:Event):void{
userList = (parent as UserList);
}
private function onBan(_arg1:ContextMenuEvent):void{
var _local2:DynamicEvent;
_local2 = new DynamicEvent("ban", true);
_local2.room = userList.room.roomName;
_local2.host = host;
this.dispatchEvent(_local2);
onKick(_arg1);
}
public function updateLabel():void{
if (textField){
textField.text = ((_mode + "") + _nick);
textFormat.bold = _me;
textFormat.underline = _over;
textFormat.color = (_selected) ? 0xFFFFFF : 17504;
textField.setTextFormat(textFormat);
};
}
public function get mode():String{
return (_mode);
}
public function set mode(_arg1:String):void{
_mode = (_arg1) ? _arg1 : "";
updateLabel();
}
private function onKick(... _args):void{
var _local2:DynamicEvent;
_local2 = new DynamicEvent("kick", true);
_local2.nick = _nick;
_local2.room = userList.room.roomName;
this.dispatchEvent(_local2);
}
private function onMenuSelect(_arg1:ContextMenuEvent):void{
var _local2:int;
var _local3:Boolean;
_local2 = userList.findItem("me", true);
_local3 = ((!((_local2 == -1))) && ((userList.items[_local2].mode == "@")));
opHelpCmi.visible = ((_local3) && ((Id.brandId == "1")));
if ((vModeCmi.visible = ((((_local3) && (userList.room.home))) && ((Id.brandId == "1"))))){
vModeCmi.caption = (userList.room.modes.m) ? "Do Not Require Ustream Registration in order to chat" : "Require Ustream Registration in order to chat";
};
if (_me){
kickCmi.visible = (banCmi.visible = (opCmi.visible = (deopCmi.visible = (voiceCmi.visible = (devoiceCmi.visible = (queryCmi.visible = false))))));
this.contextMenu.customItems[1].visible = false;
} else {
kickCmi.visible = (banCmi.visible = (opCmi.visible = (deopCmi.visible = (voiceCmi.visible = (devoiceCmi.visible = _local3)))));
};
this.upper.dispatchEvent(new MouseEvent("mouseDown"));
}
private function onTimer(_arg1:TimerEvent):void{
_arg1.target.stop();
this.parent.removeChild(this);
}
public function get selected():Boolean{
return (_selected);
}
public function set nick(_arg1:String):void{
_nick = _arg1;
if (!menu){
initMenu();
};
menu.label = (_arg1 + " : ");
updateLabel();
}
private function onVmode(_arg1:ContextMenuEvent):void{
var _local2:DynamicEvent;
_local2 = new DynamicEvent("mode", true);
_local2.nick = "";
_local2.mode = ((userList.room.modes.m) ? "-" : "+" + "m");
_local2.room = userList.room.roomName;
this.dispatchEvent(_local2);
}
public function set host(_arg1:String):void{
_host = _arg1;
}
}
}//package