I have an HTML button that I need to dynamically assign to an AS3 variable when clicked (in order to load an .mp3). I am using externalInterface.call to collect javascript variables - I am just unsure how to change these dynamically when a button is clicked.
Can anybody help me learn with some sample code?
Thanks!
You can use ExternalInterface.addCallback to add a method to your *.swf that can be called from javascript code.
ExternalInterface.addCallback("testMethod", function(message:String) { trace(message) });
And in javascript:
document.getElementById('swf').testMethod('Hello!');