I think a better solution would be to go
through the setPropertiesAt method. You could also use
myList.dataProvider.editField. You have to remember that editing an
object directly won’t notify the list that anything has changed.
That’s why we have the various editing methods etc.
And I haven’t tested this solution so
there’s a possibility that you’ll need to put the valueCommitted
handler with some sort of semaphore to make sure it only gets called
once. There’s a possibility that this could go circular so you want
to make sure that it doesn’t spiral out of control.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:List
dataProvider="{objects}" id="myList" change="curObj =
myList.selectedItem"
labelField="value"/>
<mx:TextInput
text="{curObj.value}" id="myText" valueCommitted=”myList.setPropertiesAt(myList.selectedIndex,
{value: myText.text})”/>
<mx:Array id="myDP">
<mx:String>Hello</mx:String>
<mx:String>World</mx:String>
</mx:Array>
<mx:Script>
<![CDATA[
var curObj:Object;
var objects:Array =
[{value:"Hello"},{value:"World"},{value:"How are
you ?"}];
]]>
</mx:Script>
</mx:Application>
Matt
From: r0main
[mailto:[EMAIL PROTECTED]
Sent: Friday, February 11, 2005
4:17 AM
To: [email protected]
Subject: [flexcoders] Re: List
update ?
Thanks Dirk... I'll try...
I was just wondering what event was triggered when
I pass my mouse
over the list selectedItem line and then quit that
line... That's then
the label on the list gets "updated"...
So I could manually raise that
event on the list object...
r0main
--- In [email protected],
"Dirk Eismann" <[EMAIL PROTECTED]>
wrote:
> This is what usually works (not pretty,but
does the job)
>
> <mx:TextInput
text="{curObj.value}" id="myText"
change="myList.dataProvider =
myList.dataProvider" />
>
> Dirk.
>
> > -----Original Message-----
> > From: r0main
[mailto:[EMAIL PROTECTED]
> > Sent: Friday, February 11, 2005 12:57 PM
> > To: [email protected]
> > Subject: [flexcoders] List update ?
> >
> >
> >
> >
> > Hi dudes...
> > A simple question : The following code
is a sample that reproduce my
> > problem...
> > I have a list, with a selectedItem...
The reference to that
> > selectedItem object is copied in a
variable...(both share the same
> > object)... I edit fields of that
variable via a text box... And only
> > when I pass my mouse over the selected
line of my list that name gets
> > refreshed...
> > Any Idea on how to refresh that label
automatically ?
> >
> > r0main
> >
> > <?xml version="1.0"encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
> >
<mx:List dataProvider="{objects}" id="myList"
change="curObj =
> > myList.selectedItem"
labelField="value"/>
> >
<mx:TextInput text="{curObj.value}" id="myText" />
> >
<mx:Binding source="myText.text"
destination="curObj.value" />
> >
<mx:Array id="myDP">
> >
<mx:String>Hello</mx:String>
> >
<mx:String>World</mx:String>
> >
</mx:Array>
> >
<mx:Script>
> >
<![CDATA[
> > var
curObj:Object;
> > var
objects:Array =
> >
[{value:"Hello"},{value:"World"},{value:"How are
> > you ?"}];
> > ]]>
> >
</mx:Script>
> > </mx:Application>
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >