7 Replies Latest reply on Dec 2, 2010 12:44 AM by flex2008

    contentCreationComplete event at Startup

    Bobm_10

      Hi All,

       

      I am using Flex 4 and would like to run some calculations and update a text label when my Application first comes up.  I tried calling my function calcProj in contentCreationCompleteHandler but it seems that some of my controls which have been binded have not been completely updated.  Is there another event I should be in?  Thanks  Bob

        
         protected function application1_contentCreationCompleteHandler(event:FlexEvent):void
         {
          // TODO Auto-generated method stub
          LoadCountryData();
          CalcProj();
         }

        • 1. Re: contentCreationComplete event at Startup
          flex2008 Level 3

          listen for applicationComplete event.

          • 2. Re: contentCreationComplete event at Startup
            Bobm_10 Level 1

            That sill does not work.  In my loadCountryData function I am setting a slider which is bound to a text label.  In my calcproj function I am trying to access the text label.  I think the problem may be that the binding is too slow.  Is there a way to update all bindings before I call calcproj?  Thanks  Bob

            • 3. Re: contentCreationComplete event at Startup
              hidarikani Level 2

              creationComplete event not contentCreationComplete and not applicationComplete

              • 4. Re: contentCreationComplete event at Startup
                Bobm_10 Level 1

                I tried creationcomplete as well.  I really think it's a binding being to slow issue.    thanks for your help  Bob

                • 5. Re: contentCreationComplete event at Startup
                  flex2008 Level 3

                  Post a sample code and i will take a look.

                  • 6. Re: contentCreationComplete event at Startup
                    Bobm_10 Level 1

                    Here is a simplified version of the code.  The problem appears to be that the label is not being updated (through binding) before I try to access its value. I can get around this my accessing the value in the slider but it would be interesting to know if there is a command update all bindings.  Thanks for looking.  Bob

                     

                                                                    protected function application1_applicationCompleteHandler(event:FlexEvent):void

                                                                    {

                                                                                    // TODO Auto-generated method stub

                                                                                    LoadCountryData();

                                                                                    CalcProj();

                                                                    }

                                                                   

                                                                    private function LoadCountryData():void

                                                                    {

                                                                                    InUnionBSlider.value = 69;

                                                                                   

                                                                    }

                                                                    private function CalcProj():void

                                                                    {

                                                                                    var Cm : Array = new Array();

                                                                                                                                                                                                                                                     

                                                                                    // Calc TF Base Year 

                                                                                    Cm[0] =  Number(InUnionBTB.text)/100;  //Label not updated yet.

                                            }

                                                                   

                                                    <s:HSlider x="207" y="345" stepSize="1" minimum="1" maximum="100" id="InUnionBSlider" enabled="False"/>

                                                    <s:Label x="336" y="344" text="{InUnionBSlider.value}" id="InUnionBTB"/>

                    • 7. Re: contentCreationComplete event at Startup
                      flex2008 Level 3

                      Interestingly,there seems to be no issue if we are using mx:HSlider.Using callLater(CalcProj) instead of calcProj() will fix the problem for spark HSlider.But I am curious to know why it is not working normally.Will further look into the case and let you know.