Scripting your Flash applications …

As someone of you may know, I really like studying programming languages and sometimes implement for fun (or for work) simple scripting languages that help me out during development.

The fight between scripting and programming languages will probably never end. Well, it is not really a fight but more an infinite race where the first position is exchanged continuosly between the two participants.
We need flexibility first, and so we add to our complex applications a way to support scripting to be able to easilly perform changes without the need to run the long time taking compilation process a low level language might take; then, the more the scripts became complex, the more we need an increase in performances, and so we rapidly move to compiled plugin egines; plugins offer a bit of flexibility and usually a good speed. Then we grant other users the permission to write plugins and so we need a sandbox to run the plugins in and to be sure every single line of code that is executed doesn’t harm our application. And so we revert back to scripting … and so on.
The race will never end but the technologies will continue to increase in speed and sometimes in complexity.

All the introduction is to say that its not the point to choose if scripting is useful or not for Flash applications, but to say that someone might need it for reasons we cannot think about right now, and someone else might not need it because they are fine with recompiling everything from scratch at each single small change.

I don’t think there are some many Flash applications that support scripting. I built myself a few of them for my company but they are for a particular purpose and probably the same motivations that made me decide to implement a scripting language are hard to find for other kind of applications.

As far as I know, the most of the applications that need to be flexible use a plugin system (more or less complicated – as Aviary for instance and Hobnox) and are fine with it because – we must say that – ActionScript is itself a scripting language and a SWF file is nothing more than a bunch of instructions (more or less) generated by compiled ActionScript.

But sometimes security comes into account, and it is hard (even if possible) to limit the funcionalities used by a plugin if this plugin is created by a 3rd party developer.

And so it comes into account scripting. With scripting we have full control over what a developer can do an how he can do that. We can limit it, provide builtin functionalities … But everything costs something, and building a fast/flexible/powerful/useful scripting languages is not that easy as it might seem.

This is why I decided to spend a bit of time in explaining the basics to implement a scripting language in actionscript to be able to script our applications. I’ll walk through all the passes – from lexing to bytecode generation and maybe a quick look into Virtual Machines – with the aim to provide someone (maybe in the far future) a bunch of documents to use as reference to build their own scripting language.

I’ll try to give an in depth look, but as far as the argument is quite complicated and full of facets, you may not find here the right solution for you. Nor the fastest or the most flexible. But it is better then nothing so if you are interested in that keep reading the blog 🙂

Win a 3D Flash Gallery!

This is a great opportunity for all the readers! Thanks for flashloaded we’re giving 3 free licenses of 3D Wall Pro ($199/each).

To win the prize is very simple, just leave a comment to this post with at least “I want the license” text besides any other comment and after 12 days we will select randomly 3 winners! ( remember to leave your email in the comment )

What is 3D Wall?

The 3D Wall is a papervision powered component to isplays images on an engaging interactive 3D wall. This PRO version can also display FLV videos and SWF’s and more..

Some of the key features of the 3D Wall are:

  • Flat or curved wall
  • Customizable animations
  • Glow and reflections
  • Double sided thumbnails
  • Complete customizable properties (rows, columns, preloader…)
  • Complete interaction (keyboard or mouse)
  • Use of external xml configuration file
  • A Flash component inspector
  • Images, flv and swfs
  • Customizable video controls
  • Youtube, flickr images
  • Watermarks

Here’s a couple of screenshots:

See more screenshots at the 3D Wall page

REMEMBER: Winners will be selected randomly from commenters 10 days later (31 October 2008) and will be contacted directly via email.

Contest is over!

Today (1st November 2008) the contest is over! After running this mysql query to find out 3 random commenters:
SELECT * FROM mt_comment WHERE comment_entry_id = 268 order by RAND() LIMIT 3
we got the three winners who are: (5170) moon, (5135) Pieter and (5176) tm!