3 Replies Latest reply on Jun 9, 2009 11:40 PM by Toddarooski

    Binding and Model issue?

    Toddarooski

      Hey, guys. I have what I hope is a simple question. I seem to be having some trouble getting data to work correctly with a fx:Model when using a fx:Binding tag. Basically, this works fine...

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">

           <fx:Declarations>

                <fx:Model id="myModel">

                     <info>

                          <name>

                               <firstName>Joe</firstName>

                               <lastName>Smith</lastName>

                          </name>

                           <email>joe@joesmith.com</email>

                     </info>

                </fx:Model>

           </fx:Declarations>


           <s:TextInput id="helloTextInput" text="{myModel.name.firstName}" />

      </s:Application>

       

      ...but this doesn't appear to work (the TextInput just shows up blank)...

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">

           <fx:Declarations>

                <fx:Model id="myModel">

                     <info>

                          <name>

                               <firstName>Joe</firstName>

                               <lastName>Smith</lastName>

                          </name>

                          <email>joe@joesmith.com</email>

                     </info>

                </fx:Model>

           </fx:Declarations>

       

           <s:TextInput id="helloTextInput" />

           <fx:Binding source="myModel.name.firstName" destination="helloTextInput.text" />

      </s:Application>

       

      Is this a known issue, or am I doing something stupid? I'm kinda assuming the latter...