Hi Friends,

on click on a button, I am adding n number or elements in a
ArrayCollection (newAnswersSkins) on a click on button( AddRowsBtn)
click. Now I am taking a number from a textInput (noOfAnswerSkin) and
adding that many rows into the this ArrayCollection(newAnswersSkins).
Now problem is that when user tries to add more rows, the previous
rows data gets cleared. Can somebody, what is wrong herer? You can see
the code here :

 [Bindable]
 public var newAnswersSkins:ArrayCollection = new
ArrayCollection();

public function addRows():void{
    var noOfAnswerSkins:int = parseInt(noOfAnswerSkin.text);
    for(var i:int =0; i<noOfAnswerSkins;i++){
        newAnswersSkins.addItem({key:0, answerSkin:""});
    }
    noOfAnswerSkin.text = "1";
}

<mx:NumberValidator source="{noOfAnswerSkin}" property="text"
integerError="Please Enter Integer value"
        domain="int" trigger="{AddRowsBtn}" triggerEvent="click"
valid="addRows();"
        invalidCharError="Please Enter A Valid Value"/>

<mx:VBox id="dataPrompt" horizontalScrollPolicy="off" height="100%">
       <mx:HBox horizontalScrollPolicy="off"
verticalScrollPolicy="off" horizontalGap="10">
               <mx:Label width="40" text="Select"/>
               <mx:Label width="162" text="Standard Answer Skin"/>
                <mx:Label  width="132" text="{stdAnswer}"/>
                <mx:Label  width="132" text="Sequence"/>
        </mx:HBox>
        <mx:VBox id="newStdAnswerSkin" horizontalScrollPolicy="off">
                       <mx:Repeater id="stdNewAnswerRepeater"
dataProvider="{newAnswersSkins}">
                           <mx:HBox horizontalScrollPolicy="off" 
horizontalGap="10">
           <mx:CheckBox width="40" data="{stdNewAnswerRepeater.currentIndex}"
click="setSequence(event)"/>
           <mx:TextInput id="newAnswerSkin" width="162" editable="true"/>
           <mx:TextInput id="newAnswer" width="132" editable="true"/>
          <mx:TextInput id="newAnswerSeq" width="132" text=""/>
                           </mx:HBox>
                        </mx:Repeater>
        </mx:VBox>
        <mx:HBox horizontalScrollPolicy="off" >
                       <mx:Label text="Please add" />
                        <mx:TextInput id="noOfAnswerSkin" width="50" text="1"/>
                        <mx:Label text=" new answer options."/>
                        <mx:Button id="AddRowsBtn" label="Add Rows"/>
        </mx:HBox>
</mx:VBox>

Thanks for ur replies in advance...

Regards,
Ashish Mishra
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to