1

I am currently developing an application in Adobe Flex and i have to use some APIs (Google Earth API, Garmin Communicator Plugin API..) which are written in javascript how can i use js inside Flex.

Thanks !!

1 Answer 1

4

You can call a JavaScript-Function with the ExternalInterface.

For example: In your index.template.html-file you can include javascript-code or define some javascript:

<script type="text/javascript" src="./assets/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="./assets/js/jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">   
  function launchEditor() {
    $("#editor").hide();
  }
</script>

If you want to call the function "launchEditor()" you can do this with the following code:

// Run editor
ExternalInterface.call("launchEditor");

You could now send your data from your Flex-Application to your JavaScript and then call the Javascript API.

In your Flex-Application:

// Send data to javascript
ExternalInterface.call("garminSender", data1, data2, data3);

In your JavaScript:

function garminSender(data1, data2, data3) {
 ...
}
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.