I believe the problem is that you didn't set
maintainAspectRatio="false" on the image.
Try this:
<?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) {
colorBar.width = str+"%";
}
]]>
</mx:Script>
<mx:Image id="colorBar" maintainAspectRatio="false" />
</mx:Canvas>
<mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml"
width="100%" xmlns="*">
<mx:Script>
<![CDATA[
function setValue(str:String,obj:Object) {
colorBar.width = str+"%";
}
]]>
</mx:Script>
<mx:Image id="colorBar" maintainAspectRatio="false" />
</mx:Canvas>
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of
sreejithunni
Sent: Thursday, May 12, 2005 2:58 AM
To: [email protected]
Subject: [flexcoders] Re: Setting percentage value by setValue
Manish, I did try that ...Sent: Thursday, May 12, 2005 2:58 AM
To: [email protected]
Subject: [flexcoders] Re: Setting percentage value by setValue
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 [email protected], 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 the Yahoo! Terms of Service.

