hide side navigation
    5 most recent
    Web Services
  Flash Spell Checker  Company information and news  LinkToMe  Flash Google MX  Flash Currency Conversion  Language Translation  Flash Server Inspector  Stock Quotes in Flash  Flash 2D and 3D charts
    Library's
    Component's
    Applications
    Articles
This example provides a quick overview of using a web service with flash remoting. AMFPHP was used in this case, but any type of flash remoting (coldfusion, .net, java, etc) could be used. The only code we have to worry about in this case is actionscript in the flash movie.

For this example the Company Information Web Service was used, you can find more information on this service here: http://www.flash-db.com/services/?ID=10&sType=Business. Use the wsdl inspector to learn more about the service.


The following code was used:
 #include "NetServices.as"
#include "NetDebug.as"

quoteResult = new Object(); 
quoteResult.onResult = function(result){
    
_root.Thinking.gotoAndStop(1); // stop loading animation.
    
    // handle results
    
company         result.company;
    
lastPrice         result.lastPrice;
    
tradedTime         result.tradedTime;
    
tradedDate         result.tradedDate;
    
change             result.change;
    
changePercent     result.changePercent;
    
open             result.open;
    
yesterdayClose     result.yesterdayClose;
    
dayLow            result.dayLow;
    
yearHigh        result.yearHigh;
    
yearLow            result.yearLow;
    
volume            result.volume;
    
PE                result.PE;
    
earnPerShare    result.earnPerShare;
    
yield            result.yield;
    
divShare        result.divShare;
    
marketCap        result.marketCap;
}

//System.onStatus = quoteResult.onStatus; 

quoteResult.onStatus = function(status){
    
status status.description;
      
trace("Error: " status.description); //provides good error handling inside flash
    
_root.Thinking.gotoAndStop(1); // stop loading animation.
}

// sets up the gateway connection.
var serverConn         NetServices.createGatewayConnection("<webroot>path to your gateway");
// sets up quote service.
var quoteService     serverConn.getService("http://www.flash-db.com/services/ws/companyInfo.wsdl"quoteResult);

function 
getCompanyInfo() {
    
// at some point you may have to be a flash-db member to use.
    // right now the username and password are not authenticated.
    
_root.Thinking.gotoAndPlay(2);
    
params = {
        
username:"any",
        
password:"any",
        
ticker_root.symbol
    
}
    
// call the quote service.
    // use the wsdl inspector at flash-db.com/services/ for more info on the service.
    // doCompanyInfo is the web service we are invoking in this case.
    
quoteService.doCompanyInfo(params);

 Download the Stock Quotes Source Files
- be sure to check the message board for updates.