Thanks Igor - but that generates a further error. In any case, I need
to be able to enable/disable other buttons on the bar based on which
button is clicked on etc... won't this approach only permit the
enabling/disabling of the currently clicked button on the bar ?
It's looking like perhaps the ButtonBar isn't the best thing to use
here... this does seem like a bit of an oversight though - if you
can't enable/disable buttons on the bar it's pretty awkward in a lot
of instances.
Anyway, thanks for taking a look - much appreciated.
Jamie.
--- In flexcoders@yahoogroups.com, Igor Costa [EMAIL PROTECTED] wrote:
Try that.
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:StringReply/mx:String
mx:StringEdit/mx:String
mx:StringDelete/mx:String
mx:StringSave/mx:String
/mx:Array
/mx:dataProvider
/mx:ButtonBar
/mx:Application
Regards.
On 11/3/06, jamiebadman [EMAIL PROTECTED] wrote:
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:StringNew Topic/mx:String
mx:StringReply/mx:String
mx:StringEdit/mx:String
mx:StringDelete/mx:String
mx:StringSave/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
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
* Your email settings:
Individual Email | Traditional
* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
* To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/