1 Reply Latest reply on Jul 14, 2009 6:42 PM by tanyagray01

    binding image in actionscript question

    cpthk0

      Hi:

       

      Here is my flex code:

           <mx:Script>
                <![CDATA[
                     
                     import mx.binding.utils.*;
                     
                     [Embed(source="assets/image.png")]
                     [Bindable]
                     private var indicatorIcon:Class;
      
                               //second image here
                     
                     override public function set data(value:Object):void{
                          super.data = value;
                          if(data > 0){
                               BindingUtils.bindSetter(updateIconIndicatorSource, ?, ?);
                          }
                                      else{
                                              BindingUtils.bindSetter(updateIconIndicatorSource, ?, ?);
                                      }                    
                     }
                     
                     private function updateIconIndicatorSource(indicatorIcon:Class){
                          iconIndicator.source = indicatorIcon;
                     }
                     
                ]]>
           </mx:Script>
           
           <mx:Image id="iconIndicator"/>
      

       

      My code is to when setter function gets called, it will check for its value and bind the appropriate image to the <image> tag. In the bindSetter, I do not know what should I put in there. In documentation, they only have example of binding textinput property.

       

      Thanks.