I want to call my update(id) javascript function from my flash menu with actionscript 3. How do I do?
2 Answers
You can use ExternalInterface.call.
import flash.external.ExternalInterface;
ExternalInterface.call('update', id);
1 Comment
calico-cat
This results in nothing... I'm using CS3 and the button handler works, but nothing is happening. Any reason for it?
<script>
function displayCurrentTime()
{
var date = new Date();
return date.toLocaleTimeString();
}
</script>
You can call this function just like you always would, but simply call it like you would any other kind of a getter function where you store the returned value as part of some variable:
var currentTime:string = ExternalInterface.call("displayCurrentTime()");
When this code runs, Flash will call the displayCurrentTime JavaScript function and store the returned value from it in the currentTime variable.