3 Replies Latest reply on Oct 30, 2009 1:10 PM by Flex harUI

    ItemRenderer events inconsistencies


      I'm noticing some weird things going on in the code I recently wrote.  I wrote a custom ItemRenderer, to render the data in an <mx:List> object.


      It works fine for awhile, but after awhile I find that I lose the events for "button mode".  I find that this happens by navigating around the app, so destructing and reconstructing the component.


      I'm leaving out the AS which is used to set a variety of text fields at run time.  Nothing too fancy.  If necessary I can post the entire file, but this just doesn't make any sense to me from a coding standpoint.  Since the declarations for the events are in the mxml root, they should be enabled every time the component is created (which is the case, 90% of the time).  Nothing else really interacts with this as it is a stand-alone component, so I don't think anything else could be modifying any properties, etc.


      So, to summarize, I have this display class which consists of two sub-components.  One sub component should act as a button (AlertListData.mxml) and thus be in buttonMode and show the hand cursor, as well as have a click handler.  The other sub component has a few LinkButtons, which by default show the hand cursor and highlight a backdrop when moused over.  Sometimes when this component is constructed, it has these properties, other times it does not and I'm not sure why.


      Here is the markup for the list.


      <mx:List id="list"
           height="100%" width="100%"
           dataProvider="{ Model.Collection }"


      Here is the mark-up for the renderer class:


      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
          <comps:AlertListData id="dataFields" x="0" y="0" width="100%" height="100%"/>
          <comps:otherClass id="ackAndClear" x="0" y="143" width="100%" height="100%"/>





      AlertListData.mxml has the following declaration.


      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
          styleName="supportImageInit" buttonMode="true"




      otherClass.mxml has the following declaration.


      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" styleName="supportImageInit">


          <mx:Spacer width="5"/>
              <mx:Image id="grainImg" source="assets/largeGrain.png" />
              <mx:Spacer height="10"/>
              <mx:LinkButton enabled="true" label="ACK" icon="@Embed('/assets/ack.png')" click="ack()"
                  id="ack_Btn" cornerRadius="8" rollOverColor="#EB988D"/>
              <mx:Spacer height="10"/>
              <mx:LinkButton enabled="false" label="Clear" icon="@Embed('/assets/clear.png')" click="clear()"
                  cornerRadius="8" rollOverColor="#EB988D" id="clear_Btn" buttonMode="true" useHandCursor="true"/>