<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Displaying RadioButton controls using the Repeater in Flex (redux)</title>
	<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Fri, 05 Dec 2008 00:23:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: David</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-16791</link>
		<author>David</author>
		<pubDate>Wed, 19 Nov 2008 22:21:42 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-16791</guid>
		<description>I have a complicated problem using a Repeater.
There are four new classes: Souce, SourceData, Tactic, TacticData.
Source has a name.
SourceData has a Source (thus a Source name) and quantity.
Tactic has a name.
TacticData has a Tactic (...), selected, dueDate, and done.
(Nevermind why it has to be so split up like that.)
When displayed, a Source has one or more Tactics.
If a tactic is selected, then dueDate and done are enabled.
Now the problems:
1- I've gotten this much to for the data supplied at compile time, but how to make the tactic's field change at runtime?
2- Bonus: if a tactic's done is checked, then the entire tactic is disabled (selected and dueDate) except done. And then, another tactic of the same name must appear in the same source.
I don't know if that makes any sense the way I explain it, but here is the source and if I could just get the first problem solved, I'll be doing alright:
Source.as:
&lt;pre class="code"&gt;
package 
{
	public class Source
	{
		public function Source(){}

		public function get name():String {
			return _name;
		}
		public function set name(value:String):void{
			_name = value;
		}
		private var _name:String = "";
	}
}
&lt;/pre&gt;

SourceData.as:
&lt;pre class="code"&gt;
package 
{
	public class SourceData
	{
		public function SourceData(source:Source) {
			_source = source;
		}

		public function name():String {
			return _source.name;
		}
		public function get quantity():Number {
			return _quantity;
		}
		public function set	quantity(value:Number):void {
			_quantity = value;
		}	
		private var _source:Source = null;
		private var _quantity:Number = 0;
	}
}
&lt;/pre&gt;

Tactic.as:
&lt;pre class="code"&gt;
package 
{
	public class Tactic
	{
		public function Tactic(){}

		public function get name():String {
			return _name;
		}
		public function set name(value:String):void{
			_name = value;
		}
		private var _name:String = "";
	}
}
&lt;/pre&gt;

TacticData.as:
&lt;pre class="code"&gt;
package 
{
	public class TacticData
	{
		public function TacticData(tactic:Tactic){
			_tactic = tactic;
		}
		//this must be a get (unlike the name function of SourceData)
		//for the label of checkboxes
		//either that or jump thru some hoops when calling name to display text of function result
		public function get name():String {
			return _tactic.name;
		}
		public function get selected():Boolean {
			return _selected;
		}
		public function set selected(value:Boolean):void{
			_selected = value;
		}
		public function get dueDate():Date {
			return _dueDate;
		}
		public function set dueDate(value:Date):void{
			_dueDate = value;
		}
		public function get done():Boolean {
			return _done;
		}
		public function set done(value:Boolean):void{
			_done = value;
		}
		private var _selected:Boolean = false;
		private var _dueDate:Date = new Date();
		private var _done:Boolean = false;
		private var _tactic:Tactic = null;
	}
}
&lt;/pre&gt;

Main.mxml:
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
	creationComplete="init()"&#62;
