ECMA-262 Edition 4

That's the official name of the next version of what's commonly known as JavaScript or ECMAScript. I ran across it because I've been taking a look at Macromedia technology lately and trying to grok a bit about their different tools, etc. and the ActionScript that was introduced in the latest Flash is based on this version of ECMAScript.

Note, if you haven't had a chance to take a look at the library of tools that Macromedia is building, you should. In addition to standard design and multimedia stuff you imagine when you think of Macromedia and their forward-thinking embrace of corporate weblogs, the company is really doing some cool things with Web Services and the newest version of Flash uses ActionScript 2, which seems to be a full-on object oriented scripting language. Note - I'm applying for a job at Macromedia so feel free to temper my enthusiasm with your cynicism. :-)

Actually, let me say for the record that I still loathe Flash for just about any purpose in a browser. I hate Flash-based banner ads, I hate when designers break the back button with a badly designed Flash UI, or take over my entire screen, or add unwanted sound effects, or add graphics that pulse, or think that I really want to see their 120 second 2MB Flash home page with the stupid "Click here to skip" link in the bottom. Whether I want a job at Macromedia or not I just can't deal with user-hostile web designs, and it seems much of those have Flash. Basically, if you haven't used Flash *exactly* how Macromedia itself uses Flash on its website (which is subtle and helpful), then you're abusing the technology and your users. Period. (Okay, whew. I feel free to continue with a clear concience.)

All that said, the new version of Flash is really kinda cool, especially when it's used in Macromedia Central, the new stand-alone Flash application launcher. I was browsing some of the *many* Macromedia-focused weblogs out there (both official and not - there's a huge community blogging about various Macromedia technologies) and discovered the new Macromedia Central Dev Chat applet on Kevin Lynch's blog. You should see it above. It's a very cool use of Flash as an application platform.

It's a pretty basic chat app - and because it has some IRC-like commands, I actually asked if it was using IRC on the back end, but was told that its actually using the Flash Communication Server, which I didn't really know anything about. But the general idea is that it's a custom media server which allows functionality like video on demand, shared whiteboards, and webcam chat. Which is what we were doing on Dev Chat - on the side was a list of webcams available from the other chatters, and it was really well done. The amazing thing about it was that all that functionality must be inherent in either Flash 6 or the Macromedia Central client because I didn't notice any of that being installed when I added that app to Central. It was very cool - though I have to ask how scalable it would be - though I guess that's the same question whether you're streaming Quicktime or Real - it just depends on your servers and your bandwidth.

Anyways, this example of a quick app you can add to Central brings me back to ECMAScript v4 and ActionScript. I had read a while ago that ActionScript is a variant of JavaScript so it surprised me while I was reading a weblog and found a discussion about objects, packages with a link to a tutorial with some sample code that looked like this:

/**
   A TexBox component
   @class TextBox
   @package com.rewindlife.controls
   @author Chafic Kazoun
*/

import mx.core.UIComponent;

class com.rewindlife.controls.TextBox extends UIComponent
{
    static var symbolName:String = "com.rewindlife.controls.TextBox";
    static var symbolOwner:Object = com.rewindlife.controls.TextBox;

    private var boundingBox_mc:MovieClip;

    private var textBoxLabel:TextField = null;

    private var defaultBgColor:Number = 0xFFFF33;

    private var _text:String = null;
    private var depth:Number = 0;

    function TextBox(){};

    private function init():Void 
    {
       super.init();
       boundingBox_mc._visible = false;
       boundingBox_mc._width = boundingBox_mc._height = 0;
    } 

    private function createChildren():Void 
    { 
       textBoxLabel = createLabel("textBoxLabel",depth++);
    };

    private function draw():Void
    {
      if(getStyle("backgroundColor") == undefined)
      {
        var bgColor:Number = defaultBgColor;
      } 
      else
      {
        var bgColor:Number = getStyle("backgroundColor");
      }

     beginFill(bgColor);
     drawRect(0,0,width,height);
     endFill();

     textBoxLabel.text = text;

     textBoxLabel.setSize(textBoxLabel.textWidth+3,textBoxLabel.textHeight+3);

     var cWidth:Number = width/2 - textBoxLabel.width/2;
     var cHeight:Number = height/2 - textBoxLabel.height/2;

     textBoxLabel.move(cWidth,cHeight); 
     } 

     private function size():Void 
     {
       invalidate();
     }; 

     [Inspectable]

     function set text(newText:String):Void
     {
       _text = newText;
       invalidate();
     };

     function get text():String
     {
       return _text;
     }
};

I was like, *that*'s not JavaScript - or at least it doesn't look like the Javascript that I recognize. That's when I looked it up and found out that JScript.NET and JavaScript 2.0 and ActionScript 2 are all derived from ECMA-262 Edition 4 which is the next generation of JavaScript and at least looks object oriented. Actually, it looks a lot like Java no? (Except for those funky variable declarations). It's pretty cool - it's still scripting, but with a lot more structure.

So wow... that's pretty powerful. Using ActionScript you can subclass Flash widgets and create a lot more logic on the back end. If it's performant, I can really see something like Central being incredibly useful. If it's *not* performant, then I can see it going the way of Marimba's Bongo which tried to do the same sort of thing for Java applets years ago.

Anyways, this is all a bit far away from the scripting capabilities that I'm most interested in which is in Flash Lite, but still it's interesting to discover this sort of new technology under your nose. Having played with the demos of Flash MX 2004 and Dreamweaver, I wonder why Macromedia chose not to create an environment for Flash that was more "application development centric". When you install Dreamweaver, for example, you're given the choice of having an IDE that's oriented for coders and one that's oriented towards designers. Being *completely* lost in the Timeline UI of Flash, I really wished for this sort of coding interface for developers as well. I understand ActionScript relatively well, and have browsed the classes available, it seems to me that I should be able to start throwing buttons down on a form and starting up a simple Hello World. But the timeline interface is pretty daunting in MX for those of us who haven't really used it before, though maybe there's something I'm missing.

This brings up a thought from yesterday's Mobile Email post. It seems to me that rich-client, filtered mobile email would be a perfect service for Flash Cast when it's launched. I wonder if Macromedia has thought of this? They really need to get those phones out there with Flash (in the West) so it can be permanently added to the list of options for rich clients along with Java, BREW and native smart phone OS apps (Symbian, Palm and Windows Mobile).

Okay, neat stuff.

-Russ

< Previous         Next >