Tim_mj22
asked on
automatically reload content of list box every 10 seconds?
I've setup a flash app which connects to a Coldfusion component. The component returns a list of telephone numbers and populates a list box in my flash App. Does anyone know how I get flash to automatically refresh the list box every 10 seconds thus checking the database for any new telephone numbers???
Any help would be very much apreciated.
Kind Regards,
Tim
Any help would be very much apreciated.
Kind Regards,
Tim
If you are not using flash remoting:
data_var = new LoadVars();
data_var.path = this;
data_var.onLoad = function(success)
{
if(success){
// update listbox
this.callID = setInterval(this, "updatePhonesList", 10000);
} else {
trace("SERVER ERROR");
}
};
data_var.updatePhonesList = function()
{
clearInterval(this.callID) ;
this.load(component_url + "?q=" + new Date().getTime());
};
data_var.updatePhonesList( );
data_var = new LoadVars();
data_var.path = this;
data_var.onLoad = function(success)
{
if(success){
// update listbox
this.callID = setInterval(this, "updatePhonesList", 10000);
} else {
trace("SERVER ERROR");
}
};
data_var.updatePhonesList = function()
{
clearInterval(this.callID)
this.load(component_url + "?q=" + new Date().getTime());
};
data_var.updatePhonesList(
ASKER
Sorry, I looked at your code and don't understand :-| this is what code I have below, Is it possible to integrate your code into it?
====Sample Code===
// Include the Required NetService class files
#include "NetDebug.as"
#include "NetServices.as"
#include "DataGlue.as"
// connect to the Flash Remoting service provider
if (isGatewayOpen == null) {
// do this code only once
isGatewayOpen = true;
// Make the Gateway connection
NetServices.setDefaultGate wayUrl("http://10.1.9.4/flashservices/gateway") ;
gatewayConnnection = NetServices.createGatewayC onnection( );
Dynamo = gatewayConnnection.getServ ice("cam_m anager.sys tem.dynamo ", this);
trace("Connected");
// CALL Web service: Do initial Data load for List Box
Dynamo.test1();
trace("sent request");
}
// :::: DEFAULT RESPONDERS ::::
function test1_Result(result) {
trace("server responded: Records: " + result.getLength());
trace("setting the Drop Down");
//Add my results to the list box
cb_parkType.setDataProvide r(result);
}
====Sample Code===
// Include the Required NetService class files
#include "NetDebug.as"
#include "NetServices.as"
#include "DataGlue.as"
// connect to the Flash Remoting service provider
if (isGatewayOpen == null) {
// do this code only once
isGatewayOpen = true;
// Make the Gateway connection
NetServices.setDefaultGate
gatewayConnnection = NetServices.createGatewayC
Dynamo = gatewayConnnection.getServ
trace("Connected");
// CALL Web service: Do initial Data load for List Box
Dynamo.test1();
trace("sent request");
}
// :::: DEFAULT RESPONDERS ::::
function test1_Result(result) {
trace("server responded: Records: " + result.getLength());
trace("setting the Drop Down");
//Add my results to the list box
cb_parkType.setDataProvide
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that works great :-) Thanks very much negatyve
nothin at all :)
#include "NetServices.as"
NetServices.setDefaultGate
remote_conn = NetServices.createGatewayC
updateListboxService = remote_conn.getService("yo
customUpdateListboxRespond
customUpdateListboxRespond
{
// update your listbox with result
this.callID = setInterval(this, "updatePhonesList", 10000);
};
customUpdateListboxRespond
{
clearInterval(this.callID)
this.path.updateListboxSer
};
customUpdateListboxRespond