0 Replies Latest reply on May 26, 2009 10:38 PM by WestSide

    Dynamic <mx:Label> problem...

    WestSide Level 1

      Hi,

       

      I have the following code.  I am populating this custom combo box control and it works fine as it stands, but I need to handle an additional object type and the way my code is written is uses a ternary operator so I can handle a third object type.  So where you see Customer ( data ) and Employee ( data ), I would like to add another type here but I'm unsure how to do it.  Basically appModel.searchResults currently contains 2 types of objects, there is a third object I would like to have.

       

      Code below:

       

       

      <!-- Search Component -->

       

       

       

       

      <controls:CustomAutoComplete id="searchInput" width="234" height="22

      " typedTextChange="onTypeTextChanged()"

      dataProvider="

       

      { appModel.searchResults }" lookAhead="false" styleName="searchInput" labelField="displayName"

      >

       

       

       

      <controls:itemRenderer>

       

       

       

       

      <mx:Component>

       

       

       

       

           <mx:Label text="{ data is Customer? Customer( data ).displayName : Employee( data ).displayName }">

       

         <mx:Script>

        <[CDATA[

         

       

       

       

      import com.app.model.Customer;

          

       

       

       

      import com.app.model.Employee;

       

       

      ]]>

       

         </mx:Script>

       

       

       

      </mx:Label>

       

       

       

        </mx:Component>

       

       

      </controls:itemRenderer>

       

      </controls:CustomAutoComplete>

       

       

       

      Thanks,

       

      -westside