Use wrapped HTMLElement
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/da10baae Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/da10baae Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/da10baae Branch: refs/heads/core_js_to_as Commit: da10baaeeea5a6c5c4f04f7714e2eb45dd09b952 Parents: 1890e89 Author: Alex Harui <[email protected]> Authored: Thu Sep 17 11:12:52 2015 -0700 Committer: Alex Harui <[email protected]> Committed: Thu Sep 17 11:12:52 2015 -0700 ---------------------------------------------------------------------- .../as/src/org/apache/flex/core/Application.as | 16 +++++++------ .../org/apache/flex/core/HTMLElementWrapper.as | 2 +- .../org/apache/flex/core/WrappedHTMLElement.as | 25 ++++++++++++++++++++ frameworks/projects/Core/build.xml | 2 ++ frameworks/projects/Core/compile-js-config.xml | 1 + 5 files changed, 38 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/da10baae/frameworks/projects/Core/as/src/org/apache/flex/core/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/Application.as b/frameworks/projects/Core/as/src/org/apache/flex/core/Application.as index 1d8d7e0..b4d65f9 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/Application.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/Application.as @@ -246,7 +246,8 @@ package org.apache.flex.core * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public var model:Object; + COMPILE::AS3 + public var model:IBead; /** * The controller. The controller typically watches @@ -257,7 +258,7 @@ package org.apache.flex.core * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public var controller:Object; + public var controller:IBead; /** * An array of data that describes the MXML attributes @@ -271,6 +272,7 @@ package org.apache.flex.core * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ + COMPILE::AS3 public function get MXMLDescriptor():Array { return null; @@ -419,7 +421,7 @@ package org.apache.flex.core addChildAt(c as DisplayObject, index); } COMPILE::JS { - var children:Array = internalChildren(); + var children:NodeList = internalChildren(); if (index >= children.length) addElement(c); else @@ -446,7 +448,7 @@ package org.apache.flex.core return getChildAt(index); } COMPILE::JS { - var children:Array = internalChildren(); + var children:NodeList = internalChildren(); return children[index].flexjs_wrapper; } } @@ -468,7 +470,7 @@ package org.apache.flex.core return getChildIndex(c as DisplayObject); } COMPILE::JS { - var children:Array = internalChildren(); + var children:NodeList = internalChildren(); var n:int = children.length; for (var i:int = 0; i < n; i++) { @@ -516,7 +518,7 @@ package org.apache.flex.core return numChildren; } COMPILE::JS { - var children:Array = internalChildren(); + var children:NodeList = internalChildren(); return children.length; } } @@ -525,7 +527,7 @@ package org.apache.flex.core * @return {Object} The array of children. */ COMPILE::JS - protected function internalChildren():Array + protected function internalChildren():NodeList { return element.childNodes; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/da10baae/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as b/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as index 9ee26b2..9775e29 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/HTMLElementWrapper.as @@ -53,7 +53,7 @@ package org.apache.flex.core // Property //-------------------------------------- - public var element:EventTarget; + public var element:WrappedHTMLElement; public var model:IBead; protected var beads:Array; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/da10baae/frameworks/projects/Core/as/src/org/apache/flex/core/WrappedHTMLElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/WrappedHTMLElement.as b/frameworks/projects/Core/as/src/org/apache/flex/core/WrappedHTMLElement.as new file mode 100644 index 0000000..c160bcb --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/WrappedHTMLElement.as @@ -0,0 +1,25 @@ +package org.apache.flex.core +{ + COMPILE::JS + { + } + + COMPILE::JS + public class WrappedHTMLElement extends HTMLElement + { + + //-------------------------------------- + // Property + //-------------------------------------- + + /** + * A pointer back to the instance that wrapped this element. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var flexjs_wrapper:Object; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/da10baae/frameworks/projects/Core/build.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/build.xml b/frameworks/projects/Core/build.xml index b1ccdb8..3b6ed4f 100644 --- a/frameworks/projects/Core/build.xml +++ b/frameworks/projects/Core/build.xml @@ -173,6 +173,8 @@ </target> <target name="compile-as-for-js" > + <!-- copy js.swc into frameworks/libs --> + <copy file="${FALCONJX_HOME}/../externs/js/out/bin/js.swc" todir="${basedir}/../../libs" /> <echo message="Cross-compiling Core/as for js"/> <echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/> <java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/da10baae/frameworks/projects/Core/compile-js-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/compile-js-config.xml b/frameworks/projects/Core/compile-js-config.xml index 52b2a2b..170a467 100644 --- a/frameworks/projects/Core/compile-js-config.xml +++ b/frameworks/projects/Core/compile-js-config.xml @@ -23,6 +23,7 @@ <external-library-path> <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> + <path-element>../../libs/js.swc</path-element> </external-library-path> <mxml>
