Search code examples
apache-flexfocusindexingmouseoverbuttonbar

Flex 3 - Getting focusedIndex in a buttonbar


I've been looking around on how to get the focusedIndex property of a ButtonBar when there's a mouseOver/Out event, but haven't found nothing useful.

Thanks in advance for your help.

Regards,
BS_C3


EDIT 1

Assuming we have this button bar:

buttonbar

I'd like to know, when rolling over, the target button.

Putting a break point in a function that listens to the mouseover event, this is what I see in the debug view:

focusedIndex

As you can see, there's a focusedIndex variable that's is strangely not documented...


Solution

  • The value is an mx_internal value.

    Just use this magic when yo do imports:

    import mx.core.mx_internal;
    use namespace mx_internal;
    

    Then you should be able to access the value in your button bar's mouse hander w/o issues:

    trace(e.target.focusedIndex);
    

    As a point of clarification; the property on the ButtonBar class; not on the event class, like you originally stated. The ButtonBar instance is embedded inside the Mouse Event. I've heard that called Nested Objects before.