Avatar

Level 1

Hi Nigel,

Thanks so much for your response. I tried your suggetions and I can see that the custom user filed is set right in the user collection when I use the setCustomUserField() method. I still don't see the value being synchronized across sessions though. I debugged it, and the user collection shows the customUserField with the right value, so not sure why it is not being bound correctly to the ui component. I also changed the event handler to the synchronizationChange instead of applicationComplete. Any insights?

Thanks,

Ritu..

Here is the code for setting the field.

protected function eGamingSession_synchronizationChangeHandler(event:SessionEvent):void

                              {

                                        // TODO Auto-generated method stub

                                        if(eGamingSession.isSynchronized)

                                        {

 

                                                  rosterItem.score = 1;

 

                                                  for(var i:int=0;i<eGamingSession.userManager.userCollection.length;i++)

                                                  {

                                                            eGamingSession.userManager.registerCustomUserField("score");

                                                            eGamingSession.userManager.setCustomUserField(eGamingSession.userManager.userCollection.getItemAt(i).userID,"score",rosterItem.score);

 

                                                            trace("Value of stepper is: "+eGamingSession.userManager.userCollection.getItemAt(i).customFields.score);

 

                        }

  }

}

Here is the code to display the value of custom user field.

<s:List id="userList"

                                                                      dataProvider="{eGamingSession.userManager.userCollection}"

                                                                      labelField="displayName"

                                                                      width="100%" height="100%">

 

                                                            <s:itemRenderer>

                                                                      <fx:Component>

                                                                                <s:ItemRenderer>

 

                                                                                          <s:HGroup width="100%">

 

                                                                                                    <s:Label text="{data.displayName}" paddingTop="5" width="60%"/>

                                                                                                    <s:Button id="winnerButton"

                                                                                                                          width="30%"

                                                                                                                          label="Winner!"

                                                                                                                          visible="{!data.customFields.batonHolder}"/>

                                                                                                    <s:NumericStepper id="userStepper" width="10%" value="{data.customFields.score}"/>

 

                                                                                          </s:HGroup>

 

                                                                                </s:ItemRenderer>

                                                                      </fx:Component>

                                                            </s:itemRenderer>

  </s:List>