It depends if you create your accordion segments dynamically (defined in external files) or if your segments are already defined in the current mxml file.
For dynamic segment creation, you would use something like this: <mx:Accordion id="someAccordion" initialize="initAccordion()" /> <mx:Script> import mx.containers.VBox; function initAccordion() { someAccordion.createSegment(VBox, "vBox1", "Some label 1", DynamicAssetsManager.getInstance().getSymbol('ICON1')); someAccordion.createSegment(VBox, "vBox2", "Some label 2", DynamicAssetsManager.getInstance().getSymbol('ICON2')) } </mx:Script> With static segment creation, you would use something like this: <mx:Accordion id="someAccordion" initialize="initAccordion()"> <mx:VBox> <!-- Define here the content of the first segment --> </mx:VBox> <mx:VBox> <!-- Define here the content of the second segment --> </mx:VBox> </mx:Accordion> <mx:Script> import mx.containers.accordionclasses.AccordionHeader; function initAccordion() { var header:AccordionHeader; header = (AccordionHeader) someAccordion.getHeaderAt(0); header.label = "Some label 1"; header.icon = DynamicAssetsManager.getInstance().getSymbol('ICON1'); header = (AccordionHeader) someAccordion.getHeaderAt(1); header.label = "Some label 2"; header.icon = DynamicAssetsManager.getInstance().getSymbol('ICON2'); } </mx:Script> Good luck! Benoit Hediard -----Message d'origine----- De : Jos vd Laar [mailto:[EMAIL PROTECTED] Envoyé : mercredi 2 février 2005 17:28 À : flexcoders@yahoogroups.com Objet : RE: [flexcoders] dynamic vbox icon ok, cool, the class works, at least, it returns the image I want, but where do I need to call the methode? <mx:VBox initialize="DynamicAssetsManager.getInstance().getSymbol('ICON1');" doesn't has any result, how does the class knows where (on which object) to link the icon to. Thanks for your time! Jos -----Original Message----- From: Benoit Hediard [mailto:[EMAIL PROTECTED] Sent: woensdag 2 februari 2005 16:29 To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] dynamic vbox icon To be able to get icons dynamically, you can create an DynamicAssetsManager singleton class. All the necessary icons must be embedded in it (so I don't know if it solves your problem). class DynamicAssetsManager { [Embed(source="assets/images/someicon1.png")] public var ICON1:String; [Embed(source="assets/images/someicon2.png")] public var ICON2:String; private static var dynamicAssetsManager ; public static function getInstance():DynamicAssetsManager { if (dynamicAssetsManager == undefined) dynamicAssetsManager = new DynamicAssetsManager(); return dynamicAssetsManager; } private function DynamicAssetsManager() {} public function getSymbol(name:String):String { if (this[name] == undefined) { trace("DynamicAssetsManager.getSymbol : " + name + " is undefined"); return ""; } else { return this[name]; } } } Then, you can call this manager from anywhere (usually during view helpers initialization) to get the icon dynamically : DynamicAssetsManager.getInstance().getSymbol('ICON1'); ... Hope this helps! Benoit Hediard -----Message d'origine----- De : Jos vd Laar [mailto:[EMAIL PROTECTED] Envoyé : mercredi 2 février2005 16:06 À : flexcoders@yahoogroups.com Objet : [flexcoders] dynamic vbox icon Hi All, I have a accordion pane with some vboxes as its children. What I want to do is set the icons on these vboxes dynamically. But as I understand from the docs, these icons can only be embedded? So isn't there a way to set the icons dynamic? Thanks for your time! Jos Yahoo! Groups Links Yahoo! Groups Links Yahoo! Groups Links