Category Archives: Uncategorized

Stuff that didn’t fit anywhere else

Blue lego block of ambiguity

At the risk of getting sucked into the Apple vs Adobe shitstorm, my own response to Apple chosing to block Flash content from their mobile devices is to at least tell users why – because Apple left it at the rather obscure blue lego block, with no explanation (great experiential design guys). Simply include this code in your page/s to redirect mobile safari users to a page of your chosing …I direct them here.

Local playback security in FlashDevelop and Flash CS3 / CS4

I’ve seen a few people get into a pickle over this one. When you’re developing and testing locally, you need to set the ‘Local Playback Security’ setting (sometimes referred to as the ‘use network services’ option) depending on whether you wish to access local external files (e.g. XML files, or images) or some other server (e.g. your dev backend server). You can’t access both from a locally running SWF anymore, since it’s a security risk. So here’s how to set that option in Flash CS3 / CS4 or from within FlashDevelop.

Synchronising animation across multiple SWFs

I’ve been asked a few times now to create effects that require multiple instances of the Flash Player on a page to interact and remain in sync – even with interaction. Because of this, using timed events is no good and because of harddrive thrashing (which I won’t do for what might just be some banners) you can’t use Flash cookie updates. Also, when you have more than 2 SWFs, deciding which SWF updates who becomes tricky. I came up with this solution, using LocalConnection with a twist, which works pretty well – but if anyone has a better method, drop it in a comment 🙂

Quick as a Flash 10

Flash Player 10 is here...Flash Player 10 is finally here! But does it live up to the hype? Previous major releases of Flash Player have each brought with them significant improvements in performance or added functionality. This time around, the guys at Adobe have been tinkering with a few exciting (and a few somewhat drier) enhancements, including: native 3-D transform APIs, new custom ‘Pixel Bender’ filters, dynamic sound generation, hardware accelerated graphics and new video capabilities.

Personally, because I’m always looking for new things that enable us to create innovative and engaging user experiences, I’m a little less excited about new features such as support for right-to-left languages or new audio codecs. But at least there are people out there filling in the gaps, pushing Flash beyond its perceived limits and developing things we can actually use to create edifying experiences, such as papervision, box2d, etc.

Any new features though, even if they aren’t quite as ‘cool’ as the previous additions of webcam or socket server access, are ultimately a good thing. Let’s just hope everyone keeps pushing in the right direction and uses Flash to beautify the web, not just make it more clunky – Shockwave people take note.

XML within a class

I was recently asked about the problem of loading XML from within a class to trigger an arbitrary method. The problem was: the onLoad event triggers on the XML instance, not the class creating it. This could probably be worked around with the Delegate class, but in the past I’ve simply extended the XML class itself, overriding the onLoad handler and adding a callback object that’s passed in (along with some error checking). It’s partnered with an XMLLoader class, the source and simple demo of which you can download here.

Design Patterns

I went to an interesting talk on Enterprise Integration Patterns at SkillsMatter the other day. Though aimed primarily at Java developers, there was not a scrap of code and the concepts discussed could apply to development in almost any language.

The focus of the talk was: good, simple code design versus just using lots of clever inheritance to create complex-looking, unmaintainable frameworks. Common sense really – it’s the kind of ‘form over function’ approach that we’re all too aware of plaguing the creative world that applies to programmers too. I’m sure many developers (especially us contractors) have personal experience of this. Be it having to use over-complicated web services, where three lines of PHP would do the trick. Or being forced to base a project on some client’s ailing framework, written in the dark ages, with little or no support.

However, it’s the reality of having to integrate with a host of unknown systems that keeps the job interesting, I suppose. It does mean, however, that the Holy Grail of code reuse (even across similar projects) doesn’t often happen the way we’d like. How many times have I heard “it’s OK, this half-finished project is all in classes, so it should be easy to repurpose”?

With such specific requirements to any individual project, some classes and knowledge can be reused, but the more complex the program structure, the more difficult it is to grasp mentally. Also, design patterns mean exactly that: patterns. Not: “this is the way we do every project”, but general approaches you learn from experience are more apt for a given task.