Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

A Strange Error!

phaseblue
Level 3
Level 3

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

1 Accepted Solution
aponnusa
Correct answer by
Employee
Employee

Hi,

Answers for 1 & 2 below

1.) Quoting an expert (Raff & Nikola)- external auth tokens last until the room ends (or you manually invalidate the session).So basically you can use them only once per room.

2.) Session containers creationComplete event is good enough, as by that time all LCCS components would have been initialized. But an applications applicationComplete is lot safer as you pointed out, but both of them would work fine in my opinion - [for more info http://www.wietseveenstra.nl/blog/2007/02/understanding-the-flex-application-startup-event-order/]

Thanks

Arun

View solution in original post

0 Replies
aponnusa
Employee
Employee

Hi Matt.

From your error, it seems like you  are setting guestsHaveToKnock even before you synchronize.

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()

Thanks

Arun

phaseblue
Level 3
Level 3

Arun,

You were absolutely right!  When I wrote the post I had just moved the guestsHaveToKnock setting into the synchronization event handler, but for some reason it was still throwing the same error, so I think the browser didn't update the version of the app. I was using.  However, it is working now!

I do have a couple of quick questions though:

1)  How long does an authentication token last before it expires?

2)  What is the difference between using the application's "applicationComplete" event and the session container's "onCreationComplete" event?  I ask because I see both used in the example apps in different situations.  I would think that listening for the "applicationComplete" event would be better as all components and variables that could be created up to that point would have been at the time that the event is sent.

Thanks,

Matt

aponnusa
Correct answer by
Employee
Employee

Hi,

Answers for 1 & 2 below

1.) Quoting an expert (Raff & Nikola)- external auth tokens last until the room ends (or you manually invalidate the session).So basically you can use them only once per room.

2.) Session containers creationComplete event is good enough, as by that time all LCCS components would have been initialized. But an applications applicationComplete is lot safer as you pointed out, but both of them would work fine in my opinion - [for more info http://www.wietseveenstra.nl/blog/2007/02/understanding-the-flex-application-startup-event-order/]

Thanks

Arun

View solution in original post

phaseblue
Level 3
Level 3

Thanks again for your help Arun!

Matt