באג: combobox.visible לא משפיע על ה-list
הבאג:
אם משנים תצוגה של קומפוננטת combobox ל-visible = true ומשתמשים בפונקציית open לפתוח אותו דינאמית, התוצאה תהיה ה-scrolllist עצמו ייפתח, ללא תיבת הטקסט העליונה עצמה.
הסיבה:
המימוש של פונקציית open בקומפוננטה, משתמש ב-stage עבור addChild ולא באובייקט עצמו ולכן אין קשר בין התצוגה של הקומפוננטה לתצוגה של ה-list.
/**
* Opens the drop-down list.
*
* <p><strong>Note:</strong> Calling this method causes the <code>open</code>
* event to be dispatched. If the ComboBox component is already open, calling this method has no effect.</p>
*
* @see #close()
* @see #event:open
*
* @langversion 3.0
* @playerversion Flash 9.0.28.0
*/
public function open():void {
currentIndex = selectedIndex;
if (isOpen || length == 0) { return; }
dispatchEvent(new Event(Event.OPEN));
isOpen = true;
// Add a listener to the stage to close the combobox when something
// else is clicked. We need to wait a frame, otherwise the same click
// that opens the comboBox will also close it.
addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true);
positionList();
list.scrollToSelected();
stage.addChild(list);
}
הסיבה לזה היא כנראה הרצון להציג את ה-list מעל רכיבים אחרים שנמצאים על הבמה ולכן אין התייחסות לאובייקט עצמו.
פתרון אפשרי:
לבדוק visibility או contains של ה-combobox לפני שימוש ב-open





תגובות אחרונות