I've developed a class to make it easier to display runtime-loaded icons in
Buttons and Trees etc.

This uses the same technique provided by Ben Stucki:
http://blog.benstucki.net/?p=42 but takes his idea a little bit further.

Supports:

* Displaying icons loaded at runtime in components that normally only accept
embedded icons
* Displaying default embedded images when runtime icons cannot be loaded
* Icons can be resized as desired (if not specified then the original size
is used)
* Embedded icons can also be resized

To give you an idea, this is how you might use runtime icons in a Tree:

var myTree:Tree = new Tree();
myTree.iconFunction = IconUtils.getTreeIconFunction(myTree,
iconPathFunction, 20, 20, DEFAULT_ICON_CLASS);

private function iconPathFunction(treeItem:Object):String {
        var iconPath:String = ...
        return iconPath;
}


Here's a demo:

http://flex.mark.carter.name/icon/bin/IconUtilsExamples.swf

The library can be found here:

http://flex.mark.carter.name/icon/IconUtils.zip

The example code can be found here:

http://flex.mark.carter.name/icon/IconUtilsExamples.zip

===

I hope someone finds this useful.

Any feedback, would be much appreciated.
-- 
View this message in context: 
http://www.nabble.com/Displaying-icons-loaded-at-runtime%2C-in-Buttons%2C-Trees-etc-tp17161472p17161472.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to