Hi, my flex code reads an XML and displays its contents one after the other. to 
be more clear, here is the flex code i have written:

<?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.controls.*;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.collections.XMLListCollection;
import mx.collections.ArrayCollection;
import flash.utils.Timer;

[Bindable]
private var AccountInformation:ArrayCollection;
[Bindable]
private var tmp:Object;


[Bindable]
public var listDP:XMLListCollection = new XMLListCollection(new XMLList());   
private const TIMER_INTERVAL:int = 1500;

[Bindable]
private var baseTimer:int = 0;


private var t:Timer;

[Bindable]
private var xmlReaderTimer:Timer;

public function init():void
{
        accountData.send();
        xmlReaderTimer = new Timer(1*60*500);
        xmlReaderTimer.addEventListener(TimerEvent.TIMER, readXml);
        xmlReaderTimer.start();
}

private function readXml(event:TimerEvent):void{
        accountData.send();
}

private function updateTimer(evt:TimerEvent):void 
{
        datagrid.dataProvider = AccountInformation.getItemAt(baseTimer);
        baseTimer++;
        
        if(baseTimer == AccountInformation.length)
        baseTimer = 0;          
}

private function startTimer():void 
{
          t.start();
}

private function stopTimer():void 
{
          t.stop();
}

private function AccountHandler(evt:ResultEvent):void
{
        AccountInformation = evt.result.xml.AccInfo as ArrayCollection;
        if(t!=null && t.running)
        {
                t.removeEventListener(TimerEvent.TIMER,updateTimer );
                t.stop();
                t =null;
                
        }
        t = new Timer(TIMER_INTERVAL);
    t.addEventListener(TimerEvent.TIMER, updateTimer);
    datagrid.dataProvider = AccountInformation.getItemAt(baseTimer);
    startTimer();    
}


private function faultHandler(evt:FaultEvent):void
{
        var faultMessage:String = "Could not connect with XML file";
        Alert.show(faultMessage, "Error opening file");
}
]]>
</mx:Script>

<mx:Fade id="fadeOut" duration="10" alphaFrom="1.0" alphaTo="0.0"/>
<mx:Fade id="fadeIn" duration="10" alphaFrom="0.0" alphaTo="1.0"/>


<mx:HTTPService id="accountData" url="pgm1.xml" result="AccountHandler(event)" 
fault="faultHandler(event)"  />
<mx:AdvancedDataGrid rowCount="1" 
                                         x="20" y="10" 
                                         verticalGridLines="false" 
                                         textAlign="center" 
                                         editable="true" 
                                         width="950"  
                                         id="datagrid" 
                                         rowHeight="40" 
                                         headerColors="red"   
                                         
headerSortSeparatorSkin="mx.skins.ProgrammaticSkin"
                                     
headerSeparatorSkin="mx.skins.ProgrammaticSkin"
                                     sortExpertMode="true"
                                         headerHeight="50"
                                         height="100"
                                         fontSize="12"
                                         showEffect="{fadeIn}"
                                         hideEffect="{fadeOut}"/>
                                         

        <mx:HRule x="20" y="63" width="950" height="6"/>
        
        
<!-- mx:Button label="Start" click="{startTimer()}" x="176" y="242"/>
<mx:Button label="Stop" click="{stopTimer()}" x="271" y="242"/ -->
</mx:Application>


i want the text to fade in and fade out. how do i do it?

Reply via email to