ItemClick Flex组合框中的事件 [英] ItemClick Event in a flex Combobox

查看:231
本文介绍了ItemClick Flex组合框中的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道,有什么办法在Flex ComboBox(或任何类似的)中捕获ItemClick事件。 )

Does anyone know, is there any way to catch ItemClick Event in a Flex ComboBox (or anything similar). Maybe there's any trick .. :) I do realize, that I can customize it, but this not suits my case.

感谢您抽出时间:)

推荐答案

正如你可以在 mx:ComboBox 源代码中看到的, list是私有的,侦听器 ITEM_CLICK 是私有的,列表本身也是私有的:

As you can see in mx:ComboBox sources, the function, creating the dropdown list, is private, the listener to ITEM_CLICK is private and the list itself is also private:

private var _dropdown:ListBase;

private function getDropdown():ListBase
{
        // ...

        _dropdown = dropdownFactory.newInstance();

        // ...

        _dropdown.addEventListener(ListEvent.ITEM_CLICK, dropdown_itemClickHandler);

        // ....
}

private function dropdown_itemClickHandler(event:ListEvent):void
{
    if (_showingDropdown)
    {
        close();
    }
}

所以你甚至不能扩展 ComboBox

唯一的公共东西是 dropdownFactory ,理论上可以覆盖以某种方式注册创建的下拉列表或创建扩展列表。但是我看到的问题是 ComboBox 不是下拉列表的父级 - PopupManager。这可能使调度(泡沫)事件相当困难。

The only public thing is dropdownFactory, which theoretically can be overriden to somehow register the created dropdown list or create extended list. But the problem I see is that ComboBox is not the parent of dropdown list - PopupManager is. This can make dispatching (bubble) events quite difficult.

这篇关于ItemClick Flex组合框中的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