handleInternalRequest - xt interoperability issue
Posted: 29 Apr 2008, 00:29
I found the following response in the post called 'banning quitters'
But I'm stuck on just how to go about sending a request from the zone down to a room extention . I assume that I need to get a reference to the room extention and have tried first getting the correct room object which works fine using (form the zone extention)
var room = zone.getRoom(roomID)
but then when I try
var targetExtension = room.getExtension("xtname");
I get an error stating: TypeError: Cannot find fuction getExtention . . .
So
HOW DO I go about getting a reference to an extention running in a room?
Thanks
C
Which works just perfectly if I'm making an internal request from a room extention to the zone extention the room sits underneath.You simply have to add a handleInternalRequest method in your AS server side code for handling the call.
Code:
function handleInternalRequest(obj)
{
...etc...
}
In order to call another extension you can translate the code like this:
Code:
// Get a reference to the Zone where the target extension is running
var zone = _server.instance.getZone("testZone");
// Get a reference to the Extension we want to call
var targetExtension = zone.getExtension("testExtension");
// Invoke the handleInternalRequest on the target extension and receive the response
var response = targetExtension.handleInternalRequest("Hello");
trace("Response: " + response);
hope it helps
But I'm stuck on just how to go about sending a request from the zone down to a room extention . I assume that I need to get a reference to the room extention and have tried first getting the correct room object which works fine using (form the zone extention)
var room = zone.getRoom(roomID)
but then when I try
var targetExtension = room.getExtension("xtname");
I get an error stating: TypeError: Cannot find fuction getExtention . . .
So
HOW DO I go about getting a reference to an extention running in a room?
Thanks
C