Basically you need to look into clearing the interval and restarting it with the new slider value because once you call setInterval that number is locked in.  Check out clearInterval in the docs.

 

Matt

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of dillo_mac
Sent: Tuesday, May 24, 2005 9:24 PM
To: [email protected]
Subject: [flexcoders] DataGrid Refreshing and using slider to change interval...need help:)

 

Hello folks, I have a datagrid that refreshes itself every 30 seconds.
I want to implement a slider that will give the user the ability to
change this when the application runs. I have the following code
below. Can someone tell me what I am doing wrong? Thanks a bunch, you
guys are the greatest for helping out noobs like me.

private var gridTimer:Number = 30000;

private function initComp() {
    //stuff that calls the webservice and populates the grid.
    //this funtion is also the initialize="initComp()" in the main
app         
    setInterval(this,"getData",gridTimer);
}

//code to change time

function handleGridTimeChange(event){
           gridTimer = refreshGridSlider.value;
           var so:SharedObject = SharedObject.getLocal("_gridTimer");
           so.data.gridTimer = gridTimer;
           so.flush();
}


//the slider code in the main app.

<mx:HSlider id="refreshGridSlider"
                              change="handleGridTimeChange(event)"
                              minimum="30000"
                              maximum="60000"
                              liveDragging="true"
                              tickInterval="5000"
                              value="{gridTimer}"
                              labels="['30000', '60000']"
                              width="15%"/>

Bottom line, its not working and I need somehelp. Any input is greatly
appreciated







Yahoo! Groups Links

Reply via email to