Flash against the world

Although I use to make a living from Flash since Flash 4 (learning time) and Flash 5 (real usage time, when AS 1 was born), I’ve never been in the mood to write about the goods and chimes of Flash, as most of times I’ve been forced to agree with the general sense which said that stuff made-in-Flash was crap. Who doesn’t hate Flash intros and banners and nonsensycal fireworks?

Today, in the mature age of Flash (and maybe myself’s professional mature age), I see the cake quite different.

  1. Flash is a plugin, just like the old Java plugin, QuickTime, Windows Media Player or VRML: a way to introduce rich content in a browser.
  2. Nobody demands for a plugin a bunch of features regarding navigability (integration with common browser’s features, such as history, bookmarking or accessibility), except for the Flash plugin.
  3. People in Macromedia (then) and Adobe (now) made a great effort of creativity and enthusiasm in order to introduce in the Flash plugin lots of features, including support for audio, video and 3D. Do you remember when you was forced to install a bunch of things only to hear audio in the mp3 format? Flash supported it. Do you remember when watching a video in the web was sort of chance if you had the codec installed, if available at all for your machine specs? Flash made possible a successful website such as Youtube. Do you remember when people needed something else, from the programming point of view, and AS 2 was born (and yet more AS 3), being a real alternative to today’s so called Web 2.0 and smelly things such as Ajax, which is today a very common technology?
  4. Flash, even being a plugin, offered a bridge to the user’s surfing experience from the beginnings. Wheter you like it or not, being more or less difficult for the developer, you can bookmark a page from Flash contents, access the history, make a Flash movie fully accessible and localizable, make practice of asynchronous communication with the server, get your contents indexed by major search engines and a long catalogue of things you would never expect from a plugin.
  5. Most probably, people who feels anger against Flash, feels anger as well against bad (or low-cost, if you prefer so) web developers. Me and my team can make a full blown rich app driven by Flash -in the client side- in a few days, supporting navigability, accessibility AAA and advanced features (such as databases in the backend). Today, 2010, you are told to make a website with A/V support. You have three days to make it live. Will you rely on WM, QT or Real? Or you will stick with the de-facto standard, codenamed Flash? What about 3D? Do you prefer Flash via Swift 3D, for example, or you will force your users to install whatever plugin?
  6. Bad and low-cost developers still can offer with Flash to their bad and low-cost customers much more than they can offer with their bad and low-cost web knowledge.
  7. Although Flash still offers usually much more features than other plugins (I won’t say “similar plugins”, as I don’t know similar ones), including a brand new OOP programming interface with AS 3 and integration with most if not all of modern technologies, along with the mentioned A/V capabilities, as well as support for 3D, bitmap and vector graphics, camera and micro input, etc… Although Flash offers more and still more, it still offers more again: Flash was exiled from major mobile platforms (specially iPhone, which is a point of reference), but Flash keeps trying and trying. The new betas, with an eye put over the mobile platforms, are performing so fine in the desktop in the first optimization. I believe they’ll keep improving. Stuff in the computer uses to require more and more resources (RAM, CPU, etc.). That’s because we all are forced to replace our computers, mobile phones (and now also TVs —in Spain, at least— with digital TV). And now Flash is in the business of downsampling: more features, less resources. It was time, anyway, and now begun the race. They’ll keep improving. Once more again, we demand from Flash a very high level of performance and optimization we don’t in fact demand to the own machines (nobody seems to blame Apple for creating a 4 GB iPhone or iPod, then very soon the 8GB one, then 16, 32GB, etc., making every new release feel oldies the previous ones). Adobe is making his homework in order to optimize CPU and RAM usage, support multitouch and a very long etcetera in the chain of the —oftenly stupid— needs of the market.
  8. SWF specs are free. We have now many tools —paid and free— to create and compile Flash movies. If you are freak enough, you can even create your own swf-based format and your swf-based flash player. In fact, they DO exist. You can even use your Flash knowledge to create robust cross-platform desktop apps based on SWF (Adobe’s AIR wasn’t the first to make it real, others did it first, creating environments similar to the RealBASIC or Revolution IDE’s and runtimes, such as mProjector, Zinc or the open-source HippoHX… And much more).
  9. Still waiting for others’ answers: universal, cross-platform, localizable, accessible, extensible and with the unlimited level of support of a huge and still-growing community of developers. And, as stated, with the enthusiasm required to make something new every day.
  10. Finally, the market rules. In my personal and tiny market, I never thought I was forced to learn AS 3, coming from AS 1 and 2, as well as I never thought the print shop would never accept as input a 5MB PDF document, instead of a Quark 3 document with a bunch of fonts and images enclosed in a ZIP disk. Today we have market for Flash, as well as yesterday, and a brighting future for the “newborn” AS 3 language, along with all the daily newcome features for us developers and end-users.

