7 Replies Latest reply on Jun 30, 2010 6:36 AM by nikos101

    image path expression in item renderer

    nikos101 Level 2

      I'm not having success with this in my item renderer


              <mx:Image id="imgVideo" source="{'nikos\icons\twotinyexpansion' + !data.wasVideoRecorded?'\screen-delete.gif':'\screen-add.gif'}" toolTip="Video has been created for this row" >
                             </mx:Image>

       

      see anyting I'm doing wrong?

        • 1. Re: image path expression in item renderer
          David_F57 Level 5

          hi,

           

          change your backslashes to forward slashes...

           

           

          David.

          1 person found this helpful
          • 2. Re: image path expression in item renderer
            nikos101 Level 2

            Thanks Dave,

             

            I still get the same result:

             

            the text always says screen-delete.gif

             

            <mx:AdvancedDataGridColumn showDataTips="true" headerText="Status" dataField="staffName" width="160">
                                        <mx:itemRenderer>
                                            <fx:Component>
                                                <s:MXAdvancedDataGridItemRenderer focusEnabled="true" height="22" >
                                                    <s:states>
                                                        <s:State name="normal" />           
                                                        <s:State name="hovered" />
                                                        <s:State name="selected" />
                                                    </s:states>
                                                    <s:HGroup left="0" right="0" verticalCenter="0">
                                                        <s:Label text="{'nikos/icons/twotinyexpansion/' + !data.wasVideoRecorded?'screen-delete.gif':'screen-add.gif'}">
                                                           
                                                        </s:Label>
                                                        <mx:Image id="imgVideo" source="{'nikos/icons/twotinyexpansion/' + !data.wasVideoRecorded?'screen-delete.gif':'screen-add.gif'}" toolTip="Video has been created for this row" >
                                                           
                                                        </mx:Image>
                                                        <mx:Image id="Comment" source="nikos\icons\twotinyexpansion\document-edit.gif" toolTip="Comment:\n\n{data.comment}" visible="{data.wasVideoRecorded}" includeInLayout="{data.wasVideoRecorded}">
                                                           
                                                        </mx:Image>
                                                    </s:HGroup>
                                                   
                                                </s:MXAdvancedDataGridItemRenderer>
                                            </fx:Component>
                                        </mx:itemRenderer>
                                    </mx:AdvancedDataGridColumn>

            • 3. Re: image path expression in item renderer
              David_F57 Level 5

              hi, 

               

               

              see if this works

               

               

              source="{'nikos\icons\twotinyexpansion' + (!data.wasVideoRecorded?'\screen-delete.gif':'\screen-add.gif')}"

               

               

              David.

              • 4. Re: image path expression in item renderer
                nikos101 Level 2

                Nope, but this works, do you like it?

                 

                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                                                                {
                                                                    if (data != null)
                                                                    {
                                                                        super.updateDisplayList(unscaledWidth, unscaledHeight);
                                                                               
                                                                        if(data.wasVideoRecorded){
                                                                            imgVideo.source = 'nikos/icons/twotinyexpansion/screen-add.gif';
                                                                            toolTip="Video has been created for this row"
                                                                        }
                                                                        else{
                                                                            imgVideo.source = 'nikos/icons/twotinyexpansion/screen-delete.gif';
                                                                            toolTip="No video"
                                                                        }
                                                                       
                                                                    }
                                                                }

                • 5. Re: image path expression in item renderer
                  David_F57 Level 5

                  hi,

                   

                   

                  That was my next thought but in a datachange event

                   

                  It must be a renderer thing as the logic works in a normal nonbound situation.

                   

                   

                  David.

                  1 person found this helpful
                  • 6. Re: image path expression in item renderer
                    nikos101 Level 2

                    Ok datachange event it is

                    • 7. Re: image path expression in item renderer
                      nikos101 Level 2

                      I wish that event wouldn't get fired when the data is null so I dont have to do this check:

                       

                              <s:dataChange>
                                                                  <![CDATA[
                                                         if(data){   
                                                              Comment.toolTip = "Extra summary information\n\nComment: " + data.comment;
                                                                  }
                                                                 ]]>
                                                              </s:dataChange>