Flash + AIR == Director???

Not quite. But together Flash and AIR provide some capabilities that Flash alone couldn’t do in the past. I am having some fun playing with AIR. The good news is it’s easy for flash developers to learn building AIR apps as it is really like building swf app, except we now have more Actionscripts APIs available. For example the code below can be used to build a flash video (.flv) desktop player which allows user to browse to flv videos in their hard drive and play it through the flash video component.

import flash.filesystem.*; 

var fileChooser:File  = File.documentsDirectory;
var currentFile:File;

browse_btn.addEventListener(MouseEvent.CLICK, doClick);
fileChooser.addEventListener(Event.SELECT, doSelect);

  function doClick(e:MouseEvent):void
  {
   if (currentFile)
   {
    fileChooser = currentFile;
   }
   fileChooser.browseForOpen(“Open”);
  }
  function doSelect(e:Event):void
  {
   currentFile = e.target as File;
   fl_vid.source = fileChooser.nativePath; // fl_vid being the flash video compoment
  }

 There are of course much more to AIR than the above. That’s why AIR is so exciting. But before I got carried away, AIR doesn’t support launching of native app yet. Not even with fscommand. But it is only version 1 beta 2 at present, so things can only get better from here.

Advertisements

~ by brianchau on October 11, 2007.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: