Hey Niklas,
Here’s a quick and dirty example:
<?xml
version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.macromedia.com/2003/mxml" width="100%"
height="100%" >
<mx:Script>
<![CDATA[
[Embed("plus.png")]
var
plusIcon:String;
[Embed("minus.png")]
var
minusIcon:String;
function
changeIcons():Void {
for
(var i:Number = 0; i < acdIcons.numChildren; i++)
mx.controls.Button(acdIcons.getHeaderAt(i)).icon = plusIcon;
mx.controls.Button(acdIcons.getHeaderAt(acdIcons.selectedIndex)).icon
= minusIcon;
}
]]>
</mx:Script>
<mx:Accordion
width="200" height="400" change="changeIcons()"
id="acdIcons">
<mx:Form
icon="{plusIcon}"/>
<mx:Form
icon="{plusIcon}"/>
<mx:Form
icon="{plusIcon}"/>
</mx:Accordion>
</mx:Application>
Naturally you’d need files named
plus.png and minus.png to make it work.
Let me know if this helps.
Jim
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Niklas Richardson
Sent: Friday, November 18, 2005
6:33 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders]
Accordion Header Icons - Changing during runtime
Hi Jim,
I gave that a shot and still to no avail.
Still get the error:
"There is no property with the name
'icon'."
Oh well. Perhaps I need to figure out these
custom header classes!
Thanks for the help.
Cheers
Niklas
On 17/11/05, Jim Phelan
<[EMAIL PROTECTED]> wrote:
>
>
>
> The custom class might not benefit you (it
has some other features like a
> close button), but try this:
>
>
>
> Button(accd.getHeaderAt(0)).icon
>
>
>
> ________________________________
>
>
> From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On
> Behalf Of Niklas Richardson
> Sent: Thursday, November 17, 2005 11:51
AM
>
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] Accordion
Header Icons - Changing during runtime
>
>
>
> Unfortunately I tried:
>
> accd.getHeaderAt(0).icon
>
> and it doesn't work. It says
"icon" does not exist. I think that's
> because getHeaderAt() returns a
UIComponent object.
>
> Would you be willing to share your
custom header class?
>
> Thanks
>
> Niklas
>
> On 17/11/05, Jim Phelan
<[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > Hey Niklas,
> >
> >
> >
> > I've done this before. I'm
accomplishing it with a custom class for the
> > header, but if all you need is the
icon you should be able to use
> something
> > like accd.getHeaderAt(0).icon =
"iconLinkage" Since AccordianHeader is a
> > subclass of Button, it should work
just fine.
> >
> >
> >
> > Jim
> >
> >
> >
> >
________________________________
> >
> >
> > From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On
> > Behalf Of Niklas Richardson
> > Sent: Thursday, November 17,
2005 11:24 AM
> > To: flexcoders@yahoogroups.com
> > Subject: Re: [flexcoders]
Accordion Header Icons - Changing during
> runtime
> >
> >
> >
> > Crapola! So you'd need some
custom header class huh?
> >
> > Thanks.
> >
> > Niklas
> >
> > On 17/11/05, Sreejith
Unnikrishnan <[EMAIL PROTECTED]> wrote:
> > > The icon is
embedded at compile time and may not be changed
> dynamically.
> > > But then I could
be wrong!
> > >
> > > Sree
> > >
> > >
> > > Niklas Richardson
wrote:
> > > Hi all,
> > >
> > > I have hunted
high and low for an answer to this and I've played
> > > around with
accordion.getHeaderAt(), getChildAt(), but to no avail.
> > >
> > > Basically, I want
to change the icon for a specific accordion header
> > > depending on a
certain state of that child.
> > >
> > > There doesn't
seem to be a way at runtime to change the icon.
> > >
> > > Does anyone know
a solution to this?
> > >
> > > Thanks.
Your help is much appreciated.
> > >
> > > Cheers
> > >
> > > Niklas
> > >
> > >
> > >
> > > --
> > > Flexcoders
Mailing List
> > > FAQ:
> > >
> >
> http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > Search Archives:
> > >
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > >
> > >
> > >
> > >
________________________________
> > > YAHOO! GROUPS
LINKS
> > >
> > >
> > > Visit your group
"flexcoders" on the web.
> > >
> > > To unsubscribe
from this group, send an email to:
> > >
[EMAIL PROTECTED]
> > >
> > > Your use of
Yahoo! Groups is subject to the Yahoo! Terms of Service.
> > >
> > >
________________________________
> > >
> >
> >
> > --
> > Niklas Richardson
> > Prismix Ltd
> >
> > Flex and ColdFusion Experts!
> >
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
> >
> http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.com
> >
> >
> >
> >
________________________________
> > YAHOO! GROUPS LINKS
> >
> >
> > Visit your group
"flexcoders" on the web.
> >
> > To unsubscribe from this
group, send an email to:
> >
[EMAIL PROTECTED]
> >
> > Your use of Yahoo! Groups is
subject to the Yahoo! Terms of Service.
> >
> >
________________________________
> >
> >
> >
>
>
> --
> Niklas Richardson
> Prismix Ltd
>
> Flex and ColdFusion Experts!
>
>
>
> --
> Flexcoders Mailing List
> FAQ:
> http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
>
> ________________________________
> YAHOO! GROUPS LINKS
>
>
> Visit your group "flexcoders"
on the web.
>
> To unsubscribe from this group, send an
email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to
the Yahoo! Terms of Service.
>
> ________________________________
>
>
>
--
Niklas Richardson
Prismix Ltd
Flex and ColdFusion Experts!
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS