hmmm... the code completion in Eclipse builder says it isn't valid, but the compiler says it is....
Anyway, I solved the problem by creating a new class: <?xml version="1.0" encoding="utf-8"?> <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ import mx.controls.ProgressBarLabelPlacement; import mx.controls.ProgressBarMode; import mx.controls.ProgressBar; private var _data:Object; override public function set data(value:Object):void { _data = value; var percentageComplete:Number = Number(value.percentageComplete) * 100; var colour:Number if (percentageComplete == 0) { colour = 0xda0707; } else if (percentageComplete == 100) { colour = 0x04ae30; } else { colour = 0x005efb; } removeAllChildren(); var pb:ProgressBar = new ProgressBar(); pb.mode = ProgressBarMode.MANUAL; pb.label = "%3%%" pb.setStyle("barColor", colour); pb.labelPlacement = ProgressBarLabelPlacement.CENTER; pb.setProgress(percentageComplete, 100); pb.percentWidth = 100; addChild(pb); } override public function get data():Object { return _data; } ]]> </mx:Script> </mx:HBox> --- In [email protected], "Douglas Knudsen" <[EMAIL PROTECTED]> wrote: > > Its certainly possible to do this. Try the following > > <mx:itemRenderer> > <mx:Component> > <mx:HBox> > <mx:Script> > ..... > > Cheers! > > DK > > On Nov 12, 2007 8:59 AM, johantrax < [EMAIL PROTECTED]> wrote: > > > Seems to me that Flex doesn't like scripts anywhere but in the root of > > a document. I do not have any experience with item-renderers, nor do I > > have with loaders, but this is my guess: > > > > If you create the ItemRenderer as a custom mxml-component, then you > > should be able to set a script-block in this file. > > > > Again this is just my wild thinking, but I hope that with it, you, or > > others in here, might get to a working example. > > > > Good luck, > > > > --jeetee > > > > --- In [email protected] <flexcoders%40yahoogroups.com>, > > "triggersoftware" <david.bates@> > > wrote: > > > > > > > When using 'manual' you could try using the setter method, again > > > from the docs... > > > > > > I've tried doing this but Flex doesn't like having script blocks in > > > the item renderer. > > > > > > > When needed for binding, take a look at BindingUtils.bindSetter > > > > > > I don't know what to do with this as I can't get into a <SCRIPT> block. > > > > > > A small example would really help. > > > > > > Cheers, > > > > > > David. > > > > > > ... [cut out response] ... > > > > > > > > > > --- In [email protected] <flexcoders%40yahoogroups.com>, > > "triggersoftware" <david.bates@> > > > > wrote: > > > > > > > > > > I'm trying to create a progress bar item renderer, but I can't > > get the > > > > > value of progress bar to bind: > > > > > > > > > > <mx:AdvancedDataGridColumn headerText="% Complete" width="100"> > > > > > <mx:itemRenderer> > > > > > <mx:Component> > > > > > <mx:VBox> > > > > > <mx:Label id="lbl" text="{data.percentageComplete}"/> > > > > > <mx:ProgressBar label="%3%%" maximum="100" width="100%" > > > > > mode="manual" source="{data.percentageComplete}"/> > > > > > </mx:VBox> > > > > > </mx:Component> > > > > > </mx:itemRenderer> > > > > > </mx:AdvancedDataGridColumn> > > > > > > > > > > You don't appear to be able to bind the value using source. > > What am I > > > > > doing wrong? > > > > > > > > > > > > > > > > > > > > > > -- > Douglas Knudsen > http://www.cubicleman.com > this is my signature, like it? >

