- Introduction to the SWX Twitter API
- Building your first Twitter mashup with SWX RPC
- Using the SWX ActionScript Library to make SWX Twitter API calls
Introduction to the SWX Twitter API
Last modified on 2007-08-25 16:31:26 GMT. 0 comments. Top.
Twitter is a social network where you update your friends on what you're doing or thinking or feeling at the moment. It lets friends keep in touch with you in an ambient manner that's not invasive or distracting.
The SWX Twitter API implements all of the latest (as of July 28, 2007) official Twitter API methods as well as some custom methods of its own.
You can try out the SWX Twitter API methods online right this moment by using the SWX Service Explorer.
Building your first Twitter mashup with SWX RPC
Last modified on 2007-08-25 16:31:32 GMT. 0 comments. Top.
If you want to develop Flash (and Flash Lite) applications that use data from Twitter, you can get started without installing anything at all by using the public SWX gateway on this site. (The public SWX gateway is located at http://swxformat.org/php/swx.php).
In fact, you can create your very first Twitter mashup in just four lines of code by following these simple instructions:
- Open the SWX Data Analyzer
- In Flash, create a new FLA.
- Create a new movie clip and give it the instance name loader.
- On the frame that has the loader movie clip, add the following script:
loader.serviceClass = "Twitter"; loader.method = "getPublicUpdates"; loader.debug = true; loader.loadMovie("http://swxformat.org/php/swx.php", "GET");
That's all you need to get the latest public timeline updates from Twitter into Flash (you can see that the data is being loaded if you look in the SWX Data Analyzer).
To display the text of the first update in Flash, trace out the value of loader.result[0].text.
A quick hack to do this is shown below. Create a TextField on Stage and give it the instance name status and add the following code to your script:
function onEnterFrame { status.text = loader.result[0].text; }
Notice that you didn't need to download or install anything. That's because SWX is native! It uses SWF files to store and exchange data.
That's all you need to start working with SWX and Twitter! No API, external classes, etc. are necessary! And that little snippet of code (which, by the way, fits on to a moo card) also shows you exactly how SWX works. It loads the data in a SWF file and the data is accessible the moment it loads as native Flash objects. No deserialization necessary.
Of course, if you want to host your own SWX gateway or develop and test offline on your own machine, you can download and install SWX to your own machine. That will also allow you to create your own service classes and APIs.
Note: The Flash IDE will give you a security sandbox warning when you run the above example but the application will run correctly (look in the SWX Data Analyzer or trace out the loaded data to check this.) This warning occurs because you are running the SWF in the Flash IDE. If you put the SWF file on the same domain as the SWX gateway, it will also work without requiring any further code. However, if you want to use the Public SWX gateway and deploy your Flash applications to your own server, you must either manually call System.security.allowDomain, or (the recommended way is to) use the SWX ActionScript Library, as exlained below.
Using the SWX ActionScript Library to make SWX Twitter API calls
Last modified on 2008-04-20 07:41:58 GMT. 0 comments. Top.
If you don't want to work manually with movie clips (and you will probably not want to on a daily basis), you can use the SWX ActionScript Library instead. This library provides you with a completely abstract (and recommended) way of working with SWX RPC.
Here's how to display the text of the last status update of your friends using the SWX ActionScript Library:
import org.swxformat.*; var swx:SWX = new SWX(); swx.gateway = "http://swxformat.org/php/swx.php"; swx.encoding = "POST"; swx.debug = true; var callParameters:Object = { serviceClass: "Twitter", method: "getNumFriendsUpdates", args: ["aral", 1], result: [this, resultHandler] } swx.call(callParameters); function resultHandler(event:Object) { // Display the text property of the first result. trace (event.result[0].text); }
I hope you enjoy working with the SWX Twitter API (also check out the Flickr API while you're at it) and, again, please feel free to use the public SWX gateway here on swxformat.org in your own mashups and applications.
tramadol
generic cialis price
prednisone dose pack
cost levitra
diet hoodia pill product
clonidine epidural
clonidine use
buy prozac online
prednisone dose pack
prednisone steroids
diflucan uk
phentermine prescription
diet hoodia pill
buy furosemide
rimonabant tablets
purchase tramadol
order paxil
clonidine hydrochloride
prednisone use
kamagra energy gell
prozac anxiety
fluconazole diflucan
melphalan prednisone
buy carisoprodol where
celebrex stroke
phentermine diet
digoxin dosage
cheapest cialis generic
neurontin drug
lipitor vs zocor
clonidine flushing
commercial levitra
celebrex order
carisoprodol withdrawal
hoodia uk
furosemide infusion
prednisone and alcohol
lipitor zocor
pharmacy celebrex
lipitor statins
phentermine on line
crestor side
kamagra uk
lipitor cholesterol
about tramadol
rimonabant fda approval
cost levitra low
paxil medicine
prozac
purchase effexor

When I test the above script, I get these errors:
SWX.call INFO: No progress handler defined.
SWX.call INFO: No timeout handler defined.
SWX.call INFO: No fault handler defined.
What to do with them?
Thanks!
Erik.
Hi Erik,
Those are informational messages (INFO) not error messages. They’re just telling you that you haven’t defined a progress handler (for creating a progress bar), or a timeout handler (which gets called if a call times out so you can handle the error gracefully) and no fault handler is defined (if a server fault is detected, you can handle it gracefully there).
So, the short answer is: you don’t have to do anything about them.
The longer answer is that you might want to define those handlers to create a nicer experience for your users.
thanks for the explanation. I’ve published a working demo here! http://www.eerkmans.nl/twitter/
it’s got no error handling / progress bars yet but at least it’s working for twitter. The next step would be getting jaiku / numpa friends in here as well.
The whole idea was that this “fountain” gets beamed on a wall of a symposium, where people in the audience can follow the symposium’s speaker. The audience’s comments and thoughts would be directly displayed live during the speech. (as long as they’re twittering of course)
It’s looking good, Erik — nice one!
thanks…;-)
just another question: can the SWX method “getpublictimeline” filter out certain messages? for example, if I’d only want to see “@replies” to a certain person, but no other public messages?
sorry about all these questions
Where can I find a complete description of the returned event.result… values? There seems to be several different possibilities what kind of attributes are returned. Where can I find a complete documentation of those?
I just found a way to track returned results using SWX data anylzer.
However, there seems to be an another big defect in the SWX-API. It seems that Twitter SWX API does not support update_location Twitter API call. Is this true? update_location is part of official Twitter API and it would be very useful if it could be supported via SWX.