public virtual bool contains(AsDisplayObject child)
        {
            if (child == this)
            {
                return(true);
            }
            int childsCount = getNumChildren();
            int i           = 0;

            for (; i < childsCount; ++i)
            {
                AsDisplayObject          currentChild          = mChildren[i];
                AsDisplayObjectContainer currentChildContainer = currentChild as AsDisplayObjectContainer;
                if (currentChildContainer != null && currentChildContainer.contains(child))
                {
                    return(true);
                }
                else
                {
                    if (currentChild == child)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
 public virtual bool contains(AsDisplayObject child)
 {
     if((child == this))
     {
         return true;
     }
     int numChildren = (int)(mChildren.getLength());
     int i = 0;
     for (; (i < numChildren); ++i)
     {
         AsDisplayObject currentChild = mChildren[i];
         AsDisplayObjectContainer currentChildContainer = ((currentChild is AsDisplayObjectContainer) ? ((AsDisplayObjectContainer)(currentChild)) : null);
         if(((currentChildContainer != null) && currentChildContainer.contains(child)))
         {
             return true;
         }
         else
         {
             if((currentChild == child))
             {
                 return true;
             }
         }
     }
     return false;
 }
 public virtual bool contains(AsDisplayObject child)
 {
     if(child == this)
     {
         return true;
     }
     int childsCount = getNumChildren();
     int i = 0;
     for (; i < childsCount; ++i)
     {
         AsDisplayObject currentChild = mChildren[i];
         AsDisplayObjectContainer currentChildContainer = currentChild as AsDisplayObjectContainer;
         if(currentChildContainer != null && currentChildContainer.contains(child))
         {
             return true;
         }
         else
         {
             if(currentChild == child)
             {
                 return true;
             }
         }
     }
     return false;
 }
        public virtual void swapChildrenAt(int index1, int index2)
        {
            AsDisplayObject child1 = getChildAt(index1);
            AsDisplayObject child2 = getChildAt(index2);

            mChildren[index1] = child2;
            mChildren[index2] = child1;
        }
        public virtual void removeChild(AsDisplayObject child, bool dispose)
        {
            int childIndex = getChildIndex(child);

            if (childIndex != -1)
            {
                removeChildAt(childIndex, dispose);
            }
        }
예제 #6
0
 public AsTouch(int id, float globalX, float globalY, String phase, AsDisplayObject target)
 {
     mID = id;
     mGlobalX = mPreviousGlobalX = globalX;
     mGlobalY = mPreviousGlobalY = globalY;
     mTapCount = 0;
     mPhase = phase;
     mTarget = target;
 }
        public virtual AsDisplayObject getRoot()
        {
            AsDisplayObject currentObject = this;

            while (currentObject.getParent() != null)
            {
                currentObject = currentObject.getParent();
            }
            return(currentObject);
        }
        public virtual void setChildIndex(AsDisplayObject child, int index)
        {
            int oldIndex = getChildIndex(child);

            if (oldIndex == -1)
            {
                throw new AsArgumentError("Not a child of this container");
            }
            mChildren.splice(oldIndex, (uint)(1));
            mChildren.splice(index, (uint)(0), child);
        }
        public virtual void swapChildren(AsDisplayObject child1, AsDisplayObject child2)
        {
            int index1 = getChildIndex(child1);
            int index2 = getChildIndex(child2);

            if (index1 == -1 || index2 == -1)
            {
                throw new AsArgumentError("Not a child of this container");
            }
            swapChildrenAt(index1, index2);
        }
        public virtual AsPoint localToGlobal(AsPoint localPoint)
        {
            sTargetMatrix.identity();
            AsDisplayObject currentObject = this;

            while (currentObject != null)
            {
                currentObject.getTransformationMatrix(currentObject.mParent, sHelperMatrix);
                sTargetMatrix.concat(sHelperMatrix);
                currentObject = currentObject.getParent();
            }
            return(sTargetMatrix.transformPoint(localPoint));
        }
예제 #11
0
        public override AsRectangle getBounds(AsDisplayObject targetSpace, AsRectangle resultRect)
        {
            if ((resultRect == null))
            {
                resultRect = new AsRectangle();
            }
            if ((targetSpace == this))
            {
                resultRect.x      = getX();
                resultRect.y      = getY();
                resultRect.width  = mBitmapData.getWidth();
                resultRect.height = mBitmapData.getHeight();
                return(resultRect);
            }
            float minX = AsMathHelper.MAX_NUMBER;
            float maxX = -AsMathHelper.MAX_NUMBER;
            float minY = AsMathHelper.MAX_NUMBER;
            float maxY = -AsMathHelper.MAX_NUMBER;

            getTransformationMatrix(targetSpace, sHelperMatrix);
            sPosition.x = getX();
            sPosition.y = getY();
            AsGlobal.transformCoords(sHelperMatrix, sPosition.x, sPosition.y, sHelperPoint);
            minX        = (((minX < sHelperPoint.x)) ? (minX) : (sHelperPoint.x));
            maxX        = (((maxX > sHelperPoint.x)) ? (maxX) : (sHelperPoint.x));
            minY        = (((minY < sHelperPoint.y)) ? (minY) : (sHelperPoint.y));
            maxY        = (((maxY > sHelperPoint.y)) ? (maxY) : (sHelperPoint.y));
            sPosition.x = (sPosition.x + getBitmapData().getWidth());
            AsGlobal.transformCoords(sHelperMatrix, sPosition.x, sPosition.y, sHelperPoint);
            minX        = (((minX < sHelperPoint.x)) ? (minX) : (sHelperPoint.x));
            maxX        = (((maxX > sHelperPoint.x)) ? (maxX) : (sHelperPoint.x));
            minY        = (((minY < sHelperPoint.y)) ? (minY) : (sHelperPoint.y));
            maxY        = (((maxY > sHelperPoint.y)) ? (maxY) : (sHelperPoint.y));
            sPosition.y = (sPosition.y + getBitmapData().getHeight());
            AsGlobal.transformCoords(sHelperMatrix, sPosition.x, sPosition.y, sHelperPoint);
            minX        = (((minX < sHelperPoint.x)) ? (minX) : (sHelperPoint.x));
            maxX        = (((maxX > sHelperPoint.x)) ? (maxX) : (sHelperPoint.x));
            minY        = (((minY < sHelperPoint.y)) ? (minY) : (sHelperPoint.y));
            maxY        = (((maxY > sHelperPoint.y)) ? (maxY) : (sHelperPoint.y));
            sPosition.x = getX();
            AsGlobal.transformCoords(sHelperMatrix, sPosition.x, sPosition.y, sHelperPoint);
            minX              = (((minX < sHelperPoint.x)) ? (minX) : (sHelperPoint.x));
            maxX              = (((maxX > sHelperPoint.x)) ? (maxX) : (sHelperPoint.x));
            minY              = (((minY < sHelperPoint.y)) ? (minY) : (sHelperPoint.y));
            maxY              = (((maxY > sHelperPoint.y)) ? (maxY) : (sHelperPoint.y));
            resultRect.x      = minX;
            resultRect.y      = minY;
            resultRect.width  = (maxX - minX);
            resultRect.height = (maxY - minY);
            return(resultRect);
        }
예제 #12
0
 public override AsRectangle getBounds(AsDisplayObject targetSpace, AsRectangle resultRect)
 {
     if((resultRect == null))
     {
         resultRect = new AsRectangle();
     }
     if((targetSpace == this))
     {
         resultRect.x = getX();
         resultRect.y = getY();
         resultRect.width = mBitmapData.getWidth();
         resultRect.height = mBitmapData.getHeight();
         return resultRect;
     }
     float minX = AsMathHelper.MAX_NUMBER;
     float maxX = -AsMathHelper.MAX_NUMBER;
     float minY = AsMathHelper.MAX_NUMBER;
     float maxY = -AsMathHelper.MAX_NUMBER;
     getTransformationMatrix(targetSpace, sHelperMatrix);
     sPosition.x = getX();
     sPosition.y = getY();
     AsGlobal.transformCoords(sHelperMatrix, sPosition.x, sPosition.y, sHelperPoint);
     minX = (((minX < sHelperPoint.x)) ? (minX) : (sHelperPoint.x));
     maxX = (((maxX > sHelperPoint.x)) ? (maxX) : (sHelperPoint.x));
     minY = (((minY < sHelperPoint.y)) ? (minY) : (sHelperPoint.y));
     maxY = (((maxY > sHelperPoint.y)) ? (maxY) : (sHelperPoint.y));
     sPosition.x = (sPosition.x + getBitmapData().getWidth());
     AsGlobal.transformCoords(sHelperMatrix, sPosition.x, sPosition.y, sHelperPoint);
     minX = (((minX < sHelperPoint.x)) ? (minX) : (sHelperPoint.x));
     maxX = (((maxX > sHelperPoint.x)) ? (maxX) : (sHelperPoint.x));
     minY = (((minY < sHelperPoint.y)) ? (minY) : (sHelperPoint.y));
     maxY = (((maxY > sHelperPoint.y)) ? (maxY) : (sHelperPoint.y));
     sPosition.y = (sPosition.y + getBitmapData().getHeight());
     AsGlobal.transformCoords(sHelperMatrix, sPosition.x, sPosition.y, sHelperPoint);
     minX = (((minX < sHelperPoint.x)) ? (minX) : (sHelperPoint.x));
     maxX = (((maxX > sHelperPoint.x)) ? (maxX) : (sHelperPoint.x));
     minY = (((minY < sHelperPoint.y)) ? (minY) : (sHelperPoint.y));
     maxY = (((maxY > sHelperPoint.y)) ? (maxY) : (sHelperPoint.y));
     sPosition.x = getX();
     AsGlobal.transformCoords(sHelperMatrix, sPosition.x, sPosition.y, sHelperPoint);
     minX = (((minX < sHelperPoint.x)) ? (minX) : (sHelperPoint.x));
     maxX = (((maxX > sHelperPoint.x)) ? (maxX) : (sHelperPoint.x));
     minY = (((minY < sHelperPoint.y)) ? (minY) : (sHelperPoint.y));
     maxY = (((maxY > sHelperPoint.y)) ? (maxY) : (sHelperPoint.y));
     resultRect.x = minX;
     resultRect.y = minY;
     resultRect.width = (maxX - minX);
     resultRect.height = (maxY - minY);
     return resultRect;
 }
예제 #13
0
        public override AsDisplayObject hitTest(AsPoint localPoint, bool forTouch)
        {
            if (forTouch && (!getVisible() || !getTouchable()))
            {
                return(null);
            }
            AsDisplayObject target = base.hitTest(localPoint, forTouch);

            if (target == null)
            {
                target = this;
            }
            return(target);
        }
        public override AsRectangle getBounds(AsDisplayObject targetSpace, AsRectangle resultRect)
        {
            if (resultRect == null)
            {
                resultRect = new AsRectangle();
            }
            int childsCount = getNumChildren();

            if (childsCount == 0)
            {
                getTransformationMatrix(targetSpace, sHelperMatrix);
                AsGlobal.transformCoords(sHelperMatrix, 0.0f, 0.0f, sHelperPoint);
                resultRect.x     = sHelperPoint.x;
                resultRect.y     = sHelperPoint.y;
                resultRect.width = resultRect.height = 0;
                return(resultRect);
            }
            else
            {
                if (childsCount == 1)
                {
                    return(mChildren[0].getBounds(targetSpace, resultRect));
                }
                else
                {
                    float minX = AsMathHelper.MAX_NUMBER;
                    float maxX = -AsMathHelper.MAX_NUMBER;
                    float minY = AsMathHelper.MAX_NUMBER;
                    float maxY = -AsMathHelper.MAX_NUMBER;
                    int   i    = 0;
                    for (; i < childsCount; ++i)
                    {
                        mChildren[i].getBounds(targetSpace, resultRect);
                        minX = minX < resultRect.x ? minX : resultRect.x;
                        maxX = maxX > resultRect.getRight() ? maxX : resultRect.getRight();
                        minY = minY < resultRect.y ? minY : resultRect.y;
                        maxY = maxY > resultRect.getBottom() ? maxY : resultRect.getBottom();
                    }
                    resultRect.x      = minX;
                    resultRect.y      = minY;
                    resultRect.width  = maxX - minX;
                    resultRect.height = maxY - minY;
                    return(resultRect);
                }
            }
        }
 public virtual void addChildAt(AsDisplayObject child, int index)
 {
     if(((index >= 0) && (index <= getNumChildren())))
     {
         child.removeFromParent();
         mChildren.splice(index, (uint)(0), child);
         child.setParent(this);
         child.dispatchEvent(new AsEvent(AsEvent.ADDED, true));
         if(getStage() != null)
         {
             child.dispatchEventOnChildren(new AsEvent(AsEvent.ADDED_TO_STAGE));
         }
     }
     else
     {
         throw new AsRangeError("Invalid child index");
     }
 }
        public override void render(AsRenderSupport support, float alpha)
        {
            alpha = alpha * this.getAlpha();
            int childsCount = getNumChildren();
            int i           = 0;

            for (; i < childsCount; ++i)
            {
                AsDisplayObject child = mChildren[i];
                if (child.getAlpha() != 0.0f && child.getVisible() && child.getScaleX() != 0.0f && child.getScaleY() != 0.0f)
                {
                    support.pushMatrix();
                    support.transform(child.getTransform().getMatrix());
                    child.render(support, alpha);
                    support.popMatrix();
                }
            }
        }
예제 #17
0
        public virtual void load(AsURLRequest request, AsLoaderContext context)
        {
            mRequest = request;
            String url = request.getUrl();

            if (url.StartsWith("http"))
            {
                throw new NotImplementedException("Http loading not implemented");
            }

            BcTexture2D image = BcResFactory.GetInstance().LoadImage(url);
            AsDebug.assert(image != null, url);

            AsBitmapData bitmapData = new AsBitmapData(image);
            mContent = new AsBitmap(bitmapData);

            Debug.WriteLine("Image loaded: " + url);
            dispatchEvent(new AsEvent(AsEvent.COMPLETE));
        }
        private void getChildEventListeners(AsDisplayObject _object, String eventType, AsVector <AsDisplayObject> listeners)
        {
            AsDisplayObjectContainer container = _object as AsDisplayObjectContainer;

            if (_object.hasEventListener(eventType))
            {
                listeners.push(_object);
            }
            if (container != null && container.getNumChildren() > 0)
            {
                AsVector <AsDisplayObject> children = container.mChildren;
                int numChildren = (int)(children.getLength());
                int i           = 0;
                for (; i < numChildren; ++i)
                {
                    getChildEventListeners(children[i], eventType, listeners);
                }
            }
        }
예제 #19
0
        public virtual void load(AsURLRequest request, AsLoaderContext context)
        {
            mRequest = request;
            String url = request.getUrl();

            if (url.StartsWith("http"))
            {
                throw new NotImplementedException("Http loading not implemented");
            }

            BcTexture2D image = BcResFactory.GetInstance().LoadImage(url);

            AsDebug.assert(image != null, url);

            AsBitmapData bitmapData = new AsBitmapData(image);

            mContent = new AsBitmap(bitmapData);

            Debug.WriteLine("Image loaded: " + url);
            dispatchEvent(new AsEvent(AsEvent.COMPLETE));
        }
 public virtual void removeChildAt(int index, bool dispose)
 {
     if (index >= 0 && index < getNumChildren())
     {
         AsDisplayObject child = mChildren[index];
         child.dispatchEvent(sRemovedEvent);
         if (getStage() != null)
         {
             child.dispatchEventOnChildren(sRemovedFromStageEvent);
         }
         child.setParent(null);
         mChildren.splice(index, (uint)(1));
         if (dispose)
         {
             child.dispose();
         }
     }
     else
     {
         throw new AsRangeError("Invalid child index");
     }
 }
 public virtual void addChildAt(AsDisplayObject child, int index)
 {
     if(mChildren == null)
     {
         mChildren = new AsVector<AsDisplayObject>();
     }
     if(index >= 0 && index <= getNumChildren())
     {
         child.removeFromParent();
         mChildren.splice(index, (uint)(0), child);
         child.setParent(this);
         child.dispatchEvent(sAddedEvent);
         if(getStage() != null)
         {
             child.dispatchEventOnChildren(sAddedToStageEvent);
         }
     }
     else
     {
         throw new AsRangeError("Invalid child index");
     }
 }
 public virtual void addChildAt(AsDisplayObject child, int index)
 {
     if (mChildren == null)
     {
         mChildren = new AsVector <AsDisplayObject>();
     }
     if (index >= 0 && index <= getNumChildren())
     {
         child.removeFromParent();
         mChildren.splice(index, (uint)(0), child);
         child.setParent(this);
         child.dispatchEvent(sAddedEvent);
         if (getStage() != null)
         {
             child.dispatchEventOnChildren(sAddedToStageEvent);
         }
     }
     else
     {
         throw new AsRangeError("Invalid child index");
     }
 }
        public override AsDisplayObject hitTest(AsPoint localPoint, bool forTouch)
        {
            if (forTouch && (!getVisible() || !getTouchable()))
            {
                return(null);
            }
            float localX      = localPoint.x;
            float localY      = localPoint.y;
            int   childsCount = getNumChildren();
            int   i           = childsCount - 1;

            for (; i >= 0; --i)
            {
                AsDisplayObject child = mChildren[i];
                getTransformationMatrix(child, sHelperMatrix);
                AsGlobal.transformCoords(sHelperMatrix, localX, localY, sHelperPoint);
                AsDisplayObject target = child.hitTest(sHelperPoint, forTouch);
                if (target != null)
                {
                    return(target);
                }
            }
            return(null);
        }
 public virtual AsRectangle getBounds(AsDisplayObject targetSpace)
 {
     return(getBounds(targetSpace, null));
 }
 private void getChildEventListeners(AsDisplayObject _object, String eventType, AsVector<AsDisplayObject> listeners)
 {
     AsDisplayObjectContainer container = _object as AsDisplayObjectContainer;
     if(_object.hasEventListener(eventType))
     {
         listeners.push(_object);
     }
     if(container != null && container.getNumChildren() > 0)
     {
         AsVector<AsDisplayObject> children = container.mChildren;
         int numChildren = (int)(children.getLength());
         int i = 0;
         for (; i < numChildren; ++i)
         {
             getChildEventListeners(children[i], eventType, listeners);
         }
     }
 }
 public virtual AsMatrix getTransformationMatrix(AsDisplayObject targetSpace)
 {
     return(getTransformationMatrix(targetSpace, null));
 }
 public virtual AsRectangle getBounds(AsDisplayObject targetSpace)
 {
     return getBounds(targetSpace, null);
 }
 public virtual AsMatrix getTransformationMatrix(AsDisplayObject targetSpace)
 {
     return getTransformationMatrix(targetSpace, null);
 }
예제 #29
0
 public AsTransform(AsDisplayObject displayObject)
 {
     mDisplayObject = displayObject;
     mColorTransform = new AsColorTransform();
     mMatrix = new AsMatrix();
 }
예제 #30
0
 public virtual bool interactsWith(AsDisplayObject target)
 {
     if((getTouch(target) == null))
     {
         return false;
     }
     else
     {
         AsVector<AsTouch> touches = getTouches(target);
         int i = (int)((touches.getLength() - 1));
         for (; (i >= 0); --i)
         {
             if((touches[i].getPhase() != AsTouchPhase.ENDED))
             {
                 return true;
             }
         }
         return false;
     }
 }
예제 #31
0
 public override void removeChild(AsDisplayObject child)
 {
     removeChild(child, false);
 }
 public override AsRectangle getBounds(AsDisplayObject targetSpace, AsRectangle resultRect)
 {
     if(resultRect == null)
     {
         resultRect = new AsRectangle();
     }
     int childsCount = getNumChildren();
     if(childsCount == 0)
     {
         getTransformationMatrix(targetSpace, sHelperMatrix);
         AsGlobal.transformCoords(sHelperMatrix, 0.0f, 0.0f, sHelperPoint);
         resultRect.x = sHelperPoint.x;
         resultRect.y = sHelperPoint.y;
         resultRect.width = resultRect.height = 0;
         return resultRect;
     }
     else
     {
         if(childsCount == 1)
         {
             return mChildren[0].getBounds(targetSpace, resultRect);
         }
         else
         {
             float minX = AsMathHelper.MAX_NUMBER;
             float maxX = -AsMathHelper.MAX_NUMBER;
             float minY = AsMathHelper.MAX_NUMBER;
             float maxY = -AsMathHelper.MAX_NUMBER;
             int i = 0;
             for (; i < childsCount; ++i)
             {
                 mChildren[i].getBounds(targetSpace, resultRect);
                 minX = minX < resultRect.x ? minX : resultRect.x;
                 maxX = maxX > resultRect.getRight() ? maxX : resultRect.getRight();
                 minY = minY < resultRect.y ? minY : resultRect.y;
                 maxY = maxY > resultRect.getBottom() ? maxY : resultRect.getBottom();
             }
             resultRect.x = minX;
             resultRect.y = minY;
             resultRect.width = maxX - minX;
             resultRect.height = maxY - minY;
             return resultRect;
         }
     }
 }
 public virtual int getChildIndex(AsDisplayObject child)
 {
     return mChildren.indexOf(child);
 }
 public virtual void removeChild(AsDisplayObject child, bool dispose)
 {
     int childIndex = getChildIndex(child);
     if(childIndex != -1)
     {
         removeChildAt(childIndex, dispose);
     }
 }
 public virtual void removeChild(AsDisplayObject child)
 {
     removeChild(child, false);
 }
 public virtual void setChildIndex(AsDisplayObject child, int index)
 {
     int oldIndex = getChildIndex(child);
     if(oldIndex == -1)
     {
         throw new AsArgumentError("Not a child of this container");
     }
     mChildren.splice(oldIndex, (uint)(1));
     mChildren.splice(index, (uint)(0), child);
 }
예제 #37
0
 public virtual AsVector<AsTouch> getTouches(AsDisplayObject target)
 {
     return getTouches(target, null);
 }
 public virtual void swapChildren(AsDisplayObject child1, AsDisplayObject child2)
 {
     int index1 = getChildIndex(child1);
     int index2 = getChildIndex(child2);
     if(index1 == -1 || index2 == -1)
     {
         throw new AsArgumentError("Not a child of this container");
     }
     swapChildrenAt(index1, index2);
 }
예제 #39
0
 public virtual AsTouch getTouch(AsDisplayObject target, String phase)
 {
     AsVector<AsTouch> touchesFound = getTouches(target, phase);
     if((touchesFound.getLength() > 0))
     {
         return touchesFound[0];
     }
     else
     {
         return null;
     }
 }
 public virtual void addChild(AsDisplayObject child)
 {
     addChildAt(child, getNumChildren());
 }
 public virtual AsMatrix getTransformationMatrix(AsDisplayObject targetSpace, AsMatrix resultMatrix)
 {
     if(resultMatrix != null)
     {
         resultMatrix.identity();
     }
     else
     {
         resultMatrix = new AsMatrix();
     }
     AsDisplayObject currentObject = this;
     if(targetSpace == this)
     {
         return resultMatrix;
     }
     else
     {
         if(targetSpace == mParent || (targetSpace == null && mParent == null))
         {
             if(mPivotX != 0.0f || mPivotY != 0.0f)
             {
                 resultMatrix.translate(-mPivotX, -mPivotY);
             }
             if(mScaleX != 1.0f || mScaleY != 1.0f)
             {
                 resultMatrix.scale(mScaleX, mScaleY);
             }
             if(mRotation != 0.0f)
             {
                 resultMatrix.rotate(AsMathHelper.toRadians(mRotation));
             }
             if(mX != 0.0f || mY != 0.0f)
             {
                 resultMatrix.translate(mX, mY);
             }
             return resultMatrix;
         }
         else
         {
             if(targetSpace == null)
             {
                 currentObject = this;
                 while(currentObject != null)
                 {
                     currentObject.getTransformationMatrix(currentObject.mParent, sHelperMatrix);
                     resultMatrix.concat(sHelperMatrix);
                     currentObject = currentObject.getParent();
                 }
                 return resultMatrix;
             }
             else
             {
                 if(targetSpace.mParent == this)
                 {
                     targetSpace.getTransformationMatrix(this, resultMatrix);
                     resultMatrix.invert();
                     return resultMatrix;
                 }
             }
         }
     }
     sAncestors.setLength(0);
     AsDisplayObject commonParent = null;
     while(currentObject != null)
     {
         sAncestors.push(currentObject);
         currentObject = currentObject.getParent();
     }
     currentObject = targetSpace;
     while(currentObject != null && sAncestors.indexOf(currentObject) == -1)
     {
         currentObject = currentObject.getParent();
     }
     if(currentObject == null)
     {
         throw new AsArgumentError("Object not connected to target");
     }
     else
     {
         commonParent = currentObject;
     }
     currentObject = this;
     while(currentObject != commonParent)
     {
         currentObject.getTransformationMatrix(currentObject.mParent, sHelperMatrix);
         resultMatrix.concat(sHelperMatrix);
         currentObject = currentObject.getParent();
     }
     sTargetMatrix.identity();
     currentObject = targetSpace;
     while(currentObject != commonParent)
     {
         currentObject.getTransformationMatrix(currentObject.mParent, sHelperMatrix);
         sTargetMatrix.concat(sHelperMatrix);
         currentObject = currentObject.getParent();
     }
     sTargetMatrix.invert();
     resultMatrix.concat(sTargetMatrix);
     return resultMatrix;
 }
예제 #42
0
 public virtual AsPoint getPreviousLocation(AsDisplayObject space)
 {
     throw new AsNotImplementedError();
 }
 public virtual AsRectangle getBounds(AsDisplayObject targetSpace, AsRectangle resultRect)
 {
     throw new AsAbstractMethodError("Method needs to be implemented in subclass");
 }
 public virtual void removeChild(AsDisplayObject child)
 {
     removeChild(child, false);
 }
        public virtual AsMatrix getTransformationMatrix(AsDisplayObject targetSpace, AsMatrix resultMatrix)
        {
            if (resultMatrix != null)
            {
                resultMatrix.identity();
            }
            else
            {
                resultMatrix = new AsMatrix();
            }
            AsDisplayObject currentObject = this;

            if (targetSpace == this)
            {
                return(resultMatrix);
            }
            else
            {
                if (targetSpace == mParent || (targetSpace == null && mParent == null))
                {
                    if (mPivotX != 0.0f || mPivotY != 0.0f)
                    {
                        resultMatrix.translate(-mPivotX, -mPivotY);
                    }
                    if (mScaleX != 1.0f || mScaleY != 1.0f)
                    {
                        resultMatrix.scale(mScaleX, mScaleY);
                    }
                    if (mRotation != 0.0f)
                    {
                        resultMatrix.rotate(AsMathHelper.toRadians(mRotation));
                    }
                    if (mX != 0.0f || mY != 0.0f)
                    {
                        resultMatrix.translate(mX, mY);
                    }
                    return(resultMatrix);
                }
                else
                {
                    if (targetSpace == null)
                    {
                        currentObject = this;
                        while (currentObject != null)
                        {
                            currentObject.getTransformationMatrix(currentObject.mParent, sHelperMatrix);
                            resultMatrix.concat(sHelperMatrix);
                            currentObject = currentObject.getParent();
                        }
                        return(resultMatrix);
                    }
                    else
                    {
                        if (targetSpace.mParent == this)
                        {
                            targetSpace.getTransformationMatrix(this, resultMatrix);
                            resultMatrix.invert();
                            return(resultMatrix);
                        }
                    }
                }
            }
            sAncestors.setLength(0);
            AsDisplayObject commonParent = null;

            while (currentObject != null)
            {
                sAncestors.push(currentObject);
                currentObject = currentObject.getParent();
            }
            currentObject = targetSpace;
            while (currentObject != null && sAncestors.indexOf(currentObject) == -1)
            {
                currentObject = currentObject.getParent();
            }
            if (currentObject == null)
            {
                throw new AsArgumentError("Object not connected to target");
            }
            else
            {
                commonParent = currentObject;
            }
            currentObject = this;
            while (currentObject != commonParent)
            {
                currentObject.getTransformationMatrix(currentObject.mParent, sHelperMatrix);
                resultMatrix.concat(sHelperMatrix);
                currentObject = currentObject.getParent();
            }
            sTargetMatrix.identity();
            currentObject = targetSpace;
            while (currentObject != commonParent)
            {
                currentObject.getTransformationMatrix(currentObject.mParent, sHelperMatrix);
                sTargetMatrix.concat(sHelperMatrix);
                currentObject = currentObject.getParent();
            }
            sTargetMatrix.invert();
            resultMatrix.concat(sTargetMatrix);
            return(resultMatrix);
        }
예제 #46
0
 public override void removeChild(AsDisplayObject child, bool dispose)
 {
     throw new AsIllegalOperationError();
 }
예제 #47
0
 public override void addChildAt(AsDisplayObject child, int index)
 {
     throw new AsIllegalOperationError();
 }
예제 #48
0
 public override void addChildAt(AsDisplayObject child, int index)
 {
     throw new AsIllegalOperationError();
 }
 public virtual AsRectangle getBounds(AsDisplayObject targetSpace, AsRectangle resultRect)
 {
     throw new AsAbstractMethodError("Method needs to be implemented in subclass");
 }
 public virtual void addChild(AsDisplayObject child)
 {
     addChildAt(child, getNumChildren());
 }
예제 #51
0
 public AsTouchData(AsTouch touch, AsDisplayObject target)
 {
     this.touch = touch;
     this.target = target;
 }
 public virtual int getChildIndex(AsDisplayObject child)
 {
     return(mChildren.indexOf(child));
 }
예제 #53
0
 public override void removeChild(AsDisplayObject child)
 {
     removeChild(child, false);
 }
예제 #54
0
 public virtual AsTouch getTouch(AsDisplayObject target)
 {
     return getTouch(target, null);
 }
예제 #55
0
 public override void removeChild(AsDisplayObject child, bool dispose)
 {
     throw new AsIllegalOperationError();
 }
예제 #56
0
 public virtual AsVector<AsTouch> getTouches(AsDisplayObject target, String phase)
 {
     AsVector<AsTouch> touchesFound = new AsVector<AsTouch>();
     int numTouches = (int)(mTouches.getLength());
     int i = 0;
     for (; (i < numTouches); ++i)
     {
         AsTouch touch = mTouches[i];
         bool correctTarget = ((touch.getTarget() == target) || (target is AsDisplayObjectContainer && ((target is AsDisplayObjectContainer) ? ((AsDisplayObjectContainer)(target)) : null).contains(touch.getTarget())));
         bool correctPhase = ((phase == null) || (phase == touch.getPhase()));
         if((correctTarget && correctPhase))
         {
             touchesFound.push(touch);
         }
     }
     return touchesFound;
 }