Thank you, that code makes sense and works great!

-Cliff
 

On 6/17/05, Abdul Qabiz <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> You can nest tags in custom components. That should not be problem. Look
> at the following code, its modified version of your code.
> 
> ##StatusImageCellRenderer.mxml##
> <?xml version="1.0" encoding="utf-8"?>
> <mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml"; marginBottom="0"
> marginLeft="0" marginRight="0" marginTop="0" horizontalAlign="center">
>         <mx:Script>
>                 <![CDATA[
> 
>                         [Embed(source="images/status_icon_red.png")]
>                         var redSymbol:String;
>                         [Embed(source="images/status_icon_yellow.png")]
>                         var yellowSymbol:String;
>                         [Embed(source="images/status_icon_green.png")]
>                         var greenSymbol:String;
> 
>                         function setValue( str:String, item:Object,
> sel:Boolean ) : Void
>                         {
>                                 var newImage;
>                                 if ( item.status == undefined )
>                                         newImage = undefined;
>                                 if ( item.status == "0" )
>                                         newImage = redSymbol;
>                                 else if ( item.status == "1" )
>                                         newImage = yellowSymbol;
>                                 else if ( item.status == "2" )
>                                         newImage = greenSymbol;
> 
>                                 image.source = newImage;
>                         }
> 
>                         function getPreferredWidth(Void) : Number
>                         {
>                                 return 24;
>                         }
>                 ]]>
>         </mx:Script>
>         <mx:Image id="image" />
> </mx:VBox>
> 
> 
> I have not tested it and it seems, it might require some changes in
> preferredWidth/preferredHeight to show the icon properly.
> 
> -abdul
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Cliff Meyers
> Sent: Friday, June 17, 2005 11:57 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Datagrid, custom cell renderer, horizontal
> alignment
> 
> I am trying to set up a Datagrid that uses a custom cell renderer to
> display an image based on the value of a property for the object bound
> to each row of the grid.  I have the image working fine, however I
> can't seem to affect the horizontal alignment of the cell.  If I use
> "textAlign" on the mx:DataGridColumn itself that doesn't work.  If I
> try to wrap the mx:Image in a mx:VBox or mx:Canvas I get this error
> when the MXML tries to compile:
> 
> "There is no property with the name 'source'."
> 
> It seems like nesting tags within the cell renderer won't work.  I've
> inherited this code so I'm not sure if it's the best way of going
> about it, but I've attached it below.  Thanks to anyone who might be
> able to give me a push.
> 
> 
> -Cliff
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
>


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to