1 Reply Latest reply on Jun 18, 2008 4:20 AM by anirudhs

    Adding mxml form with actionscript

    flatpickinJohn Level 1
      In my application, I have a form that is generated with an accodion and a repeater. The repeater is used to generate the number of forms needed based on the number of children in the xml dataprovider. Now what I would like to do is to add new forms with actionscript and a button. Can this be done? Here's to code:

      <!--Create an accordion for Contacts-->
      <mx:Accordion width="360" height="610" x="837" y="10" backgroundColor="#FFD897" cornerRadius="5" borderThickness="3" id="contactAccordion" creationPolicy="auto">
      <mx:Repeater id="repeat" dataProvider="{populateContactXML}" >
      <mx:Form xmlns:mx=" http://www.adobe.com/2006/mxml" id="contactForm" width="360" height="585" borderStyle="none" backgroundColor="#E1E1E1" cornerRadius="5" borderThickness="3" label=" >
      <mx:FormHeading id="contactHeading" label="Contact Information"/>
      <mx:FormItem label="Contact Type" width="290" x="790" y="10">

      <mx:FormItem id="address1Item" label="Address 1" width="290">
      <mx:TextInput id="address1" change="onChange(event, event.currentTarget.repeaterIndex, 'Address_1')" width="183" borderStyle="solid" cornerRadius="5" text="{repeat.currentItem.@Address_1}" >

      public function onChange(event:Event, idx:int, str:String):void
      populateContactXML[idx]["@" + str] = event.currentTarget.text;
      trace("index = ", idx);
      tmptxt3.text = "index = " +idx;