I don't see in the addChild event any info that can help determine what index the child was inserted at. My case assumed you were declaratively creating accordion children in mxml.
You could do something like below, since addChild calls addChildAt: <?xml version="1.0"?> <mx:Accordion xmlns:mx="http://www.adobe.com/2006/mxml" childAdd="onChildAdd(event)" > <mx:Script> <![CDATA[ import mx.events.ChildExistenceChangedEvent; import mx.containers.accordionClasses.AccordionHeader; import mx.containers.Accordion; private var _lastAddedIndex:int; private function onChildAdd(e:ChildExistenceChangedEvent):void{ var acc:Accordion = e.target as Accordion; var header:AccordionHeader=acc.getHeaderAt(_lastAddedIndex) as AccordionHeader; header.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); } private function onMouseOver(e:MouseEvent):void{ (e.target as AccordionHeader).dispatchEvent(new MouseEvent(MouseEvent.CLICK)); } override public function addChildAt(child:DisplayObject, index:int):DisplayObject{ _lastAddedIndex=index; return super.addChildAt(child,index); } ]]> </mx:Script> </mx:Accordion> There may be better ways, but this is what I came up with in my 10 minutes of poking around further :-) HTH -Kyle ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Holmes Sent: Friday, September 14, 2007 3:47 PM To: [email protected] Subject: RE: [flexcoders] How can I get the Accordion headerRender instances @Kyle, thanks, that's what I was looking for. One question tho, I noticed you always grab the last child. Accordion supports addChildAt() so I'm assuming I'll have to get the index of the child another route to always be sure. Thought I'd bring it up in case I'm completely wrong about that. @Doug, to answering your answering a question with a question, uh, er, question. I don't know if I need access to the header renderer or not, but I've tried children and some other various things that haven't worked. And I thought about overriding the headerRenderer but since this will be a base class chances are it will get overridden itself. I'm extending mx components just for our test environment where we're doing capturing / saving / translating labels, titles and phrases which will get stored in a database, pushed out with our production app and then loaded dynamically based on user's language so we don't have to deal with .properties files and Resource Bundles and the like. a quick example is at http://www.mxmvc.com/translations/SweetTranslations.html <http://www.mxmvc.com/translations/SweetTranslations.html> but I'm just getting started at working out the kinks and that example doesn't have the accordion yet, obviously. brian.. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Doug McCune Sent: Friday, September 14, 2007 2:25 PM To: [email protected] Subject: Re: [flexcoders] How can I get the Accordion headerRender instances To not answering your question and instead ask another one: Why do you need access to the header renderer? If you want to alter the label, or blank out the label, you can use a custom extension of Button and set that as your header renderer (ie if you wanted header renderers that always converted the labels to uppercase or something). Or if you just want to get access to the labels, that's simply the label property of each child, so looping over the children will get you what you need. Doug On 9/14/07, Brian Holmes <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: I'm trying to extend the Accordion class, I'm listening for creationComplete, and when it fires I'd like to loop over the headers and pull off the labels, but I can't seem to get a handle on them. I've tried looping over the children() but I need to get the actual headerRenderer instance. I'm willing to trade the answer for a digg! or I might be able to be talked into sending the first person who answers a free t shirt. Thanks for any help! Brian.. ________________________________ *** The information in this e-mail is confidential and intended solely for the individual or entity to whom it is addressed. If you have received this e-mail in error please notify the sender by return e-mail delete this e-mail and refrain from any disclosure or action based on the information. *** ________________________________ *** The information in this e-mail is confidential and intended solely for the individual or entity to whom it is addressed. If you have received this e-mail in error please notify the sender by return e-mail delete this e-mail and refrain from any disclosure or action based on the information. ***

