Jul 16 2007

Flex: Dynamic, Bindable Icons & Labels

Posted by Joe Rinehart at 11:03 AM
1 comments
- Categories: Flex

I've got a challenge in a current project that seems to go beyond normal skinning in Flex: I need to let a user choose sets of icons, labels, and other UI elements and have the application immediately react.

[View an example (right-click to view source)] From a tech perspective, I need to be able to bind something like a button's icon property to a changing source that's part of an underlying collection of icons.

Going further, I need to allow other developers to configure which libraries of icons, labels, etc. should be compiled in to the application: it'll be shipped to multiple end customers, and they need to be able to customize the build for each customer.

The solution I came to was to implement a configurable "UIFactory" that acted as a singleton. It'd have properties like "icons", "labels", etc. that are implementations of a base (abstract) bundle of bindable String, Class, etc. properties.

I could then extend the UIFactory with a UIConfiguration (mxml) component that'd allow developers to configure it on a per customer basis with MXML. That'd allow the end developer to edit (M)XML code to change which icon libraries are available in a given build:

<ui:iconLibraries>
   <mx:Object label="Small Icons" library="{new SmallIconLibrary()}" />
   <mx:Object label="Large Icons" library="{new LargeIconLibrary()}" />
</ui:iconLibraries>

In the frontend, developers just need to get an instance of the singleton UI factory and then bind to the appropriate member:

<mx:Button icon="{ui.icons.person}" label="{ui.labels.someButton}" />

Comments

Michael

Michael wrote on 09/29/08 3:54 AM

Going further, I need to allow other developers to configure which libraries of icons, labels, etc. should be compiled in to the application: it'll be shipped to multiple end customers, and they need to be able to customize the build for each customer.
http://www.batteryfast.co.uk/apple/a1185-white.htm apple a1185 white battery,
http://www.batteryfast.co.uk/apple/a1185-black.htm apple a1185 black battery,
http://www.batteryfast.co.uk/asus/a42-a3.htm asus a42-a3 battery,
http://www.batteryfast.co.uk/asus/a3000.htm asus a3000 battery,
http://www.batteryfast.co.uk/asus/z9100.htm asus z9100 battery,
http://www.batteryfast.co.uk/asus/a3.htm asus a3 battery,
http://www.batteryfast.co.uk/asus/z91.htm asus z91 battery,
http://www.batteryfast.co.uk/asus/a32-a8.htm asus a32-a8 battery,
http://www.batteryfast.co.uk/asus/a8.htm asus a8 battery,

http://www.batteryfast.co.uk/asus/z99.htm asus z99 battery,
http://www.batteryfast.co.uk/asus/m3000.htm asus m3000 battery,
http://www.batteryfast.co.uk/asus/m3n.htm asus m3n battery,
http://www.batteryfast.co.uk/asus/m3000n.htm asus m3000n battery,
http://www.batteryfast.co.uk/asus/m3.htm asus m3 battery,
http://www.batteryfast.co.uk/asus/a42-m6.htm asus a42-m6 battery,
http://www.batteryfast.co.uk/asus/m6n.htm asus m6n battery,
http://www.batteryfast.co.uk/asus/m67.htm asus m67 battery,
http://www.batteryfast.co.uk/asus/m67n.htm asus m67n battery,

http://www.batteryfast.co.uk/asus/m68.htm asus m68 battery,
http://www.batteryfast.co.uk/asus/m68n.htm asus m68n battery,
http://www.batteryfast.co.uk/asus/m6000.htm asus m6000 battery,
http://www.batteryfast.co.uk/asus/a42-w1.htm asus a42-w1 battery,
http://www.batteryfast.co.uk/asus/w1.htm asus w1 battery,
http://www.batteryfast.co.uk/asus/w1g.htm asus w1g battery,
http://www.batteryfast.co.uk/asus/w1v.htm asus w1v battery,
http://www.batteryfast.co.uk/asus/w1000.htm asus w1000 battery,
http://www.batteryfast.co.uk/asus/w1000n.htm asus w1000n battery,

Write your comment



(it will not be displayed)