0 Replies Latest reply on Mar 30, 2012 5:24 PM by Rob-2007

    flex 4.5 addElements and getElement

    Rob-2007

      Hello,

       

      I'm trying to add elements to a group with a button and then mathematically add the totals

       

      protected function addNewItem(event:MouseEvent):void{

       

           // I want to add a group like this everytime someone clicks on the "Add A New Item" button to the VGroup "qItems" and increase the id by 1 "products1, product1, description1, price1" and so on.

           <s:Group id="products">

                <s:TextInput id="product" width="100" />

                <s:TextInput id="description" width="100" />

                 <s:TextInput id="price" width="100" />

           </s:Group>

      }

       

      protected function addMainTotal(event:MouseEvent):void{

       

         // Add the price field of every added item

         if(tiTotal+length){

           Alert.show(document.getElementById('tiTotal').value);

         }

      }

       

       

      <s:Button label="Add A New Item" click="addNewItem(event)"/>

      <s:Button label="Add Totals" click="addNewItem(event)"/>

      <s:VGroup id="qItems" width="100%" styleName="qMain"/>

       

      Thank you all.