Hello!

I'm trying to create an application that builds a chart with the
information from my database via WCF every two minutes.
The problem I'm having is related to cache, because the chart is still
no update.
I checked the temporary file directory and noticed that the data is
being cached.
Can anyone help me please?

My code:

private function atualizaDados():void
{
        timerAtualizaDados = new Timer(120000);
        timerAtualizaDados.addEventListener(TimerEvent.TIMER,
timerAtualizaDadosHandler);
        timerAtualizaDados.start();
}

private function timerAtualizaDadosHandler(e:TimerEvent):void
{
        dataUltimaAtualizacao = new Date();
        getDataSVC("ListarDados", "",listarDadosCompleteHandler);
}

public function getDataSVC(pSvcMetodo:String, parametros:String,
completeFunc:Function):void
{
        svcMetodo = pSvcMetodo;
        var url:String = Application.application.parameters.urlSvc
+"/"+svcMetodo;
        var loader:URLLoader = new URLLoader();
        var request:URLRequest = new URLRequest();

        loader.addEventListener(Event.COMPLETE, completeFunc);
        loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityErrorHandler);
        loader.addEventListener(HTTPStatusEvent.HTTP_STATUS,
httpStatusHandler);
        loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

        request.requestHeaders.push(new URLRequestHeader("Content-Type",
"application/json"));
        request.requestHeaders.push(new URLRequestHeader("pragma", "no-
cache"));
        request.requestHeaders.push(new URLRequestHeader("Expires", "Thu, 01
Jan 1970 00:00:00 GMT, -1"));
        request.requestHeaders.push(new URLRequestHeader("Cache-Control", "no-
cache, no-store, must-revalidate"));
        request.url = url;
        request.method = URLRequestMethod.GET;

        try
        {
                CursorManager.setBusyCursor();
                loader.load(request);
        }
        catch (error:Error)
        {
                msgErro("Erro!","Não foi possível carregar o 
documento.\n"+error);
        }

        CursorManager.removeBusyCursor();
}

private function listarDadosCompleteHandler(event:Event):void
{
        var tempLoader:URLLoader = URLLoader(event.target);
        var dados:Object = JSON.decode(tempLoader.data);
        var objDados:Object = dados[svcMetodo+'Result'];

        graficoSituacaoTransmissao.invalidateDisplayList();
        graficoSituacaoTransmissao.dataProvider = objDados;
}

Thanks!

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to flex_in...@googlegroups.com.
To unsubscribe from this group, send email to 
flex_india+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to