8 Replies Latest reply on Jan 31, 2011 8:20 AM by Gregory Lafrance

    Bizarre behavior involving Form, List, and Button

    Gregory Lafrance Level 6

      The following code does not work, but if you uncomment the opening and closing HBox tags it does work.


      By "work" I mean click the button and the default string should be added to the data provider and appear in the list.


      Very strange.


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
            import mx.collections.ArrayCollection;
            [Bindable] private var detailsAC:ArrayCollection = new ArrayCollection();
            private var addNewDetailPrompt:String = "click to add new details entry";
            private function addDetail():void{
              if(detailsAC.length == 0 || detailsAC.getItemAt(0) != addNewDetailPrompt){
                detailsAC.addItemAt(addNewDetailPrompt, 0);
          <mx:FormItem label="Event details:">
              <mx:List id="detailsList" editable="true"
                    <mx:TextArea text="{data}"/>
              <mx:Button label="Add..." click="addDetail();"/>