This is an automated email from the ASF dual-hosted git repository. aharui pushed a commit to branch feature/MXRoyale in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 4f2d2a18934f67d0d99f3fecc2c8ba59465be024 Author: Alex Harui <[email protected]> AuthorDate: Thu Mar 22 12:00:39 2018 -0700 try using addedToParent --- .../src/main/royale/mx/core/Application.as | 41 +++++++++++++--------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as index 4ebe1f6..68935af 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as @@ -84,6 +84,7 @@ import org.apache.royale.events.Event; import org.apache.royale.events.IEventDispatcher; import org.apache.royale.events.ValueChangeEvent; import org.apache.royale.states.State; +import org.apache.royale.utils.MixinManager; import org.apache.royale.utils.MXMLDataInterpreter; import org.apache.royale.utils.Timer; import org.apache.royale.utils.loadBeadFromValuesManager; @@ -351,16 +352,22 @@ public class Application extends Container implements IStrand, IParent, IEventDi return _info; } + COMPILE::SWF + { + [SWFOverride(returns="flash.display.DisplayObjectContainer")] + override public function get parent():IParent + { + // may not work in sub-apps + var p:* = root; + return p; + } + } + COMPILE::SWF private function initHandler(event:flash.events.Event):void { MouseEventConverter.setupAllConverters(stage); - for each (var bead:IBead in beads) - addBead(bead); - - dispatchEvent(new org.apache.royale.events.Event("beadsAdded")); - if (dispatchEvent(new org.apache.royale.events.Event("preinitialize", false, true))) this.initialize(); else @@ -390,8 +397,12 @@ public class Application extends Container implements IStrand, IParent, IEventDi COMPILE::SWF override public function initialize():void { - MXMLDataInterpreter.generateMXMLInstances(this, instanceParent, MXMLDescriptor); - + addBead(new MixinManager()); + // the application is never added to the dom via addChild + // because the parent is the browser, not an IUIBase, but we + // need to run most of the code that usually runs when added. + addedToParent(); + this.initManagers(); dispatchEvent(new org.apache.royale.events.Event("initialize")); @@ -507,12 +518,6 @@ public class Application extends Container implements IStrand, IParent, IEventDi COMPILE::JS public function start():void { - for (var index:int in beads) { - addBead(beads[index]); - } - - dispatchEvent(new org.apache.royale.events.Event("beadsAdded")); - if (dispatchEvent(new org.apache.royale.events.Event("preinitialize", false, true))) initialize(); else { @@ -543,9 +548,13 @@ public class Application extends Container implements IStrand, IParent, IEventDi { var body:HTMLElement = document.getElementsByTagName('body')[0]; body.appendChild(element); - - MXMLDataInterpreter.generateMXMLInstances(this, instanceParent, MXMLDescriptor); - + + // the application is never added to the dom via addChild + // because the parent is the browser, not an IUIBase, but we + // need to run most of the code that usually runs when added. + addBead(new MixinManager()); + addedToParent(); + dispatchEvent('initialize'); // if (initialView) -- To stop receiving notification emails like this one, please contact [email protected].
