0

Is there a way to call flex module from Javascript?

The context: I'm running flex app with embedded HTML/Javascript, and I have to call flex module from this app from Javascript.

Maybe I have to make the module standalone?

I also found this approach with ExternalInterface: http://www.flexafterdark.com/docs/Flex-JavaScript

Is that the solution? Expose a callback which loads and opens the module?

Thanks

1 Answer 1

1

ExternalInterface is the way to do it.

If all you want to do is load and open the module, just use ExternalInterface.addCallback to create a callback to a function that loads and opens the module as you would normally.

If you need to be able to call functions on the module after it's loaded, for every method you want to be able to use from JavaScript, you can use ExternalInterface.addCallback to register it. Or you can get fancy and use describeType to get all the public methods of the module, and register them in a loop, rather than specifying them one by one.

Keep in mind that you can't pass complex objects over the ExternalInterface. Typed JS objects become generic { } objects. Functions become null.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.