flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FlexJS] subclassed Flash classes and casting
Date Mon, 11 Jul 2016 05:18:46 GMT

On 7/10/16, 1:32 PM, "Harbs" <harbs.lists@gmail.com> wrote:

>I just added some casting to Point, Rectangle and Matrix. The reason for
>this is that Flex objects are expecting org.apache.flex.geom instead of
>flash.geom classes. Any objects originating from Flash causes compiler
>errors on the Flex side.
>I’m sure there are other classes which have this issue (MouseEvent and
>its Point objects come to mind. If folks could keep this in mind when
>working on these kinds of classes, that would be great.
>I ran into one issue related to this that I did not find a solution for:
>Rectangle has a few getters and setters which take and return Point
>objects (i.e. size, topLeft and bottomRight). Changing the getters to
>return org.apache.flex.geom.Point works, but I get a mismatch warning
>because the setters are type flash.geom.Point. The setter probably SHOULD
>be flash.geom.Point, but even trying to change them to
>org.apache.flex.geom.Point did not work because the compiler complains of
>an incompatible override.
>Is there any way around this problem?

Maybe.  I think we could try not having org.apache.flex.geom.Rectangle
extend flash.geom.Rectangle. Some utility/static method would convert
to/from flash.geom.Rectangle as needed.  I think it would make for an
extra step when using Flash APIs, but maybe that is less painful than what
we have now.

It might be possible to do some compiler tricks.  I haven't thought it all
through, but what if the compiler always resolved
org.apache.flex.geom.Rectangle as flash.geom.Rectangle?


View raw message