SWX: SWF Data Format

Icon

SWX is the native data format for Adobe Flash. This blog is about all things SWX, SWX RPC, SWX PHP and the SWX APIs (Flickr, Twitter, etc.)

Using the SWX ActionScript Library to make SWX Twitter API calls

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

Building your first Twitter mashup with SWX RPC

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:

  1. Open the SWX Data Analyzer
  2. In Flash, create a new FLA.
  3. Create a new movie clip and give it the instance name loader.
  4. 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.

Introduction to the SWX Twitter API

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.

Swadge Twitter Badge

Folkert Swadge Twitter Badge

Swadge by Folkert Hielema is a Twitter badge that displays the Twitter stream of you and your friends. You can also update your Twitter status and customize the colors of the badge to fit the color scheme of your blog or web site.

About SWX

SWX is the native data format for the Flash Platform.

SWX on Twitter