January 14, 2003

Darshan's LocalStyleManager

Darshan Sawardekar, at octaneinteractive.com, has devised a way to update the style of components, and reflect changes to their live previews on stage in real time!

A few months ago, I remember wondering about the possibility of hooking up live previews via localconnection channels, but it seemed a bit theoretical and awkward. Imagine my surprise when I visited Branden's website and saw that Darshan had accomplished such a brilliant feat of component hacking!

According to Darshan's blog entry, "The LocalStyleManagers flash extension consists of 3 separate components that work together towards a common goal of providing skinning functionality to the Flash UI Components in the Flash MX IDE itself, in real time as well as runtime. These 3 components are LocalStyleManager Manual, FStyleUpdater and LocalStyleBroadcaster. "

To understand how Darshan's system works, download and study his LocalStyleBroadcaster component. It works in a way similar to the Observer design pattern (or commonly known as the "broadcaster/listener model in Actionscript). He has modified the live previews of all the FUI components to register as listeners withe the style broadcaster, and to update their styles according to onUpdate events sent by the broadcaster. The actual run-time styling is performed through a modified version of the FStyleManager component that I'd released last month.

I really enjoyed reading his articles, they're quite thorough and detailed. Check out his article on LocalStyleManager here. Also, check out another of Darshan's innovative hacks in the article "Building Flash MX Components that don't Pre-Load!"

Posted by samuel at January 14, 2003 05:08 AM