1 Reply Latest reply on Feb 3, 2011 2:14 AM by Pablo Souza

    Will Creating  Itemrenderer Component many times affect perfromance .

    kiran7881 Level 1

      Hi ,

       

      I am using a Custom Itemrenderer Component for my DataGRidColumn .

      I am concerned about the performance of the Application .

      This is my code and  working fine with good performance , until i did some changes .

       

      <DataGrid id="Testing2">
      if(viewName == "PeopleBasedView")
      {
      Testing2.itemRenderer = new ClassFactory(navigation.ViewElement);
      }
      else
      {
          Testing2.itemRenderer = new ClassFactory(navigation.DomainElemnt);
      }

       

      Now as per the requirement , i have added state to an HBox (which included adding an Image to it dynamically to an HBox ).

      But adding this resulted in slowing of the Application dramitically .
      Please tell me whether i am creating too many instances of the itemRenderer component ?? will it effect in performance ??

       

       

       

      public function ChageToNormalView():void
                       {
                           Testing2.itemRenderer = new ClassFactory(ViewElementOrdinary);
                           currentState="Second";
                       }


      public function ChageToNormalView2():void
                       {
                           Testing2.itemRenderer = new ClassFactory(ViewElement);
                           this.currentState="First";
                       }

       

       

       

                                                  <mx:states>
                                                   <mx:State name="First">
                                                   <mx:AddChild relativeTo="{menu}">
                                                   <mx:Image id="three" source="@Embed(source='/table.PNG')"  click="ChageToNormalView()"/>   
                                                   </mx:AddChild>
                                                   </mx:State>
                                                  
                                                   <mx:State name="Second">
                                                   <mx:AddChild relativeTo="{menu}">
                                                   <mx:Image id="three3" source="@Embed(source='/DataGrid.PNG')"    click="ChageToNormalView2()"/>   
                                                   </mx:AddChild>
                                                   </mx:State>
                                               </mx:states>

       

       

      Please sugest , thanks .