How to pass variables inside ActionScript to Javascript

If you want to call a Javascript function inside ActionScript, you can just take this basis:

getURL(“javascript:showpicture(‘images/example.jpg)”);

In addition if you don’t want to hardcode the image which has to be taken for this function, you need variables. But how to pass variables from Flash to Javascript? Here is the solution:

var example:String = “images/example.jpg”;

getURL (“javascript:showpicture(\”"+example+”\”)”);

Very much of the “, but this will work!

Share and Enjoy:
  • Facebook
  • MisterWong
  • del.icio.us
  • MySpace
  • Mixx
  • Digg
  • email
  • Add to favorites
  • MisterWong.DE
  • Gwar
  • Wikio
  • Yahoo! Bookmarks

Leave a Reply