Archive for July, 2007

The new SWX Twitter API (and how to build your first Flash Twitter mashup in four lines of code!)

Twitter released an update to the official Twitter API this month and I've updated the SWX Twitter API so that it now has all the latest official Twitter API methods as well as some new custom ones.

Try it out!

You can try out the SWX Twitter API methods online right this moment by using the SWX Service Explorer.

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 updates in Flash, trace out the value of loader.result.

Note: The Flash IDE will give you a security sandbox warning 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 Full API, as exlained below.

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.

Using the SWX Full API

If you don't want to work manually with movie clips (and that is understandable), you can use the SWX Full API -- a completely abstract (and recommended) way of working with SWX.

Here's how to display the text of the last status update of your friends using the SWX Full API:

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 hit the public SWX gateway here on swxformat.org.

New Twitter API method reference

The newly added official Twitter API methods are listed below for your convenience. You can find (and test) the full list of methods in the SWX Service Explorer.

Status methods

  • replies
  • destroy

User methods

  • featured (was fixed in the official API and so I've re-enabled it)

Direct message methods

  • sentDirectMessages
  • newDirectMessage
  • destroyDirectMessage

Friendship methods

  • friendshipCreate
  • friendshipDestroy
  • verifyCredentials
  • endSession

New custom methods

Status methods

  • getPublicUpdates (alias for getNumPublicTimelineUpdates)

Friendship methods

  • friendsNoAuth
  • followersWhoAreNotFriends
  • getFans (alias for followersWhoAreNotFriends)
  • notifications

Deprecated methods

The following methods are deprecated as of the upcoming Beta 1.4 release in favor of the new official API methods that replace them. Please do not rely on these methods in the future as they may be removed from the API completely later on.

  • addFriend (use friendshipCreate instead)
  • removeFriend (use friendshipDestroy instead)

A YSlow tip for speeding up Viddler embeds

YSlow is a wonderful Firebug plugin from Yahoo! that helps you optimize your web sites by analyzing them according to 13 rules for high performance web sites as written by the Yahoo! Exceptional Performance team.

I just started playing with it on my site and one of the things it pointed out was that the default Viddler embed URL for the SWX screencast was redirecting to a different URL. Removing that redirection should speed things up according to Rule 11: Avoid Redirects and you should be able to apply this to all embedded Viddler videos.

Simply change the URL that is given to you by Viddler from the form

http://www.viddler.com/player/ad098fea/

to

http://www.viddler.com/flash/publisher.swf?key=ad098fea

and you'll remove the redirect and speed up the loading of the video.

I do hope that Viddler modifies the code that their Embed feature creates to use this direct URL and, also, to provide the option of embedding the video at its original size without your having to calculate it yourself.

Abbey National Business’s logon page: a perfect example of stupidity

Abbey's Idiotic Logon Screen

What is your memorable answer?

Can you get any dumber? Apparently, you can:

Abbeys Idiotic Logon 2

Here's a wonderful example of blindly copying a convention without understanding why.

If anyone from Abbey is reading this, here's how it's supposed to work: You're supposed to display my memorable question so I can remember my answer to it and give it to you (that's the memorable answer).

I wouldn't be so pissed off if I hadn't actually spent time on the phone with these people, telling them about this exact same issue almost a year ago. Have they fixed it? No. Why not?

"Sir, it's a security issue."

Oh, so in other words, you're just totally clueless. All right, then!

New screencast: Discover the easiest way to build data-driven Flash apps with SWX Beta 1.3!

This video requires Flash.

I released SWX Beta 1.3 today and recorded a new screencast to get you up and running with it.

The screencast covers installing and using the SWX MAMP Bundle but it applies equally if you're using your own development server.

The SWX MAMP Bundle contains everything you need to get up and running with SWX on a Mac (a full development server that contains Apache, PHP, MySQL, and, of course, SWX.)

If you already have a web server with PHP, you can download the much smaller zip file that just contains SWX and unzip it under your web folder and follow along with the screencast from there.

I hope you enjoy the screencast and the latest version of SWX. As always, your feedback is invaluable. Feel free to leave a comment here or join the SWX mailing list.

