get CreateJS manual test to work with back ported SWC
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/61ee45f0 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/61ee45f0 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/61ee45f0 Branch: refs/heads/core_js_to_as Commit: 61ee45f0331b0ed890f4050984c35573faa9912f Parents: a601ad5 Author: Alex Harui <[email protected]> Authored: Thu Dec 10 16:58:42 2015 -0800 Committer: Alex Harui <[email protected]> Committed: Thu Dec 10 16:58:42 2015 -0800 ---------------------------------------------------------------------- .../as/src/org/apache/flex/core/Application.as | 17 +- .../apache/flex/core/BrowserResizeListener.as | 4 +- .../org/apache/flex/core/IApplicationView.as | 45 +++++ .../as/src/org/apache/flex/core/ViewBase.as | 2 +- .../src/org/apache/flex/createjs/Application.as | 20 ++- .../as/src/org/apache/flex/createjs/CheckBox.as | 6 +- .../as/src/org/apache/flex/createjs/Label.as | 58 ++++++- .../src/org/apache/flex/createjs/TextButton.as | 74 ++++++++- .../src/org/apache/flex/createjs/core/UIBase.as | 164 ++++++++++++++++--- .../org/apache/flex/createjs/core/ViewBase.as | 59 ++----- 10 files changed, 361 insertions(+), 88 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/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 202806a..bb2dff6 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 @@ -183,15 +183,16 @@ package org.apache.flex.core // if someone has installed a resize listener, fake an event to run it now if (stage.hasEventListener("resize")) stage.dispatchEvent(new flash.events.Event("resize")); - else + else if (initialView is ILayoutChild) { + var ilc:ILayoutChild = initialView as ILayoutChild; // otherwise, size once like this - if (!isNaN(initialView.percentWidth) && !isNaN(initialView.percentHeight)) - initialView.setWidthAndHeight(stage.stageWidth, stage.stageHeight, true); - else if (!isNaN(initialView.percentWidth)) - initialView.setWidth(stage.stageWidth); - else if (!isNaN(initialView.percentHeight)) - initialView.setHeight(stage.stageHeight); + if (!isNaN(ilc.percentWidth) && !isNaN(ilc.percentHeight)) + ilc.setWidthAndHeight(stage.stageWidth, stage.stageHeight, true); + else if (!isNaN(ilc.percentWidth)) + ilc.setWidth(stage.stageWidth); + else if (!isNaN(ilc.percentHeight)) + ilc.setHeight(stage.stageHeight); } var bgColor:Object = ValuesManager.valuesImpl.getValue(this, "background-color"); if (bgColor != null) @@ -236,7 +237,7 @@ package org.apache.flex.core * @productversion FlexJS 0.0 */ [Bindable("__NoChangeEvent__")] - public var initialView:ViewBase; + public var initialView:IApplicationView; /** * The data model (for the initial view). http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserResizeListener.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserResizeListener.as b/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserResizeListener.as index 644528e..f88201f 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserResizeListener.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserResizeListener.as @@ -113,7 +113,7 @@ COMPILE::AS3 { COMPILE::AS3 { - var initialView:UIBase = app.initialView; + var initialView:UIBase = app.initialView as UIBase; if (!isNaN(initialView.percentWidth) && !isNaN(initialView.percentHeight)) initialView.setWidthAndHeight(Math.max(minWidth, app.stage.stageWidth), Math.max(minHeight, app.stage.stageHeight), true); @@ -124,7 +124,7 @@ COMPILE::AS3 } COMPILE::JS { - var initialView:UIBase = app.initialView; + var initialView:UIBase = app.initialView as UIBase; var element:HTMLElement = app.element; if (!isNaN(initialView.percentWidth) || !isNaN(initialView.percentHeight)) { element.style.height = window.innerHeight.toString() + 'px'; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as new file mode 100755 index 0000000..b011cd1 --- /dev/null +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.core +{ + /** + * The IApplicationView interface is the interface for main + * view of the application. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IApplicationView extends IUIBase + { + /** + * The application model. + * + * @param value The subcomponent to add. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function set applicationModel(value:Object):void; + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as index 376fff7..0230e57 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ViewBase.as @@ -49,7 +49,7 @@ package org.apache.flex.core * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class ViewBase extends ContainerBase implements IPopUpHost + public class ViewBase extends ContainerBase implements IPopUpHost, IApplicationView { /** * Constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as index c6048ff..06ae1fb 100644 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as +++ b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as @@ -46,15 +46,18 @@ package org.apache.flex.createjs [Event(name="initialize", type="org.apache.flex.events.Event")] /** - * FalconJX will inject html into the index.html file. Surround with - * "inject_html" tag as follows: - * - * <inject_html> - * <script src="https://code.createjs.com/easeljs-0.8.1.min.js"></script> - * </inject_html> + * CreateJS Application */ public class Application extends org.apache.flex.core.Application implements IStrand, IFlexInfo { + /** + * FalconJX will inject html into the index.html file. Surround with + * "inject_html" tag as follows: + * + * <inject_html> + * <script src="https://code.createjs.com/easeljs-0.8.1.min.js"></script> + * </inject_html> + */ public function Application() { super(); @@ -78,6 +81,7 @@ package org.apache.flex.createjs // and it provides convenient access to the stage. element = document.createElement('canvas') as WrappedHTMLElement; + element.flexjs_wrapper = this; canvas = element as HTMLCanvasElement; canvas.id = 'flexjsCanvas'; canvas.width = 700; @@ -99,6 +103,8 @@ package org.apache.flex.createjs addElement(initialView); dispatchEvent('viewChanged'); + + stage.update(); } /** @@ -107,7 +113,7 @@ package org.apache.flex.createjs COMPILE::JS override public function addElement(c:Object, dispatchEvent:Boolean = true):void { - stage.addChild(c as DisplayObject); + stage.addChild(c.element as DisplayObject); c.addedToParent(); } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as index d072e82..3ce2d50 100644 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as +++ b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as @@ -26,6 +26,7 @@ package org.apache.flex.createjs { import createjs.Container; import createjs.Shape; + import createjs.Stage; import createjs.Text; import org.apache.flex.createjs.core.UIBase; @@ -78,7 +79,6 @@ package org.apache.flex.createjs container.onClick = clickHandler; this.positioner = this.element; - this.positioner.style.position = 'relative'; return this.element; } @@ -104,7 +104,9 @@ package org.apache.flex.createjs public function set selected(value:Boolean):void { checkMark.visible = value; - (element as Container).getStage().update(); + var stage:Stage = (element as Container).getStage(); + if (stage) + stage.update(); } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as index 3da881a..3540599 100644 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as +++ b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as @@ -18,10 +18,64 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.createjs { - import org.apache.flex.html.Label; - + COMPILE::AS3 + { + import org.apache.flex.html.Label; + } + + COMPILE::JS + { + import createjs.Text; + import createjs.Stage; + + import org.apache.flex.createjs.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + } + + COMPILE::AS3 public class Label extends org.apache.flex.html.Label { } + + COMPILE::JS + public class Label extends UIBase + { + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + override public function createElement():WrappedHTMLElement + { + var text:Text = new Text('default text', '20px Arial', '#ff7700'); + text.x = 0; + text.y = 20; + text.textBaseline = 'alphabetic'; + + positioner = element = text as WrappedHTMLElement; + return element; + } + + + /** + * @flexjsignorecoercion createjs.Text + */ + public function get text():String + { + return (element as Text).text; + } + + /** + * @flexjsignorecoercion createjs.Text + */ + public function set text(value:String):void + { + var text:Text = element as Text; + text.text = value; + var stage:Stage = text.getStage(); + if (stage) + stage.update(); + } + + } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as index 44c9e88..f7a31f9 100644 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as +++ b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as @@ -18,9 +18,23 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.createjs { - import org.apache.flex.core.ITextModel; - import org.apache.flex.html.Button; - + COMPILE::AS3 + { + import org.apache.flex.core.ITextModel; + import org.apache.flex.html.Button; + } + COMPILE::JS + { + import createjs.Container; + import createjs.Text; + import createjs.Shape; + import createjs.Stage; + + import org.apache.flex.createjs.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + } + + COMPILE::AS3 public class TextButton extends Button { public function TextButton() @@ -47,4 +61,58 @@ package org.apache.flex.createjs } } + + COMPILE::JS + public class TextButton extends UIBase + { + private var buttonBackground:Shape; + private var buttonLabel:Text; + private var button:Container; + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + override public function createElement():WrappedHTMLElement + { + buttonBackground = new createjs.Shape(null); + buttonBackground.name = 'background'; + buttonBackground.graphics.beginFill('red'). + drawRoundRect(0, 0, 200, 60, 10); + + buttonLabel = new createjs.Text('button', 'bold 24px Arial', + '#FFFFFF'); + buttonLabel.name = 'label'; + buttonLabel.textAlign = 'center'; + buttonLabel.textBaseline = 'middle'; + buttonLabel.x = 200 / 2; + buttonLabel.y = 60 / 2; + + button = new createjs.Container(); + button.name = 'button'; + button.x = 50; + button.y = 25; + button.addChild(buttonBackground); + button.addChild(buttonLabel); + + positioner = element = button as WrappedHTMLElement; + element.flexjs_wrapper = this; + return element; + } + + + /** + * @flexjsignorecoercion createjs.Text + */ + public function get text():String + { + return buttonLabel.text; + } + + /** + * @flexjsignorecoercion createjs.Text + */ + public function set text(value:String):void + { + buttonLabel.text = value; + } + } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as index b3051d7..10f18ab 100644 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as +++ b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as @@ -22,6 +22,8 @@ package org.apache.flex.createjs.core import org.apache.flex.core.IStrand; import org.apache.flex.core.IBeadModel; import org.apache.flex.core.IBead; + import org.apache.flex.core.IFlexJSElement; + import org.apache.flex.core.IUIBase; import org.apache.flex.events.Event; import org.apache.flex.events.IEventDispatcher; @@ -29,10 +31,11 @@ package org.apache.flex.createjs.core { import createjs.Container; import createjs.DisplayObject; + import createjs.Stage; import org.apache.flex.core.WrappedHTMLElement; } - public class UIBase extends HTMLElementWrapper implements IStrand, IEventDispatcher + public class UIBase extends HTMLElementWrapper implements IStrand, IEventDispatcher, IUIBase, IFlexJSElement { public function UIBase() { @@ -43,9 +46,6 @@ package org.apache.flex.createjs.core } } - COMPILE::JS - public var positioner:WrappedHTMLElement; - /** * @flexjsignorecoercion createjs.Container * @flexjsignorecoercion createjs.DisplayObject @@ -53,7 +53,7 @@ package org.apache.flex.createjs.core COMPILE::JS public function addElement(c:Object, dispatchEvent:Boolean = true):void { - (element as Container).addChild(c as DisplayObject); + (element as Container).addChild(c.element as DisplayObject); } /** @@ -63,7 +63,7 @@ package org.apache.flex.createjs.core COMPILE::JS public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void { - (element as Container).addChildAt(c as DisplayObject, index); + (element as Container).addChildAt(c.element as DisplayObject, index); } @@ -74,7 +74,7 @@ package org.apache.flex.createjs.core COMPILE::JS public function getElementIndex(c:Object):int { - return (element as Container).getChildIndex(c as DisplayObject); + return (element as Container).getChildIndex(c.element as DisplayObject); } @@ -85,7 +85,7 @@ package org.apache.flex.createjs.core COMPILE::JS public function removeElement(c:Object, dispatchEvent:Boolean = true):void { - (element as Container).removeChild(c as DisplayObject); + (element as Container).removeChild(c.element as DisplayObject); } @@ -111,7 +111,7 @@ package org.apache.flex.createjs.core } /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement; + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement */ COMPILE::JS public function createElement():WrappedHTMLElement @@ -119,12 +119,11 @@ package org.apache.flex.createjs.core element = new Container() as WrappedHTMLElement; positioner = this.element; - positioner.style.position = 'relative'; return element; } /** - * @flexjsignorecoercion createjs.Container; + * @flexjsignorecoercion createjs.Container */ COMPILE::JS public function get x():Number @@ -133,19 +132,21 @@ package org.apache.flex.createjs.core } /** - * @flexjsignorecoercion createjs.Container; + * @flexjsignorecoercion createjs.Container */ COMPILE::JS public function set x(value:Number):void { var container:Container = positioner as Container; container.x = value; - container.getStage().update(); + var stage:Stage = container.getStage(); + if (stage) + stage.update(); } /** - * @flexjsignorecoercion createjs.Container; + * @flexjsignorecoercion createjs.Container */ COMPILE::JS public function get y():Number @@ -154,18 +155,20 @@ package org.apache.flex.createjs.core } /** - * @flexjsignorecoercion createjs.Container; + * @flexjsignorecoercion createjs.Container */ COMPILE::JS public function set y(value:Number):void { var container:Container = positioner as Container; container.y = value; - container.getStage().update(); + var stage:Stage = container.getStage(); + if (stage) + stage.update(); } /** - * @flexjsignorecoercion createjs.Container; + * @flexjsignorecoercion createjs.Container */ COMPILE::JS public function get width():Number @@ -174,18 +177,20 @@ package org.apache.flex.createjs.core } /** - * @flexjsignorecoercion createjs.Container; + * @flexjsignorecoercion createjs.Container */ COMPILE::JS public function set width(value:Number):void { var container:Container = positioner as Container; container.width = value; - container.getStage().update(); + var stage:Stage = container.getStage(); + if (stage) + stage.update(); } /** - * @flexjsignorecoercion createjs.Container; + * @flexjsignorecoercion createjs.Container */ COMPILE::JS public function get height():Number @@ -194,14 +199,16 @@ package org.apache.flex.createjs.core } /** - * @flexjsignorecoercion createjs.Container; + * @flexjsignorecoercion createjs.Container */ COMPILE::JS public function set height(value:Number):void { var container:Container = positioner as Container; container.height = value; - container.getStage().update(); + var stage:Stage = container.getStage(); + if (stage) + stage.update(); } COMPILE::AS3 @@ -325,5 +332,118 @@ package org.apache.flex.createjs.core return null; } + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function get visible():Boolean + { + return (positioner as DisplayObject).visible; + } + + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function set visible(value:Boolean):void + { + var oldValue:Boolean = (positioner as DisplayObject).visible; + if (value !== oldValue) + { + if (!value) + { + (positioner as DisplayObject).visible = value; + dispatchEvent(new Event('hide')); + } + else + { + (positioner as DisplayObject).visible = value; + dispatchEvent(new Event('show')); + } + dispatchEvent(new Event('visibleChanged')); + } + } + + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function get alpha():Number + { + return (positioner as DisplayObject).alpha; + } + + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function set alpha(value:Number):void + { + (positioner as DisplayObject).alpha = value; + } + + COMPILE::JS + private var _positioner:WrappedHTMLElement; + + /** + * The HTMLElement used to position the component. + */ + COMPILE::JS + public function get positioner():WrappedHTMLElement + { + return _positioner; + } + + /** + * @private + */ + COMPILE::JS + public function set positioner(value:WrappedHTMLElement):void + { + _positioner = value; + } + + /** + * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher + */ + public function get topMostEventDispatcher():IEventDispatcher + { + COMPILE::AS3 + { + return null; + } + COMPILE::JS + { + var e:WrappedHTMLElement = document.body as WrappedHTMLElement; + return e.flexjs_wrapper as IEventDispatcher; + } + } + + public function addedToParent():void + { + + } + + /** + * @copy org.apache.flex.core.IUIBase#element + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::AS3 + public function get element():IFlexJSElement + { + return this; + } + } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61ee45f0/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as index 3331b8a..b210559 100644 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as +++ b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as @@ -21,25 +21,32 @@ package org.apache.flex.createjs.core COMPILE::AS3 { import flash.display.DisplayObject; + import org.apache.flex.core.ViewBase; } - import org.apache.flex.core.IParent; - import org.apache.flex.core.IUIBase; - import org.apache.flex.events.Event; - import org.apache.flex.utils.MXMLDataInterpreter; + import org.apache.flex.core.IApplicationView; + import org.apache.flex.core.IParent; + import org.apache.flex.core.IUIBase; + import org.apache.flex.events.Event; + import org.apache.flex.utils.MXMLDataInterpreter; + COMPILE::AS3 + public class ViewBase extends org.apache.flex.core.ViewBase + { + + } + [DefaultProperty("mxmlContent")] - public class ViewBase extends UIBase implements IParent + COMPILE::JS + public class ViewBase extends UIBase implements IParent, IApplicationView { public function ViewBase() { super(); } - public function initUI(model:Object):void + override public function addedToParent():void { - _applicationModel = model; - dispatchEvent(new Event("modelChanged")); /* AJH needed? MXMLDataInterpreter.generateMXMLProperties(this, MXMLProperties); */ @@ -68,40 +75,10 @@ package org.apache.flex.createjs.core return _applicationModel; } - COMPILE::AS3 - public function addElement(c:Object, dispatchEvent:Boolean = true):void - { - addChild(c as DisplayObject); - } - - COMPILE::AS3 - public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void - { - addChildAt(c as DisplayObject, index); - } - - COMPILE::AS3 - public function getElementAt(index:int):Object - { - return getChildAt(index); - } - - COMPILE::AS3 - public function getElementIndex(c:Object):int - { - return getChildIndex(c as DisplayObject); - } - - COMPILE::AS3 - public function removeElement(c:Object, dispatchEvent:Boolean = true):void - { - removeChild(c as DisplayObject); - } - - COMPILE::AS3 - public function get numElements():int + public function set applicationModel(value:Object):void { - return numChildren; + _applicationModel = value; + dispatchEvent(new Event("modelChanged")); } }
