Hi Ashish,

The problem is with Repeater. Repeater clears the list and re-builds all the
instances when the data provider changes. I recommend that you should use
some list-based container like "mx:List". And add your "HBox" in the
itemRenderer of that list.

If for some reason you feel that list wont work for u, then you should get
rid of the Repeater and manually add the elements in the for loop itself.
You could convert the HBox (that is currently there inside the repeater) as
a custom component and do an addChild of this customComponent inside the for
loop itself.

Regards,
Venkat
www.venkatv.com

On Fri, Oct 10, 2008 at 9:03 PM, AshishMishra <[EMAIL PROTECTED]>wrote:

>
> 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