Send to all in room AS extension

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
pilot
Posts: 10
Joined: 16 Jun 2010, 22:10

Send to all in room AS extension

Post by pilot »

Hi there,

I've written a function that most of my code depends on that sends a message to everyone in the room. Take a look:

Code: Select all

function sendToRoom(resp, fromRoom, sender, recipients)
{
    var room = _server.getCurrentRoom();
    _server.sendResponse(resp, fromRoom, sender, room.getAllUsers());
}
Am I doing something incorrectly? I keep getting a method cannot be called on getAllUsers() on my object. Can't seem to find any samples that make use of the getAllUsers() method.

Thanks.
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

Is this script located in one of your room extension? (since _server.getCurrentRoom() only works in a room extension)
Smartfox's forum is my daily newspaper.
pilot
Posts: 10
Joined: 16 Jun 2010, 22:10

Post by pilot »

Well the silly thing is that I've written a single extension that gets used when the user first joins then when they join a room. When the person actually makes the request it IS inside a room (thus I assume it's acting as a room extension at that moment?).
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

Sounds like you are dynamically attaching an extension to a room upon creation or the extension was defined in your <room> tags at boot time - in this case, yes - it is a room extension.

A zone extension is located outside the <rooms> scope, but inside the <zone> tag.
Smartfox's forum is my daily newspaper.
Post Reply