&#60;mx:Script&#62;
&#60;![CDATA[
	import mx.controls.CheckBox;
	import mx.controls.Alert;
	import mx.collections.ArrayCollection;

	[Bindable]
	private var sources:ArrayCollection;
	
	private function init():void{
			var s1:Source = new Source();
			s1.name = "Source 1"
			var s2:Source = new Source();
			s2.name = "Source 2"
			
			var s1d:SourceData = new SourceData(s1);
			var s2d:SourceData = new SourceData(s2);
			
			var ta:Tactic = new Tactic();
			ta.name = "tactic A";
			var tb:Tactic = new Tactic();
			tb.name = "tactic B";
			var tc:Tactic = new Tactic();
			tc.name = "tactic C";
			
			var tad:TacticData = new TacticData(ta);
			var tbd:TacticData = new TacticData(tb);
			tbd.selected=true;
			var tcd:TacticData = new TacticData(tc);
			
			var a1:Array = new Array(tad,tbd);
			var a2:Array = new Array(tcd);
			
			sources = new ArrayCollection();
			sources.addItem({name:s1d.name(),quantity:s1d.quantity,tactics:a1});
			sources.addItem({name:s2d.name(),quantity:s2d.quantity,tactics:a2});
	}
	private function checkTactic(event:Event):void{
		var cb:CheckBox = event.currentTarget as CheckBox;
		var t:TacticData = cb.getRepeaterItem() as TacticData;
	}
	private function checkDone(event:Event):void{
		var cb:CheckBox = event.currentTarget as CheckBox;
		var t:TacticData = cb.getRepeaterItem() as TacticData;
		//Alert.show(t.name);
		//now how to get the sourceData associated with this tacticData?
	}
	private function n():void{
		var a:int = 0;
		a++;
	}
]]&#62;
&#60;/mx:Script&#62;
&#60;mx:VBox width="100%" height="100%"&#62;
	&#60;mx:HBox horizontalGap="0" &#62;
		&#60;mx:Label text="Source" fontSize="14" fontWeight="bold" /&#62;
		&#60;mx:Label text="Quantity" fontSize="14" fontWeight="bold" /&#62;
		&#60;mx:Label text="Tactic" fontSize="14" fontWeight="bold" /&#62;
	&#60;/mx:HBox&#62;		
			
	&#60;mx:Grid horizontalScrollPolicy="auto" verticalScrollPolicy="auto" 
		id="mainGrid"
		width="100%" &#62;
		&#60;mx:Repeater id="repSources" dataProvider="{this.sources}" 
			&#62;
			&#60;mx:GridRow&#62;
				&#60;mx:GridItem colSpan="2"&#62;
					&#60;mx:HRule width="100%" /&#62;
				&#60;/mx:GridItem&#62;
			&#60;/mx:GridRow&#62;
			&#60;mx:GridRow&#62;
				&#60;mx:GridItem&#62;
					&#60;mx:Label id="sourceName" text="{repSources.currentItem.name}" /&#62;					
				&#60;/mx:GridItem&#62;
				&#60;mx:GridItem&#62;
					&#60;mx:TextInput text="{repSources.currentItem.quantity}" /&#62;					
				&#60;/mx:GridItem&#62;
				&#60;mx:GridItem&#62;
				&#60;mx:VBox&#62;
					&#60;mx:Repeater id="repTactics" dataProvider="{repSources.currentItem.tactics}"&#62;
					&#60;mx:HBox&#62;
						&#60;mx:CheckBox label="{repTactics.currentItem.name}" 
							selected="{repTactics.currentItem.selected}"
							change="checkTactic(event)"/&#62;
						&#60;mx:DateField enabled="{repTactics.currentItem.selected}"/&#62;
						&#60;mx:CheckBox label="Done" 
							selected="{repTactics.currentItem.done}"
							enabled="{repTactics.currentItem.selected}"
							change="checkDone(event)"/&#62;
					&#60;/mx:HBox&#62;
					&#60;/mx:Repeater&#62;
				&#60;/mx:VBox&#62;
				&#60;/mx:GridItem&#62;
			&#60;/mx:GridRow&#62;
		&#60;/mx:Repeater&#62;
	&#60;/mx:Grid&#62;
