<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection ;
[Bindable] public var ary:Array = [1,2,3];
[Bindable] public var aryC:ArrayCollection = new ArrayCollection(ary);
]]>
</mx:Script>
<mx:Text text="{'ary: ' + aryC.getItemAt(uint(rg.selectedValue))}"/>
<mx:Text text="{'aryC: ' + ary[uint( rg.selectedValue)]}"/>
<mx:Button x="10" y="26" label="ary <<" click="ary[uint( rg.selectedValue)]--"/>
<mx:Button x="62" y="26" label="ary >>" click="ary[uint( rg.selectedValue)]++"/>
<mx:Button x="10" y="26" label="aryC <<" click="aryC.setItemAt (Number(aryC.getItemAt(uint(rg.selectedValue))) - 1, uint(rg.selectedValue))"/>
<mx:Button x="62" y="26" label="aryC >>" click=" aryC.setItemAt(Number(aryC.getItemAt(uint(rg.selectedValue))) + 1, uint(rg.selectedValue))"/>
<mx:RadioButtonGroup id="rg"/>
<mx:RadioButton x="10.0" y="56.0" label="element 0" groupName="rg" value="0" selected="true"/>
<mx:RadioButton x="10.0" y="80.0" label="element 1" groupName="rg" value="1"/>
<mx:RadioButton x="10.0" y="104.0" label="element 2" groupName="rg" value="2"/>
</mx:Application>
thanks jason.
hmph....the funny part is the [] notation works fine, just gets compiler warnings. Since I can't change my array to a arraycollection and I can't make a local arraycollection version of my array due to bindings, what I did was create a local reference to the array element and wrote a simple function to manage it. This allowed me to use bindings in the form in a 'double-binding' manner.
oh joy!
DKOn 6/29/06, Pan Troglodytes < [EMAIL PROTECTED]> wrote:It's not just suggesting you change the text= part, it's suggesting you bind it to an ArrayCollection instead of an Array. One of the others here could probably tell you more about the guts of how it works, but the bottom line is you either need to change your Array to an ArrayCollection, or add a second variable that is an ArrayCollection that wraps it. It's pretty easy. Just look at the ArrayCollection help.On 6/29/06, Douglas Knudsen < [EMAIL PROTECTED]> wrote:Ok, I have this array of objects called say addressesAry. Each
element is of type Address having the usual variables in it. I have a
form that has a List control with id="addressChoice" where the
dataProvider="{ adressesAry }" and labelField="addressTitle" lets say.
Next to this list control are TextInput controls for city, state,
address1, etc. I have it bound like so
<mx:TextInput width="240" id="city"
text="{addressesAry[addressChoice.selectedIndex].city}"/>
Now this works, but I get a compiler warning
"Data binding will not be able to detect changes when using square
bracket operator. For Array, please use ArrayCollection.getItemAt()
instead."
So, based on the warning suggestion I change things to this
<mx:TextInput width="240" id="city"
text="{addressesAry.getItemAt(addressChoice.selectedIndex).city}"/>
and things do NOT work at all.
so, is the compiler warning wrong? Or am I missing something about
bindings/events and this code?
--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?
--
Jason
--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?
--
Jason __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
![]()
SPONSORED LINKS
Web site design development Computer software development Software design and development Macromedia flex Software development best practice
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
Reply via email to

