我正在使用最新的flex SDK开发Flash Builder。Flex;在FormItem中获取RadioButton的值
我有得到的selceted单选按钮的值单选按钮形式内部的问题:
<mx:Form id="form_new_contribution">
<mx:FormItem label="Contribution type" includeIn="project_contributions">
<mx:RadioButtonGroup id="myG" enabled="true" />
<mx:RadioButton id="subtitle" label="subtitle" groupName="{myG}" value="subtitle"/>
<mx:RadioButton id="note" label="notes/chapters" groupName="{myG}" value="note"/>
</mx:FormItem>
</mx:Form>
的功能是:
protected function button_add_new_clickHandler(event:MouseEvent):void{
Alert.show(myG.selectedValue.toString());
}
我试图也:
Alert.show(myG.selection.toString());
显示错误代码:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
,如果它只能如果我把:
Alert.show(myG.toString());
它提醒:对象的RadioButtonGroup
thanx的任何提示,并遗憾的长消息:)
谢谢罗布斯托, 你的第二个解决方案工作完美;我将“groupName”更改为“group”,它工作正常! 谢谢大家;) – numediaweb 2010-05-14 10:57:48