Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

automatically reload content of list box every 10 seconds?

Posted on 2003-10-25
6
Medium Priority
?
179 Views
Last Modified: 2010-04-03
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
0
Comment
Question by:Tim_mj22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 9621101
Ask if you need help:

#include "NetServices.as"

NetServices.setDefaultGatewayUrl("http://localhost/flashservices/gateway");

remote_conn = NetServices.createGatewayConnection();

updateListboxService = remote_conn.getService("your_application.your_component");

customUpdateListboxResponder = {path:this};
customUpdateListboxResponder.onResult = function(result)
{
      // update your listbox with result
      this.callID = setInterval(this, "updatePhonesList", 10000);
};
customUpdateListboxResponder.updatePhonesList = function()
{
      clearInterval(this.callID);
      this.path.updateListboxService(this, parameters);
};
customUpdateListboxResponder.updatePhonesList();
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9621133
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();
0
 

Author Comment

by:Tim_mj22
ID: 9621149
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.setDefaultGatewayUrl("http://10.1.9.4/flashservices/gateway");
      gatewayConnnection = NetServices.createGatewayConnection();
      Dynamo = gatewayConnnection.getService("cam_manager.system.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.setDataProvider(result);
      }
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Accepted Solution

by:
negatyve earned 2000 total points
ID: 9621153
//====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.setDefaultGatewayUrl("http://10.1.9.4/flashservices/gateway");
      
      gatewayConnnection = NetServices.createGatewayConnection();
      
      Dynamo = gatewayConnnection.getService("cam_manager.system.dynamo", this);
      
      trace("Connected");
      // CALL Web service: Do initial Data load for List Box
      updatePhoneList();
      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.setDataProvider(result);
      this.callID = setInterval(this, "updatePhoneList", 10000);
}
// :::: UPDATE PHONE LIST
updatePhoneList = function()
{
            clearInterval(this.callID);
            Dynamo.test1();
};
0
 

Author Comment

by:Tim_mj22
ID: 9621158
that works great :-) Thanks very much negatyve
0
 
LVL 27

Expert Comment

by:negatyve
ID: 9621176
nothin at all :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question