I have an interesting observation and the solution to the problem ... In the example posted below, I had the actual size of the image to be 1 px x 20 px.
In normal circumstances, for eg <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" width="100%" height="100%"> <mx:Image width="100%" height="100%" source="@Embed ('something.gif')" /> </mx:Application> the image would stretch to 100% of the screen (application). On the other hand, if I did the same in the cellRenderer, the 100% would actually mean 100% OF THE IMAGE SIZE - NOT THE CONTAINER. So when, I was passing 98%, the value being set was 98% of 1px and that is .98px (why blame anybody!). Thats the reason it was not working. My workaround is to create the image with atleast 100px width, so that even 1% would translate to 1px. Huh! Sree --- In flexcoders@yahoogroups.com, "sreejithunni" <[EMAIL PROTECTED]> wrote: > Manish, I did try that ... > For example, in the CellRenderer if I use a mx:Text it displays the % > value but does not work for anything else such as mx:Image or mx:HBox. > > <?xml version="1.0" encoding="utf-8"?> > <mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml" > width="100%" xmlns="*"> > <mx:Script> > <![CDATA[ > function setValue(str:String,obj:Object) { > var theRank = str+"%"; > rankBar.text = theRank; > // This does not :-( > // colorBar.width = theRank; > } > > ]]> > </mx:Script> > <mx:Text id="rankBar" /> > <mx:Image id="colorBar" /> > </mx:Canvas> > > > > --- In flexcoders@yahoogroups.com, Manish Jethani > <[EMAIL PROTECTED]> wrote: > > On 5/12/05, sreejithunni <[EMAIL PROTECTED]> wrote: > > > The "str" is a variable! that gets passed on to the cellRenderer > from > > > the dataprovider of the datagrid. If, the value passed on is x, I > want > > > to set the width of the image to x%. > > > > So why not do the following? > > > > colorBar.width = str + "%"; 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/