13 Replies Latest reply on Jul 29, 2011 9:44 PM by snkd

    Loading time issue

    snkd Level 1

      hi,

      I have an issue with loading custom compont based on title window.

      Problem is creating component take too many large time.

       

      This component based on TitleWindow.
      And it included
      1.HBox which contain 15 buttons(actually it is also an separate component)
      2.TabNavigator which contain 9 tabs(7 of them are custom components)

       

      I have use creation policy all for the tabnavigator,because I can't perform my logic using on demand creation policy.
      Note:
      If I use creation policy auto,then I can't perform my logic.
      eg:cann't call reset methods of components, because sometimes,If I I didn't navigate then it has not been created and Object reference is null.then cann't help.

       


      component is very reusable in my system.But it takes too many time to load.
      What can I do? Any suggessons?

        • 1. Re: Loading time issue
          Mattr1981

          I'm sorry but without seeing your code I can not answer this. You should really look into profiling your flex application.

          You can see things like memory usage and load times for all parts of your application. Learn how to use the profiler and you should

          be able to make any flex app load as fast as it possibly can.

          • 2. Re: Loading time issue
            snkd Level 1

            Thanks.Thats true.that what I am trying to do.I need to speed up loading.

            what is profiler? and how can I get help on this?

            • 3. Re: Loading time issue
              Mattr1981 Level 1

              Profiler is on Flash Builder (I use 4) its the button with the little timer on, next to button with the little bug on it. While I cant tell you how to use here, just google for some excellent articles. You'll be using it in no time.

              • 4. Re: Loading time issue
                Karl_Sigiscar_1971 Level 3

                Check this thread about an investigation on this issue and the workaround found:

                http://forums.adobe.com/thread/786472?decorator=print&displayFullThread=true

                • 5. Re: Loading time issue
                  Flex harUI Adobe Employee

                  But you'll probably end up rewriting your code to handle on-demand

                  creationPolicy.  Note that there is a bug in Flex 4 if you have nested

                  ViewStacks/TabNavigators if you use creationPolicy="all".

                  • 6. Re: Loading time issue
                    snkd Level 1

                    Hi,

                     

                    Yes,I have code viewstack inside the tabnavigator with creation policy all.

                     

                    What is the bug? Is slowness the bug you mentioned above?How can I prevent them?

                    If I use Panels Or canvas can I prevent them?

                     

                    So Flex harUI (Alex), What should I do?What is your recomendation?

                     

                    thnx every one for reply.All points are very important for me.thnx everybody.

                    • 7. Re: Loading time issue
                      Flex harUI Adobe Employee

                      You should be able to set creationPolicy="auto" on the viewstack so it

                      doesn't create all of its grandchildren.  Of course, avoiding

                      creationPolicy="all" anywhere in your app is best practice, so taking the

                      time to make that change on your TabNavigator will also help.

                      • 8. Re: Loading time issue
                        snkd Level 1

                        ok I got it.thnx alex and that is hard for me to change the logic.

                         

                        I will describe my case,

                        As I mentioned earlier  there is a tabnavigator which has 9 tabs.

                        Frist tab contain the record selector combobox.When I(user) select one record from combobox,that record will bind into other 8 tabs content also.but how can I do that without creating those tabs at once.I can't accsess those tabs If I use "creationPolicy===auto".Because at that time it is null and hasn't created yet.

                        thats why I set creationPolicy all.

                         

                         

                         

                        What happened If I replace TabNavigator & NavigatorContent using Button & Panel ?

                        Will there a gain?I ask this because it is easy to do for me.

                        What is your openion?

                         

                        thanks

                        • 9. Re: Loading time issue
                          Flex harUI Adobe Employee

                          If you have slow startup, it is because you are creating too many things at

                          startup.  TabNav and ViewStack help you delay creating of things.  Your code

                          will need to deal with that.

                          • 10. Re: Loading time issue
                            snkd Level 1

                            ok,is there an idea for my case I have  mentioned in below. I need your suggesions.what is the best way to do that?

                             

                            I will describe my case,

                            As I mentioned earlier  there is a tabnavigator which has 9 tabs.

                            Frist tab contain the record selector combobox.When I(user) select one record from combobox,that record will bind into other 8 tabs content also.but how can I do that without creating those tabs at once.I can't accsess those tabs If I use "creationPolicy===auto".Because at that time it is null and hasn't created yet.Thats why I set "creationPolicy===all".

                             

                            Thanks

                            • 11. Re: Loading time issue
                              Mattr1981 Level 1

                              If you want to go down the creation policy route, set the creation policy to NONE, the use the initialize methods to create them when you have data.

                               

                              I have a similar project (some code below). In the main <mx:Application/> block, I have a preinitialize method that gets the initial data, the one that is good for tabone then call VSMain.initialize(). This creates the viewstack but only TabOne. The others are created when they are accessed for the first time.

                               

                              <mx:VBox width="990" paddingLeft="0" paddingRight="0" horizontalCenter="0" height="570" horizontalScrollPolicy="off" verticalScrollPolicy="off">
                              <mx:ViewStack id="VSMain" width="990" height="570" selectedIndex="0" creationPolicy="none">
                                   <s:NavigatorContent id="one" label="One">
                                        <main:TabOne/>
                                   </s:NavigatorContent>
                                   <s:NavigatorContent id="two" label="Two" creationPolicy="none">
                                        <main:TabTwo />
                                   </s:NavigatorContent>
                                   <s:NavigatorContent id="three" label="Three" creationPolicy="none">
                                        <main:TabThree/>
                                   </s:NavigatorContent>
                              </mx:ViewStack>
                              </mx:VBox>
                              1 person found this helpful
                              • 12. Re: Loading time issue
                                Flex harUI Adobe Employee

                                When you say "bind into", I think of that as pushing data from the main app

                                down to the children.  I recommend the children pulling data from a central

                                data model when they are created.  It is more object oriented that way,

                                IMHO.

                                1 person found this helpful
                                • 13. Re: Loading time issue
                                  snkd Level 1

                                  Greate,got the point.Thanks Alex,Thanks every-one.