Archive for the 'Apollo' Category

What is SWX, how does it work, and where is it going?

I do some of my best thinking (and singing) in the shower. So it's no surprise that this morning, while in the shower, I decided to review my plans and roadmap for SWX. Here's a direct-from-the-shower look at what SWX is, how it works (with a few examples to get you up and running), and roadmap of where SWX is heading.

Some of the contents of this post will be familiar to my friends at Yahoo! UK, where I presented SWX earlier this month. (Thank you guys for your amazing support, it means a lot!)

Definitions

Let's start at the beginning with some definitions. When I first embarked on SWX, the technology and implementation were one and the same. Several months on, SWX has matured and simply bundling everything in the SWX ecosystem as "SWX" is not sufficient. To that end, here are some definitions of SWX-related concepts to start us off with a common vocabulary for talking about SWX.

  • SWX: Native data format for Flash. It is a subset of the SWF format. SWX SWFs are regular SWF files that are used to store just data.
  • SWX RPC: RPC protocol encoded in SWX. Allows you to call methods on server-side classes and get the results in SWX format.
  • SWX PHP: SWX RPC implementation in PHP. SWX PHP is currently the only implementation of SWX RPC but there will be Python, Ruby, J2EE, .Net, etc. implementations in the future.
  • SWX Tools: The SWX Service Explorer & SWX Data Analyzer. These tools come bundled with SWX PHP and will work with any future implementations of SWX RPC.
  • SWX AS: A high-level ActionScript library that handles 
the client-side queuing and execution of SWX RPC calls. You don't have to use the ActionScript library to work with SWX RPC as SWX is native to Flash but the library does provide you with useful functionality such as cross-domain access, queueing of data calls, etc.
  • SWX APIs: APIs for Flickr, Twitter, etc. I am as excited about the SWX APIs as I am about the SWX data format and SWX RPC as they provide Flash developers with a very easy way to create mashups. In fact, if you hit the Public SWX RPC gateway (see below) at swxformat.org, you can use these APIs with ActionScript alone (no server-side programming is necessary.)
  • Public SWX RPC gateway: Open SWX RPC endpoint. The Public SWX RPC Gateway
is at http://swxformat.org/php/swx.php. You can use the public SWX
APIs from this gateway in your own applications without having to
write any server-side code whatsoever.

Supported platforms and technologies

Swx Supported Platforms

You can create and load SWX SWF files with any version of Flash (5+) as they are simply SWF files. As far as manually creating SWX files go, SWX is supported on Flash 5+.

SWX PHP, the current SWX RPC implementation that I'm working on, creates SWX files that are compatible with Flash 7+ Flash 6+, Flash Lite 2.0 and Flash Lite 2.1. Currently, SWX PHP does not support Flash 9/AVM2 but it will eventually do so.

SWX AS, the SWX ActionScript library, compiles on Flash 7+ Flash 6+ and MTASC.

You can use SWX PHP currently to create applications that run on mobile phones (Flash Lite 2.0/2.1), the Nintenso Wii, Sony PS3, and devices like the Nokia N800 internet tablet and the Chumby.

You can also wrap SWX-based applications to create desktop versions using Adobe Air.

SWX (SWF Data Format)

