Avatar

Not applicable

Hi,

I'm working on an app. that has 2 parts, a staff and a client and I've been running into the same error over and over for over a week now.

I've implemented a knocking queue and it works fine when the staff (who is the "OWNER") login details are hardcoded in MXML.  However, the minute I try to incorporate external authentication in the staff app., which is all done in the creationComplete() handler, I get the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
     at com.adobe.rtc.sharedManagers::RoomManager/set guestsHaveToKnock()
     at Staff_App/onCreationComplete()
     at Staff_App/___Staff_App_Application1_applicationComplete()
     at flash.events::EventDispatcher/dispatchEventFunction()
     at flash.events::EventDispatcher/dispatchEvent()
     at mx.core::UIComponent/dispatchEvent()
     at mx.managers::SystemManager/preloader_preloaderDoneHandler()
     at flash.events::EventDispatcher/dispatchEventFunction()
     at flash.events::EventDispatcher/dispatchEvent()
     at mx.preloaders::Preloader/displayClassCompleteHandler()
     at flash.events::EventDispatcher/dispatchEventFunction()
     at flash.events::EventDispatcher/dispatchEvent()
     at mx.preloaders::SparkDownloadProgressBar/initCompleteHandler()
     at flash.events::EventDispatcher/dispatchEventFunction()
     at flash.events::EventDispatcher/dispatchEvent()
     at mx.preloaders::Preloader/dispatchAppEndEvent()
     at mx.preloaders::Preloader/appCreationCompleteHandler()
     at flash.events::EventDispatcher/dispatchEventFunction()
     at flash.events::EventDispatcher/dispatchEvent()
     at mx.core::UIComponent/dispatchEvent()
     at mx.core::UIComponent/set initialized()
     at mx.managers::LayoutManager/doPhasedInstantiation()
     at mx.managers::LayoutManager/doPhasedInstantiationCallback()

The error seems to be telling me that it isn't even aware of the property called guestsHaveToKnock, which seems completely absurd!  It really begs the question of exactly when things (sessions, components, etc...) which are created in code are ready to be used by the app.

I've tried putting all the knocking queue code inside of a SYNCHRONIZATION_CHANGE event, but to no avail.
Here is the code for my creationComplete() function:

private function onCreationComplete():void
{
     roomURL = FlexGlobals.topLevelApplication.parameters["roomURL"];
     authToken = FlexGlobals.topLevelApplication.parameters["authToken"];
     cSession.login();

     cSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onSyncChange);              
}

private function onSyncChange(p_evt:SessionEvent):void
{
     if (p_evt.type == SessionEvent.SYNCHRONIZATION_CHANGE) {
          if(cSession.isSynchronized)

          {
             // Require that guests must knock.Note that this line changes the setting of your room so that in future anyone guest coming in
          // has to knock. You can change this setting again either from code by making roomManager.guestsHaveToKnock as false or from the DevConsole's manage tab
          cSession.roomManager.guestsHaveToKnock = true ;
                        
          // For owners that arrive late, the pending queue is populated with waiting users.
          if ( cSession.userManager.myUserRole == UserRoles.OWNER ) {

                  //  var pendingArray:Array = new Array();
               var pendingArray:ArrayList = new ArrayList();

                  var queue:Array = cSession.roomManager.knockingQueue.pendingQueue ;
            for ( var i:int = 0 ; i < queue.length ; i++ ) {
               var item:UserQueueItem = queue[i] as UserQueueItem ;
               pendingArray.addItem({label:item.descriptor.displayName,descriptor:item.descriptor});
                  }

                  knockingList.dataProvider = pendingArray ;

                  cSession.roomManager.knockingQueue.addEventListener(UserQueueEvent.ITEM_UPDATE,onKnockingQueueUpdate);

                  cSession.roomManager.knockingQueue.roleForManaging =  UserRoles.PUBLISHER;
            addPods();
          }else {
                  //Else, remove all UI from seeing.
                  knockingUI.removeAllChildren() ;
             }

          )

     }

}

I have been studying the class docs, and I'm starting to get a good handle of what to do where, but no matter what I do, I can't find a solution to this problem.  I originally had this posted in my "Knocking Queue Example" thread, but I thought maybe it got overlooked because I had marked it as "solved".  I'm literally pulling my hair out and I can't move further with this until I get this solved.

As always, I do appeciate you guys taking the time out to help us.

Matt