The joy of separation

So why not use PHP to create the test, given my familiarity and affection for it? The fact is that my testing engine requires a rich user interface with drag-and-drop, choosing images and free-form text input alongside the bog-standard multiple choice question types, and while this could be achieved using a judicious splash of JavaScript, Flash lets me create the whole application as one file that can remember scores without having them posted or stored in cookies or session variables. Flash is ideal if you need a rich user interface. I suppose I could achieve similar results in Silverlight, but that would mean learning C# from scratch and imposing a large runtime download on my site’s visitors, 95% of whom already have Flash Player 9. (Passyourtheory’s sister site Passyourcitizenship uses PHP only, plus a bit of JavaScript to present the questions, but in that case the test format was simpler and there was never any intention to include new graphical question types nor to reuse the test engine as a general purpose product in future.)

The joy of separation

The result of my three weeks of effort will look to a purist AS3 programmer the way XHTML Transitional looks to an internet standards geek, or a CSS/Table hybrid web page looks to a CSS-only evangelist. In other words it achieves its chief objective (which is also the objective of XHTML Strict and pure CSS) of separating content from presentation, but without being purely class-based: instead it employs two frames.

I’ve learned through bitter experience how much time gets wasted if you mix up what you want to say with how you say it. Say you’re creating a presentation or e-learning course in Flash – the obvious way to go about this is to place the material on the timeline using a keyframe for each page and tweens for the bullet transitions. That’s all very well, but what happens when the client asks you for a further five modules? As you’ve “hardwired” the material into Flash, creating a further five modules means five times more work and you’re going to be repeating the same tasks for every frame of every one of the five. Fair enough, I can charge five times as much, you may think – except that your clients will expect to pay less for ordering “in bulk” because they imagine, not unreasonably, that you will benefit from economies of scale. Furthermore, what if the clients change their corporate colour scheme? At the very least that’s going to mean changing the movieclips of five course libraries, and it probably means altering the colour of every bullet on every page in every course too.

Clearly this is bad practice (but it’s also very real-world and the way many, if not most, Flash designers proceed nowadays). There comes a point when building a separate, re-useable content presentation engine becomes worth the investment. I accept that my low tolerance for repeating myself brings me to this point well before most developers – endlessly repeating the same tasks rather than writing a program to handle them is just soul-destroying to me. I built my first Flash playback engine in 2003/2004 using Flash MX2004 and ActionScript 2, a “black box” that interprets text-based scripts that describe the text, images, sounds, videos and buttons that make up a course and the flow logic between them, to present the course materials as you intended. A course’s author needs no Flash experience and indeed doesn’t need to see Flash at all: all they need to deploy the application are the media files and these text scripts.

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.

Todays Highlights
How to See Google Search History
how to download photos from google photos