actually you dont realy need a repeater to do that.
you can instantiate a label control everytime your
timer  dispatches an event instead: create new label
control instances, set their text to the current xml
items being read. however, you will have to handle the
placement (x,y) to avoid having them on top of each
other.  BUt if you really need a repeater
implementation, I will have to warn you that the code
im posting below 'redraws' everything each time two(or
more) items are displayed at a time. So if you have
like 1000 entries, it will draw 2 (or whatever number
of elements you need to display at a time) first, then
will erase everything before redrawing the first 4
elements.. etc.  You can however set new repeater
instances each time the timer 'ticks' and pass in the
current set of xml elemnts as dataprovider.that will
require you to instatiate unique repeaters everytime
the timer 'ticks'. Hence As I have said, you dont
really need a repeater component for that, you can
directly instantiate label/text components then pass
in the xml elemnts you need for their text. Below is
the code you need. This implementation automatically
adjusts the total time depending on your xml
provider's length and the number of elements you set
to display  Cheers!

<?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= new Array();
                [Bindable]
                private var dpAC:ArrayCollection=new
ArrayCollection(dp);
                
                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{
                        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);
                                }
                        }
                        dpAC.source=dp;
                }
                        
                ]]>
        </mx:Script>
 
<mx:Repeater horizontalCenter="0" id="rep"
dataProvider="{dpAC}"   y="20" >
<mx:Label  
text="{rep.dataProvider.getItemAt(rep.currentIndex)}"
id="lbel" width="257" horizontalCenter="0" 
y="{rep.currentIndex*20+rep.y}" />
</mx:Repeater>
        
</mx:Application>

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