0

I am trying to build a button that will active specific Javascript function.

I tried:

getURL("javascript:functionName()");

but its seems like a bad idea (plus it doesn't work)..

or

import flash.external.ExternalInterface;

function call_javascript(evt:MouseEvent):void {
    ExternalInterface.call("functioName()");
}
btn.addEventListener(MouseEvent.MOUSE_UP, call_javascript);

none of this working for me..

3
  • Do you get any errors? Did you add the JavaScript function to your HTML? Commented Aug 23, 2013 at 13:45
  • Is the typo in your example ("functioName()") also in your code? Commented Aug 23, 2013 at 14:43
  • I'm just skimming this, but are you aware that you're trying to call 'functioName' as opposed to 'functionName' in your handler? Commented Aug 23, 2013 at 16:07

2 Answers 2

0

First of all, this is a duplicate. The question has been asked about 10 times before. But, here is an answer for you: ExternalInterface.call("jsFunctionName", argument, argument, ...);. It is very possible. Click here for more details.

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

Comments

0

Your problem is that you are calling it wrong. The 1st param should be the function name without the brackets: ExternalInterface.call("funcionName");

Also note that you will have to have allowScriptAccess set to a value that will actually allow you to call the function (in your example you have sameDomain, which is OK).

1 Comment

I tested the code without the "()" in the .call but still. plus change the allowScriptAccess to always but noting.. jsfiddle.net/g9kYL/1 (this is not going to work - just to show u the code)

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.