SWX is the native data format for Flash. Data is stored as SWF bytecode (you can't get more native than that on the Flash Platform) that is interpreted by the Flash Player. The SWX format is a subset of the SWF format (just like JSON is a subset of JavaScript).

SWX is open. I am in the process of writing an Internet Draft (I-D) for SWX which I hope will become an informational RFC.

You loadMovie() SWX data files and they are ready to use the moment they are loaded. You don't need to deserialize or massage the data in any way before using it as it is stored in native Flash objects.

Why do we need a new data format?

When I first announced SWX, Patrick Mineault questioned whether SWX was reinventing the wheel. Why, he asked, do we need SWX when there is AMFPHP? (AMFPHP is a PHP implementation of a Flash Remoting gateway).

To start with, comparing SWX and AMFPHP is like comparing apples and oranges. As I stated earlier, SWX is a new data format for Flash and SWX RPC is a remote procedure call protocol encoded in SWX. As such, we can compare SWX to AMF (the data format) and SWX RCP to Flash Remoting (the RPC protocol) and SWX PHP (my PHP implementation of SWX RPC) to AMF PHP.

So the real question becomes, does the Flash Platform need a new data format and a new RPC protocol? I believe it does and here are some reasons why:

  • Existing formats are non-native, complicated, require parsing and/or writing plumbing code e.g., XML, variable-encoded strings (LoadVars, loadVariables), Flash Remoting, etc.
  • SWX files have low processor overhead when parsed by the Flash Player as they are native (SWF bytecode)
  • SWX RPC is the only RPC solution for Flash Lite 2.0 and 2.1 (and thus for mobile Flash applications). Flash Remoting does not work with Flash Lite.
  • Most important: SWX, being native, has inherent advantages such as cross-platform data exchange (via allowDomain support for SWF files), simplicity (no ActionScript library is necessary to use it), etc.

It's my first belief that every platform can benefit from a native data format that does not require parsing. The main advantage of SWX over other data formats and of SWX RPC over other RPC solutions is ease of use. I hope that this ease of use will spur a wealth of development of data-driven applications and mashups on the Flash Platform by developers who may traditionally have shied away from creating such applications because it was just too darn hard to do so.

SWX RPC

SWX RPC is a remote procedure call protocol encoded in SWX format. You use it to call methods on server-side classes (called services in SWX RPC) and get the results returned to you in SWX format.

SWX RPC is open. I am in the process of writing an Internet Draft (I-D) for SWX RPC which I hope will become an informational RFC.

SWX RCP is stateless, lightweight, and uses HTTP as the transfer protocol.

A typical SWX RPC call involves parameters sent from Flash to the SWX RPC endpoint (gateway) in JSON format. These consist of serviceClass, method, and args parameters that define the method on the service class that you want to call on the back-end and the arguments that you want to send to that method. The resulting data is returned to Flash in the result property.

SWX PHP

SWX PHP is a SWX RPC implementation in PHP. It is open source.

SWX PHP is written in pure PHP. It doesn't require any extensions and runs under both PHP 4 and 5. (As such, it runs without problems even on shared hosting accounts.)

SWX PHP has a SWX RPC endpoint (gateway) and an assembler that creates and returns SWX files. Your service classes contain business logic only.

SWX PHP comes with service classes (APIs) for Flickr, Twitter, Ten Word Review, Nabaztag, etc. There is a publicly accessible instance of SWX PHP running on swxformat.org at http://swxformat.org/php/swx.php. You can access these APIs from this public gateway without hosting your own instance of SWX PHP if you want to build mashups using just these APIs.

SWX PHP uses Amfphp as a library and this means that you can also hit SWX PHP services via Flash Remoting, JSON and XML-RPC. (In other words, you're not locked into using SWX RPC and you can switch easily between these various technologies if you want to.)

SWX PHP comes with a plain vanilla installer (unzip it into your web folder on the server and go) and as a MAMP Bundle (everything you need to get up and running with SWX PHP on OS X). I am planning on creating Windows and Linux bundles as well in the future. In the meanwhile, I recommend using WAMP on Windows and XAMMP on Linux is you want to quickly get up and running with a server (Apache + PHP, etc.) on your development machine.

SWX PHP adheres to SWX’s core philosophy of Systemwide Simplicity.

Systemwide simplicity

A system is only as simple as its most complicated part. It's not enough to just simplify individual components and processes, you must also simplify the relationships and interactions between components and sub-processes. Systemwide Simplicity takes a wider approach to simplicity that involves understanding and supporting the entire user experience.

It is thus my aim to make it as easy as humanly possible for Flash developers to start creating data-driven Flash applications from the moment they arrive on the SWX homepage to the moment they first get data into Flash using SWX RPC.

How simple is SWX? Moo card example

SWX is so simple that instructions for getting data into Flash using it easily fit on to a Moo card. (In fact, I've just ordered two sets of Moo cards with just this example on them -- ask me for one if you see me around!)

To get a list of the most recent 100 photos from Flickr into Flash, do the following:

  • Open up the SWX Data Analyzer
  • In Flash, create a new FLA and create a movie clip on the Stage. Give it the instance name loader.
  • Write the following code on to the frame that the loader movie clip is on:
loader.serviceClass = "Flickr";
loader.method = "swxPhotosGetRecent";
loader.debug = true;
 
loader.loadMovie("http://swxformat.org/php/swx.php", "GET");

That’s it! Test your movie and look in the SWX Data Analyzer to see the results being loaded in to Flash from Flickr. That’s how simple SWX is.

If you want to display the results from within Flash, create a long, single-line dynamic text field on stage and give it the instance name status. Add the following code to the timeline:

function onEnterFrame()
{
    status.text = loader.result.photo[0].src;
}

Initially, the status text field will display undefined until the data is loaded and then it will display the URL of the first photo from the list of recent photos that is loaded from Flickr. Notice how you can access the results as native Flash objects the moment they’re loaded. No deserialization or massaging of the data is necessary!

Read the next section to see a better way of handing results using SWX AS and the SWX Class in ActionScript.

Building a complete web application (back-end and front-end) with SWX PHP

In the next ten minutes you are going to learn everything there is to know about exactly how SWX PHP works by building a very simple, but complete, data-driven Flash application. You will be using Flash to create the client and PHP (with SWX) for the server.

Installing SWX PHP

If you haven’t done so already, download and install SWX PHP on to your computer. Before installing SWX PHP, you will need to have a web server running PHP on the machine you’re installing it on.

If you’re on a Mac, running OS X, download and install the SWX PHP MAMP Bundle. This will have you up and running with everything you need using a simple installer.

If you’re on Windows, I suggest installing WAMP and, on Linux, XAMMP. Both of these are single-click installers that provide you with a turnkey development environment with a web server (Apache) and PHP.

Once you’ve installed a web server and PHP, just download SWX PHP and unzip it into your web root. Start your web server and hit the web root in your browser to access the SWX PHP Start Page.

Swxphp Start Page


Getting Started

The application you’re going to build is a simple calculator that uses a server-side method to add two numbers together.

To start, you're going to create a PHP service class. In SWX you place service classes under the php/services folder.

SWX Service Explorer

To see what services are already in the services folder, you can use the SWX Service Explorer that comes with SWX PHP. Open that now and you will see that there are several services there already.

Swx Service Explorer

Creating the Calculator service class in PHP

Create a new file using your text editor of choice under php/services/ and call it Calculator.php.

Add the following code to Calculator.php and save the file:

 
<?php
    class Calculator
    {
        function addNumbers($n1, $n2)
        {
            return $n1 + $n2;
        }
    }
?>

This is a very simple server-side service class that has a single method called addNumbers(). This method takes two numbers as arguments and returns their sum.

At this point, it would be nice if you could test the server-side method you just created without having to create a Flash client. SWX Service Explorer lets you do just that.
Testing server-side methods with the SWX Service Explorer

Return to the SWX Service Explorer (or open it if you didn't earlier) and you will see the Calculator class you just created. Click on it and you will see the addNumbers() method that you just created. Enter two numbers in the $n1 and $n2 fields and press the call button to test out the method. You should see the sum returned in the results area.

Your server-side service method is working correctly. Now let’s call it from Flash.

  1. Open up Flash and create a new FLA (ActionScript 2). You can set the publish setting to Flash 7 or 8.
  2. On Frame 1 of the new FLA, create a movie clip instance and give it the instance name dataHolder.
  3. Create a new layer and call it Actions. On the Actions layer, add the following code:
dataHolder.serviceClass = "Calculator";
dataHolder.method = "addNumbers";
dataHolder.args = "[35, 7]";
dataHolder.debug = true;
 
dataHolder.loadMovie("http://localhost:8888/php/swx.php", "GET");

That's it! That's all the code you need to call the addNumbers method on the Calculator service class in PHP and pass it the numbers 35 and 7 as arguments. The loadMovie calls the SWX gateway and passes to it any of the properties you set on your movie clip. In this case, since we are sending a small number of arguments, we use the GET HTTP encoding method. We could just as easily have used POST.

SWX Data Analyzer

Before testing the movie, open the SWX Data Analyzer in a separate browser window.

Swx Data Analyzer

SWX Data Analyzer is a debugging tool that shows you the SWX data that arrives inside your Flash movie.

To make SWX data that loads into the Flash player appear in Analyzer, you turn debug mode on. That's what the line dataHolder.debug = true does.

Now, test your movie and then look in the Analyzer. If all went well, you should see the number 42.

Accessing the result property

That's great, but now let's display that result in Flash. You're going to implement a quick hack to get it working and we can evolve the application later to improve it.

Add a TextField instance to the Stage and give it the instance name status.

Next, create an onEnterFrame handler that prints out the value of the result property of the dataHolder movie clip into the status text field.

The complete script at this point is shown below:

dataHolder.serviceClass = "Calculator";
dataHolder.method = "addNumbers";
dataHolder.args = "[35, 7]";
dataHolder.debug = true;
 
dataHolder.loadMovie("http://localhost:8888/php/swx.php", "GET");
 
<strong>function onEnterFrame()
{
    status.text = dataHolder.result;
}</strong>

Test the movie and you should see the number 42 appear in the status text field.

Now stop for a moment and take a deep breath: You now know exactly how SWX RPC works!

You didn't import any classes, you aren't using an API, you didn't include any external code whatsoever. SWX is completely native to the Flash platform and, if you want to, you can make use of it by using only built-in Flash features like you did here.

Compare this to other technologies like Flash Remoting. Do you actually know exactly how Flash Remoting works? There are numerous classes, lots of code, etc. There's some magic involved that you don't really understand. Not so with SWX RPC. With SWX RPC, your data arrives in native Flash format.

It's important for a technology to be so simple that you can actually conceptualize it completely. However, that doesn't mean that the above method is the way you'd want to use SWX PHP on a daily basis.

For one thing, take a look at how you set the arguments. It's a string. In fact, what you did was serialize the arguments you're sending in JSON format. It's not confusing or difficult to this by hand if you are sending simple arguments like two numbers but what if you wanted to send an array of complex objects over? It would get tiresome and impractical very quickly.

The example you just created uses the No API method. In other words, you used pure Flash. No additional classes.

However, to make your life easier, you may want to use just a little API. Specifically, a method to serialize your arguments into JSON format for you would be nice. The SWX AS minimal API provides just such a method. Modify the code sample so that it matches the listing below:

<strong>import org.swxformat.SWX;</strong>
 
dataHolder.serviceClass = "Calculator";
dataHolder.method = "addNumbers";
dataHolder.args = <strong>[35, 7]</strong>;
dataHolder.debug = true;
 
<strong>SWX.prepare(dataHolder);</strong>
 
dataHolder.loadMovie("http://localhost:8888/php/swx.php", "GET");
 
function onEnterFrame()
{
    status.text = dataHolder.result;
}

Notice the lines that have been added and the line that had changed (in boldface). The prepare() static method of the SWX class simply serializes your arguments into JSON format for you. Notice that the args property in your dataHolder is no longer a string but an ActionScript array with two numbers inside it.

This is definitely far better than manually serializing your arguments by hand but it's still not ideal, is it? For one thing, that onEnterFrame function we're using is not a good practice. It would be really nice if we could have an event handler called when the data arrives instead of polling for it. The SWX AS Full API provides that functionality (and a few more).

Modify the code listing so that it matches the one below:

import org.swxformat.SWX;
 
<strong>var swx:SWX = new SWX();
swx.gateway = "http://localhost:8888/php/swx.php";
swx.encoding = "GET";
swx.debug = true;
 
var callParameters:Object =
{
    serviceClass: "Calculator",
    method: "addNumbers",
    args: [35, 7],
    result: [this, resultHandler]
}
 
swx.call(callParameters);
 
function resultHandler(event:Object)
{
    status.text = event.result;
}</strong>

When you run the above example, you should again see 42 in the status text field. Let's look at what has changed.

When using the SWX AS Full API, you actually instantiate the SWX class and set some properties there (such as the gateway URL, encoding method and whether you want debug information for calls).

Instead of putting call-related parameters directly into a movie clip (you can delete the dataHolder movie clip now as you aren't using it any more), you create a callParameters object and specify the serviceClass, method, and args properties there. But you can do more, you can also specify a result handler that will get called once the data has loaded.

The result handler receives an event object as an argument. That event object has a result property that points to the loaded data.

The SWX AS Full API doesn't stop there. You can also specify a timeout handler to handle calls that take too long.

Modify the listing so that it matches the one below:

import org.swxformat.SWX;
 
var swx:SWX = new SWX();
swx.gateway = "http://localhost:8888/php/swx.php";
swx.encoding = "GET";
swx.debug = true;
<strong>swx.timeout = 2;</strong> // seconds
 
var callParameters:Object =
{
    serviceClass: "Calculator",
    method: "addNumbers",
    args: [35, 7],
    result: [this, resultHandler],
    <strong>timeout: [this, timeoutHandler]</strong>
}
 
swx.call(callParameters);
 
function resultHandler(event:Object)
{
    status.text = event.result;
}
 
<strong>function timeoutHandler()
{
    status.text = "Call timed out!";
}</strong>
 

The default timeout duration is 30 seconds but you can override that, as shown here.

In order to make the call actually time out, modify the Calculator class in PHP too to make it sleep for 10 seconds before returning the result. The Calculator class should match the one in the listing below:

&lt;?php
class Calculator
{
    function addNumbers($n1, $n2)
    {
        <strong>sleep(10);</strong> // Make the call time out!
        return $n1 + $n2;
    }
}
?&gt;

Now test your Flash movie and, after two seconds, you should see the SWX call time out. Timed-out calls are cancelled and will not trigger the result handler at any point in the future.

Finally, there is also a fault handler that you can use in the same way. To test it out, modify the ActionScript listing so that it matches the one below:

import org.swxformat.SWX;
 
var swx:SWX = new SWX();
swx.gateway = "http://localhost:8888/php/swx.php";
swx.encoding = "GET";
swx.debug = true;
swx.timeout = 2; // seconds
 
var callParameters:Object =
{
    serviceClass: "Calculator",
    method: "addNumbers",
    args: [35, 7],
    result: [this, resultHandler],
    timeout: [this, timeoutHandler],
    <strong>fault: [this, faultHandler]</strong>
}
 
swx.call(callParameters);
 
function resultHandler(event:Object)
{
    status.text = event.result;
}
 
function timeoutHandler()
{
    status.text = "Call timed out!";
}
 
<strong>function faultHandler(event:Object)
{
    status.text = event.fault.message;
}</strong>

And modify your class so that it generates an error:

&lt;?php
    class Calculator
    {
        function addNumbers($n1, $n2)
        {
            <strong>return $n3;</strong> // $n3 does not exist!
        }
    }
?>&gt;

Test your FLA and you should get something along the lines of Error 8: Undefined variable: n3 in /htdocs/swx/trunk/php/services/Calculator.php, line 7 in the status text field in Flash.

The fault handler also returns API-specific fault codes (e.g., Flickr API error codes) back to Flash.

And that, in a nutshell, is the SWX AS Full API.

There's more to SWX that we haven't covered in this introductory article such as the LoadManager and ExternalAsset classes that the SWX AS Full API uses internally to queue and load SWX SWFs but you can find out more information about these in more advanced tutorials to be released soon (they are useful when you want to load your own external assets like SWFs, JPGs, etc.)

Beyond making your own service classes, you can also use the existing service classes in SWX to access public APIs like the Twitter API and Flickr API. In fact, why don’t you play around with the Twitter and Flickr APIs now, using the PHP Service Browser to discover how they work? You can modify the examples above to get data from any of those APIs as easily as you have done here.

There is also a screencast of this example that you can watch online.

SWX and Flash Lite (mobile applications)

SWX and SWX RPC work in Flash Lite 2.0 and 2.1! In fact, due to its low processor overhead and native support in Flash, SWX is the ideal data format for mobile applications with Flash Lite.

Check out the MiniFlickr sample application that comes with SWX PHP for an example of how to build data-driven Flash Lite applications using SWX.

Keep in mind that, due to a bug in Flash Lite, you cannot make POST requests in a loadMovie call. Instead, you must make GET requests when using SWX RPC with Flash Lite. For more information on this, see the Mobile Limitations section, below.

The MiniFlickr application makes use of the ExternalAsset and LoadManager classes that come with SWX AS to queue all load requests (data and assets such as images). This is essential in mobile development as most handsets will fail if you try to load two things at once. The SWX AS Full API handles the queueing of requests for you and gives you a general purpose load queue that you can use in your own applications. Make sure you study the MiniFlickr sample if you want to create Flash Lite applications using SWX PHP.

Swx Mobile Device Central

SWX and SWX RPC advantages for mobile development

SWX RPC is the only RPC solution for Flash Lite and, beyond that, it works really well and is simple to use. Here is a summary of some of the advantages of the SWX data format and SWX RPC for Flash Lite development:

  • Native; data is ready to use the moment it loads as native ActionScript objects.
  • No processor-intensive parsing, etc.
  • No plumbing code for deserializing requests.
  • Public gateway and APIs for mobile mashups.
  • Only RPC solution for Flash Lite.
  • Easy to understand and use.

SWX Flickr API

As of the upcoming SWX PHP Release Candidate 1, a full implementation of the Flickr API is included in SWX PHP.

You can start playing with the SWX Flickr API right now, using the Public SWX RPC gateway. Try the methods out online using the SWX Service Explorer.

  • Implements the full Flickr API, current as of August 1, 2007.
  • Liberal open source license (MIT).
  • Provides photo upload feature.
  • Actively maintained and updated.
  • Simplest way for Flash developers to work with Flickr.

Roadmap

So where is SWX, SWX RPC, and SWX PHP going?

I realized today that I was being overly ambitious with my plans for version 1 of SWX PHP.

For one thing, I had considered getting the Flash 9/AVM2 version of SWX PHP ready in time for version 1 but that involves writing a whole new assembler. I've now decided to leave this for after the 1.0 release so that I can instead concentrate on getting a polished and stable 1.0 release of SWX PHP that includes all the learning materials, screencasts, etc. that you need to get up and running with SWX RPC.

SWX PHP already fills a gaping void in RPC solutions for Flash Lite and getting SWX PHP to version 1.0 is important in getting development houses to adopt SWX PHP for production of Flash Lite applications.

Also, the SWX assembler (the bit that creates the SWX SWF files) in SWX PHP is extremely stable and has been for a while and I want the Flash 9/AVM2 version of it to be as stable when it goes into version 1 but that's not realistically going to happen in the timeframe that I have in mind.

So, instead of working on yet another implementation, I'm going to spend the next few weeks working on the Internet Drafts for SWX and SWX RPC and on documenting the heck out of SWX so that others can create implementations of SWX RPC (in fact, if anyone is interested in undertaking the Flash 9/AVM2 implementation for PHP, please get in touch).

What is important is that eventual Ruby, Python, J2EE, .Net, etc. implementations of SWX RPC are all compatible and that they all adhere to the same philosophy of simplicity. (And thus, for example, do not require extensions, etc. or place other barriers in front of developers.)

So what is the eventual release data of SWX PHP? I'm going to be aiming for the start of September and definitely before FlashForward Boston.

I will be releasing Release Candidate 1 of SWX PHP this week so keep any eye out for that on this blog.

Also expect a number of new screencasts in the coming days, showing you how to work with SWX PHP and the various APIs and how to create mobile applications using SWX PHP.

Come September, I will be embarking on a crazy schedule of conferences, starting with FlashForward Boston to present my session Let's talk about SWX, baby!

The conferences I'll be presenting SWX at include MAX Chicago, FlashForum Conference (Germany), MAX Barcelona, FITC Hollywood, Flash on the Beach (Brighton, UK), and MAX Japan.

I hope I'll get to meet and talk with some of you at these conferences. If you see me, do come up and say hello and ask me for a SWX Moo card and a SWX Moo sticker :)

The Tangent: Roundup

Following Mike Davies's spirited uncovering of the domain name that The Tangent will be hosted at (http://swxformat.org), here's a roundup of everything that's currently public about the project, including some new bits of information, ahead of next week's official announcement:

  • I started it because I'm not happy with any of the existing methods of working with data in Flash. I find them unnecessarily complicated to work with and I believe that this is scaring developers Flash developers (hint) away from building mashups, experimenting and having fun with data-driven applications in Flash. (The other formats have their uses and The Tangent won't replace them for every use case -- and will work alongside them also. You'll be able to use it in a complimentary manner with AMFPHP, for example.)
  • My overriding design focus with The Tangent is simplicity. Everything about the project will reflect this, from the web site to how the project itself is deployed and distributed and the documentation and supporting materials. The Tangent is going to be the easiest way of working with data in Flash.
  • Next week's release of The Tangent is *very* early alpha - it will creak, it will break, it will throw its toys and generally be a nuisance — but it will nevertheless be very, very cool!
  • And a new tid-bit: Initially, PHP will be the only server-side technology that is supported. In further iterations (and with community support), we should see support for other server-side technologies such as Python, Ruby and Java.

I spent some time today making the analyzer component (one piece of The Tangent project) all-beautiful-and-shiny-like. I'm very biased, of course, but I like to think that it's a lovely analyzer, as far as analyzers go (I decided it's not really a debugger and hence the name change). I hope you'll agree when you see it next week.

I will be releasing the web site, full information and the initial alpha over the course of next week. The alpha will be out prior to my talk at the LFPUG on Thursday and you can be sure that I'll be presenting it during the conference tour that I'm going to be embarking on starting in April (May's totally crazy -- something like four conferences, maybe more! More on those later!)

Thank you all for the interest you've shown in this and for your support. It's going to be worth it -- I can't wait to reveal The Tangent and to work with you to develop it into something that's really useful to us all.

Here's to the most amazing community on the planet! Go Flashers! (Yell that in public, I dare you!.. umm, does a blog count?) :) Love you guys! And I hope you'll love The Tangent! :)

Apollo is out on labs

Apollo logo

Go get it, tiger!

What's Apollo?

Apollo is the code name for a cross-operating system runtime being developed by Adobe that allows developers to leverage their existing web development skills (Flash, Flex, HTML, JavaScript, Ajax) to build and deploy rich Internet applications (RIAs) to the desktop.

Apollo enables developers to create applications that combine the benefits of web applications – network and user connectivity, rich media content, ease of development, and broad reach – with the strengths of desktop applications – application interactions, local resource access, personal settings, powerful functionality, and rich interactive experiences.

Learn more on Adobe labs.

FlashForward KeyNote at MacWorld

I took notes during the FlashForward keynote at MacWorld today but couldn't post them since I didn't have WiFi in the room. It was a nice keynote and we got some cool sneak peeks at Flash CS3 and Apollo and a fun presentation on Flash on the Wii by Justin. Here are my notes:

I'm sitting in at the FlashForward keynote at MacWorld. Lynda just gave the opening speech and introduced Mike Downey.

Mike: We will be shipping the full production studio for the Mac, including Premiere, Encore and Sound Booth. (This was announced last week.) On Friday, we announced that we have finished and shipped Flex Builder for the Mac. About a month ago we released Photoshop CS3 in beta on Adobe Labs.

Flash Player Adoption update. Flash Player 9 is projected to reach over 70% penetration in its first six months. In comparison, Flash Player 8 took 9 months to reach over 80% and Flash Player 7 took twelve months to break 70% penetration. Basically, the adoption rate of the Flash Player is accelerating with each player release and continues to do so with Flash Player 9.

What's new in the Flash Player 9? Mike focusses on the new virtual machine with ActionScript 3 support and its performance improvements. AS3 is an ECMAScript implementation that uses the W3C DOM Level 3 event model, E4X (ECMAScript for XML), Regular Expressions and runtime error checking.

Mike is showing some example sites that showcase Flash Player 9. He starts with Kuler, Adobe's own online color utility.

In Flash Player 9.1, Adobe added a fullscreen feature. Mike shows the full screen demos linked to from the Labs Wiki. He demos the full-screen panorama made with Papervision 3D, which of course, you can find on OSFlash.

Flash Video has an unbelievable momentum which has mostly picked up following the release of Flash Player 8. Taking Flash Player 7 as the starting point, use of Flash video has grown 800x in the past three years, with the steepest rise taking place in 2006.

Mobile is another area that Flash has a presence in, especially in Japan. In September 2006, FlashLite was deployed on over 150 million handsets. In the US, in partnership with Qualcomm and Verizon, Adobe can distribute the FlashLite player to handsets over the air.

Flash can Wii

Now Justin Everett-Church takes the stage and he's going to talk about the Nintendo Wii. He is showing the Opera browser for the Wii, which, of course, comes with Flash Player 7. He is showing a mashup he did with Yahoo maps. He mentions the resolution of the browser (800x500) can make it difficult to read things and that he is actually doubling the size of his UI to make it more legible on the screen. Good tip.

Now he's showing YouTube and playing back some YouTube video.

Next, he is showing a 3D pool game from TeaGames to show the performance of the player. Looks good.

Now he's showing a game he created a while back called Insane in the Membrance. He loaded a SWF directly. It's not an 800x500 SWF but since it is vector, it scales. The game runs really well. This mirrors my own experience with the Flash Player on the Wii, which is that the player performance is very good.

Mike's returned to the stage now. He's mentioning that the Flash Player is also available on other game consoles. Mike Chambers is now taking the stage to show Flex and Apollo. To recap, Apollo is a cross-operating system runtime that allows developers to leverage their existing web development skills (Flash, Flex, HTML, Ajax) to build and deploy desktop RIAs.

He's demoing Ascension, an Apollo-based MP3 player that integrates with the desktop. For example, he's importing the iTunes Music Library from his Mac and using that as a data source for Ascension. He hasn't showed it yet but the coolest thing with Apollo is how easy it is to make cross-platform applications. For example, using Flex Builder, it is as simple as choosing your platforms and compiling. That's it. There is no platform-specific code whatsoever (those of you who have used Zinc, for example, will understand how much easier this will make their lives.)

Ascension also displays HTML pages to show the lyrics for songs. Apollo can do this. In fact, you can create Apollo applications using HTML as a top-level element. Basically, as has been mentioned to death elsewhere, Apollo allows you to use HTML, Flash and PDF in a transparently cross-platform development workflow. Flash and include HTML and Flash, HTML can include Flash and PDF. In short, it's mucho cool!

Now he's showing Flex Builder 2.0.1 on the Mac. The version he's showing has built-in support for Apollo which is not available in the released version. A version with Apollo support will apparently be released in a couple of months.

He shows how easy it is to compile a Flex application into an Apollo application. His sample application has an HTML control that is fully interactive and yet you can apply any Flash-based transformation, effects, etc. to the HTML control.

Now he is showing a mapping application called Maptacular that uses Google Maps, built by Christian Cantrell. It has an HTML control that loads in google maps. He overlays Flex on top the HTML control -- a tree control that is populated by the VCards on his system. He then drags a VCard to the map and it displays its location. Apollo is going to make a whole new type of mashup possible. A dashup, if you will, that combines data from your desktop with web services and the sorts of rich interfaces and interactions made possible with Flash.

Finally, he is showing a tool that is being built by eBay that makes it very easy to create eBay listings. For example, it uses your webcam to create images for your listing, etc.

You can find more information about Apollo at www.adobe.com/go/apollo.

Adobe plans to have a public beta available on Labs in a couple of months so it's getting close. They plan to have a 1.0 release mid to second-half of this year.

Flash CS3 Sneak Peek

Mike Downey is back on stage. OH NO IT'S THE UGLY NEW ICON! (His slide has the new icon for the next release of Flash.)

New UI

He is showing the new UI for Flash CS3. It's beautiful (apart from the icon and the splash screen.) And consistent. The toolbar icons match Photoshop and Illustrator, for example. He relates how they went out to talk to Adobe customers about how to integrate Flash with the existing Adobe tools. One thing many people have not liked about Flash was the Pen Tool. "Drawing with Flash's pen tool is like drawing with your feet" -- a customer quote! So they changed it. Flash CS3 has the same Pen Tool as Illustrator.

Now he is talking about the unique way that Flash treats shapes. This hasn't changed (since it's actually great for animators.) However, they have introduced primitive support to Flash CS3. There are now new tools such as the Rectangle and Oval primitives. (So you can, for example, add rounded corners to a rectangle very easily.)

About the workspace: They've focussed on making the content be the focus of the UI. For example, it's very easy to collapse the timeline and the PI. The toolbar is now a single column (and that saves some screen real-estate itself). You can expand and collapse the Palettes (when collapsed, it comes a single column toolbar where clicking on the buttons displays the Palette for that panel.)

There is also a new workspace drop-down that gives you quick access to your various panel layouts.

Automatic animation to code conversion

Now he is showing the new automatic animation to code feature developed by Robert Penner. Basically, this feature allows you to create a timeline-based animation (with guide layers, etc.), right-click the timline and select Copy Motion as ActionScript 3 and have Flash convert it to time-based ActionScript code that plays back exactly the same way as your timeline animation. The actual animation is written out as XML (using the native E4X support in Flash Player 9). So you can easily modify the settings of an animation without touching the animation engine itself. The only thing it doesn't work with is shape tweens. If nothing else, this feature alone will make it worth the upgrade.

New Photoshop (and Illustrator) importers

Finally, he is showing the new Photoshop importer (they also have the same feature for Illustrator). The new importer tool gives you access to all of the layers in the Photoshop document, including layer folders and layer comps. It recognizes layers with blend modes, text layers, etc. and allows you do to different things depending on the type of the layer. You also have options to Convert layers to Flash Layers, you can selectively choose which layers (or folders) you want to import and you can choose what type of content you want to convert a layer into.

For example, with a Bitmap layer in Photoshop, you can either import it as a flattened bitmap or as a bitmap image with editable layer styles. You can give it an instance name and set its registration point and set compression settings. You can also choose to set the stage size in Flash to match the canvas size in Photoshop and have the importer place the imported layers at their original coordinates.

The compression engine in Flash is now the same quality as the one in Photoshop.

Grant Skinner on the new V3 components in Flash CS3

He mentions that Flash finally understands how to maximize itself correctly.

V3 Components are built for Flash. They are 25%-40% smaller. 10kb smaller base than the Version 2 components (~15kb). Performance: Lower CPU, higher capacity. Customizability: Skinning (visual and programmatic) is made easier, extending the components is much simpler.

He is now doing a simple performance demo with a List component on stage. He is populating it with a million records. He just selected 200,000 records without delay and is scrolling through without any lag. They've also solved the problem that the earlier components had where external content (eg. images) would flicker when scrolled. Now they don't.

Now he's talking about how it is much easier in the Version 3 components to customize the components using skinning. I'm so happy that we finally have a Flash component set that gets skinning right. To skin a component, you just double click the component and you get a skinning dialog box. Select a skin and you can edit it on stage. The skins use Scale-9 so that corners are maintained and skins scale intelligently.

The style manager now also has massively improved performance and you can do runtime style changes on any number of components without lag. You can also use instances in styles so you can use external media, for example, as icons, etc.

He is now showing how they used skinning to create the color sliders in Kuler.

You also get the performance improvements in ActionScript 3. AS3 gives you development productivity using E4X, RegEx, display list, event model, debugging. He is showing a demonstration of E4X with an example of the Yahoo Maps code where a method with over 20 lines of code in ActionScript 2 is reduced to one line of code with E4X. Performance in AS3 is 10x-100x faster. As a demonstration of the performance, Grant is showing a demo by John Grden, with AS2 and AS3 versions. In AS2, it lags with a single model of a ship. In AS3, there are 10 ships flying by. Finally, there are API additions in AS3 such as BinarySocket, ByteArray, computeSpectrum, etc. He is now showing a computeSpectrum demo with some music and a flaming Blaze demo.

Lynda is now taking the stage again and ending off the keynote.

Daniel Dura on Apollo

Some notes from the session:

  • Project is in early development
  • Individual items/features subject to change
  • Accurate as of today (he's showing the latest build from last night)
  • Not mock-up, etc. Everything he's showing us is working version

What is Apollo?

Apollo is a cross-OS runtime for building RIAs. Leverage skills in Flash, Flex, HTML, Ajax to build and deploy desktop RIAs.

Benefits

Targetting the Apollo runtime as several benefits:

  • Run across multiple operating systems with any additional work by the developer
  • Apps are easier to develop. Leverage existing web technologies instead of
  • learning lower-level languages such as C, C++. (i.e., simplicity)

Build applications using the following technologies:

  • Flash/Flex/AS
  • HTML/JS/CSS/AJAX
  • Combinations of the above
  • PDF can be used in any application

Scripting support:

  • Depends on container being used
  • AS3 - Flash/Flex
  • JS - HTML/CSS/AJAX
  • Cross-environment communication and scripting will be possible
  • Complete access to Flash Player and HTML DOMs and APIs

For example, you can embed Flash into a JS container and traverse the Flash DOM from JS. You can walk the DOM in both JS and Flash, transparently.

APIs:

Rich set of frameworks and APIs:

  • Apollo-specific APIs provided by the Apollo runtime and the Apollo framework (e.g., file system API.)
  • Flash Player-specific APIs provided by the Flash Player and the Flex Framework (as well as other AS-based libraries and frameworks.)
  • HTML/Javascript-specific APIs provided by the HTML and JavaScript engines. This includes external JavaScript libraries like dojo.

Application stack

Apollo APIs

  • Offline/occassionally-connected (like Macromedia Central)
  • Network:
    • HTTP
    • XML-RPC/SOAP/REST-based web services
    • Binary and XML sockets
  • File I/O

  • Local storage/settings API
  • Custom chrome
    • Shape
    • Alpha

Desktop Integration

  • Installation: A packaging format (.AIR). Custom format. Contains all assets for application in a single file. Can be emailed, downloaded, etc. Single-click install. Download and install Apollo runtime.
  • Application shortcuts will be placed in the correct places for the OS (eg. in Start Menu on Windows.)
  • Drag and drop
  • Clipboard
  • Launch native applications: e.g., Building a photo-upload tool and launching iPhoto.
  • Cross-application communication: Make it easy to expose the APIs of your applications so that other applications can take advantage of them. Desktop mashups.
  • Notifications

Demos

Danny's got a couple of AIR files (the installer) and the Apollo runtime (Apollo.msi on Windows) on his desktop.

Pixel Perfect by Christian Cantrell. The installer looks like it was created in Flex. Creates shortcut on desktop. Installation was simple. It's a ruler application. Very cool/simple app. (I use Grab on OS X for measuring areas of the desktop but this looks cooler!)

In Task Manager it's taking up 0 CPU 14,256K memory at the moment. (It has its own process in the Task Manager.) If one Apollo application crashes, it won't affect any other Apollo applications.

Users really don't need to know that they're running Apollo apps. It's just like any other app.

Lookup by Christian Cantrell. App that loads word definitions from a web service. Cool little application. Apollo will allow people to build small desktop applications easily.

File Browser. It's a OS X-style file browser built in Apollo. Neat.

He's now showing an application that loads in your iTunes music and plays them back. Flickr photos based on song that's playing. Cool 3D spectrum analyzer.

Video Demo: Full-screen video of an IMAX Deep Sea video. It's very high quality.

Building a sample Apollo application

Danny is now building an Apollo application in Flex. Basically, it's like any other Flex 2 application with the following differences:

  • Add a namespace for apollo (http://www.adobe.com/2006/apollo)
  • Use the component.
  • Create an Application.mxml file. This is the manifest file that describes the application

Inside the ApplicationWindow, he puts some regular Flex components (Button, Label).

Application.xml manifest file:

[xml]

Hello World Sample

Daniel Dura
apollo_demo.swf


[/xml]

You can use command line compilers to compile Apollo and create Apollo installers. (You don't have to use Flex Builder 2.)

Timeline

  • Public beta by the end of 2006
  • Version 1 release: Sometime in 2007

Links:

There's a question:

Are there APIs for accessing databases?

No object-relational mapping. They're exploring data support. You can write AMF objects to the file system. AMF is the format of Flash Remoting.

Apollo looks really great. Can't wait to try it out with Flex 2. It's going to open up desktop application development to a large number of web developers.

FlashForward Austin Days 1 & 2

I arrived in Austin on Sunday for FlashForward and had a great time presenting my Head Start Flex 2 workshop yesterday.

Right now I'm sitting in on Kevin Lynch's keynote and they're showing a couple of firsts. Big Spaceship just demoed their latest site for Nike using the Flash 9 Player on Linux. The site contains heavy alpha channel video and animation and the player ran it without a glitch. I can't wait to get my hands on that baby. It's going to be great to be able to create Flex applications on Linux and run them in Flash Player 9 on Linux.

Mark Anders has taken the stage and he's currently creating a small Flickr-based application on Flex Builder 2 on OS X. Once this baby and CS3 are released, I don't think I'll have much to do in Windows under Parallels anymore and, as good as Parallels is, I did switch to a Mac to get away from Windows!

Now Mark's talking about Apollo. How it will support HTML, Flash and PDF and integrate them. You can build a Flash based application using Flash Professional or Flex and it gives you access to ActionScript and all of the capabilities of the Flash player. Beyond that you can integrate HTML and PDF into Flash. You can render HTML inside Flash. Or, you can approach it from an HTML perspective. You can build an HTML application that uses SWF and PDF. You have access to operating system APIs, cross-platform (Mac, Windows, Linux.)

Now he's showing, for the first time ever, how to build an application in Apollo on OS X. It's a very early build and it doesn't have all the integration with Flex Builder in the version that he's showing us.

He selects the Apollo Debug Launcher from the Web Browsers preference in Flex Builder 2. He is also changing the tag to (he is changing the same Flickr application that he built a few moments ago.) Apollo gives you complete control over the chrome. You have System Chrome, Window Chrome and Transparent Chrome. He's giving it an icon too. He did all this with a tiny XML configuration file. And now he's running the application as an OS X application. It's cool but the Window control buttons are on the right (they should be on the left.)

They want to have a developer release this year with version 1.0 in 2007.

Kevin's returned to the stage and now he's inviting Justin Everett-Church and Mike Downey to the stage to talk about the Flash Authoring Tool. Justin is demoing the Flash 9 Public Alpha. He mentions the performance difference between AS2 and AS3 applications using a particle demo.

Now Mike's going to show us what they're working on next. A sneak preview of the next version of Flash (this is the first public presentation of the tool, codename Blaze.)

One of the new features is importing Photoshop PSD files. Import -> Import to stage. There is precise control over every layer. He chooses a PSD file and you can see all the layers, layer groups, layer comps and you can make choices about each layer separately. The options include "Make text editable" (so that text imported from PSD files is editable in Flash). He selects a Folder. And asks everything in that folder to be made into a MovieClip and he gives it an instance name and sets is registration point (the crowd loves it - claps!) They're also supporting layer modes -- drop shadows, blurs, etc. -- and covert them to the Flash format.

Also, Photoshop JPEG format looks better so they swapped out the compression engine in Flash to use the one in the next version of Photoshop.

You can convert layers to keyframes. You can set the Flash stage to the same size as your photoshop document window. (This is all still in the Photoshop import wizard.)

Looks like this is the first step towards much tighter integration with Photoshop.

He's going to show one other thing. An innovative feature. In a lot of Flash teams, there is a workflow where a designer will prototype the site on the timeline and then the developer would rip it all apart and then recreate the animations, etc., in ActionScript, optimize, etc. There is an inherent loss of fidelity as you go through the process. Breeding discontent between "designers" and "developers". Code-based animation. So they hired Robert Penner (who now works on the Flash team and he's working on the feature Mike's showing now.)

There is a traditional timeline animation of a bug moving around the stage, following a motion path, changing size, alpha, etc. So it's a complex timeline animation. Select any span of animation, right-click, Copy Motion as ActionScript 3. So the feature walks the timeline and converts the timeline-based animation into an XML structure using E4X and then copies it to the clipboard.

He creates a copy of the first movie clip and then adds the code. The timeline-based animation and the coded animation are identical.

You can also that this animation code into Flex Builder and it will work in Flex.

This is quite an amazing feature and they're still refining it and working on the interface.

The last thing he's going to mention is components. People want smaller components. And components that are very easy to skin. So they decided to build that and base it on the same architecture as Flex but very lightweight. Instead of Adobe building them, they hired Flash developers to build them. So they hired Metallic and Beau Amber and Grant Skinner. (Beau's going to give a sneak peek of the components.)