The problem it's because the buttonBar doesn't have the getChildAt properties it's only reserved to Containers. If you want to use that you have to create new a new override the mx.controls.buttonBar.
But in other way you can try that.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="100%"
height="100%">
<mx:Script>
<![CDATA[
import mx.messaging.management.ObjectName;
import mx.utils.UIDUtil ;
import mx.core.UIComponent;
import mx.events.ItemClickEvent;
import mx.controls.Button;
[Bindable]
private function setAble (event:ItemClickEvent):void
{
var noAble:Object = this.enabled = false;
Button(event.index = noAble.item);
}
]]>
</mx:Script>
<mx:ButtonBar id="controlBar" height="20" width="100%"
horizontalGap="0" itemClick="setAble(event);">
<mx:dataProvider>
<mx:Array>
<mx:String >New Topic</mx:String>
<mx:String>Reply</mx:String>
<mx:String>Edit</mx:String>
<mx:String>Delete</mx:String>
<mx:String>Save</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ButtonBar>
</mx:Application>
Regards.
Hi,
I'm trying to disable a button on a buttonbar but I'm getting an
error... here's what I have:
<mx:ButtonBar id="controlBar" height="20" width="100%"
horizontalGap="0" itemClick="buttonBarClickHandler(event);">
<mx:dataProvider>
<mx:Array>
<mx:String>New Topic</mx:String>
<mx:String>Reply</mx:String>
<mx:String>Edit</mx:String>
<mx:String>Delete</mx:String>
<mx:String>Save</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ButtonBar>
Then I have this:
import mx.controls.Button;
private function setAccess( accessLevel:String ):void {
switch(accessLevel) {
case "core":
Button(controlBar.getChildAt(1)).enabled = false;
break;
default:
trace("Error setting button states: Out of range");
}
}
The error I'm getting is:
"Call to a possibly undefined method getChildAt through a reference
with static type mx.core:IUIcomponent."
Does anyone know why I'm getting this error - and how I can resolve it
please ?!
Thanks,
Jamie.
--
----------------------------
Igor Costa
www.igorcosta.com __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Software development tool Software development Software development services Home design software Software development company
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
- Re: [flexcoders] Disabling button on buttonBar - error... Igor Costa
Reply via email to