fx.barrett
10-03-2008, 04:07 PM
I'll be short:
1) I'm loading some XML dynamically and I'm using it as my repeater's dataProvider
2) I want to create a few text fields in my repeater and populate each field with the content of a specific child
3) I want to be able to read all the text fields content with 1 button click
Here's a fake XML example on how I have my stuff organized:
<?xml version="1.0" encoding="utf-8"?>
<content>
<news show="true">
<title>New Title 1</title>
<date>10.05.2008</date>
<description>News Description ONE.</description>
</news>
<news show="true">
<title>New Title 2</title>
<date>11.06.2008</date>
<description>News Description TWO.</description>
</news>
<news show="false">
<title>New Title 3</title>
<date>12.07.2008</date>
<description>News Description THREE.</description>
</news>
</content>
I'm trying to populate the 3 text fields in my repeater each time with the correct "title" , "date" and "description" but I'm having some troubles... Especially when trying to read all the data from each text field...
I'm doing something like this:
<mx:Repeater id="rep_comp" dataProvider="{_xml}" width="100%" height="100%">
<mx:Panel width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundAlpha="0"
borderStyle="none" cornerRadius="0">
<mx:TextInput width="100%" height="20" id="news_title" text="{rep_comp.currentItem.title}"/>
<mx:TextInput width="100%" height="20" id="news_date" text="{rep_comp.currentItem.date}"/>
<mx:TextInput width="100%" height="100%" id="news_description" text="{rep_comp.currentItem.description}"/>
</mx:Panel>
</mx:Repeater>
But if I run it in debug mode then I'm getting these errors:
warning: unable to bind to property 'title' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'description' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'date' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'title' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'description' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'date' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'title' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'description' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'date' on class 'XML' (class is not an IEventDispatcher)
And I don't know how to get around this...
Finally, the problem when reading a text field's data... how can I read a certain text fields text input ( situated in the repeater ) by clicking on a button that is not inside the repeater but outside of it ???
Any help is really appreciated... I tried surfing for stuff on the net but I can't seem to find anything that could help me out with this...
1) I'm loading some XML dynamically and I'm using it as my repeater's dataProvider
2) I want to create a few text fields in my repeater and populate each field with the content of a specific child
3) I want to be able to read all the text fields content with 1 button click
Here's a fake XML example on how I have my stuff organized:
<?xml version="1.0" encoding="utf-8"?>
<content>
<news show="true">
<title>New Title 1</title>
<date>10.05.2008</date>
<description>News Description ONE.</description>
</news>
<news show="true">
<title>New Title 2</title>
<date>11.06.2008</date>
<description>News Description TWO.</description>
</news>
<news show="false">
<title>New Title 3</title>
<date>12.07.2008</date>
<description>News Description THREE.</description>
</news>
</content>
I'm trying to populate the 3 text fields in my repeater each time with the correct "title" , "date" and "description" but I'm having some troubles... Especially when trying to read all the data from each text field...
I'm doing something like this:
<mx:Repeater id="rep_comp" dataProvider="{_xml}" width="100%" height="100%">
<mx:Panel width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundAlpha="0"
borderStyle="none" cornerRadius="0">
<mx:TextInput width="100%" height="20" id="news_title" text="{rep_comp.currentItem.title}"/>
<mx:TextInput width="100%" height="20" id="news_date" text="{rep_comp.currentItem.date}"/>
<mx:TextInput width="100%" height="100%" id="news_description" text="{rep_comp.currentItem.description}"/>
</mx:Panel>
</mx:Repeater>
But if I run it in debug mode then I'm getting these errors:
warning: unable to bind to property 'title' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'description' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'date' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'title' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'description' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'date' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'title' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'description' on class 'XML' (class is not an IEventDispatcher)
warning: unable to bind to property 'date' on class 'XML' (class is not an IEventDispatcher)
And I don't know how to get around this...
Finally, the problem when reading a text field's data... how can I read a certain text fields text input ( situated in the repeater ) by clicking on a button that is not inside the repeater but outside of it ???
Any help is really appreciated... I tried surfing for stuff on the net but I can't seem to find anything that could help me out with this...