It looks like i overlooked what you really need. I
thought you want elements to APPEND 2 elements
(ormore) at a time. My bad. Anyway the code only
requires a few changes to achieve that result.
Although i really think use of repeater is not
necessary unless you want to display say, 30 elements
at a time? anyway here's the revised code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="init()" >
        <mx:Script>
                <![CDATA[
                        import mx.collections.ArrayCollection;
                        import mx.controls.Alert;
                        import mx.controls.List;
                
                private var DisplayAtATime:int=2;
                private var delayinMilliseconds:Number=5000;
                
                private var dpXML:XML=  
                                <root>
                                         <student>
                                        <name>ABC</name>
                                         </student>
                                 <student>
                                        <name>PQR</name>
                                         </student>
                                 <student>
                                        <name>123</name>
                                 </student>
                                 <student>
                                        <name>XYZ</name>
                                 </student>
                                 <student>
                                        <name>RST</name>
                                 </student>
                             </root>;
                [Bindable]           
                private var dp:Array;
                
                
                private function init():void{
                        var
DisplayCount:int=Math.ceil(dpXML.student.length()/DisplayAtATime);
                        var dispTimer:Timer = new
Timer(delayinMilliseconds,DisplayCount);
                        dispTimer.addEventListener(TimerEvent.TIMER,
ticker);
                        dispTimer.start();
                }
                
                        
                private function ticker(e:TimerEvent):void{
                        dp=new Array();
                        for (var i:int=0; i<DisplayAtATime;i++){
                        if
((DisplayAtATime*(e.target.currentCount)-DisplayAtATime+i)<dpXML.student.length()){
                        
dp.push(dpXML.student[DisplayAtATime*(e.target.currentCount)-DisplayAtATime+i].name);
                                }
                        }
                        rep.dataProvider=dp;    
                }
                        
                ]]>
        </mx:Script>
 
<mx:Repeater horizontalCenter="0" id="rep"    y="20" >
<mx:Label  
text="{rep.dataProvider.getItemAt(rep.currentIndex)}"
id="lbel" width="257" horizontalCenter="0" 
y="{rep.currentIndex*20+rep.y}" />
</mx:Repeater>

--- KP <[EMAIL PROTECTED]> wrote:

> Hi All,
> 
>  
> 
> I have xmllist which has structure like
> 
>  
> 
>  
> 
> <root>
> 
>     <student>
> 
>         <name>ABC</name>
> 
>     </student>
> 
>     <student>
> 
>         <name>PQR</name>
> 
>     </student>
> 
>     <student>
> 
>         <name>123</name>
> 
>     </student>
> 
>     <student>
> 
>         <name>XYZ</name>
> 
>     </student>
> 
>     <student>
> 
>         <name>RST</name>
> 
>     </student>
> 
> </root>
> 
>  
> 
> Now I want to display contents of this xmllist in a
> label control with a
> repeater control which repeats after few sec and
> displays 2 items at a time
> which means in first 5 sec I want to display ABC and
> PQR for the next 5 sec
> 123 and XYZ and soon.and this should repeat I know
> it will need a repeater
> control for this but I am not able to figure out
> best possible way of
> displaying contents.can some one help me out of
> this. 
> 
>  
> 
> Thanks
> 
> Kumar
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to