So in my AS file I want to call a function like
public function JS(streamUri:String):void{
JavascriptCommand(streamUri)
}
to get my JS code running…
How to do such thing (Example needed)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It sounds like you’re looking for ExternalInterface.call(). Adobe has an article about how to use it to call JavaScript from ActionScript.
You can also use ExternalInterface to expose ActionScript to JavaScript and call functions internal to your SWF from JavaScript.
Let’s say you have a JavaScript function that looks like this:
From your flash file you can call it like this:
And your JavaScript function should be called and alert the user “Hi mom!”.