make application a little more tolerant so it can be used in flexunit tests
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a5d74b31 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a5d74b31 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a5d74b31 Branch: refs/heads/develop Commit: a5d74b31c34433282913c5980b470566d117753c Parents: 2380008 Author: Alex Harui <[email protected]> Authored: Tue Mar 25 08:45:45 2014 -0700 Committer: Alex Harui <[email protected]> Committed: Tue Mar 25 08:46:42 2014 -0700 ---------------------------------------------------------------------- .../src/org/apache/flex/core/Application.as | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a5d74b31/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as index 80e3961..ce76df5 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as @@ -58,6 +58,17 @@ package org.apache.flex.core [Event(name="viewChanged", type="org.apache.flex.events.Event")] /** + * Dispatched at startup after the initial view has been + * put on the display list. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="applicationComplete", type="org.apache.flex.events.Event")] + + /** * The Application class is the main class and entry point for a FlexJS * application. This Application class is different than the * Flex SDK's mx:Application or spark:Application in that it does not contain @@ -112,9 +123,12 @@ package org.apache.flex.core dispatchEvent(new Event("initialize")); - initialView.applicationModel = model; - this.addElement(initialView); - dispatchEvent(new Event("viewChanged")); + if (initialView) + { + initialView.applicationModel = model; + this.addElement(initialView); + dispatchEvent(new Event("viewChanged")); + } dispatchEvent(new Event("applicationComplete")); }
