Avatar

Level 10

Hi,

I copied and ran your exact code and I could see the name clearly on the List. There was no problem when I ran it. Can you run it again. Can you please run it once more?You code looks and runs perfect for me.

I just want to make one extra note in case you use in future customFields of userCollection, you need to do it like this.

Attaching an example of DataGrid using customField

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" xmlns:rtc="AfcsNameSpace" >

<mx:Script>

<![CDATA[

import com.adobe.rtc.sharedManagers.UserManager;

private var _userManager:UserManager ;

public function onCreationComplete():void

{

_userManager = cSession.userManager ;

if (!_userManager.isCustomFieldDefined('score')) {

_userManager.registerCustomUserField('score');

}

userManager.setCustomUserField(userManager.myUserID,'score','7');

}

private function scoreLabelFunction(item:Object,column:DataGridColumn):String

{

return item.customFields['score'] ;

}

]]>

</mx:Script>

<rtc:ConnectSessionContainer id="cSession" roomURL="Your Room Url">

<rtc:authenticator>

<rtc:AdobeHSAuthenticator userName="Your UserName" password="Your Password" />

</rtc:authenticator>

<mx:DataGrid id="datag" dataProvider="{cSession.userManager.userCollection}" creationComplete="onCreationComplete()" >

<mx:columns>

<mx:DataGridColumn id="c1" headerText="Name" dataField="displayName" />

<mx:DataGridColumn id="c2" headerText="Score" dataField="customFields['score']" labelFunction="scoreLabelFunction" />

</mx:columns>

</mx:DataGrid>

</rtc:ConnectSessionContainer>

</mx:Application

So, for defined fields you just do labelField="fieldname" like you are doing for displayName and for customFields , you do labelField="customFields['fieldName']" provided the field is defined.

Thanks

Hironmay Basu