2 Replies Latest reply on Jan 7, 2011 11:01 AM by K4Flex

    Access to mx:Text inside mx:ItemRenderer

    K4Flex

      Hello,

       

      I have the following structure:

       

      <mx:List>

           <mx:Script>

           ,![CDATA[

       

                //some functions and bindable variables here

       

           ]]>

           </mx:Script>

          

           <mx:itemRenderer>

                <mx:Component>

                     <mx:Hbox>

                          <mx:Text id="bookTitle" text={data.bookTitle} click="outerDocument.bookClickHandler"/>

                          <mx:Button id="bookButton" label="Click Me!" />

                     </mx:Hbox>

                </mx:Component>

           </mx:itemRenderer>

      </mx:List>

       

      My question is, how do I dynamically change the bookTitle component from within the mx:Script portion of my code?  Say for example, there are no books found, how can I put on the mx:Script portion that if there are no books, this.bookTitle.text="No books found" and then set another font color and size like this.bookTitle.fontSize=15, this.bookTitle.fontColor=#333333.  I tried doing this on the mx:Script portion and I get the following error:

       

      "Access of possibly undefined property bookTitle through a reference with static type ui:BookList"

       

      (BookList is the name of my List class)

       

      Please help.

       

      Thanks,

      K4Flex