&#60;/mx:VBox&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I have a complicated problem using a Repeater.<br />
There are four new classes: Souce, SourceData, Tactic, TacticData.<br />
Source has a name.<br />
SourceData has a Source (thus a Source name) and quantity.<br />
Tactic has a name.<br />
TacticData has a Tactic (&#8230;), selected, dueDate, and done.<br />
(Nevermind why it has to be so split up like that.)<br />
When displayed, a Source has one or more Tactics.<br />
If a tactic is selected, then dueDate and done are enabled.<br />
Now the problems:<br />
1- I&#8217;ve gotten this much to for the data supplied at compile time, but how to make the tactic&#8217;s field change at runtime?<br />
2- Bonus: if a tactic&#8217;s done is checked, then the entire tactic is disabled (selected and dueDate) except done. And then, another tactic of the same name must appear in the same source.<br />
I don&#8217;t know if that makes any sense the way I explain it, but here is the source and if I could just get the first problem solved, I&#8217;ll be doing alright:<br />
Source.as:</p>
<pre class="code">
package
{
	public class Source
	{
		public function Source(){}

		public function get name():String {
			return _name;
		}
		public function set name(value:String):void{
			_name = value;
		}
		private var _name:String = "";
	}
}
</pre>
<p>SourceData.as:</p>
<pre class="code">
package
{
	public class SourceData
	{
		public function SourceData(source:Source) {
			_source = source;
		}

		public function name():String {
			return _source.name;
		}
		public function get quantity():Number {
			return _quantity;
		}
		public function set	quantity(value:Number):void {
			_quantity = value;
		}
		private var _source:Source = null;
		private var _quantity:Number = 0;
	}
}
</pre>
<p>Tactic.as:</p>
<pre class="code">
package
{
	public class Tactic
	{
		public function Tactic(){}

		public function get name():String {
			return _name;
		}
		public function set name(value:String):void{
			_name = value;
		}
		private var _name:String = "";
	}
}
</pre>
<p>TacticData.as:</p>
<pre class="code">
package
{
	public class TacticData
	{
		public function TacticData(tactic:Tactic){
			_tactic = tactic;
		}
		//this must be a get (unlike the name function of SourceData)
		//for the label of checkboxes
		//either that or jump thru some hoops when calling name to display text of function result
		public function get name():String {
			return _tactic.name;
		}
		public function get selected():Boolean {
			return _selected;
		}
		public function set selected(value:Boolean):void{
			_selected = value;
		}
		public function get dueDate():Date {
			return _dueDate;
		}
		public function set dueDate(value:Date):void{
			_dueDate = value;
		}
		public function get done():Boolean {
			return _done;
		}
		public function set done(value:Boolean):void{
			_done = value;
		}
		private var _selected:Boolean = false;
		private var _dueDate:Date = new Date();
		private var _done:Boolean = false;
		private var _tactic:Tactic = null;
	}
}
</pre>
<p>Main.mxml:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
	creationComplete="init()"&gt;
&lt;mx:Script&gt;
&lt;![CDATA[
	import mx.controls.CheckBox;
	import mx.controls.Alert;
	import mx.collections.ArrayCollection;

	[Bindable]
	private var sources:ArrayCollection;

	private function init():void{
			var s1:Source = new Source();
			s1.name = "Source 1"
			var s2:Source = new Source();
			s2.name = "Source 2"

			var s1d:SourceData = new SourceData(s1);
			var s2d:SourceData = new SourceData(s2);

			var ta:Tactic = new Tactic();
			ta.name = "tactic A";
			var tb:Tactic = new Tactic();
			tb.name = "tactic B";
			var tc:Tactic = new Tactic();
			tc.name = "tactic C";

			var tad:TacticData = new TacticData(ta);
			var tbd:TacticData = new TacticData(tb);
			tbd.selected=true;
			var tcd:TacticData = new TacticData(tc);

			var a1:Array = new Array(tad,tbd);
			var a2:Array = new Array(tcd);

			sources = new ArrayCollection();
			sources.addItem({name:s1d.name(),quantity:s1d.quantity,tactics:a1});
			sources.addItem({name:s2d.name(),quantity:s2d.quantity,tactics:a2});
	}
	private function checkTactic(event:Event):void{
		var cb:CheckBox = event.currentTarget as CheckBox;
		var t:TacticData = cb.getRepeaterItem() as TacticData;
	}
	private function checkDone(event:Event):void{
		var cb:CheckBox = event.currentTarget as CheckBox;
		var t:TacticData = cb.getRepeaterItem() as TacticData;
		//Alert.show(t.name);
		//now how to get the sourceData associated with this tacticData?
	}
	private function n():void{
		var a:int = 0;
		a++;
	}
]]&gt;
&lt;/mx:Script&gt;
&lt;mx:VBox width="100%" height="100%"&gt;
	&lt;mx:HBox horizontalGap="0" &gt;
		&lt;mx:Label text="Source" fontSize="14" fontWeight="bold" /&gt;
		&lt;mx:Label text="Quantity" fontSize="14" fontWeight="bold" /&gt;
		&lt;mx:Label text="Tactic" fontSize="14" fontWeight="bold" /&gt;
	&lt;/mx:HBox&gt;		

	&lt;mx:Grid horizontalScrollPolicy="auto" verticalScrollPolicy="auto"
		id="mainGrid"
		width="100%" &gt;
		&lt;mx:Repeater id="repSources" dataProvider="{this.sources}"
			&gt;
			&lt;mx:GridRow&gt;
				&lt;mx:GridItem colSpan="2"&gt;
					&lt;mx:HRule width="100%" /&gt;
				&lt;/mx:GridItem&gt;
			&lt;/mx:GridRow&gt;
			&lt;mx:GridRow&gt;
				&lt;mx:GridItem&gt;
					&lt;mx:Label id="sourceName" text="{repSources.currentItem.name}" /&gt;
				&lt;/mx:GridItem&gt;
				&lt;mx:GridItem&gt;
					&lt;mx:TextInput text="{repSources.currentItem.quantity}" /&gt;
				&lt;/mx:GridItem&gt;
				&lt;mx:GridItem&gt;
				&lt;mx:VBox&gt;
					&lt;mx:Repeater id="repTactics" dataProvider="{repSources.currentItem.tactics}"&gt;
					&lt;mx:HBox&gt;
						&lt;mx:CheckBox label="{repTactics.currentItem.name}"
							selected="{repTactics.currentItem.selected}"
							change="checkTactic(event)"/&gt;
						&lt;mx:DateField enabled="{repTactics.currentItem.selected}"/&gt;
						&lt;mx:CheckBox label="Done"
							selected="{repTactics.currentItem.done}"
							enabled="{repTactics.currentItem.selected}"
							change="checkDone(event)"/&gt;
					&lt;/mx:HBox&gt;
					&lt;/mx:Repeater&gt;
				&lt;/mx:VBox&gt;
				&lt;/mx:GridItem&gt;
			&lt;/mx:GridRow&gt;
		&lt;/mx:Repeater&gt;
	&lt;/mx:Grid&gt;
&lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-16436</link>
		<author>peterd</author>
		<pubDate>Tue, 28 Oct 2008 05:50:04 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-16436</guid>
		<description>MArcio,

The example at the top of the page shows how to create a Repeater using ActionScript.

Peter</description>
		<content:encoded><![CDATA[<p>MArcio,</p>
<p>The example at the top of the page shows how to create a Repeater using ActionScript.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MArcio</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-16435</link>
		<author>MArcio</author>
		<pubDate>Mon, 27 Oct 2008 21:51:46 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-16435</guid>
		<description>How do Repeater in ActionScript?

I am using this way!

But only runs the first record!


&lt;pre class="code"&gt;
private function Repeat (): void (

var repeater: Repeater = new Repeater ();
repeater.dataProvider = dataprovider_Controller.item;

trace ( "repeater.currentItem.image:" + repeater.currentItem.image);
var image: Image = new Image ();

image.setStyle ( "HorizontalAlign", "left");
image.source = repeater.currentItem.image;
image.id = "image";
trace ( "image.source:" + image.source);

)
&lt;/pre&gt;

I think I have to quit Repeat to make the loop of
records, but how would this in ActionScript?</description>
		<content:encoded><![CDATA[<p>How do Repeater in ActionScript?</p>
<p>I am using this way!</p>
<p>But only runs the first record!</p>
<pre class="code">
private function Repeat (): void (

var repeater: Repeater = new Repeater ();
repeater.dataProvider = dataprovider_Controller.item;

trace ( "repeater.currentItem.image:" + repeater.currentItem.image);
var image: Image = new Image ();

image.setStyle ( "HorizontalAlign", "left");
image.source = repeater.currentItem.image;
image.id = "image";
trace ( "image.source:" + image.source);

)
</pre>
<p>I think I have to quit Repeat to make the loop of<br />
records, but how would this in ActionScript?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Walker</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13107</link>
		<author>Steve Walker</author>
		<pubDate>Fri, 30 May 2008 14:06:55 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13107</guid>
		<description>Once again, thank you.</description>
		<content:encoded><![CDATA[<p>Once again, thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13092</link>
		<author>peterd</author>
		<pubDate>Fri, 30 May 2008 01:12:14 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13092</guid>
		<description>You could also do something like the following (using the &lt;code&gt;indexOf()&lt;/code&gt; instead of the &lt;code&gt;search()&lt;/code&gt; method):

&lt;pre class="code"&gt;
private function isUnknown(value:String):Boolean {
    return value.indexOf("UNK") == 0;
}
&lt;/pre&gt;

Although the &lt;code&gt;indexOf()&lt;/code&gt; method would perform a case sensitive search instead of our clever case &lt;em&gt;in&lt;/em&gt;sensitive search using the &lt;code&gt;search()&lt;/code&gt; method.

Peter</description>
		<content:encoded><![CDATA[<p>You could also do something like the following (using the <code>indexOf()</code> instead of the <code>search()</code> method):</p>
<pre class="code">
private function isUnknown(value:String):Boolean {
    return value.indexOf("UNK") == 0;
}
</pre>
<p>Although the <code>indexOf()</code> method would perform a case sensitive search instead of our clever case <em>in</em>sensitive search using the <code>search()</code> method.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13091</link>
		<author>peterd</author>
		<pubDate>Fri, 30 May 2008 01:06:44 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13091</guid>
		<description>Steve Walker,

Not sure if this would work with the switch statement, but it may give you a starting point:
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&#62;

    &#60;mx:Array id="arr"&#62;
        &#60;mx:Object label="UNKNOWN" /&#62;
        &#60;mx:Object label="UNK" /&#62;
        &#60;mx:Object label="UnK101" /&#62;
        &#60;mx:Object label="Porridge" /&#62;
        &#60;mx:Object label="UNK2" /&#62;
        &#60;mx:Object label="Pineapples" /&#62;
    &#60;/mx:Array&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            import mx.controls.dataGridClasses.DataGridColumn;

            private function isUnknown(value:String):Boolean {
                return value.search(/UNK/i) == 0;
            }

            private function labelFunc(item:Object, col:DataGridColumn):String {
                if (isUnknown(item.label)) {
                    return "yes";
                } else {
                    return "no";
                }
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:DataGrid id="dataGrid" dataProvider="{arr}"&#62;
        &#60;mx:columns&#62;
            &#60;mx:DataGridColumn dataField="label"
                    headerText="label:" /&#62;
            &#60;mx:DataGridColumn labelFunction="labelFunc"
                    headerText="UNKNOWN:" /&#62;
        &#60;/mx:columns&#62;
    &#60;/mx:DataGrid&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>Steve Walker,</p>
<p>Not sure if this would work with the switch statement, but it may give you a starting point:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="UNKNOWN" /&gt;
        &lt;mx:Object label="UNK" /&gt;
        &lt;mx:Object label="UnK101" /&gt;
        &lt;mx:Object label="Porridge" /&gt;
        &lt;mx:Object label="UNK2" /&gt;
        &lt;mx:Object label="Pineapples" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.dataGridClasses.DataGridColumn;

            private function isUnknown(value:String):Boolean {
                return value.search(/UNK/i) == 0;
            }

            private function labelFunc(item:Object, col:DataGridColumn):String {
                if (isUnknown(item.label)) {
                    return "yes";
                } else {
                    return "no";
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DataGrid id="dataGrid" dataProvider="{arr}"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="label"
                    headerText="label:" /&gt;
            &lt;mx:DataGridColumn labelFunction="labelFunc"
                    headerText="UNKNOWN:" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Walker</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13089</link>
		<author>Steve Walker</author>
		<pubDate>Thu, 29 May 2008 23:58:32 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13089</guid>
		<description>I combined the example you placed above with the one from the site you referenced and it works like a charm.  I really appreciate all your assistance.  I have one more problem related to this and it is how to use a wildcard in the evaluation of the string.  Thanks to the ingenuity of lazy people, the data that I have has 30 or more variations of UNKNOWN (e.g. UNK, UNK101, UNK2, UNKOWN, etc) and I would like the renderer to match anything that starts with UNK.  Is it possible?</description>
		<content:encoded><![CDATA[<p>I combined the example you placed above with the one from the site you referenced and it works like a charm.  I really appreciate all your assistance.  I have one more problem related to this and it is how to use a wildcard in the evaluation of the string.  Thanks to the ingenuity of lazy people, the data that I have has 30 or more variations of UNKNOWN (e.g. UNK, UNK101, UNK2, UNKOWN, etc) and I would like the renderer to match anything that starts with UNK.  Is it possible?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Walker</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13082</link>
		<author>Steve Walker</author>
		<pubDate>Thu, 29 May 2008 18:23:11 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13082</guid>
		<description>Thank you.</description>
		<content:encoded><![CDATA[<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13077</link>
		<author>peterd</author>
		<pubDate>Thu, 29 May 2008 15:18:22 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13077</guid>
		<description>&lt;a href="" rel="nofollow"&gt;Steve Walker&lt;/a&gt;,

Perhaps a little crude, but this should work:
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&#62;

    &#60;mx:Array id="arr"&#62;
        &#60;mx:Object label="San Francisco" population="776733" year="2000" /&#62;
        &#60;mx:Object label="San Jose" population="894943" year="2000" /&#62;
        &#60;mx:Object label="San Mateo" population="92482" year="2000" /&#62;
        &#60;mx:Object label="Daly City" year="2000" /&#62;
        &#60;mx:Object label="Pacifica" population="N/A" year="2000" /&#62;
        &#60;mx:Object label="Foster City" population="NA" year="2000" /&#62;
        &#60;mx:Object label="Redwood City" population="N\A" year="2000" /&#62;
        &#60;mx:Object label="Fremont" population="" year="2000" /&#62;
    &#60;/mx:Array&#62;

    &#60;mx:DataGrid id="dataGrid" dataProvider="{arr}"&#62;
        &#60;mx:columns&#62;
            &#60;mx:DataGridColumn dataField="label" /&#62;
            &#60;mx:DataGridColumn dataField="year" /&#62;
            &#60;mx:DataGridColumn dataField="population"
                    itemRenderer="comps.CustomItemRenderer" /&#62;
        &#60;/mx:columns&#62;
    &#60;/mx:DataGrid&#62;
    
&#60;/mx:Application&#62;
&lt;/pre&gt;

&lt;strong&gt;comps/CustomItemRenderer.as&lt;/strong&gt;:
&lt;pre class="code"&gt;
package comps {
    import mx.controls.dataGridClasses.DataGridItemRenderer;

    public class CustomItemRenderer extends DataGridItemRenderer {

        override public function validateNow():void {
            super.validateNow();
            if (data) {
                switch(data.population) {
                    case undefined:
                    case null:
                        data.population = "";
                    case "":
                        background = true;
                        backgroundColor = 0xFF0000;
                        break;
                    case "N/A":
                    case "N\\A":
                    case "NA":
                        background = true;
                        backgroundColor = 0xFFFF00;
                        break;
                    default:
                        background = false;
                        backgroundColor = 0xFFFFFF;
                        break;
                }
            }
        }
    }
}
&lt;/pre&gt;

Peter

For more great posts on item renderers, check out Alex Harui's blog at &lt;a href="http://blogs.adobe.com/aharui/" rel="nofollow"&gt;http://blogs.adobe.com/aharui/&lt;/a&gt;, and more specifically, &lt;a href="http://blogs.adobe.com/aharui/item_renderers/" rel="nofollow"&gt;http://blogs.adobe.com/aharui/item_renderers/&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p><a href="" rel="nofollow">Steve Walker</a>,</p>
<p>Perhaps a little crude, but this should work:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="San Francisco" population="776733" year="2000" /&gt;
        &lt;mx:Object label="San Jose" population="894943" year="2000" /&gt;
        &lt;mx:Object label="San Mateo" population="92482" year="2000" /&gt;
        &lt;mx:Object label="Daly City" year="2000" /&gt;
        &lt;mx:Object label="Pacifica" population="N/A" year="2000" /&gt;
        &lt;mx:Object label="Foster City" population="NA" year="2000" /&gt;
        &lt;mx:Object label="Redwood City" population="NA" year="2000" /&gt;
        &lt;mx:Object label="Fremont" population="" year="2000" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:DataGrid id="dataGrid" dataProvider="{arr}"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="label" /&gt;
            &lt;mx:DataGridColumn dataField="year" /&gt;
            &lt;mx:DataGridColumn dataField="population"
                    itemRenderer="comps.CustomItemRenderer" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p><strong>comps/CustomItemRenderer.as</strong>:</p>
<pre class="code">
package comps {
    import mx.controls.dataGridClasses.DataGridItemRenderer;

    public class CustomItemRenderer extends DataGridItemRenderer {

        override public function validateNow():void {
            super.validateNow();
            if (data) {
                switch(data.population) {
                    case undefined:
                    case null:
                        data.population = "";
                    case "":
                        background = true;
                        backgroundColor = 0xFF0000;
                        break;
                    case "N/A":
                    case "N\A":
                    case "NA":
                        background = true;
                        backgroundColor = 0xFFFF00;
                        break;
                    default:
                        background = false;
                        backgroundColor = 0xFFFFFF;
                        break;
                }
            }
        }
    }
}
</pre>
<p>Peter</p>
<p>For more great posts on item renderers, check out Alex Harui&#8217;s blog at <a href="http://blogs.adobe.com/aharui/" rel="nofollow">http://blogs.adobe.com/aharui/</a>, and more specifically, <a href="http://blogs.adobe.com/aharui/item_renderers/" rel="nofollow">http://blogs.adobe.com/aharui/item_renderers/</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Walker</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13072</link>
		<author>Steve Walker</author>
		<pubDate>Thu, 29 May 2008 11:59:31 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex-redux/#comment-13072</guid>
		<description>Completely unrelated to this post, but desperately needed.  How can I build an item renderer for a dataGrid that evaluates a text string in a cell and changes the background color.  If it is blank/null/undefined make it red, if else it has the text N/A, NA, or N\A make it amber, etc..</description>
		<content:encoded><![CDATA[<p>Completely unrelated to this post, but desperately needed.  How can I build an item renderer for a dataGrid that evaluates a text string in a cell and changes the background color.  If it is blank/null/undefined make it red, if else it has the text N/A, NA, or N\A make it amber, etc..</p>
]]></content:encoded>
	</item>
</channel>
</rss>
