<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#DEDEDE">
<mx:Script>
<![CDATA[
function doLinkBar(event){
for(var i=0; i<event.target.numChildren; i++){
event.target.getChildAt(i).enabled = i==event.index ? false : true;
}
}
]]>
</mx:Script>
<mx:LinkBar dataProvider="{['Flex','Flash','Director']}" click="doLinkBar(event)" disabledColor="#FF0000"/>
</mx:Application>
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Manish Jethani
Sent: vendredi 24 juin 2005 13:56
To: [email protected]
Subject: Re: [flexcoders] LinkBar question
> It seems to work when the ViewStack is the dataProvider, but not when using
> the LinkBar alone, bug or wish ? :)
The LinkBar disables the "selected link" only when it is connected to
a ViewStack. For the non-ViewStack case, there's no "selected link"
(you can keep clicking on the same one -- the idea is to invoke a
function like Add or Remove or Visit google.com or something).
If however you want to make it behave like there's only one selected
link at a time, see this example (yeah, so you have to write some
code):
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*">
<mx:LinkBar disabledColor="#FF0000"
dataProvider="{['1', '2', '3']}"
click="enableDisableLink(event.target, event.index)"
creationComplete="enableDisableLink(event.target, 0)" />
<mx:Script>
import mx.containers.LinkBar;
private var lastSelectedIndex:Number;
public function enableDisableLink(linkBar:LinkBar, index:Number):Void
{
linkBar.getChildAt(lastSelectedIndex).enabled = true;
linkBar.getChildAt(index).enabled = false;
lastSelectedIndex = index;
}
</mx:Script>
</mx:Application>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
--
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
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------------------------------------------------------------------
**STATEMENT OF CONFIDENTIALITY**
This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.
We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.
------------------------------------------------------------------

