3 Replies Latest reply on Mar 14, 2011 6:37 AM by JeffryHouser

    Creating  the Custom MXML Component  Once and only once

    kiran7881 Level 1

      Hi ,

       

      I have a DataGridColumn of a DataGrid , for which i am setting the itemrenderer dynamically using ClassFactory option .As shown .

      I guess that my customized Components (ViewElement , DomainElemnt ) would be creating many instances of itself .
      So is it possible to have only a single instance of this Files ??

       

       

      <mx:DataGridColumn  id="Testing2"   headerText="{getHeaderTextForView(viewRequest.lastResult.opml.head.currentView)}" showDataTips="false" >

       

      private function getHeaderTextForView(viewName:String) :String {

       

                               if(viewName == "PeopleBasedView")
                               {
                               Testing2.itemRenderer = new ClassFactory(ViewElement);
                               }
                               else if(viewName == "DomainBasedView")
                                {
                                Testing2.itemRenderer = new ClassFactory(DomainElemnt);
                          
                               }
                       }

       

       

       

      DomainElement.mxml :

       

      <mx:Box >
      <mx:Label id="viewname" text="{getDispalyName(data)}"  styleName="viewElementLabel"  toolTipCreate="createCustomTip(data,event)"/>
      <mx:Box >

       

      Please advice , thanks .

       

       

      Please suggest , thanks .