Skip to content

Flash TvGuide App

08-Sep-03

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..

< ?php
// 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();
$gateway->usePearSOAP(false);
$gateway->service();
?>

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…

this.service.getChannels(paramsObj);

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

UK TV Guide Webservice

07-Sep-03

Recently I’ve been working on a webservice using PHP and nusoap. It provides information about 41 UK TV and radio programming schedule for the upcoming week.

The wsdl can be found here and example php client here.

I’m just finishing the final touches to a flash client which I’ll be posting sometime within the next couple days. Hopefully this will show how to use the webservice in your flash apps..

Webservices in Flash 2004

01-Sep-03

I’ve been playing about with the webservice connector in flash mx 2004. What I’ve discovered is that connecting to a webservice and using the data returned is really easy.

I’m using the tvGuide webservice (http://www.nodetraveller.com/webservices/tvGuide/tvGuideService.php?wsdl here at nodetraveller.com as one of the operations it provides is a list of channels which would look ideal in a listbox.

Here’s a quick guide to using a webservice:

Create a new document from a Query-Error-Response template. (This helps us with our simple example as it already sets up a webservice connector and a submit button in the form.

Click on the Webservice Connector (picture of a globe).

In the Properties panel, paste the url of the webservice WSDL in the WSDLURL parameter,and press return. Flash will now access the wsdl and find out what operations are available.

Click on the operations parameter and use the drop down to view the available operations. There should be two (getChannels and getChannelListings).

Select getChannels. For this simple example, theres no real need to use the other parameters though you can if you want. it won’t make any difference to our example.

Drag a Listbox and a TextInput component into the query Form. Name the Listbox channels_lb. Call the TextInput date. Enter todays date into the TextInput (make sure its in DD/MM/YYYY format). (strictly we should we using the response form as well but this is only an example)

Now select the webservice connector (you may have to select the application form first) and look in the component inspector (bottom right). Select the Binding tab. This is where you tell the webservice connector what to send to the webservice (and from what component) and what component to send the data to when received.

Press the + sign icon to add a binding. In the dialog that opens up, select the
date : String child of the params : Object.

Now we have to tell Flash what value to send. Select the bound to parameter and select the TextInput date in the dialog that appears. Finally change the direction parameter to “in“. What we’ve done is told Flash to get the value of the date TextInput (bound to parameter) and send it as a request to the webservice (direction parameter).

To populate the listbox with our returned data, create another binding and select
the results Array. Bind this to the listbox by configuring the bound to parameter. by selecting ListBox, and dataprovider : Array in the right hand column of the Bound To dialog . Make sure that the direction is set to “out”. We’ve just told Flash to pass the results Array received from the webservice to the dataprovider Array of the listbox. Doing so populates the Listbox.

And that’s it! And without writing any code. Test your movie and press the submit button…

You can download it here (you’ll need flash mx 2004 to view it)

This is a very simple example but I think for more complex ones, you would bind the WSConnector to a DataHolder and use the DataHolder events to notify UI components of the data change…

I feel the need for more experimentation….

Old Stock….

01-Sep-03

Looking through the cobwebs of my old laptop backups,I (re)discovered my old DHTML newsfeeds mini-app. This app lists all newsfeeds from moreover.com and provides a user interface to view the feeds and store favourite feeds and it does this without reloading the whole pages so it can be a component within a page rather than a page in itself. You can see it here or download here.

It loads the data via javascript though I did have an xml version but that one didn’t survive…In fact I’m not sure how much longer moreover.com will support the js feeds so this may be dead in the water pretty soon or it may not…

Btw,it should work on IE5.5, IE6 and all Mozilla browsers though I remember problems with Netscape 6.x so its fairly cross-browser…

Why the glacial delay?The various components in this app were coded between late 2000 and late summer 2001 but I lost touch with it for various reasons (including my then employer pushing me out of DHTML and into Java and a serious hard drive crash around the same time). Now I’m not the best organised guy in the world and though I used to make backups, in those days, I’d forget where I put them. Hence this lost script. I recently looked thru my backups for some old information I needed and to my delight I found this script.

I tidied up the code and now provide the whole script here or if you like each component separately.

View the PageSet Menu or download it

The scroll window can be seen on its own over here or zipped

Flash 2004

29-Aug-03

It’s here! well, almost anyway…

Flash 2004 will be released next month. I know, I’m a few days behind but I’ve been too busy to post and besides this blog didn’t exist when the word came out so I have probably the best excuse in the world for a late blog about F2004.

Anyway though I’ve been busy, I have been able to read up on the new features of flash.

Heres the things I’ve seen that excite me the most so far:

CSS in textfields - anyone who’s used text in flash will breathe a sigh of relief about this..

Context Menu - Great for RIAs..

Project Control - very Nice!

History panel - at least superficially, this reminds me of Photoshop (hope there won’t be any court action over this again!)

Actionscript 2.0 - proper OO with strong typing. One thing I don’t like is the use of the colon to denote the type of the variable. For exampe if you’re declaring a movieclip variable you’d do it like this:

aclip_mc : MovieClip

but theres loads more…

Here’s a link from MM about the information about the new features:

MM Devnet Article

and finally a review of Studio 2004 at webmonkey

Personally, I’m looking forward to the new css support. This, along with the context menu will give users of flash apps richer experiences while the rest of the new features will allow developers to develop better apps in less time. Which has gotta be a good thing, right?

A new node is born…

28-Aug-03

and you’re reading its first blog. Which is nice, for me at least.

Why have I got a blog? Well, it allows me to put up anything I’ve been working on and to comment on anything I feel like commenting on… I don’t have a great big message or anything like that for people. It’s just another blog from just another bloke..