Hi guys,
I think that we are still on track to release ElectroServer 3.6 tonight. Unfortunately I have to leave town and have not finished all of the documentation updates. If Mike chooses to release 3.6 without my documentation updates then you'll need the code below for an example of how to use some of the latest features. If he wants to wait for my documenation updates then it might be another couple of days.
Here is code for the various features. You can call the different functions to test it. Of course, this will only work with 3.6, so wait for its release.
Code://///////////////////////////////////// // Buddy Code // /////////////////////////////////////// var es:ElectroServer; es.buddyLoggedIn = function(name) { //This is fired when a buddy of yours logs in trace(name +" just logged in") }; es.buddyLoggedOut = function(name) { //this is called when a buddy of yours logs out trace(name+" just logged out"); }; function addBuddy(name) { //This adds a new buddy. If he already exits then he is not added a 2nd time. es.addBuddy(name); } function removeBuddy(name) { //This removes an existing buddy. If he does not exist then no bid deal. es.removeBuddy(name); } ////////////////////////////////////////////////////////// // To load users in a specific room // ////////////////////////////////////////////////////////// function loadUsersInASpecificRoom() { //es.getUsersInRoom( zone_name, room_name) es.getUsersInRoom("Chat Area", "Lobby"); } es.usersInRoomLoaded = function(users) { //This is fired when the users in a specific room have been loaded //array is returned with user objects. They have only 1 property, username for (var i = 0; i<users.length; ++i) { var ob = users[i]; trace(ob.username); } }; ////////////////////////////////////////////////////////// // To load a user's location // ////////////////////////////////////////////////////////// function loadAUsersLocation() { //pass in the user's name es.getUserLocation("jobe"); } es.userLocationLoaded = function(username, zone, room) { //This is fired when his loacation has been received trace(username+", "+zone+", "+room); }; ////////////////////////////////////////////////////////// // Get Rooms In Zone // ////////////////////////////////////////////////////////// function loadRoomsInAZone() { //pass in a zone name es.getRoomsInZone("Chat Area"); } es.onRoomsInZoneLoaded = function(room_list, zone_name) { //This is fired when the rooms have been loaded //tracing zone name trace(zone_name); for (var i = 0; i<room_list.length; ++i) { var ob = room_list[i]; //tracing room name trace(ob.Name.value); } }; ////////////////////////////////////////////////////////// // Get All Zones // ////////////////////////////////////////////////////////// function loadAllZones() { //Call the transaction es.getAllZones(); } es.allZonesLoaded = function(zones) { //This is called when all zone names have been loaded for (var i = 0; i<zones.length; ++i) { //tracing zone names trace(zones[i]); } };


Reply With Quote
