Just another Nodetraveller

Flash TvGuide App

Okay, heres the flash client (only 47k!) for the TVguide webservice posted recently.

It’s quite a fairly simple movie using flash remoting and amfphp. I used amf to call my tvguide webservice via SOAP. Instead of having your swf call a specifc flash service, you call a special service which acts like a proxy to SOAP webservices. This service looks like this..

// AMFPHP uses by default the PEAR::SOAP
// library, so you need to define in the
// gateway not to use that. In this case
// NuSOAP will be used
// change this based on your amfphp installation
include_once($_SERVER['DOCUMENT_ROOT'] . '/flashservices/app/Gateway.php');
$gateway = new Gateway();

You connect to this via NetServices..

this.netConn = NetServices.createGatewayConnection("http://www.nodetraveller.com/flashservices/services/WSProxy.php");

Then you specify the webservice you want by providing the endpoint to the getService method..

this.service = this.netConn.getService("http://www.nodetraveller.com/webservices/tvGuide/tvGuideService.php?wsdl",this);

and then call the webservice method you want…


The paramsObj is a value object holding any parameters the webservice method expects. When the data comes back you handle it the normal way..

Oh, and I had lots of fun playing about with the datagrid and creating a custom cell for it for the channel logo graphics.

Based on the Model View Architecture which works basically like this for those of you who don’t know yet: The Model is an object that handles the remoting stuff and nothing else. It just connects to remote services and handles the data when it comes in. When the data does come in, it fires of an event to the View. The View is a listener of the Model so when the Model shouts, the View jumps. Now when the user interacts with the app, its the Controller that decides what to do; call a method on the Model or the View. Nice and easy…MVC ain’t completely perfect but its very useful…

You can see the actionscript files for the Model, View or Controller or download here