我正在使用最新的 flex SDK 开发 Flash Builder。
我在获取表单中选择的单选按钮的值 radioButton 时遇到问题:
<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
感谢您的任何提示,对于长消息表示抱歉:)