http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc11d5a3/frameworks/projects/MX/src/main/flex/mx/utils/NameUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/NameUtil.as b/frameworks/projects/MX/src/main/flex/mx/utils/NameUtil.as index e8f0823..4f8f53d 100644 --- a/frameworks/projects/MX/src/main/flex/mx/utils/NameUtil.as +++ b/frameworks/projects/MX/src/main/flex/mx/utils/NameUtil.as @@ -20,9 +20,10 @@ package mx.utils { -import flash.display.DisplayObject; -import flash.utils.getQualifiedClassName; +import org.apache.flex.reflection.getQualifiedClassName; + import mx.core.IRepeaterClient; +import mx.core.IUIComponent; /** * The NameUtil utility class defines static methods for @@ -108,9 +109,11 @@ public class NameUtil * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 + * + * @flexjsignorecoercion mx.core.IUIComponent */ public static function displayObjectToString( - displayObject:DisplayObject):String + displayObject:IUIComponent):String { var result:String; @@ -118,13 +121,13 @@ public class NameUtil // to build up the string to return. try { - for (var o:DisplayObject = displayObject; + for (var o:IUIComponent = displayObject; o != null; - o = o.parent) + o = o.parent as IUIComponent) { // If this object is in the display tree, // stop after we've prepended the topmost Application instance. - if (o.parent && o.stage && o.parent == o.stage) + if (o.parent && o.topOfDisplayList && o.parent == o.topOfDisplayList) break; // Prefer id over name if specified. @@ -140,8 +143,13 @@ public class NameUtil result = result == null ? s : s + "." + result; } } - catch (e:SecurityError) + catch (e:Error) { + COMPILE::AS3 + { + if (!(e is SecurityError)) + throw e; + } // Ignore error and continue with what we have. // We may not have access to our parent if we are loaded into a sandbox. }
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc11d5a3/frameworks/projects/MX/src/main/flex/mx/utils/ObjectUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/ObjectUtil.as b/frameworks/projects/MX/src/main/flex/mx/utils/ObjectUtil.as index fba73e5..a7d9bc7 100644 --- a/frameworks/projects/MX/src/main/flex/mx/utils/ObjectUtil.as +++ b/frameworks/projects/MX/src/main/flex/mx/utils/ObjectUtil.as @@ -24,12 +24,12 @@ COMPILE::AS3 { import flash.utils.ByteArray; import flash.utils.Dictionary; - import flash.utils.getQualifiedClassName; import flash.xml.XMLNode; } - import mx.collections.IList; +import org.apache.flex.reflection.getQualifiedClassName; + /** * The ObjectUtil class is an all-static class with methods for * working with Objects within Flex. @@ -887,7 +887,14 @@ public class ObjectUtil } // now that we know we have the same properties, let's compare the values - var propName:QName; + COMPILE::AS3 + { + var propName:QName; + } + COMPILE::JS + { + var propName:String; + } var aProp:Object; var bProp:Object; for (var i:int = 0; i < aProps.length; i++) @@ -1112,7 +1119,10 @@ public class ObjectUtil n = properties.length(); var uris:Array = options.uris; var uri:String; - var qName:QName; + COMPILE::AS3 + { + var qName:QName; + } for (i = 0; i < n; i++) { prop = properties[i]; @@ -1125,55 +1135,59 @@ public class ObjectUtil if (!options.includeTransient && internalHasMetadata(metadataInfo, p, "Transient")) continue; - if (uris != null) - { - if (uris.length == 1 && uris[0] == "*") - { - qName = new QName(uri, p); - try - { - obj[qName]; // access the property to ensure it is supported - propertyNames.push(); - } - catch(e:Error) - { - // don't keep property name - } - } - else - { - for (var j:int = 0; j < uris.length; j++) - { - uri = uris[j]; - if ([email protected]() == uri) - { - qName = new QName(uri, p); - try - { - obj[qName]; - propertyNames.push(qName); - } - catch(e:Error) - { - // don't keep property name - } - } - } - } - } - else if (uri.length == 0) - { - qName = new QName(uri, p); - try - { - obj[qName]; - propertyNames.push(qName); - } - catch(e:Error) - { - // don't keep property name - } - } + COMPILE::AS3 + { + if (uris != null) + { + if (uris.length == 1 && uris[0] == "*") + { + qName = new QName(uri, p); + try + { + obj[qName]; // access the property to ensure it is supported + propertyNames.push(); + } + catch(e:Error) + { + // don't keep property name + } + } + else + { + for (var j:int = 0; j < uris.length; j++) + { + uri = uris[j]; + if ([email protected]() == uri) + { + qName = new QName(uri, p); + try + { + obj[qName]; + propertyNames.push(qName); + } + catch(e:Error) + { + // don't keep property name + } + } + } + } + } + else if (uri.length == 0) + { + qName = new QName(uri, p); + try + { + obj[qName]; + propertyNames.push(qName); + } + catch(e:Error) + { + // don't keep property name + } + } + + } } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fc11d5a3/frameworks/projects/MX/src/main/flex/mx/utils/OnDemandEventDispatcher.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/OnDemandEventDispatcher.as b/frameworks/projects/MX/src/main/flex/mx/utils/OnDemandEventDispatcher.as index c4a0d3b..013d4bd 100644 --- a/frameworks/projects/MX/src/main/flex/mx/utils/OnDemandEventDispatcher.as +++ b/frameworks/projects/MX/src/main/flex/mx/utils/OnDemandEventDispatcher.as @@ -80,7 +80,7 @@ COMPILE::JS _dispatcher.addEventListener(type,listener,useCapture,priority,useWeakReference); } COMPILE::JS - public function addEventListener(type:String, listener:Function, useCapture:Boolean = false):void + public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, handlerScope:Object = null):void { if (_dispatcher == null) { @@ -98,12 +98,20 @@ COMPILE::JS * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function dispatchEvent(event:Event):Boolean { if (_dispatcher != null) return _dispatcher.dispatchEvent(event); return true; } + COMPILE::JS + public function dispatchEvent(event:Object):Boolean + { + if (_dispatcher != null) + return _dispatcher.dispatchEvent(event); + return true; + } /** * @inheritDoc @@ -128,11 +136,18 @@ COMPILE::JS * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void { if (_dispatcher != null) _dispatcher.removeEventListener(type,listener,useCapture); } + COMPILE::JS + public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false, handlerScope:Object = null):void + { + if (_dispatcher != null) + _dispatcher.removeEventListener(type,listener,useCapture); + } /** * @inheritDoc @@ -142,6 +157,7 @@ COMPILE::JS * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function willTrigger(type:String):Boolean { if (_dispatcher != null)
