Fix for bug where the "close" event on a Panel was not being dispatched on HTML platform. This was because the "close" event from the TitleBar was set to bubble and events do not bubble (easily anyway) on the HTML platform. PanelView now intercepts the event and dispatches its own.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f012cfad Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f012cfad Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f012cfad Branch: refs/heads/feature/amf Commit: f012cfad6e81b1d3e73c27c7ec99dc8ea735791e Parents: dae3a3c Author: Peter Ent <p...@apache.org> Authored: Thu Jul 20 14:03:02 2017 -0400 Committer: Peter Ent <p...@apache.org> Committed: Thu Jul 20 14:03:02 2017 -0400 ---------------------------------------------------------------------- .../src/main/flex/org/apache/flex/html/beads/PanelView.as | 7 +++++++ .../main/flex/org/apache/flex/html/beads/TitleBarView.mxml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f012cfad/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as index c2bb227..d9b3757 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/PanelView.as @@ -153,6 +153,8 @@ package org.apache.flex.html.beads _titleBar.element.style["flex-grow"] = "0"; _titleBar.element.style["order"] = "1"; } + + _titleBar.addEventListener("close", handleClose); // replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that // any changes to values in the Panel's model that correspond values in the TitleBar will @@ -265,5 +267,10 @@ package org.apache.flex.html.beads performLayout(event); } + private function handleClose(event:Event):void + { + IEventDispatcher(_strand).dispatchEvent(new Event("close")); + } + } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f012cfad/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml index 0f27523..a5ff08d 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/TitleBarView.mxml @@ -37,7 +37,7 @@ limitations under the License. private function clickHandler():void { - var newEvent:org.apache.flex.events.Event = new org.apache.flex.events.Event('close',true); + var newEvent:org.apache.flex.events.Event = new org.apache.flex.events.Event('close'); UIBase(_strand).dispatchEvent(newEvent) } ]]>