//JMC: Import the FCS_Connection class import FCS_Connection; class UserList extends MovieClip{ static var symbolName : String = "UserList"; static var symbolOwner : Object = UserList; static var className : String = "UserList"; private var bBox : MovieClip; private var UserListTextField : TextField; private var __users : Object; //JMC: Private instance of the connection private var myConnection:FCS_Connection; // JMC: Pass in a FCS_Connector instance on creation function UserList(myConn:FCS_Connection){ init(); //JMC: Now store a reference to the FCS_Connector instance for possible future use. myConnection = myConn; //JMC: Register this as a listener for myConnection's custom userListChange event. myConnection.addEventListener('userListChange', this); } function init() : Void { bBox._width = 0; bBox._height = 0; bBox._visible = false; createChildren(); } function createChildren() : Void { createTextField("UserListTextField", 10, 0, 0, 100, 200); UserListTextField.multiline = true; UserListTextField.wordWrap = true; UserListTextField.autoSize = true; UserListTextField.html = true UserListTextField.border = true; UserListTextField.borderColor = 0x000000; UserListTextField.background = true; UserListTextField.backgroundColor = 0xEEEEEE; size(); } function size() : Void { draw(); } function draw() : Void { UserListTextField.htmlText = ""; for (var i in users){ UserListTextField.htmlText += i + "
"; } } //JMC: Event handler for the "userListChange" event private function userListChange(evtObj) { trace("userListChange"); //JMC: Update users with the new list. This will call draw() via the setter. users = evtObj.list; } [Bindable("writeonly")] public function set users(argValue:Object) { __users = argValue; trace ("SET users called"); draw(); } public function get users():Object{ trace ("GET users called"); return __users; } }