Попробуйте использовать следующий класс, чтобы иметь преимущество привязки данных:
package
{
[Bindable]
public class DP
{
public var one:String;
public var two:Boolean;
public function DP(one:String, two:Boolean)
{
this.one = one;
this.two = two;
}
}
}
Итак, для вашего образца:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
>
<fx:Declarations>
<s:RadioButtonGroup id="oneGroup" selectedValue="{dataProvider.one}"/>
<s:RadioButtonGroup id="twoGroup" selectedValue="{dataProvider.two}"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
[Bindable]
public var dataProvider:DP = new DP("active", false);
public function doinit(e:Event):void {
dataProvider.one = "inactive";
dataProvider.two = true;
}
]]>
</fx:Script>
<mx:HBox>
<mx:Form>
<mx:FormItem label="One" direction="horizontal" >
<s:RadioButton group="{oneGroup}" value="active" label="Active" />
<s:RadioButton group="{oneGroup}" value="inactive" label="Inactive" />
</mx:FormItem>
<mx:FormItem label="Two" direction="horizontal" >
<s:RadioButton group="{twoGroup}" value="true" label="True" />
<s:RadioButton group="{twoGroup}" value="false" label="False" />
</mx:FormItem>
<s:Button label="Change DP" click="doinit(event)" />
</mx:Form>
</mx:HBox>
</s:Application>