Download SWX Beta 1.3 from swxformat.org.

The bunny of love!

When I first set up the little bunny wabbit widget on my blog, I didn't know what to expect but secretly feared an endless stream of playground obscenities. Fast forward to a few weeks later and thousands of messages and I'm absolutely floored by how cool people are even when given a totally anonymous channel of communication. I've received some absolutely lovely messages and some of you have even signed your names to your messages (and gone so far as to leave your email addresses.) Thank you! :)

Of course, there is a high rate of xlkjasdkfghjfdldf but even a few of those were followed by short messages apologizing for testing out the bunny (not having realized that it was going to read it out to me!) I mean how cool. Think about it: You have a totally anonymous means of saying anything you want to and you choose to be so nice about it. That rocks!

And, today, I received a lovely stanza from a poem that I wanted to share with you guys:

If I had a thousand pages,
I could never name them all,
The reasons that I love you,
For the list would be too tall.

It made me Google the poem and find it's author. Apparently it's from a poem by Mark Liverance. The rest of the poem (from lovepoemsandquotes.com) reads:

I love you for the melody,
I hear within your voice.
The way your blue eyes hold me,
A captive, but by choice.

I love you for your gentle hands,
That melt away my pain.
I love you for your loving heart,
That made mine beat again.

I love you for your loving smile,
With which my old heart soars.
These are some of the reasons,
Every second beat is yours.

How beautiful!

I'm keeping nearly every message sent to the bunny and I'm going to publish my favorites soon. :)

Adobe Security Advisory: Update your Flash Player

There is a security advisory published by Adobe that urges users to upgrade to the latest Flash Player (currently 9.0.47.0 on Win/Mac/Solaris and 9.0.48.0 on Linux).

Critical vulnerabilities have been identified in Adobe Flash Player that could allow an attacker who successfully exploits these potential vulnerabilities to take control of the affected system. A malicious SWF must be loaded in Flash Player by the user for an attacker to exploit these potential vulnerabilities. Users are recommended to update to the most current version of Flash Player available for their platform.

Affected software versions include Adobe Flash Player 9.0.45.0 and earlier, 8.0.34.0 and earlier, and 7.0.69.0 and earlier.

Reminder: SWX Monday meet-up at mine, this evening!

SWX meeting today at mine

This is a quick reminder for Brightoners that I'll be holding the first SWX Monday this evening at my place. See my previous post for further details.

For full details and to sign up, see the event page on Upcoming.

I’m speaking at MAX? WTF?

Aral Speaks at max Pigs Flying

Yes, it's true, I'm speaking at MAX 2007 this year. But why, after being so vocally against their policies in the past? Simple. Because Adobe listened and they're making an effort to change, starting with the MAX conferences this year.

My criticism of MAX in the past centered around three things:

  1. They didn't pay speaker's expenses.
  2. You couldn't choose your own topic to present.
  3. It felt too much like a sales event that ignored the community.

This year, I'm happy to say, they've addressed all three of my concerns.

To qualify the first point a little further, it's important to realize that there are two types of speakers at events like these: Corporate and community.

Corporate speakers are there to evangelize their products. They may be Adobe Evangelists or evangelists from partner companies. Their sessions are usually product-based and showcase their latest and greatest features. When done right, i.e., when the speaker doesn't come off like a used car salesman, I personally find these sessions very valuable. I attended a couple such sessions during Adobe Live and learned quite a few things about the latest version of Photoshop.

Community speakers, on the other hand, are a very different group. They're not there to sell you a product but to share their experiences, knowledge, and, hopefully, inspire you. I remember how sessions by Branden and Joshua at the very first Flashforward conference I attended ages ago inspired me to learn more about Flash and get involved with the Flash community. A single inspirational session by a great speaker can easily make attending a conference worthwhile for me. In recent times, I've attended just such amazing sessions by Ze Frank, John Maeda, Jeremy Keith, Mario Klingemann, Brendan Dawes, Erik Natzke, Seb Lee Delisle, John Grden and Chris Allen, Keith Peters, Chris Orwig, and others. These are the sessions that energize me, widen my horizons, and inspire me to create things. In other words, they're invaluable.

