You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by OK <OK...@edscha.com> on 2016/03/21 11:55:43 UTC

[FlexJS] Issues with casting to an Interface

Hi,
I continue exploring FlexJS and have following issue wich is hard to explain
for me:

I would like to decouple the view from the rest of my app using interfaces.
With the swc version all works fine, with the js versions it doesn't (0
errors, 0 warnings).
It seems to me that the js version doesn't like it if an interface is given
instead of the view that implements this interface. As soon as I try to cast
to an interface the js version refuse to work.
Perhaps at least it makes no sense to cast to an interface?

I have the following parts:

Main.mxml:
The application file that put it all together.
At applicationComplete event the method setData() is called tree times.

MyInitialView.mxml:
A minimial view that implements IViewMyInitialView.as

IViewMyInitialView.as:
An interface that contains only one method declaration:
setData(data:String):void

TestClass.as:
Expects the interface as constructor argument and implements a getter that
returns it

I pasted all parts with its code into one gist cause probably the code is
better formatted there:
https://gist.github.com/ok-at-github/8c4b94817fde72202231

Thanks for reading and sorry for posting so much probably confusing text. I
tried to reduce it all as best as I can.

Any ideas?

Thanks,
Olaf








--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Issues with casting to an Interface

Posted by OK <OK...@edscha.com>.
Hi Andy,

>Which version of FlexJS are you using?
One of the earliest 0.6.0 builds, so it could be some months old.

>There were bugs with the cross-compiled "as" and "is" operators in 0.5.0
and older versions, but it should >work correctly in the nightly build.
Glad to hear that it might work with the latest build! Unfortunately the
installer doesn't work properly using the company network so I'll looking
forward to do this later at home.

>In this particular case, you can remove the "as IViewMyInitialView" in the
"get view()" function [1] since it's >not needed.
Thanks for pointing that out. In despair of getting it work I tried anything
;-)

Olaf





--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299p12302.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Issues with casting to an Interface

Posted by OK <OK...@edscha.com>.
Alex has fixed the issue and I've just tested it using the nightly build
(20160322) without success.
Probably the fix did not make it into the latest build so I'll wait to the
next build.
Cause I'll probably off from tomorrow afternoon for a few days it will take
some time.

Thanks for help,
Olaf



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299p12348.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Issues with casting to an Interface

Posted by OK <OK...@edscha.com>.
Just successfully tested it, thank you!



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299p12383.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Issues with casting to an Interface

Posted by OK <OK...@edscha.com>.
Hi Andy,
many thanks for reproducing this issue, I appreciate it!

Here's the JIRA ticket (I've just just stolen your words :-)):
https://issues.apache.org/jira/browse/FLEX-35053

Olaf



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299p12325.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Issues with casting to an Interface

Posted by Andy Dufilie <an...@gmail.com>.
Hi Olaf,
The "as" operator is working correctly, but it seems that there is a bug
where the compiler does not respect the implements="..." attribute in MXML.
That information is not being included in the MyInitialView.js output:

MyInitialView.prototype.FLEXJS_CLASS_INFO = { names: [{ name:
'MyInitialView', qName: 'MyInitialView' }] };

Do you want to create a JIRA issue for this?

Andy


On Mon, Mar 21, 2016 at 3:14 PM, OK <OK...@edscha.com> wrote:

> Andy Dufilie wrote
> > Which version of FlexJS are you using?
> > There were bugs with the cross-compiled "as" and "is" operators in 0.5.0
> > and older versions, but it should work correctly in the nightly build.
> >
> > In this particular case, you can remove the "as IViewMyInitialView" in
> the
> > "get view()" function [1] since it's not needed.
> >
> > [1]
> >
> https://gist.github.com/ok-at-github/8c4b94817fde72202231#file-main-mxml-L84
>
> I've just installed the nightly build (0.6.0, build 20160321) but it
> doesn't
> fix the issue :-(
> Is there a way to make sure that the "as/is" bug is really solved with this
> build?
>
> Thanks,
> OLaf
>
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299p12317.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Re: [FlexJS] Issues with casting to an Interface

Posted by OK <OK...@edscha.com>.
Andy Dufilie wrote
> Which version of FlexJS are you using?
> There were bugs with the cross-compiled "as" and "is" operators in 0.5.0
> and older versions, but it should work correctly in the nightly build.
> 
> In this particular case, you can remove the "as IViewMyInitialView" in the
> "get view()" function [1] since it's not needed.
> 
> [1]
> https://gist.github.com/ok-at-github/8c4b94817fde72202231#file-main-mxml-L84

I've just installed the nightly build (0.6.0, build 20160321) but it doesn't
fix the issue :-(
Is there a way to make sure that the "as/is" bug is really solved with this
build?

Thanks,
OLaf




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299p12317.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Issues with casting to an Interface

Posted by OK <OK...@edscha.com>.
Andy Dufilie wrote
> In this particular case, you can remove the "as IViewMyInitialView" in the
> "get view()" function [1] since it's not needed.
> 
> [1]
> https://gist.github.com/ok-at-github/8c4b94817fde72202231#file-main-mxml-L84

Ha, can't believe it: Just removed this not needed "as IViewMyInitialView"
and... it works! :-)))

Thank you!!!

Olaf




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299p12303.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Issues with casting to an Interface

Posted by Andy Dufilie <an...@gmail.com>.
Which version of FlexJS are you using?
There were bugs with the cross-compiled "as" and "is" operators in 0.5.0
and older versions, but it should work correctly in the nightly build.

In this particular case, you can remove the "as IViewMyInitialView" in the
"get view()" function [1] since it's not needed.

[1]
https://gist.github.com/ok-at-github/8c4b94817fde72202231#file-main-mxml-L84

On Mon, Mar 21, 2016 at 6:55 AM, OK <OK...@edscha.com> wrote:

> Hi,
> I continue exploring FlexJS and have following issue wich is hard to
> explain
> for me:
>
> I would like to decouple the view from the rest of my app using interfaces.
> With the swc version all works fine, with the js versions it doesn't (0
> errors, 0 warnings).
> It seems to me that the js version doesn't like it if an interface is given
> instead of the view that implements this interface. As soon as I try to
> cast
> to an interface the js version refuse to work.
> Perhaps at least it makes no sense to cast to an interface?
>
> I have the following parts:
>
> Main.mxml:
> The application file that put it all together.
> At applicationComplete event the method setData() is called tree times.
>
> MyInitialView.mxml:
> A minimial view that implements IViewMyInitialView.as
>
> IViewMyInitialView.as:
> An interface that contains only one method declaration:
> setData(data:String):void
>
> TestClass.as:
> Expects the interface as constructor argument and implements a getter that
> returns it
>
> I pasted all parts with its code into one gist cause probably the code is
> better formatted there:
> https://gist.github.com/ok-at-github/8c4b94817fde72202231
>
> Thanks for reading and sorry for posting so much probably confusing text. I
> tried to reduce it all as best as I can.
>
> Any ideas?
>
> Thanks,
> Olaf
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Issues-with-casting-to-an-Interface-tp12299.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>