Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call function from Flash #9

Closed
AssafHason opened this issue Sep 3, 2015 · 4 comments
Closed

Call function from Flash #9

AssafHason opened this issue Sep 3, 2015 · 4 comments

Comments

@AssafHason
Copy link

I want call javascript function from Flash.
I use ExternalInterface in flash action as:

ExternalInterface.call("buttonClicked", buttonNumber);

but where should I put the function buttonClicked in the react and how it get the variable ButtonNumber in react?

Please explain and give us any simple example.
it will be very helpful.

many thanks

@syranide
Copy link
Owner

syranide commented Sep 3, 2015

ReactSWF has no possibility of providing any useful unopinionated abstraction, so you have to do it the same way it's always done. Expose a globally accessible JavaScript function and provide its name through flashVars or w/e to the SWF so that it knows which function to call. So as this is nothing specific to ReactSWF I'd recommend reading up on how to use ExternalInterface in general and building on that.

@AssafHason
Copy link
Author

Thanks, while the ExternalInterface example show that we should put on JS func inside the head tag, we wish to put them inside our React code, thus not in the same scope and not accessible.

Any idea how to access funcs that are defined inside the React code, for example inside a render func?

@syranide
Copy link
Owner

syranide commented Sep 3, 2015

You can't, it has to be a globally accessible function, either with a unique per-swf function name or a shared function with a per-swf identifying argument.

@syranide
Copy link
Owner

syranide commented Oct 9, 2015

FYI #12 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants