5 Replies Latest reply on Oct 7, 2010 12:28 AM by Flex harUI

    #1009 on creationComplete when resizing browser during loading modules

    frszilinski

      I use Flex 3.5 on Mac with Safari. Same Problem with Firefox.

       

       

      When I start my application that loads 8 Modules after login and I resize the browser window I get #1009. My views are in ViewStack that has creationPolicy "auto". Normally first time a view and it's childs get loaded is on the first itemClick in viewstack but if I resize browser window, creationComplete method of all views get called and the childs (like dataGrids or others) are null.

       

      Why? and what can I do against this behaviour?

       

       

      Thanks

        • 1. Re: #1009 on creationComplete when resizing browser during loading modules
          Flex harUI Adobe Employee

          What is the full text of the error and stack dump?

          • 2. Re: #1009 on creationComplete when resizing browser during loading modules
            kanrf1983

            Sorry for that late answer!

             

             

            TypeError: Error #1009: Der Zugriff auf eine Eigenschaft oder eine Methode eines null-Objektverweises ist nicht möglich.

            at X::Y()[/X/Y.as:45]

            at X::Y/initializeGrid()[X/Y.as:71]

            at X.page::YView/onCreationComplete()[/X/page/Y.mxml:37]

            at X.page::Y/___YGridView_BaseContentPageView1_creationComplete()[/X/page/Y.mxml:17]

            at flash.events::EventDispatcher/dispatchEventFunction()

            at flash.events::EventDispatcher/dispatchEvent()

            at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9440]

            at mx.core::UIComponent/set initialized()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as :1168]

            at mx.managers::LayoutManager/validateClient()[C:\autobuild\3.5.0\frameworks\projects\framew ork\src\mx\managers\LayoutManager.as:937]

            at mx.core::UIComponent/validateNow()[C:\autobuild\3.5.0\frameworks\projects\framework\src\m x\core\UIComponent.as:5690]

            at Y/onStageResize()[/X/Y.mxml:126]

             

            (X and Y are custom package and class names)

             

             

            That's called:

             

             

            private function onCreationCompleteEventHandler(event:FlexEvent):void {

                 initializeView(); //some internal stuff

                 model.initializeGrid(elementsDataGrid);//elementDataGrid is reference to a DataGrid component, but it's null!!!

            }

             

             

             

            So no resizing of browser window, no problem, if I resize during data/modules get loaded after login, I get this #1009.

             

            Any further steps to find a solution that creationComplete only gets called, if really everything is loaded?

            • 3. Re: #1009 on creationComplete when resizing browser during loading modules
              Flex harUI Adobe Employee

              Looks like it is in the constructor for Y() when it throws the error.

               

              Depending on creationPolicy and other timing, siblings and children may not

              be ready at creationComplete.

              • 4. Re: #1009 on creationComplete when resizing browser during loading modules
                kanrf1983 Level 1

                No the Error is thrown in my onCreationComplete event handler when I try to use a DataGrid but it's null.

                 

                • this view is in a module
                • the modules main view has a viewstack with creationPolicy none
                • "pages" that are childs of viewStack get created after an event get fired to a PageFlowManager
                • pages are creationPolicy all in general
                • this manager calls "pageContainer.createComponentsFromDescriptors(false);" at the beginning
                • in main application that calls shell I added months ago this

                 

                private function onApplicationComplete(event:FlexEvent):void {
                    stage.addEventListener(Event.RESIZE, onStageResize);
                }
                 
                private function onStageResize(e:Event):void {
                    validateNow();  
                 }
                

                 

                 

                I found this text somewhere:

                 

                The documents are not very clear on this (if not misleading), but what you have to do

                is set creationPolicy to none on the canvas, and leave it off of it's children (default to all).

                Doing so will create all of the children with recurse=true, or just it's immediate

                children with recurse=false. You would have to call the function manually on any children

                with creationPolicy set to none. So we choose false.

                 

                 

                Now I tried to set  "pageContainer.createComponentsFromDescriptors(true);" and somehow the error disappeared. Any ideas if that combination caused the creationComplete event if I resized the window on startup? And if yes why?

                 

                Message was edited by: thanks Flex harUI to give me a post after this long time

                • 5. Re: #1009 on creationComplete when resizing browser during loading modules
                  Flex harUI Adobe Employee

                  During a resize, the display list is validated immediately.  This will

                  result in creationComplete calls on new things, and if they rely on children

                  that haven't been created because of creation policy you will get an error.