History.leading=5; chatz="0"; grid.rowHeight = 19; _root.create_room_movie._visible = false; adminbut._visible=false; Message.restrict = " a-z0-9:,';!?()éèê"; Message.maxChars = 95.750000; me.text = UserName; private_bg._visible=false; myvideo._visible=false; var LastDataGridSelected:String = ""; var gridlistener:Object = new Object(); gridlistener.change = function(eventObject) { if (grid.selectedItem.label != _root.nick) { LastDataGridSelected = _root.nick; if (LastDataGridSelected != "") user_nc.call("whowatch", null, LastDataGridSelected, false); } _root.nick = grid.selectedItem.label; _root.opipp = grid.selectedItem.data.ip; video.close(); video.clear(); History._x = 413; History._y = 161; History.setSize(340, 256); who.text = grid.selectedItem.label; private_bg.private_name.html=true; private_bg.private_name.htmlText="Private Message "+ _root.nick+""; private_bg._visible=true; adminbut.opname.text=_root.nick; adminbut.opip.text= _root.opipp; History.vPosition = History.maxVPosition; user_nc.call("whowatch", null, _root.nick, true); //Play Stream In_ns = new NetStream(user_nc); video.attachVideo(In_ns); video.attachAudio(In_ns); In_ns.play(nick); } if (In_ns.play = null) { video.clear(); } if (_root.log_ok="1") { init(); manageSO(); trace("log"); user_nc.call("settopic", null, msg); } function init() { InitSO(); _root.log_ok="0"; grid.empty(); trace("iniini"); login_btn.enabled = false; login_btn._alpha = 50; login_txt.enabled = false; ns = new NetStream(user_nc); mycam = Camera.get(); mycam.setQuality(8192, 0); mycam.setMode(173, 142, 8); mycam.setKeyFrameInterval(30); mymic = Microphone.get(); mymic.setGain(38); mymic.setRate(8); ns.attachVideo(mycam); ns.attachAudio(mymic); myvideo.attachVideo(mycam); myvideo._visible=true; mycam.owner = this; if (mycam != null) { mycam.onStatus = function(infos) { if (infos.code == "Camera.Unmuted") { this.owner.cameraOk(); } else if (infos.code == "Camera.Muted") { this.owner.cameraNo(); } }; if (mycam.muted == false) { cameraOk(); } else if (mycam.muted == true) { cameraNo(); } } else if (mycam == null) { cameraNo(); } } function cameraOk() { trace("camera allowed"); ns.publish(UserName); statut = true; statut_txt.text = ""; user_nc.call("getStatut", null, statut); } function cameraNo() { trace("cam not allowed"); ns.publish(false); myvideo.clear(); statut = false; user_nc.call("getStatut", null, statut); } user_nc.newClientForAll = function(allClients) { for (var i in allClients) { afficheName(allClients[i]); } }; user_nc.newClient = function(client) { afficheName(client); user_nc.call("whowatch", null, _root.nick, true); }; user_nc.initList = function(allClients) { grid.removeAll(); for (var i in allClients) { afficheName(allClients[i]); } }; function afficheName(client) { var stat = getStat(client); o = {label:client.UserName, data:client, data:client.ip, monIcon:stat}; grid.iconField = "monIcon"; grid.addItem(o); var count = grid.length; counter.text = count; grid.sortItemsBy("id", "DESC"); } user_nc.whowatch = function(nick, watching){ for (var I:Number=0; I0) { var tts:String = Message.text; tts = ''+tts+""; user_nc.call("msgFromClient", null, tts); } Message.text = ""; } user_nc.kicked = function() { ns.close(); user_nc.close(); gotoandstop(4); } user_nc.Banned = function (){ ns.close(); user_nc.close(); gotoAndStop(5); }; String.prototype.replace = function(original,destination) { return this.split(original).join(destination); } function manageSO() { users_so = SharedObject.getRemote("users_so", _root.user_nc.uri, false); users_so.onSync = function (userList) { }; users_so.connect(user_nc); users_so.msgFromSrvr = function(msg) { History.text += msg.replace("ivideochat","").replace("msn","").replace("chatvideo","").replace(".com","").replace(".net","").replace(".ca","").replace("mirc","").replace("hotmail","").replace("www","").replace("http","").replace("m s n","").replace("email","").replace("e m a i l","").replace("ms n","").replace("m sn",""); History.vPosition = History.maxVPosition; }; } user_nc.privateMsgClient = function(msg) { History.text += msg.replace("ivideochat","").replace("msn","").replace("chatvideo","").replace(".com","").replace(".net","").replace(".ca","").replace("mirc","").replace("hotmail","").replace("www","").replace("http","").replace("m s n","").replace("email","").replace("e m a i l","").replace("ms n","").replace("m sn",""); History.vPosition = History.maxVPosition; adminbut._visible=false; op_btn._visible=true; }; adminbut.kick_pb.onRelease = function (){ var theusername = grid.selectedItem.label; user_nc.call("kickUser", null, theusername); adminbut._visible=false; op_btn._visible=true; }; adminbut.ban_ip.onRelease = function (theip,duration){ var theip = grid.selectedItem.data.ip; trace("theip est: "+theip); user_nc.call("banuser", null, theip, adminbut.radioGroup.selection.data); } function InitSO() { trace("initso"); list_so = SharedObject.getRemote("list_so", _root.user_nc.uri, false); list_so.connect(_root.user_nc); list_so.onSync = function(roomList) { var nr:Number = 0; _root.Rooms.removeAll(); for (var i in list_so.data) { if (list_so.data[i].room != null) { _root.Rooms.addItem({users:list_so.data[i].users, name:list_so.data[i].room, label:list_so.data[i].room+" ("+list_so.data[i].users+") ", data:list_so.data[i].room, id:i, users:list_so.data[i].users}); } } len = _root.Rooms.length; _root.Rooms.sortItemsBy("id", "ASC"); for (var i = 0; i<=len; i++) { if (_root.Rooms.getItemAt(i).data == "Lobby") { itm_label = _root.Rooms.getItemAt(i).label; _root.Rooms.removeItemAt(i); _root.Rooms.addItemAt(0, {label:itm_label, data:"Lobby", id:"r1"}); } } } } user_nc.set_topic = function(msg) { History.text=msg; msgServer.text=msg; History.vPosition = History.maxVPosition; } user_nc.set_joined = function(msg) { History.text=msg; msgServer.text=msg; History.vPosition = History.maxVPosition; } function closeStreams() { ns.close(); } Rooms.change = function(eventObj) { if (_root.Rooms.selectedItem.users != 0) { _root.Delete_btn.enabled = false; } else { _root.Delete_btn.enabled = true; } if (_root.Rooms.selectedItem.id == "r1") { _root.CRID = _root.Rooms.selectedItem.id; _root.crname=_root.Rooms.selectedItem.name; _root.doRoomConnect(_root.CRID) ; _root.grid.removeAll(); _root.iniSo(); } else { _root.CRID = _root.Rooms.selectedItem.id; _root.crname=_root.Rooms.selectedItem.name; _root.doRoomConnect(_root.CRID) ; _root.grid.removeAll(); _root.iniSo(); } }; function doDisConnect() { ns.close(); user_nc.close(); } Rooms.addEventListener("change", Rooms); grid.setStyle("borderStyle", "solid"); grid.setStyle("color", "0x626262"); grid.setStyle("backgroundColor", "0xF7F7F7"); grid.setStyle("fontSize", "11"); grid.setStyle("fontFamily", "Tahoma"); grid.setStyle("themeColor", "0xEEF8CD"); grid.setStyle("selectionColor", "0xD3F174"); grid.setStyle("selectionDisableColor", "0xFFFFFF"); grid.addEventListener("change", gridlistener); var usernameListener = new Object(); usernameListener.owner = this; usernameListener.onKeyDown = function () { if (this.owner.Message.MessagehasFocus && Key.isDown(Key.ENTER)){ this.owner.doSend.onPress(); Key.removeListener(usernameListener); inter = setInterval(function (){ Key.addListener(usernameListener); clearInterval(inter); }, 2000); } }; focusManager.setFocus("Message"); Message.MessagehasFocus = false; Key.addListener(usernameListener); Message.onKillFocus = function () { this.MessagehasFocus = false; }; Message.onSetFocus = function () { this.MessagehasFocus = true; }; stop();