Room list in Flex 2.0

Can any one help me in this issue,

How to get room list in flex 2.0

in flash it is working fine but in flex its not getting any response

I think the problem is

var browser = new Browser( connection );

getRooms();

function getRooms(){ browser.getServiceItems(chatserver, “browse_result”, _root); }

function browse_result( iq:IQ )

{

var itemExt:ItemDiscoExtension =iq.getAllExtensions()[0]; for( var i=0; i< itemExt.items.length; i+*) { trace( “Room:”*itemExt.items[ i ].name + "[ " + itemExt.items[ i ].jid + " ] "); }

}

  • this is just a summarized code

function getRooms(){ browser.getServiceItems(chatserver, “browse_result”, _root); }

here the last parameter(_root) is a scope variable…

I am not able to find any way in flex to get any result…

Since _root isn’‘t available in flex anymore and the main application isn’‘t derived from the Object class you’'ll have to send the scope to some Object. So before initializing your browser - create a new Object only containing a little helper function:

var myObj:Object = new Object();

myObj.callbackFunction = function(iq:IQ):void{

mydesiredFunction(iq);

}

then set the scope variable to myObj

This should work…

Message was edited by: kingschnulli