フラッシュで XML 質問エディターを作成しようとしています。基本的に、XMLをツリーコンポーネントにロードします-XMLは次のようになります:
<questions>
<question id="1" type="radio" text="This is question 1" isBranch="true">
<option id="1.1" correct="false" text="This is option 1" />
<option id="1.2" correct="false" text="This is option 2" />
<option id="1.1" correct="false" text="This is option 1" />
<option id="1.2" correct="false" text="This is option 2" />
<option id="1.3" correct="true" text="This is option 3" />
<option id="1.4" correct="false" text="This is option 4" />
</question>
<question id="2" type="check" text="This is question 2" isBranch="true">
<option id="2.1" correct="true" text="This is option 1" />
<option id="2.2" correct="false" text="This is option 2" />
<option id="2.3" correct="true" text="This is option 3" />
</question>
</questions>
それがツリーに入ります。変更すると、選択した質問 (item..option) のオプションのリストが取得され、その XMLList が (カスタム) コンポーネントに渡されます。そのコンポーネント (これが最善の方法かどうかはわかりませんが、それでも...) - いくつかの Repeater コントロールがあります - 1 つはラジオの質問の XMLList にバインドされ、もう 1 つはチェックの XMLList にバインドされますボックスの質問。各リピーターはオプションの数をループし、TextInput を (オプション テキストを編集するために) 配置し、ラジオまたはチェック ボックスのいずれか (質問の種類に応じて) を配置します。
したがって、私が求めているのは、オプションのテキストが編集されたときです。その TextInput の XML は、ツリーの dataProvider である XML にバインドされます。たとえば、「これはオプション 1 です」が「これはオプション Foo です」に変更された場合、ツリーはそれで更新されます。
これまでのところ、私のリピーター(ラジオ用など)はこのようなものです
<mx:Repeater id="repeaterRadio" dataProvider="{optionsListRadio}">
<mx:TextInput width="359" id="radioText"
editable="true" enabled="true" text="{repeaterRadio.currentItem.@text}"/>
<mx:RadioButton id="radioArray"
data="{repeaterRadio.currentItem.@id}"
selected="{repeaterRadio.currentItem.@correct=='true'}"/>
</mx:Repeater>
バインディングは機能しません-ここで得られるのは次のような警告だけです:
warning: unable to bind to property 'text' on class 'XML' (class is not an IEventDispatcher)
これが事実である理由はある程度わかりますが、ユーザーが編集できるデータをソースxmlにバインドする方法に途方に暮れています。ツリー自体を編集可能にできることはわかっていますが、実際にはここではオプションではありません。
ですから、どんな指針やアイデアも大歓迎です!