最新のフレックス 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
ヒントをありがとう、そして長いメッセージでごめんなさい:)