http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IChild.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Core/src/main/flex/org/apache/flex/core/IChild.as index 97423f9,823ecf9..647bea0 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IChild.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IChild.as @@@ -42,18 -42,18 +42,18 @@@ package org.apache.flex.cor * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - COMPILE::AS3 + COMPILE::SWF function get parent():DisplayObjectContainer; - /** - * The parent. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - COMPILE::JS - function get parent():IUIBase; + /** + * The parent. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::JS + function get parent():IUIBase; } }
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IUIBase.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as index 32b1d71,ff25bd0..dcbac3a --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as @@@ -1112,11 -1082,10 +1112,11 @@@ package org.apache.flex.cor * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.IUIBase */ - public function addElement(c:Object, dispatchEvent:Boolean = true):void + public function addElement(c:IVisualElement):IVisualElement { - COMPILE::AS3 + COMPILE::SWF { if (c is IUIBase) { @@@ -1142,11 -1109,10 +1142,11 @@@ * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.IUIBase */ - public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void + public function addElementAt(c:IVisualElement, index:int):IVisualElement { - COMPILE::AS3 + COMPILE::SWF { if (c is IUIBase) { @@@ -1180,11 -1144,11 +1180,11 @@@ * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public function getElementAt(index:int):Object + public function getElementAt(index:int):IVisualElement { - COMPILE::AS3 + COMPILE::SWF { - return getChildAt(index); + return getChildAt(index) as IVisualElement; } COMPILE::JS { @@@ -1200,11 -1164,10 +1200,11 @@@ * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.IUIBase */ - public function getElementIndex(c:Object):int + public function getElementIndex(c:IVisualElement):int { - COMPILE::AS3 + COMPILE::SWF { if (c is IUIBase) return getChildIndex(IUIBase(c).element as DisplayObject); @@@ -1232,11 -1194,10 +1232,11 @@@ * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.IUIBase */ - public function removeElement(c:Object, dispatchEvent:Boolean = true):void + public function removeElement(c:IVisualElement):IVisualElement { - COMPILE::AS3 + COMPILE::SWF { if (c is IUIBase) removeChild(IUIBase(c).element as DisplayObject); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/Event.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/EventDispatcher.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/IEventDispatcher.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/geom/Rectangle.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Display.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Display.as index 9603c3d,0000000..132b797 mode 100644,000000..100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Display.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Display.as @@@ -1,71 -1,0 +1,71 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.utils +{ - COMPILE::AS3 ++ COMPILE::SWF + { + import flash.system.Capabilities; + } + + public class Display + { + public function Display() + { + } + + public static function get dpi():int + { - COMPILE::AS3 ++ COMPILE::SWF + { + return Capabilities.screenDPI; + } + COMPILE::JS + { + // TODO (aharui) + return 96; + } + } + + public static function get width():int + { - COMPILE::AS3 ++ COMPILE::SWF + { + return Capabilities.screenResolutionX; + } + COMPILE::JS + { + return screen.width; + } + } + + public static function get height():int + { - COMPILE::AS3 ++ COMPILE::SWF + { + return Capabilities.screenResolutionY; + } + COMPILE::JS + { + return screen.height; + } + } + } + - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as index d444c93,f280a04..5ee9209 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as @@@ -295,13 -293,16 +295,13 @@@ public class MXMLDataInterprete { comp.setMXMLDescriptor(document, children); } - if (parent && comp is IVisualElement) - { - if (parent is IContainer) - (parent as IContainer).addElementNoChangeEvent(comp as IVisualElement); - else - parent.addElement(comp as IVisualElement); - } - COMPILE::SWF - { - if (parent && comp is DisplayObject) - parent.addElement(comp, !(parent is IContainer)); - } - COMPILE::JS ++ if (parent && comp is IVisualElement) + { - if (parent && comp is IUIBase) - parent.addElement(comp, !(parent is IContainer)); ++ if (parent is IContainer) ++ (parent as IContainer).addElementNoChangeEvent(comp as IVisualElement); ++ else ++ parent.addElement(comp as IVisualElement); + } if (children) { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Platform.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Platform.as index dfce50e,0000000..35725cf mode 100644,000000..100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Platform.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Platform.as @@@ -1,145 -1,0 +1,145 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.utils +{ - COMPILE::AS3 ++ COMPILE::SWF + { + import flash.system.Capabilities; + } + + public class Platform + { + public function Platform() + { + } + + public static const ANDROID:String = "Android"; + public static const BLACKBERRY:String = "Blackberry"; + public static const IOS:String = "IOS"; + public static const MAC:String = "Mac"; + public static const LINUX:String = "Linux"; + public static const WINDOWS:String = "windows"; + + + private static var _isMobile:Boolean; + public static function get isMobile():Boolean + { + return _isMobile; + } + + private static var _isIPad:Boolean; + public static function get isIPad():Boolean + { + return _isIPad; + } + - COMPILE::AS3 ++ COMPILE::SWF + private static var _isAir:Boolean; + + public static function get isAir():Boolean + { - COMPILE::AS3 ++ COMPILE::SWF + { + return _isAir; + } + COMPILE::JS + { + return false; + } + } + + private static var _isBrowser:Boolean; + public static function get isBrowser():Boolean + { + return _isBrowser; + } + + public static function get isFlash():Boolean + { - COMPILE::AS3 ++ COMPILE::SWF + { + return true; + } + COMPILE::JS + { + return false; + } + } + + private static var _platform:String; + + public static function get platform():String + { - COMPILE::AS3 ++ COMPILE::SWF + { + if (!platform) + { + var cap: Class = Capabilities; + var version: String = Capabilities.version; + var os: String = Capabilities.os; + var playerType: String = Capabilities.playerType; + + if (version.indexOf("AND") > -1) + _platform = ANDROID; + else if (version.indexOf('IOS') > -1) + _platform = IOS; + else if (version.indexOf('QNX') > -1) + _platform = BLACKBERRY; + else if (os.indexOf("Mac OS") != -1) + _platform = MAC; + else if (os.indexOf("Windows") != -1) + _platform = WINDOWS; + else if (os.indexOf("Linux") != -1) // note that Android is also Linux + _platform = LINUX; + + + _isIPad = os.indexOf('iPad') > -1; + + _isMobile = (_platform == ANDROID || _platform == IOS || _platform == BLACKBERRY); + + + _isAir = playerType == "Desktop"; + _isBrowser = (playerType == "PlugIn" || playerType == "ActiveX"); + + } + } + COMPILE::JS + { + if (navigator.userAgent.indexOf("iOS") != -1) + _platform = IOS; + else if (navigator.userAgent.indexOf("Android") != -1) + _platform = ANDROID; + else if (navigator.appVersion.indexOf("Win")!=-1) + _platform = WINDOWS; + else if (navigator.appVersion.indexOf("Mac")!=-1) + _platform = MAC; + else if (navigator.appVersion.indexOf("Linux")!=-1) + _platform = LINUX; + + _isIPad = navigator.userAgent.indexOf('iPad') > -1; + + _isMobile = (_platform == ANDROID || _platform == IOS || _platform == BLACKBERRY); + } + return _platform; + } + + } + - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/PointUtils.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Core/src/main/flex/org/apache/flex/utils/PointUtils.as index d9e9c23,be960a9..c661ad3 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/PointUtils.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/PointUtils.as @@@ -58,32 -58,33 +58,32 @@@ package org.apache.flex.util * @productversion FlexJS 0.0 * @flexjsignorecoercion HTMLElement */ - COMPILE::AS3 - public static function globalToLocal( pt:org.apache.flex.geom.Point, local:Object ):org.apache.flex.geom.Point ++ COMPILE::SWF + public static function globalToLocal( pt:flash.geom.Point, local:Object ):org.apache.flex.geom.Point { - COMPILE::SWF - { - var fpt:flash.geom.Point = DisplayObject(local).globalToLocal(pt); - return new org.apache.flex.geom.Point(fpt.x, fpt.y); - } - COMPILE::JS - { - var x:Number = pt.x; - var y:Number = pt.y; - var element:HTMLElement = local.element as HTMLElement; - - do { - x -= element.offsetLeft; - y -= element.offsetTop; - if (local.hasOwnProperty('parent')) { - local = local.parent; - element = local.element as HTMLElement; - } else { - element = null; - } - } - while (element); - return new org.apache.flex.geom.Point(x, y); + var fpt:flash.geom.Point = DisplayObject(local).globalToLocal(pt); + return new org.apache.flex.geom.Point(fpt.x, fpt.y); + } + COMPILE::JS + public static function globalToLocal( pt:org.apache.flex.geom.Point, local:Object ):org.apache.flex.geom.Point + { + var x:Number = pt.x; + var y:Number = pt.y; + var element:HTMLElement = local.element as HTMLElement; + + do { + x -= element.offsetLeft; + y -= element.offsetTop; + if (local.hasOwnProperty('parent')) { + local = local.parent; + element = local.element as HTMLElement; + } else { + element = null; + } } + while (element); + return new org.apache.flex.geom.Point(x, y); } /** @@@ -98,27 -99,27 +98,27 @@@ * @productversion FlexJS 0.0 * @flexjsignorecoercion HTMLElement */ - COMPILE::AS3 ++ COMPILE::SWF + public static function localToGlobal( pt:flash.geom.Point, local:Object ):org.apache.flex.geom.Point + { + var fpt:flash.geom.Point = DisplayObject(local).localToGlobal(pt); + return new org.apache.flex.geom.Point(fpt.x, fpt.y); + } - ++ + COMPILE::JS - public static function localToGlobal( pt:org.apache.flex.geom.Point, local:Object ):org.apache.flex.geom.Point + public static function localToGlobal( pt:org.apache.flex.geom.Point, local:Object ):org.apache.flex.geom.Point { - COMPILE::SWF - { - var fpt:flash.geom.Point = DisplayObject(local).localToGlobal(pt); - return new org.apache.flex.geom.Point(fpt.x, fpt.y); - } - COMPILE::JS - { - var x:Number = pt.x; - var y:Number = pt.y; - var element:HTMLElement = local.element as HTMLElement; - - do { - x += element.offsetLeft; - y += element.offsetTop; - element = element.offsetParent as HTMLElement; - } - while (element); - return new org.apache.flex.geom.Point(x, y); + var x:Number = pt.x; + var y:Number = pt.y; + var element:HTMLElement = local.element as HTMLElement; + + do { + x += element.offsetLeft; + y += element.offsetTop; + element = element.offsetParent as HTMLElement; } + while (element); + return new org.apache.flex.geom.Point(x, y); } } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Proxy.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Proxy.as index 7621e98,d1cec4a..8c2d1a2 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Proxy.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Proxy.as @@@ -42,10 -42,10 +42,10 @@@ COMPILE::J * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - COMPILE::AS3 + COMPILE::SWF public dynamic class Proxy extends flash.utils.Proxy { - private var valueMap:Object = {}; + protected var valueMap:Object = {}; override flash_proxy function getProperty(propName:*):* { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Container.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/UIBase.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/View.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Effects/src/main/flex/org/apache/flex/core/StatesWithTransitionsImpl.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/core/graphics/GraphicsContainer.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Graphics/src/main/flex/org/apache/flex/core/graphics/GraphicsContainer.as index 1fe7283,5ac4e54..ddfa1df --- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/core/graphics/GraphicsContainer.as +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/core/graphics/GraphicsContainer.as @@@ -102,49 -102,7 +102,49 @@@ package org.apache.flex.core.graphic } } - /** - * Draw the rectangle. - * @param x The x position of the top-left corner of the rectangle. - * @param y The y position of the top-left corner. - * @param width The width of the rectangle. - * @param height The height of the rectangle. - * @param rx The width of the ellipse that draws the rounded corners. - * @param ry The height of the ellipse that draws the rounded corners. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0.3 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, rx:Number, ry:Number):void - { - COMPILE::AS3 - { - applyStroke(); - beginFill(new Rectangle(x, y, width, height), new Point(x,y) ); - graphics.drawRoundRect(x, y, width, height, rx, ry); - endFill(); - } - COMPILE::JS - { - var style:String = getStyleStr(); - var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement; - rect.flexjs_wrapper = this; - rect.style.left = x; - rect.style.top = y; - rect.setAttribute('style', style); - rect.setAttribute('x', String(x) + 'px'); - rect.setAttribute('y', String(y) + 'px'); - rect.setAttribute('width', String(width) + 'px'); - rect.setAttribute('height', String(height) + 'px'); - rect.setAttribute('rx', String(rx) + 'px'); - rect.setAttribute('ry', String(ry) + 'px'); - element.appendChild(rect); - } - } - - COMPILE::AS3 ++ /** ++ * Draw the rectangle. ++ * @param x The x position of the top-left corner of the rectangle. ++ * @param y The y position of the top-left corner. ++ * @param width The width of the rectangle. ++ * @param height The height of the rectangle. ++ * @param rx The width of the ellipse that draws the rounded corners. ++ * @param ry The height of the ellipse that draws the rounded corners. ++ * ++ * @langversion 3.0 ++ * @playerversion Flash 10.2 ++ * @playerversion AIR 2.6 ++ * @productversion FlexJS 0.0.3 ++ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement ++ */ ++ public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, rx:Number, ry:Number):void ++ { ++ COMPILE::SWF ++ { ++ applyStroke(); ++ beginFill(new Rectangle(x, y, width, height), new Point(x,y) ); ++ graphics.drawRoundRect(x, y, width, height, rx, ry); ++ endFill(); ++ } ++ COMPILE::JS ++ { ++ var style:String = getStyleStr(); ++ var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement; ++ rect.flexjs_wrapper = this; ++ rect.style.left = x; ++ rect.style.top = y; ++ rect.setAttribute('style', style); ++ rect.setAttribute('x', String(x) + 'px'); ++ rect.setAttribute('y', String(y) + 'px'); ++ rect.setAttribute('width', String(width) + 'px'); ++ rect.setAttribute('height', String(height) + 'px'); ++ rect.setAttribute('rx', String(rx) + 'px'); ++ rect.setAttribute('ry', String(ry) + 'px'); ++ element.appendChild(rect); ++ } ++ } ++ + COMPILE::SWF public function createRect(x:Number, y:Number, width:Number, height:Number):void { var color:uint = (fill as SolidColor).color; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/core/graphics/RoundRect.as ---------------------------------------------------------------------- diff --cc frameworks/projects/Graphics/src/main/flex/org/apache/flex/core/graphics/RoundRect.as index 730da0d,0000000..ee5150e mode 100644,000000..100644 --- a/frameworks/projects/Graphics/src/main/flex/org/apache/flex/core/graphics/RoundRect.as +++ b/frameworks/projects/Graphics/src/main/flex/org/apache/flex/core/graphics/RoundRect.as @@@ -1,130 -1,0 +1,130 @@@ +/** + * Licensed 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.graphics +{ - COMPILE::AS3 ++ COMPILE::SWF + { + import flash.display.CapsStyle; + import flash.display.JointStyle; + import flash.geom.Point; + import flash.geom.Rectangle; + } + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + public class RoundRect extends GraphicShape + { + + /** + * Draw the rectangle. + * @param x The x position of the top-left corner of the rectangle. + * @param y The y position of the top-left corner. + * @param width The width of the rectangle. + * @param height The height of the rectangle. + * @param rx The width of the ellipse that draws the rounded corners. + * @param ry The height of the ellipse that draws the rounded corners. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, rx:Number, ry:Number):void + { - COMPILE::AS3 ++ COMPILE::SWF + { + graphics.clear(); + applyStroke(); + beginFill(new Rectangle(x, y, width, height), new Point(x,y)); + graphics.drawRoundRect(x, y, width, height, rx, ry); + endFill(); + } + COMPILE::JS + { + var style:String = this.getStyleStr(); + var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement; + rect.flexjs_wrapper = this; + rect.setAttribute('style', style); + if (stroke) + { + rect.setAttribute('x', String(stroke.weight / 2) + 'px'); + rect.setAttribute('y', String(stroke.weight / 2) + 'px'); + setPosition(x, y, stroke.weight, stroke.weight); + } + else + { + rect.setAttribute('x', '0' + 'px'); + rect.setAttribute('y', '0' + 'px'); + setPosition(x, y, 0, 0); + } + rect.setAttribute('width', String(width) + 'px'); + rect.setAttribute('height', String(height) + 'px'); + rect.setAttribute('rx', String(rx) + 'px'); + rect.setAttribute('ry', String(ry) + 'px'); + element.appendChild(rect); + + resize(x, y, rect['getBBox']()); + } + } + + override protected function draw():void + { + drawRoundRect(0,0,width,height, rx, ry); + } + + private var _rx:Number; + private var _ry:Number; + + public function get rx():Number + { + return _rx; + } + + /** + * The width of the ellipse used to draw the rounded corners. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion FlexJS 0.0 + */ + public function set rx(value:Number):void + { + _rx = value; + } + + public function get ry():Number + { + return _ry; + } + /** + * The height of the ellipse used to draw the rounded corners. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion FlexJS 0.0 + */ + public function set ry(value:Number):void + { + _ry = value; + } + + + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/HTML/.actionScriptProperties ---------------------------------------------------------------------- diff --cc frameworks/projects/HTML/.actionScriptProperties index 5178ac2,dac63a4..a7c1c92 --- a/frameworks/projects/HTML/.actionScriptProperties +++ b/frameworks/projects/HTML/.actionScriptProperties @@@ -1,6 -1,24 +1,6 @@@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- - -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. - ---> <actionScriptProperties analytics="false" mainApplicationPath="HTML.as" projectUUID="10468643-4626-481f-ba6b-3f035ccbbabb" version="11"> - <compiler additionalCompilerArguments="-locale en_US -define=COMPILE::AS3,true -define=COMPILE::JS,false -load-config=../config/compile-as-config.xml" autoRSLOrdering="true" copyDependentFiles="false" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="target" removeUnusedRSL="true" sourceFolderPath="src/main/flex" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" useFlashSDK="false" verifyDigests="true" warn="true"> + <compiler additionalCompilerArguments="-locale en_US -define=COMPILE::SWF,true -define=COMPILE::JS,false -load-config=../config/compile-as-config.xml" autoRSLOrdering="true" copyDependentFiles="false" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="target" removeUnusedRSL="true" sourceFolderPath="src/main/flex" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" useFlashSDK="false" verifyDigests="true" warn="true"> <compilerSourcePath/> <libraryPath defaultLinkType="0"> <libraryPathEntry kind="4" path=""> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ContainerView.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/WebBrowserView.as ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/config/compile-as-config.xml ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/config/compile-as-config.xml index c8d699d,0000000..55b8403 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/config/compile-as-config.xml +++ b/frameworks/projects/MX/src/main/config/compile-as-config.xml @@@ -1,99 -1,0 +1,99 @@@ +<!-- + + 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. + +--> +<flex-config> + + <compiler> + <accessible>false</accessible> + + <external-library-path> + <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> + <path-element>../../../../../libs/Binding.swc</path-element> + <path-element>../../../../../libs/Core.swc</path-element> + <path-element>../../../../../libs/Graphics.swc</path-element> + <path-element>../../../../../libs/Collections.swc</path-element> + <path-element>../../../../../libs/Reflection.swc</path-element> + </external-library-path> + + <!-- Conditional compilation for the framework performance instrumentation code. --> + <define> + <name>CONFIG::performanceInstrumentation</name> + <value>false</value> + </define> + <define> - <name>COMPILE::AS3</name> ++ <name>COMPILE::SWF</name> + <value>true</value> + </define> + <define> + <name>COMPILE::JS</name> + <value>false</value> + </define> + <define> + <name>COMPILE::LATER</name> + <value>false</value> + </define> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/mx</uri> + <manifest>../resources/mx-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>../flex</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + </include-file> + + <include-sources> + </include-sources> + + <include-classes> + <class>MXClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/flexjs/mx</uri> + </include-namespaces> + + <target-player>${playerglobal.version}</target-player> + + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as index bf0598b,0000000..a0ddc3a mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as @@@ -1,39 -1,0 +1,39 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ - COMPILE::AS3 ++COMPILE::SWF +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; +} +import flex.display.TopOfDisplayList; + +import org.apache.flex.core.IUIBase; +import org.apache.flex.events.IEventDispatcher; +import org.apache.flex.geom.Point; +import org.apache.flex.geom.Rectangle; + +public interface DisplayObject extends IEventDispatcher, IUIBase +{ + include "../../mx/core/IDisplayObjectInterface.as" + + function get topOfDisplayList():TopOfDisplayList; +} - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as index a6b7053,0000000..b992d46 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as @@@ -1,29 -1,0 +1,29 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ + import org.apache.flex.core.IUIBase; + import org.apache.flex.geom.Point; + + public interface DisplayObjectContainer extends InteractiveObject, IUIBase + { + include "../../mx/core/IDisplayObjectContainerInterface.as" + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/Graphics.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/Graphics.as index 55ab4bb,0000000..bee750c mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/Graphics.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/Graphics.as @@@ -1,89 -1,0 +1,89 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ + import org.apache.flex.core.graphics.GraphicsContainer; + import org.apache.flex.core.graphics.SolidColor; + + public class Graphics + { + private var host:GraphicsContainer; + + public function Graphics(host:GraphicsContainer) + { + this.host = host; + } + + public function beginFill(color:uint, alpha:Number = 1.0):void + { + var sc:SolidColor = new SolidColor(); + sc.color = color; + host.fill = sc; + } + + public function drawRect(x:Number, y:Number, width:Number, height:Number):void + { + host.drawRect(x, y, width, height); + } + + public function drawRoundRect(x:Number, y:Number, width:Number, height:Number, rx:Number, ry:Number):void + { + host.drawRoundRect(x, y, width, height, rx, ry); + } + + public function clear():void + { + host.removeAllElements(); + } + + private var lastX:Number = 0; + private var lastY:Number = 0; + + public function moveTo(x:Number, y:Number):void + { + lastX = x; + lastY = y; + } + + public function lineTo(x:Number, y:Number):void + { + var path:String = "M " + lastX.toString() + " " + lastY.toString(); + path += "L " + x.toString() + " " + y.toString(); + host.drawPath(path); + lastX = x; + lastY = y; + } + + public function curveTo(mx:Number, my:Number, x:Number, y:Number):void + { + var path:String = "M " + lastX.toString() + " " + lastY.toString(); + path += "Q " + mx.toString() + " " + my.toString() + " " + + x.toString() + " " + y.toString(); + host.drawPath(path); + lastX = x; + lastY = y; + } + + public function endFill():void + { + // really, we should queue up the drawing commands and execute them here. + } + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/InteractiveObject.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/InteractiveObject.as index b2e542c,0000000..e62ebc4 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/InteractiveObject.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/InteractiveObject.as @@@ -1,35 -1,0 +1,35 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ + public interface InteractiveObject extends DisplayObject + { + /** + * @copy flash.display.InteractiveObject#tabIndex + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + function get tabIndex():int; + function set tabIndex(index:int):void; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/Loader.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/Loader.as index 78bec64,0000000..285b82a mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/Loader.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/Loader.as @@@ -1,27 -1,0 +1,27 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ + // keeps UIComponent happy when compiling + public interface Loader extends DisplayObjectContainer + { + + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/ModuleInfo.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/ModuleInfo.as index 5faeebb,0000000..2ce5c93 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/ModuleInfo.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/ModuleInfo.as @@@ -1,75 -1,0 +1,75 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ - COMPILE::AS3 ++ COMPILE::SWF + { + import flash.display.LoaderInfo; + } + + public class ModuleInfo + { + - COMPILE::AS3 ++ COMPILE::SWF + private var loaderInfo:LoaderInfo; + - COMPILE::AS3 ++ COMPILE::SWF + public function ModuleInfo(loaderInfo:LoaderInfo) + { + this.loaderInfo = loaderInfo; + } + - COMPILE::AS3 ++ COMPILE::SWF + public function get height():Number + { + return loaderInfo.height; + } + - COMPILE::AS3 ++ COMPILE::SWF + public function get width():Number + { + return loaderInfo.width; + } + - COMPILE::AS3 ++ COMPILE::SWF + public function get url():String + { + return loaderInfo.url; + } + + COMPILE::JS + public function get height():Number + { + return document.height; + } + + COMPILE::JS + public function get width():Number + { + return document.width; + } + + COMPILE::JS + public function get url():String + { + return document.URL; + } + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/MovieClip.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/MovieClip.as index 8add311,0000000..b537568 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/MovieClip.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/MovieClip.as @@@ -1,223 -1,0 +1,223 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IBeadView; + import org.apache.flex.core.IFlexJSElement; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + - COMPILE::AS3 ++ COMPILE::SWF + { + import flash.display.MovieClip; + } + COMPILE::JS + { + import flex.display.DisplayObjectContainer; + } + - COMPILE::AS3 ++ COMPILE::SWF + public class MovieClip extends flash.display.MovieClip + { - COMPILE::AS3 ++ COMPILE::SWF + private var _model:IBeadModel; + + /** + * An IBeadModel that serves as the data model for the component. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ - COMPILE::AS3 ++ COMPILE::SWF + public function get model():Object + { + if (_model == null) + { + // addbead will set _model + addBead(new (ValuesManager.valuesImpl.getValue(this, "iBeadModel")) as IBead); + } + return _model; + } + + /** + * @private + */ - COMPILE::AS3 ++ COMPILE::SWF + public function set model(value:Object):void + { + if (_model != value) + { + addBead(value as IBead); + dispatchEvent(new Event("modelChanged")); + } + } + + private var _view:IBeadView; + + /** + * An IBeadView that serves as the view for the component. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion Class + */ + public function get view():IBeadView + { + if (_view == null) + { + var c:Class = ValuesManager.valuesImpl.getValue(this, "iBeadView") as Class; + if (c) + { + if (c) + { + _view = (new c()) as IBeadView; + addBead(_view); + } + } + } + return _view; + } + + /** + * @private + */ + public function set view(value:IBeadView):void + { + if (_view != value) + { + addBead(value as IBead); + dispatchEvent(new Event("viewChanged")); + } + } + + /** + * @copy org.apache.flex.core.IUIBase#element + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get element():IFlexJSElement + { + return this; + } + + /** + * @copy org.apache.flex.core.Application#beads + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var beads:Array; + + private var _beads:Vector.<IBead>; + + /** + * @copy org.apache.flex.core.IStrand#addBead() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + override public function addBead(bead:IBead):void + { + if (!_beads) + _beads = new Vector.<IBead>; + _beads.push(bead); + if (bead is IBeadModel) + _model = bead as IBeadModel; + else if (bead is IBeadView) + _view = bead as IBeadView; + bead.strand = this; + + if (bead is IBeadView) { + IEventDispatcher(this).dispatchEvent(new Event("viewChanged")); + } + } + + /** + * @copy org.apache.flex.core.IStrand#getBeadByType() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function getBeadByType(classOrInterface:Class):IBead + { + for each (var bead:IBead in _beads) + { + if (bead is classOrInterface) + return bead; + } + return null; + } + + /** + * @copy org.apache.flex.core.IStrand#removeBead() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function removeBead(value:IBead):IBead + { + var n:int = _beads.length; + for (var i:int = 0; i < n; i++) + { + var bead:IBead = _beads[i]; + if (bead == value) + { + _beads.splice(i, 1); + return bead; + } + } + return null; + } + + + } + + COMPILE::JS + public class MovieClip extends Sprite + { + public function get totalFrames():int + { + return 1; + } + public function get framesLoaded():int + { + return 1; + } + + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/Shape.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/Shape.as index 2593600,0000000..bfcd184 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/Shape.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/Shape.as @@@ -1,114 -1,0 +1,114 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ + import org.apache.flex.core.graphics.GraphicsContainer; + import org.apache.flex.geom.Point; + import org.apache.flex.utils.PointUtils; + import mx.managers.SystemManagerGlobals; + + public class Shape extends GraphicsContainer + { + COMPILE::JS + private var _name:String; + COMPILE::JS + public function get name():String + { + return _name; + } + COMPILE::JS + public function set name(value:String):void + { + _name = value; + } + + /** + * @flexjsignorecoercion flex.display.TopOfDisplayList + */ + public function get topOfDisplayList():TopOfDisplayList + { + return topMostEventDispatcher as TopOfDisplayList; + } + + COMPILE::JS + /** + * @flexjsignorecoercion flex.display.DisplayObject + */ + public function get root():DisplayObject + { + return topMostEventDispatcher as DisplayObject; + } + + COMPILE::JS + /** + * @flexjsignorecoercion flex.display.DisplayObject + */ + public function contains(child:DisplayObject):Boolean + { + while (child) + { + if (child.parent == this) + return true; + child = child.parent as DisplayObject; + } + return topMostEventDispatcher as DisplayObject; + } + + COMPILE::JS + private var _graphics:Graphics; + + COMPILE::JS + /** + * @flexjsignorecoercion flex.display.DisplayObject + */ + public function get graphics():Graphics + { + if (!_graphics) + _graphics = new Graphics(this); + return _graphics + } + + COMPILE::JS + public function get mouseX():Number + { + var pt:Point = new Point(SystemManagerGlobals.lastMouseEvent.screenX, + SystemManagerGlobals.lastMouseEvent.screenY); + pt = PointUtils.globalToLocal(pt, this); + return pt.x; + } + + COMPILE::JS + public function get mouseY():Number + { + var pt:Point = new Point(SystemManagerGlobals.lastMouseEvent.screenX, + SystemManagerGlobals.lastMouseEvent.screenY); + pt = PointUtils.globalToLocal(pt, this); + return pt.x; + } + + COMPILE::JS + override public function get parent():DisplayObjectContainer + { + return super.parent as DisplayObjectContainer; + } + + } + - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/Sprite.as index 045039e,0000000..6b6d668 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as @@@ -1,179 -1,0 +1,179 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ + import org.apache.flex.core.graphics.GraphicsContainer; + import org.apache.flex.geom.Point; + import org.apache.flex.utils.PointUtils; + import mx.managers.SystemManagerGlobals; + + public class Sprite extends GraphicsContainer implements DisplayObjectContainer + { + COMPILE::JS + private var _name:String; + COMPILE::JS + public function get name():String + { + return _name; + } + COMPILE::JS + public function set name(value:String):void + { + _name = value; + } + + COMPILE::JS + public function get numChildren():int + { + return numElements; + } + + COMPILE::JS + public function getChildAt(index:int):DisplayObject + { + return getElementAt(index) as DisplayObject; + } + + COMPILE::JS + public function getChildByName(name:String):DisplayObject + { + for (var i:int = 0; i < numChildren; i++) + { + if (getChildAt(i).name == name) + return getChildAt(i); + } + return null; + } + + COMPILE::JS + public function getChildIndex(child:DisplayObject):int + { + return getElementIndex(child); + } + + COMPILE::JS + public function setChildIndex(child:DisplayObject, index:int):void + { + removeElement(child); + addElementAt(child, index); + } + + COMPILE::JS + public function addChild(child:DisplayObject):DisplayObject + { + addElement(child); + return child; + } + + COMPILE::JS + public function addChildAt(child:DisplayObject, index:int):DisplayObject + { + addElementAt(child, index); + return child; + } + + COMPILE::JS + public function removeChild(child:DisplayObject):DisplayObject + { + removeElement(child); + return child; + } + + COMPILE::JS + public function removeChildAt(index:int):DisplayObject + { + var child:DisplayObject = getChildAt(index); + removeElement(child); + return child; + } + + /** + * @flexjsignorecoercion flex.display.TopOfDisplayList + */ + public function get topOfDisplayList():TopOfDisplayList + { + return topMostEventDispatcher as TopOfDisplayList; + } + + COMPILE::JS + /** + * @flexjsignorecoercion flex.display.DisplayObject + */ + public function get root():DisplayObject + { + return topMostEventDispatcher as DisplayObject; + } + + COMPILE::JS + /** + * @flexjsignorecoercion flex.display.DisplayObject + */ + public function contains(child:DisplayObject):Boolean + { + while (child) + { + if (child.parent == this) + return true; + child = child.parent as DisplayObject; + } + return topMostEventDispatcher as DisplayObject; + } + + COMPILE::JS + private var _graphics:Graphics; + + COMPILE::JS + /** + * @flexjsignorecoercion flex.display.DisplayObject + */ + public function get graphics():Graphics + { + if (!_graphics) + _graphics = new Graphics(this); + return _graphics + } + + COMPILE::JS + public function get mouseX():Number + { + var pt:Point = new Point(SystemManagerGlobals.lastMouseEvent.screenX, + SystemManagerGlobals.lastMouseEvent.screenY); + pt = PointUtils.globalToLocal(pt, this); + return pt.x; + } + + COMPILE::JS + public function get mouseY():Number + { + var pt:Point = new Point(SystemManagerGlobals.lastMouseEvent.screenX, + SystemManagerGlobals.lastMouseEvent.screenY); + pt = PointUtils.globalToLocal(pt, this); + return pt.x; + } + + COMPILE::JS + override public function get parent():DisplayObjectContainer + { + return super.parent as DisplayObjectContainer; + } + + } + - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as index e5ef3e4,0000000..b56732f mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as @@@ -1,82 -1,0 +1,82 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ - COMPILE::AS3 ++COMPILE::SWF +{ + import flash.display.Stage; +} +COMPILE::JS +{ + import org.apache.flex.core.UIBase; + import org.apache.flex.core.HTMLElementWrapper; + import org.apache.flex.core.WrappedHTMLElement; +} + - COMPILE::AS3 ++COMPILE::SWF +public class TopOfDisplayList extends Stage +{ + public function TopOfDisplayList(stage:Stage) + { + super(); + _stage = stage; + } + + override public function get width():Number + { + return _stage.stageWidth; + } + + override public function get height():Number + { + return _stage.stageHeight; + } + + private var _stage:Stage; + +} + +COMPILE::JS +public class TopOfDisplayList extends Sprite +{ + public function TopOfDisplayList() + { + super(); + } + + /** + * @flexjsignorecoercion flex.display.InteractiveObject + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + public function get focus():InteractiveObject + { + return (document.activeElement as WrappedHTMLElement).flexjs_wrapper as InteractiveObject; + } + + /** + * @flexjsignorecoercion org.apache.flex.core.HTMLElementWrapper + */ + public function set focus(value:InteractiveObject):void + { + document.activeElement = (value as HTMLElementWrapper).element; + } +} + - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/events/ContextMenuEvent.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/events/ContextMenuEvent.as index caad1be,0000000..1bede01 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/ContextMenuEvent.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/ContextMenuEvent.as @@@ -1,12 -1,0 +1,12 @@@ +package flex.events +{ + public class ContextMenuEvent extends Event + { + public function ContextMenuEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + public static const MENU_SELECT:String = "menuSelect"; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/events/Event.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/events/Event.as index db77ff6,0000000..fa60732 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/Event.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/Event.as @@@ -1,23 -1,0 +1,23 @@@ +package flex.events +{ + import org.apache.flex.events.Event; + + public class Event extends org.apache.flex.events.Event + { + public function Event(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + protected var bubbles:Boolean; + protected var cancelable:Boolean; + + public static const ADDED:String = "added"; + public static const CHANGE:String = "change"; + public static const COMPLETE:String = "change"; + public static const ENTER_FRAME:String = "enterFrame"; + public static const REMOVED:String = "removed"; + public static const REMOVED_FROM_STAGE:String = "removedFromStage"; + public static const RESIZE:String = "resize"; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/events/EventPhase.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/events/EventPhase.as index 8f9db3b,0000000..33bdd5d mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/EventPhase.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/EventPhase.as @@@ -1,13 -1,0 +1,13 @@@ +package flex.events +{ + public class EventPhase + { + public function EventPhase() + { + } + + public static const AT_TARGET:int = 2; + public static const BUBBLING_PHASE:int = 3; + public static const CAPTURING_PHASE:int = 1; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/events/FocusEvent.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/events/FocusEvent.as index e529f15,0000000..c7fe636 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/FocusEvent.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/FocusEvent.as @@@ -1,39 -1,0 +1,39 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.events +{ + import flex.display.InteractiveObject; + + public class FocusEvent extends Event + { + public function FocusEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, relatedObject:InteractiveObject = null, + shiftKey:Boolean = false, keyCode:uint = 0, direction:String = "none") + { + super(type, bubbles, cancelable); + this.relatedObject = relatedObject; + } + + public var relatedObject:InteractiveObject; + public var keyCode:uint; + public var shiftKey:Boolean; + + public static const FOCUS_IN:String = "focusIn"; + public static const FOCUS_OUT:String = "focusOut"; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as index e1017e4,0000000..c65a9aa mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/IEventDispatcher.as @@@ -1,10 -1,0 +1,10 @@@ +package flex.events +{ + import org.apache.flex.events.IEventDispatcher; + + public interface IEventDispatcher extends org.apache.flex.events.IEventDispatcher + { + function get bindingEventDispatcher():org.apache.flex.events.IEventDispatcher; + function get effectEventDispatcher():org.apache.flex.events.IEventDispatcher; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/events/IOErrorEvent.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/events/IOErrorEvent.as index bfda542,0000000..ba1acfe mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/IOErrorEvent.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/IOErrorEvent.as @@@ -1,12 -1,0 +1,12 @@@ +package flex.events +{ + public class IOErrorEvent extends Event + { + public function IOErrorEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + public static const IO_ERROR:String = "ioError"; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/events/ProgressEvent.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/events/ProgressEvent.as index 012b376,0000000..5a65b6f mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/ProgressEvent.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/ProgressEvent.as @@@ -1,17 -1,0 +1,17 @@@ +package flex.events +{ + public class ProgressEvent extends Event + { + public function ProgressEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, + bytesLoaded:int = 0, bytesTotal:int = 0) + { + super(type, bubbles, cancelable); + this.bytesLoaded = bytesLoaded; + this.bytesTotal = bytesTotal; + } + + public var bytesLoaded:int; + public var bytesTotal:int; + public static const PROGRESS:String = "progress"; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/events/TimerEvent.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/events/TimerEvent.as index cd41889,0000000..46ee9eb mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/TimerEvent.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/TimerEvent.as @@@ -1,30 -1,0 +1,30 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.events +{ + public class TimerEvent extends Event + { + public function TimerEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + public static const TIMER:String = "timer"; + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/system/DefinitionManager.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/system/DefinitionManager.as index 1730181,0000000..6f3acbe mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/system/DefinitionManager.as +++ b/frameworks/projects/MX/src/main/flex/flex/system/DefinitionManager.as @@@ -1,81 -1,0 +1,81 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.system +{ - COMPILE::AS3 ++COMPILE::SWF +{ + import flash.system.ApplicationDomain; +} + + public class DefinitionManager + { - COMPILE::AS3 ++ COMPILE::SWF + public function DefinitionManager(appdom:ApplicationDomain = null) + { + if (appdom) + this.appdom = appdom; + else + this.appdom = ApplicationDomain.currentDomain; + } + - COMPILE::AS3 ++ COMPILE::SWF + private var appdom:ApplicationDomain; + + public function hasDefinition(name:String):Boolean + { - COMPILE::AS3 ++ COMPILE::SWF + { + return appdom.hasDefinition(name); + } + COMPILE::JS + { + var parts:Array = name.split("."); + var obj:* = window; + for each (var part:String in parts) + { + obj = obj[part]; + if (obj === undefined) + return false; + } + return true; + } + } + + public function getDefinition(name:String):Object + { - COMPILE::AS3 ++ COMPILE::SWF + { + return appdom.getDefinition(name); + } + COMPILE::JS + { + var parts:Array = name.split("."); + var obj:* = window; + for each (var part:String in parts) + { + obj = obj[part]; + if (obj === undefined) + throw new Error("definition not found"); + } + return obj; + } + } + } - } ++} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/flex/system/I18NManager.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/flex/system/I18NManager.as index 68e6cf4,0000000..d95d349 mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/flex/system/I18NManager.as +++ b/frameworks/projects/MX/src/main/flex/flex/system/I18NManager.as @@@ -1,31 -1,0 +1,31 @@@ +package flex.system +{ - COMPILE::AS3 ++ COMPILE::SWF + { + import flash.system.Capabilities; + } + + public class I18NManager + { + public function I18NManager() + { + } + + public static function get languages():Array + { - COMPILE::AS3 ++ COMPILE::SWF + { + // Capabilities.languages was added in AIR 1.1, + // so this API may not exist. + if (Capabilities["languages"]) + return Capabilities["languages"]; + else + return [ Capabilities.language ]; + } + COMPILE::JS + { + return [ navigator.language ]; + } + } + } - } ++}
