flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: FlexJS and ExternalInterface
Date Mon, 23 Nov 2015 19:00:28 GMT


On 11/23/15, 9:43 AM, "Saul Diaz" <cripito.sd@gmail.com> wrote:

>Hey alex.
>
>I love flexJS so far.
>
>Make sense.. I am starting to check all  the examples.
>
>The question is mostly how the pieces communicate. I need the JS  events
>sent to my code  and my code needs to call functions in the js.
>
>In short words Zoiper send there is a call incoming I should send to my
>code and my code can ask Zoiper to answer the call.  Pretty much
>
>Doing this without ExternalInterface maybe tricky.. there is any way the
>JS section can call something from inside the class that's created? And
>vice versa 

In your AS code for the SWF version you would continue to use
ExternalInterface.  The Zoiper class in AS might, for example, override
addEventListener, and call into the Zoiper JS code via ExternalInterface
to register a listener, and when the ZoiperJS code dispatches an event,
code calls back into the SWF via ExternalInterface and dispatches an event
from the Zioper instance in Flash.  I'm guessing that's how your code
works today.

But in your JS version, the Zoiper class's override of addEventListener
would just find the Zoiper instance and call whatever API it is that
listens for an event.  No need for some sort of ExternalInterface
emulation in the middle.

In the 0.5.0 source, there are two classes in
frameworks/projects/Core/as/src/org/apache/flex/core/BrowserResizeListener.
as and BrowserScroller.as.  Both use ExternalInterface to talk to the
browser.  The js/src/ versions don't use External interface at all.  Those
might serve as an example for you.

>
>I think can be doing using createjs/jquery wrapper will let you know how
>my adventure goes
>
><!-- the CreateJS text button component -->
><createjs:TextButton label="CreateJS" /> so I can get the events this
>baby have right?
>
>So creating a class in jquery and calling the jquery wrapper I can call
>all the methods in my class and receive all the events correct?

Yes, that's the theory.

-Alex

Mime
View raw message