29 March 2006

Audio Cue Points in Flash MX 2004 Pro / Flash 8

Simple: turn the audio file into a video file (FLV).

There are probably much better ways of adding audio cue points that I haven't discovered yet, but Flash MX 2004 or Flash 8 don't seem to have any classes / components to help you do this quickly. Flash DOES have a selection of Media Components that allow you to add cue points to mpg or flv videos.

Simply convert the audio to FLV by exporting it with QuickTime Pro or another audio/video tool and the Flash Video Encoder (I use Sorenson Squeeze for this). The Flash 8 video encoder even allows you to add Event or Navigation cue points to the audio.

Import the FLV into your flash movie using the MediaDisplay component to add cue points as you would with video.

There's also a tutorial here that uses FlashAmp, the "Lite" version costs $45. This is probably better than my solution (but not as quick) as it can include the volume and spectral properties of the sound.

28 March 2006

Setting up Apache, PHP, MySql and Eclipse for Mac OS X

A mate of mine wanted to get into web development and needed to know the best way to go about getting the right stuff on his Mac. I've chosen PHP as the scripting language because it's one of the easiest to install on the Mac. Follow the links below in order, and you should have it all up and running within an hour.

Apache Server

Apache PHP plugin

Eclipse (code editor)

PHP Plugin for Eclipse


PHP reference & tutorials

24 March 2006

Getting responseXML to work in IE

Nightmare! This took me ages to solve, but was actually quite easy in the end.

I thought it'd be a great idea to have "live" validation on a registration page, that'd check the database to see if a username had already been chosen.

First I created a ColdFusion Component (CFC) as a web service which checks the user input against usernames in the database and returns a boolean true/false. The CFC returns a WDDX formatted XML packet containing the boolean value.

Assuming you have a response handler like the AJAX tutorial here: http://developer.mozilla.org/en/docs/AJAX, all you need to do is use http_request.responseXML to receive the XML content and then use the XML DOM properties and methods to extract the data.

This works fine in Mozilla browsers like FireFox / Safari, but not in IE, which produces an 'Object Expected' error.

This is because IE expects all XML responses to have: Content-Type: 'text/xml' in the response header. However, ColdFusion broadcasts the WDDX packet as 'text/html', and therefore using responseXML in the javascript handler will not work, as IE doesn't acknowledge this as XML data.

The simple way to fix this is to create an XML DOM object in the Javascript response handler and use the responseText property, like so:

if(window.ActiveXObject){ // If IE Windows
var XMLdoc = new ActiveXObject("Microsoft.XMLDOM");
} else {
var XMLdoc = http_request.responseXML;

AJAX and other animals

I've recently jumped on the AJAX band wagon and had a stab at using the XMLHttpRequest() object in my applications. I followed a number of tutorials including:


I'm still to be wholly convinced about using AJAX to deliver pages, due to accessibility issues, but I do think that using the XMLHttpRequest() to get live data as a user interacts with the page is well worth getting stuck into. It's the way ahead.

There are alternatives to AJAX: Flash Remoting, the art of using Flash for the UI and web services (mainly written in ColdFusion) and Macromedia - sorry - Adobe Flex 2 offer a much more dynamic UI, but at a price! Flex 2 will set you back the best part of a grand when it's released sometime this summer.

Hi there!


This is the first entry on this site... not terrible exciting for anyone reading it, but I've been meaning to build a website for 5 years and never got around to it! What the hell was I going to use as a domain name for starters? Anyway... it excites me in ways I'd rather not share on here.

So, let me explain what this site is about. Lapsus Mentis pretty much translates as "absent minded" and is what an Italian collegue of mine called me as she didn't know how to describe me in English. This blog, indeed this whole site, is my own personal web development reference, so I don't forget the stuff I've done, problems I've solved or all the other websites that have create tutorials and references.

I mostly develop sites in ColdFusion and use flash / flex fairly frequently, so I'm fairly savvy with Actionscript. I also no a fair bit of ASP, a dash of .NET and have dabbled with Java (mainly J2ME). I'm always learning new stuff - there's a lot to learn! In the future I'll be posting stuff about my trials with AJAX, Flex 2, and MVC's (Fusebox / model-glue).

Hopefully, my reference can become your reference. After most of what I've learnt over the past 5 years has been from forums and blogs like this, so it's high time I gave something back.