Posts Tagged ‘actionscript 3.0’

My new portfolio site – williamdady.com

Over the last couple of weeks I have slowly been putting together my new portfolio site, williamdady.com, which has been long overdue.  The site was developed in FlashDevelop and Flash CS4 using the PureMVC framework.

pic1

I had a very specific design goal from the beginning to maintain a modular structure, something that PureMVC was a big help at pulling off. Sections are segregated into their own SWF’s each with an accompanying background SWF which in-turn contains multiple background images.

The main shell, the top-most parent SWF, is responsible for the layout of the modules as well as controlling the navigation. I utilized BulkLoader in the shell to handle the loading of module and background SWF’s as a pair. I’ve used BulkLoader a few times now and I it’s a really handy tool which all AS3 devs should have in their library.
(more…)

PureMVC: Creating a short-hand Mediator

99% of coding I do lately is built on top of the excellent PureMVC framework. Something that has been irking me for a while now is the way Mediators register and handle notifications dispatched from the View.

Part of working with PureMVC requires extending from the Mediator base class (more specifically implementing IMediator) as this contains two important methods, listNotificationInterests and handleNotification. Where this starts to get a little painful is you need to override both of those methods for every Mediator you create. That is where I came up with the idea of abstracting away these two methods by creating a ‘helper method’ which will map a notification to a handler. I should say that before doing this I searched on the PureMVC forums and found several people who have already encountered this issue and created their own implementations.

I’ve created my own extended version of the base Mediator class I’ve called AbstractMediator. This includes a custom method called registerNotificationHandler which you pass a notification name and call back method to. This is very similar to the addEventListener method used in AS3. Then you simply extend AbstractMediator instead of Mediator in your application. AbstractMediator automatically populates the array returned by listNotificationInterests and uses handleNotification to route incoming notifications to the mapped functions, thus you no longer need to explicitly override these.

Overall the main reason I wanted to create this was to significantly shorten the amount of code needed in each Mediator. *Cliff Hall, creator of PureMVC, has commented on this post below noting that once you account for separate functions to handle notifications it is not necessarily shorter than the default way of overriding listNotificationInterests and handleNotification.

Download.

Light Steam

So it seems I’ve been neglecting this blog lately. I guess I’ve been a little busy now that I’m working full time again. Nonetheless I thought I’d throw up this little ‘light stream’ effect I’ve been working on. This is really just a re-imagining of a very similar effect I did for a banner ad a little while back.

This effect is achieved by combining several of the Flash players features such as the drawing API, Blur & Glow Filters, blendMode and BitmapData. The original version I did was built for Flash 8 in AS2, this version is AS3 but still built in a very similar way. I’ve made it customizable by being able to set the size, length and colours of the stream as well as being able to set the initial darkness.

I’m not sure what I plan on doing with it yet. I may work on it a little more still… who knows. Move your mouse around to see the light stream.

Sending data with LocalConnection in Flash

As a follow up to my previous post titled “How to communicate between multiple Flash files with LocalConnection” I’m going to demonstrate a slightly more advanced way of using the LocalConnection object in Flash. (more…)