WindowSWF, mix ActionScript and JSFL for automation and productivity

It’s a long title for a post which could, in fact, be the only message without extra ellaboration. But I’ll ellaborate a bit, because I think this is a underrated feature I love in Flash, which allows to the end-user a full experience of automation and high detail customization of the Flash IDE. This post is for those of you who don’t know about it.

You can create a UI in Flash/ActionScript, link it with JSFL (Javascript Flash, a javascript-based language to drive the Flash IDE) and create your own utilities panel with customized solutions for your daily work. Such as this:

windowswf

I use every day the buttons in this panel. The first button in the top-left corner, for example, will convert selected items in the stage to named movie clips. It’s a silly task, but some times, before I worked out this solution, I was forced to do it manually hundreds of times in a single day (!) –> select, F8, insert name for symbol, insert name for instance in the stage.

My most impressive automation task was one responsible of arranging, making certains changes and publishing thousands of FLA files in a row, which reduced various workdays to 20 or 30 minutes I could spend in a delicious capuccino while the machine was working by itself.

This isn’t a guide, so I’ll describe briefly the mechanism:

1. You have some need (usually automation of repetitive tasks in the Flash IDE).
2. You write a JSFL command in order to replicate what you use to do manually –> most of times *any* task can be duplicated via JSFL. If you don’t believe it, create a new document, make a rectangle, group it, then go to the menu Window > Other Panels > History. Everything listed in there is pure JSFL recorded which you can copy to the clipboard. More complex tasks will require heavy tweaks, though 😉
3. You create a FLA file with a button (or buttons, progress bars or whatever) linking to the JSFL command. Usually, JSFL commands are stored in the “Commands” folder of Flash’ main configuration dir and can be accesed as well from the Commands menu. You can even assign them a shortcut. But sometimes you run out of shortcuts or you can’t remember more shortcuts (!). This is the time when you need to create your own toolbar with that bunch of customized daily tasks. You call the JSFL command from ActionScript as follow:

myButton.onRelease=function(){
	MMExecute('fl.runScript(fl.configURI + "Commands/selec-to-movies.jsfl");');
}

This example is using AS 2 syntax, but that isn’t a problem, very simple to port it to AS 3. Basically, you call the ActionScript method of the same name, which executes JSFL code. This method is *only* available to “WindowSWF” panels, XMLtoUI dialogs (created on the fly usually by JSFL commands, that is another topic) or UI components. Obviously, no sense out of the Adobe Flash IDE.
4. Move the resulting SWF file to the WindowSWF folder of the config folder (next to Commands, Components, etc.).
5. Relaunch Flash. Now you can access your brand new panel from the menu Window > Other Panels, and it will behave just like any other utilities panel (more or less, you will learn some tiny details when you do it real).

And that’s all. Even if you don’t write your own JSFL solutions, you can still create a WindowSWF panel and link it to others’ JSFL commands you can find in Adobe’s Exchange web site.

FLA to PNG via AppleScript plus JSFL

We use this as a droplet, so we can convert dropped FLA files to PNG in a shot. The original script is much larger, as PNG files are post-processed before using them (need some tweaks in GraphicConverter or a similar apple-scriptable app), but it is a skeleton you can use in many little automation projects involving the wonderful world of AppleScript and Flash Javascript (aka JSFL), the language used to automate and extend the Flash IDE capabilities.

AppleScript --> FLA to PNG

AppleScript --> FLA to PNG (click to enlarge)

The FLA file will be exported as PNG using the last settings you used to export a PNG file.

You can download it here.