Hi Yishay,

Can you explain why IRenderedObject was needed?

Thanks,
-Alex

On 8/11/16, 5:01 AM, "yish...@apache.org" <yish...@apache.org> wrote:

>Repository: flex-asjs
>Updated Branches:
>  refs/heads/refactor-sprite 4558126d0 -> 971cdf3d1
>
>
>Allow classes that don't implement IChild to have a $displayObject, and
>other changes to make drag&drop work in flash.
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/971cdf3d
>Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/971cdf3d
>Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/971cdf3d
>
>Branch: refs/heads/refactor-sprite
>Commit: 971cdf3d127489e4f38a153552b7ac79faf5b96b
>Parents: 4558126
>Author: yishayw <yishayj...@hotmail.com>
>Authored: Thu Aug 11 15:01:34 2016 +0300
>Committer: yishayw <yishayj...@hotmail.com>
>Committed: Thu Aug 11 15:01:34 2016 +0300
>
>----------------------------------------------------------------------
> .../flex/org/apache/flex/core/Application.as    |  2 +-
> .../flex/org/apache/flex/core/CallLaterBead.as  |  5 +--
> .../main/flex/org/apache/flex/core/IChild.as    | 12 +-----
> .../org/apache/flex/core/IRenderedObject.as     | 44 ++++++++++++++++++++
> .../org/apache/flex/core/WrappedMovieClip.as    | 10 ++++-
> .../flex/org/apache/flex/core/WrappedShape.as   | 10 ++++-
> .../org/apache/flex/core/WrappedSimpleButton.as | 10 ++++-
> .../flex/org/apache/flex/core/WrappedSprite.as  | 10 ++++-
> .../org/apache/flex/core/WrappedTextField.as    |  9 +++-
> .../flex/org/apache/flex/events/DragEvent.as    |  2 +-
> .../beads/controllers/DragMouseController.as    |  6 +--
> .../org/apache/flex/effects/PlatformWiper.as    |  7 ++--
> 12 files changed, 99 insertions(+), 28 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/Application.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.
>as 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.
>as
>index c7cc402..0a9c69a 100644
>--- 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.
>as
>+++ 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.
>as
>@@ -113,7 +113,7 @@ package org.apache.flex.core
>      *  @playerversion AIR 2.6
>      *  @productversion FlexJS 0.0
>      */
>-    public class Application extends ApplicationBase implements IStrand,
>IParent, IEventDispatcher, ISWFApplication, IPopUpHost
>+    public class Application extends ApplicationBase implements IStrand,
>IParent, IEventDispatcher, ISWFApplication, IPopUpHost, IRenderedObject
>     {
>         /**
>          *  Constructor.
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/CallLaterBead.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CallLaterBea
>d.as 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CallLaterBea
>d.as
>index 6944290..6baf02d 100644
>--- 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CallLaterBea
>d.as
>+++ 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CallLaterBea
>d.as
>@@ -20,7 +20,6 @@ package org.apache.flex.core
> {
>     COMPILE::SWF
>     {
>-        import flash.display.DisplayObject;
>         import flash.events.Event;
>     }
>     
>@@ -91,7 +90,7 @@ package org.apache.flex.core
>         {
>             COMPILE::SWF
>             {
>-                (_strand as
>UIHTMLElementWrapper).$displayObject.addEventListener(Event.ENTER_FRAME,
>enterFrameHandler);
>+                (_strand as
>IRenderedObject).$displayObject.addEventListener(Event.ENTER_FRAME,
>enterFrameHandler);
>             }
>             if (calls == null)
>                 calls = [ {thisArg: thisArg, fn: fn, args: args } ];
>@@ -107,7 +106,7 @@ package org.apache.flex.core
>         COMPILE::SWF
>         private function enterFrameHandler(event:Event):void
>         {
>-            (_strand as
>UIHTMLElementWrapper).$displayObject.removeEventListener(Event.ENTER_FRAME
>, enterFrameHandler);
>+            (_strand as
>IRenderedObject).$displayObject.removeEventListener(Event.ENTER_FRAME,
>enterFrameHandler);
>             makeCalls();
>         }
>         
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/IChild.as
>----------------------------------------------------------------------
>diff --git 
>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
>index 30a358f..a391a6e 100755
>--- 
>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
>@@ -18,10 +18,6 @@
> 
>//////////////////////////////////////////////////////////////////////////
>//////
> package org.apache.flex.core
> {
>-COMPILE::SWF
>-{
>-    import flash.display.DisplayObject;
>-}
>     /**
>      *  The IChild interface is the basic interface for a
>      *  component that is parented by another component.
>@@ -31,7 +27,7 @@ COMPILE::SWF
>      *  @playerversion AIR 2.6
>      *  @productversion FlexJS 0.0
>      */
>-    public interface IChild
>+    public interface IChild extends IRenderedObject
>       {
>         
>         /**
>@@ -44,12 +40,6 @@ COMPILE::SWF
>          */
>         function get parent():IParent;
>         
>-        COMPILE::SWF
>-        function get $displayObject():DisplayObject;
>-        
>-        COMPILE::JS
>-        function get element():IFlexJSElement;
>-
>         COMPILE::JS
>         function get positioner():WrappedHTMLElement;
>         
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/IRenderedObject.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IRenderedObj
>ect.as 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IRenderedObj
>ect.as
>new file mode 100644
>index 0000000..7ebee4f
>--- /dev/null
>+++ 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IRenderedObj
>ect.as
>@@ -0,0 +1,44 @@
>+/////////////////////////////////////////////////////////////////////////
>///////
>+//
>+//  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
>+{
>+COMPILE::SWF
>+{
>+    import flash.display.DisplayObject;
>+}
>+    /**
>+     *  The IRenderedObject interface is the basic interface for a
>+     *  component that has been rendered.
>+     * 
>+     *  @langversion 3.0
>+     *  @playerversion Flash 10.2
>+     *  @playerversion AIR 2.6
>+     *  @productversion FlexJS 0.0
>+     */
>+    public interface IRenderedObject
>+      {
>+        
>+        COMPILE::SWF
>+        function get $displayObject():DisplayObject;
>+        
>+        COMPILE::JS
>+        function get element():IFlexJSElement;
>+
>+      }
>+}
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/WrappedMovieClip.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovie
>Clip.as 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovie
>Clip.as
>index ff9ed6d..1b91d63 100644
>--- 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovie
>Clip.as
>+++ 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedMovie
>Clip.as
>@@ -18,13 +18,15 @@
> 
>//////////////////////////////////////////////////////////////////////////
>//////
> package org.apache.flex.core
> {
>+      import flash.display.DisplayObject;
>+
>       COMPILE::SWF
>       {
>           import flash.display.MovieClip;
>       }
> 
>       COMPILE::SWF
>-      public class WrappedMovieClip extends MovieClip implements
>IFlexJSElement
>+      public class WrappedMovieClip extends MovieClip implements
>IFlexJSElement, IRenderedObject
>       {
>         private var _flexjs_wrapper:ElementWrapper;
>         
>@@ -48,5 +50,11 @@ package org.apache.flex.core
>         {
>             _flexjs_wrapper = value;
>         }
>+              
>+              public function get $displayObject():DisplayObject
>+              {
>+                      return this;
>+              }
>+
>       }
> }
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape
>.as 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape
>.as
>index 020b50f..1978fff 100644
>--- 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape
>.as
>+++ 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape
>.as
>@@ -18,13 +18,15 @@
> 
>//////////////////////////////////////////////////////////////////////////
>//////
> package org.apache.flex.core
> {
>+      import flash.display.DisplayObject;
>+
>     COMPILE::SWF
>     {
>         import flash.display.Shape;
>     }
> 
>       COMPILE::SWF
>-      public class WrappedShape extends Shape implements IFlexJSElement
>+      public class WrappedShape extends Shape implements IFlexJSElement,
>IRenderedObject
>       {
>         private var _flexjs_wrapper:ElementWrapper;
>         
>@@ -48,5 +50,11 @@ package org.apache.flex.core
>         {
>             _flexjs_wrapper = value;
>         }
>+              
>+              public function get $displayObject():DisplayObject
>+              {
>+                      return this;
>+              }
>+
>       }
> }
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpl
>eButton.as 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpl
>eButton.as
>index a069f2e..557ddf9 100644
>--- 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpl
>eButton.as
>+++ 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpl
>eButton.as
>@@ -20,12 +20,12 @@ package org.apache.flex.core
> {
>     COMPILE::SWF
>     {
>-        import flash.display.DisplayObject;
>+        import flash.display.DisplayObject;
>         import flash.display.SimpleButton;
>     }
> 
>       COMPILE::SWF
>-      public class WrappedSimpleButton extends SimpleButton implements
>IFlexJSElement
>+      public class WrappedSimpleButton extends SimpleButton implements
>IFlexJSElement, IRenderedObject
>       {
>         public function WrappedSimpleButton(upState:DisplayObject =
>null, overState:DisplayObject = null, downState:DisplayObject = null,
>hitTestState:DisplayObject = null)
>         {
>@@ -55,5 +55,11 @@ package org.apache.flex.core
>         {
>             _flexjs_wrapper = value;
>         }
>+              
>+              public function get $displayObject():DisplayObject
>+              {
>+                      return this;
>+              }
>+              
>       }
> }
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprit
>e.as 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprit
>e.as
>index b77a1d1..0fc230b 100644
>--- 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprit
>e.as
>+++ 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprit
>e.as
>@@ -18,13 +18,15 @@
> 
>//////////////////////////////////////////////////////////////////////////
>//////
> package org.apache.flex.core
> {
>+      import flash.display.DisplayObject;
>+
>       COMPILE::SWF
>       {
>           import flash.display.Sprite;
>       }
> 
>       COMPILE::SWF
>-      public class WrappedSprite extends Sprite implements IFlexJSElement
>+      public class WrappedSprite extends Sprite implements IFlexJSElement,
>IRenderedObject
>       {
> 
>         private var _flexjs_wrapper:ElementWrapper;
>@@ -49,5 +51,11 @@ package org.apache.flex.core
>         {
>             _flexjs_wrapper = value;
>         }
>+              
>+              public function get $displayObject():DisplayObject
>+              {
>+                      return this;
>+              }
>+              
>       }
> }
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextF
>ield.as 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextF
>ield.as
>index c832d62..ae7faf4 100644
>--- 
>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextF
>ield.as
>+++ 
>b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextF
>ield.as
>@@ -18,13 +18,15 @@
> 
>//////////////////////////////////////////////////////////////////////////
>//////
> package org.apache.flex.core
> {
>+      import flash.display.DisplayObject;
>+
>       COMPILE::SWF
>       {
>           import flash.text.TextField;
>       }
> 
>       COMPILE::SWF
>-      public class WrappedTextField extends TextField implements
>IFlexJSElement
>+      public class WrappedTextField extends TextField implements
>IFlexJSElement, IRenderedObject
>       {
> 
>         private var _flexjs_wrapper:ElementWrapper;
>@@ -49,5 +51,10 @@ package org.apache.flex.core
>         {
>             _flexjs_wrapper = value;
>         }
>+              
>+              public function get $displayObject():DisplayObject
>+              {
>+                      return this;
>+              }
>       }
> }
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEv
>ent.as 
>b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEv
>ent.as
>index a226858..3e3c353 100644
>--- 
>a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEv
>ent.as
>+++ 
>b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEv
>ent.as
>@@ -340,7 +340,7 @@ package org.apache.flex.events
>          *  @flexjsignorecoercion org.apache.flex.events.IEventDispatcher
>          *  @flexjsignorecoercion window.Event
>          */
>-        public static function dispatchDragEvent(event:DragEvent,
>target:IEventDispatcher):void
>+        public static function dispatchDragEvent(event:DragEvent,
>target:Object):void
>         {
>             COMPILE::SWF
>             {
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/Dra
>gMouseController.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/co
>ntrollers/DragMouseController.as
>b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/co
>ntrollers/DragMouseController.as
>index 01351b8..407ebb3 100644
>--- 
>a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/co
>ntrollers/DragMouseController.as
>+++ 
>b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/co
>ntrollers/DragMouseController.as
>@@ -210,7 +210,7 @@ package org.apache.flex.html.beads.controllers
>                 {
>                     trace("sending dragStart");
>                     dragEvent = DragEvent.createDragEvent("dragStart",
>event);
>-                    DragEvent.dispatchDragEvent(dragEvent,
>IEventDispatcher(_strand));
>+                    DragEvent.dispatchDragEvent(dragEvent, _strand);
>                     if (DragEvent.dragSource != null)
>                     {
>                         dragging = true;
>@@ -231,7 +231,7 @@ package org.apache.flex.html.beads.controllers
>                 trace("host: " + pt.x.toString() + " " +
>pt.y.toString());
>                 dragImage.x = pt.x + dragImageOffsetX;
>                 dragImage.y = pt.y + dragImageOffsetY;
>-                DragEvent.dispatchDragEvent(dragEvent,
>IEventDispatcher(event.target));
>+                DragEvent.dispatchDragEvent(dragEvent, event.target);
>             }
>         }
>         
>@@ -244,7 +244,7 @@ package org.apache.flex.html.beads.controllers
>             {
>                 trace("sending dragEnd");
>                 dragEvent = DragEvent.createDragEvent("dragEnd", event);
>-                DragEvent.dispatchDragEvent(dragEvent,
>IEventDispatcher(event.target));
>+                DragEvent.dispatchDragEvent(dragEvent, event.target);
>                 event.preventDefault();
>             }
>             dragging = false;
>
>http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/971cdf3d/frameworks/
>projects/Effects/src/main/flex/org/apache/flex/effects/PlatformWiper.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Platfo
>rmWiper.as 
>b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Platfo
>rmWiper.as
>index af35500..0e04f47 100644
>--- 
>a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Platfo
>rmWiper.as
>+++ 
>b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Platfo
>rmWiper.as
>@@ -22,13 +22,14 @@ package org.apache.flex.effects
> 
> COMPILE::SWF
> {
>-    import flash.display.DisplayObject;
>     import flash.geom.Rectangle;
> }
> 
> import org.apache.flex.geom.Rectangle;
> import org.apache.flex.core.IDocument;
> import org.apache.flex.core.IUIBase;
>+import org.apache.flex.core.IRenderedObject;
>+
> 
> /**
>  *  Helper class for Wipe effects.
>@@ -91,7 +92,7 @@ public class PlatformWiper
>         COMPILE::SWF
>         {
>             if (value == null)
>-                DisplayObject(_target).scrollRect = null;
>+                (_target as IRenderedObject).$displayObject.scrollRect =
>null;
>             _target = value;
>         }
>         COMPILE::JS
>@@ -122,7 +123,7 @@ public class PlatformWiper
>     {
>         COMPILE::SWF
>         {
>-            DisplayObject(_target).scrollRect = new
>flash.geom.Rectangle(value.x,value.y,value.width,value.height);
>     
>+            (_target as IRenderedObject).$displayObject.scrollRect = new
>flash.geom.Rectangle(value.x,value.y,value.width,value.height);
>     
>         }
>         COMPILE::JS
>         {
>

Reply via email to