|
|
|||||
Регистрация: Apr 2003
Адрес: DC
Сообщений: 4,489
|
Tree клик по иконке
Как отследить клик по иконке любого item'а в дереве? (8
Добавлено через 6 минут Отслеживать из кастомного класса иконки?
__________________
flash/flex/unity |
|
|||||
Modus ponens
|
Я переписывал итемрендерер. Но в теории можно и свою иконку скормить.
Вот кусок из рендерера переписаный под копирку из фреймворка: protected override function commitProperties():void . . . if (this.icon) { super.removeChild(this.icon as DisplayObject); this.icon = null; } if (this.disclosureIcon) { this.disclosureIcon.removeEventListener( MouseEvent.MOUSE_DOWN, this.disclosureIcon_mouseDownHandler); this.disclosureIcon.removeEventListener( MouseEvent.CLICK, this.disclosureIcon_clickHandler); super.removeChild(disclosureIcon as DisplayObject); this.disclosureIcon = null; } if (this._data) { this._tree = this._listData.owner as Tree; if (this._listData.disclosureIcon) { disclosureInstance = new (this._listData.disclosureIcon)(); if (!(disclosureInstance is InteractiveObject)) { wrapper = new SpriteAsset(); wrapper.addChild(disclosureInstance as DisplayObject); this.disclosureIcon = wrapper as IFlexDisplayObject; } else { this.disclosureIcon = disclosureInstance as IFlexDisplayObject; } super.addChild(disclosureIcon as DisplayObject); this.disclosureIcon.addEventListener( MouseEvent.MOUSE_DOWN, this.disclosureIcon_mouseDownHandler); this.disclosureIcon.addEventListener( MouseEvent.CLICK, this.disclosureIcon_clickHandler); } if (this._listData.icon) { this.icon = new (this._listData.icon)(); super.addChild(icon as DisplayObject); } this.label.text = this._data.name; this.label.multiline = this._tree.variableRowHeight; this.label.wordWrap = this._tree.wordWrap; } disclosureInstance = new (this._listData.disclosureIcon)(); и далее по тексту надо будет заменить на что-то более пристойное (например - просто задать класс иконки ) Да, и иконка не обязана быть SpriteAsset / IFlexDisplayObject - нет к ней таких требований, это просто код заморский такой Но желательно, чтобы была InteractiveObject все-таки.
__________________
Hell is the possibility of sanity Последний раз редактировалось wvxvw; 01.04.2010 в 22:17. |
|
|||||
Регистрация: Apr 2003
Адрес: DC
Сообщений: 4,489
|
Ага, спасибо (8
__________________
flash/flex/unity |
Часовой пояс GMT +4, время: 07:25. |
|
« Предыдущая тема | Следующая тема » |
|
|