One major difference between corporate and community speakers is that while corporate speakers are on company time when presenting at these events, earning their salaries and expensing their accounts, community speakers (for the most part) are not (some community speakers do work for companies like Yahoo! and Google who do pay their expenses, which is fair enough). One of my major beefs with MAX in the past was that it wouldn't pay for community speaker's expenses. This year, things have begun to change in this area and they are covering expenses for a select group of community speakers, including myself. I see this as a very positive step forward.

To put this into perspective, Adobe is a billion dollar company and yet they're listening to community feedback. As a comparison, Apple doesn't pay speakers to present at MacWorld. Do you think any amount of criticism by the community would get them to listen and change their policy on this? (The most I would expect is a fanboy response stating "Apple doesn't owe you anything!") *ducks* :)

The other issue I had with MAX was that you were pretty much asked to speak on a given topic and present the same (often product-related) session several times. In other words, it felt like you were being employed to be a corporate speaker when, in fact, you weren't even being employed. This year, with the "inspire" line of sessions, that's changing too. I'm going to be presenting the latest version of my Rediscovering Fun session and talking about SWX. At MAX. That rocks! :)

This year's MAX is going to be the first one that embraces the amazing community Adobe has around its products and all I can say is, it was about time! I believe that Adobe is finally realizing that the Flash community is far more than a loose conglomeration tied together by commercial interests: It's a living, breathing, passionate family of designers and developers who truly love working on this amazing platform. Among other things, it feels like Adobe has finally begun to realize that this community is one of the things that sets it apart from the purely corporate, follow-the-bucks community that Microsoft has. (Microsoft does an amazing job of building an economy around its products but the monetary incentive is almost entirely the only thing that binds people to it -- not so with the Flash community.)

So is this a clever short-term PR move on Adobe's part or are they truly committed to involving the community in MAX and other Adobe events? There are several strong indicators I've seen that point to the latter.

Firstly, Adobe must be aware of the wonderful feedback Adobe Live Amsterdam got for its Developer Track this year. I was personally floored by the positive feedback my sessions got and I know that the other developer sessions were held in similarly high esteem. At about the same time, Adobe Live in the UK, with an expanded designer and developer track, also got very favorable reviews. The message from this is clear: Involving the community in these events is a winning formula.

Secondly, my good friend Ted Patrick has been tasked with heading up preparations for MAX this year. Ted is one my oldest Flash buddies and has been in the Flash community for as long as I can remember. He's a Flash developer that I both admire and respect and, most importantly, coming from the community, he understands the community. Putting Ted in charge of MAX is a clear signal from Adobe that they want MAX to have a much stronger community focus.

Personally, I am very excited about MAX this year and I want to thank my friends at Adobe for listening and for taking those most important first steps towards changing things.

Here's to the best MAX conferences ever in Chicago, Barcelona and Japan! (I'm especially looking forward to Japan as it will be my first time there and I've been dying to go for ages!) :)

Do not Buy Blog Comments

Buy Blog Comments is a new business that sells blog spam. Do not support these people. How is this even legal?

The guy behind it is apparently one Jon Waraas. I hate blog spammers, Mr. Waraas, and something tells me that I'm not alone in that. I wonder if Mr. Waraas has set himself up to be one of the most hated 19-year-olds on the Internet.

Read more about it on Mashable! and Read/WriteWeb.

Kyle Roth on SWX

Kyle's SWX Twitter Widget

Kyle Roth recently created a Twitter badge for his blog using SWX and blogged about his experience:

Aral Balkan has some great FLA source files and the SWX format really turned out to be easy to incorporate . . . After trying and trying to authenticate to the twitter API, I got some help that led me to the SWX. It uses PHP to handle the authentication since flash cannot due to security reasons . . . The reason I spent the time on this is because I feel this could be of great benefit to some future clients.

I plan to post little case studies of people who are using SWX in the future so if you're building something with SWX, get in touch with me by leaving a comment here!






Bad Behavior has blocked 0 access attempts in the last 7 days.