It's all in the code

Still flashing

leave a comment »

Yes, I’m definitely still flashing.

I’ve been to Flash on the Beach twice now – in 2010 and 2009. For those of us who spend a large part of their lives writing animations in Flash this is a fun, inspirational event held in Brighton every year. It’s not just about Flash – it’s more about artistic communication using technology – and so many other technologies get a good airing. Last year the Processing and Open Frameworks promoted by Ben Fry and others were prominent. This year HTML5 and Steve Jobs’s take on Flash were a lurking presence on and off stage.

In case you missed it, Steve Jobs made some very disparaging remarks about Flash on his blog during the year, supporting his outright ban on Flash generated projects ever appearing on iOS (the iPhone or iPad operating system). I think most of the conference attendees had taken note of Steve’s views, noticing the sudden upsurge of anti-Flash sentiment everywhere, and had started to wonder. Is he right? Should I do things differently? Have web standards finally caught up? Should we be doing everything in HTML and CSS with all the new features they now have?

Technologists are a fickle bunch. Nobody likes to stay doing things the old way – we all want to finish the current project so we can do the next one right. It hurts your job prospects hard if you learn one thing and just stick to it. So the other notable feature at FOTB was that most people had rolled up their sleeves and done stuff in this new HTML5 world. I had done so myself, researching a few interesting development frameworks like jqTouch, Sencha, Cappuccino, and Sproutcore, and noting along the way some excellent javascript libraries like Flot and Raphael – and for us mathematicians MathJAX. There are certainly a lot of good minds on the job.

I think Lee Brimelow summed it all up very well. Lee is great. He says what he thinks. He was the Adobe blogger who said what he thought about Jobs’s new policies and had his knuckles rapped over it. Lee’s view? Use HTML5 if you can, but you’ll still need Flash when things get tough. Oh, and this all takes a lot of work – but that’s OK because it keeps us all employed. Maybe Lee had been worrying about that a bit. Even Lee acknowledges that plug-in technologies are probably not appropriate for the mobile web. He would very much have liked to use the Flash cross compiler to generate native iOS apps though.

But then even Steve Jobs can change his mind, and just a couple of weeks before the 2010 FOTB came the news that Apple were no longer banning apps cross compiled from Flash.

OK, so why am I still flashing?

Mainly because I’m a development team of one person for this stuff. I need to stay efficient. The HTML5 development tools are nowhere near mature and browser differences are still making life exceptionally difficult. If you believe the hype, you believe that javascript frameworks now hide browser differences. Use the framework (jQuery et al) and you have no need to worry. Not true! You still need to test everything you do in every browser your users use. If you stretch the boundaries of the web towards animation and interactivity you will be disappointed.

I just made an advent calendar for NRICH. This is the simplest of simple animations – nothing more than an array of buttons with rollover behaviour. We were doing this sort of thing 12 years ago in javascript. I decided to follow Lee’s advice. If it can be done using web standards, do it that way.

I did. It took one and a half days of effort. I had wanted smooth animations so I first tried webkit and mozilla transitions. Beautiful in Safari, not yet available elsewhere. Ah, let’s try jQuery animate. Good in Safari and Firefox. A disaster in Chrome. OK, forget smooth animations for a bit – this is taking too long. Tidy up and test again. All good except for Internet Explorer. It wasn’t seeing any events at all. You see, the calendar had a load of passive decorations lying over the top of the button grid – these were in a transparent png – and so they masked events from the underlying buttons. I had overcome this in the other browsers by adding empty buttons (divs) on top of the decorations.  IE wasn’t happy – if you can’t see it then you can’t click on it – right? Well I finally found a solution – fill the top layer buttons, but give them alpha transparency in CSS. That’s opacity:0 in the web standards. In real life to hit all browsers it’s:

	-khtml-opacity: 0;
	opacity: 0;

What’s worse is that when I look back on the code I created I hate it. It’s full of the horrible tricks I needed to get round those browser inconsistencies. It looks like something I might have written 12 years ago. And I’m at the whim of future browser quirks. It can and probably will break in the future. To do this properly I would need a development tool that knows about all these tricks allowing me to forget them. I want to develop once, test once, deploy everywhere. I want the tool kept up to date and backwards compatible so when browsers do something different the very worst I have to do is update and recompile.

So next time I’ll be flashing.

Postscript: At Adobe Max, there was a small demonstration of an animation written in a new version of Flash and then exported to HTML5. Maybe I just have to wait a little…


Written by gmp26

November 24, 2010 at 10:39 am

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: