Connecting Tech Pros Worldwide Help | Site Map

Calling JavaScript from ActionScript

  #1  
Old May 19th, 2009, 02:28 AM
Member
 
Join Date: May 2009
Location: Goregaon, मुंबई IN :)
Posts: 85
Hello,
I'm beginner to actionscript, I've defined following function in script tag of page

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function showMessage(){
  3.         alert("javascript says: Hello ActionScript");
  4. }
  5. </script>
i want to call it from actionscript,

what i've already wrote is:

Expand|Select|Wrap|Line Numbers
  1. import flash.external.ExternalInterface;
  2.  
  3. on (press) {
  4.     //mx.controls.Alert.show("Hello, world!");
  5.     ExternalInterface.call("showMessage()");
  6. }
neither it shows the alert, nor calls the showMessage function,

reply
  #2  
Old May 20th, 2009, 11:04 AM
Member
 
Join Date: May 2009
Posts: 81

re: Calling JavaScript from ActionScript


Don't you mean ExternalInterface.call("showMessage") instead of ExternalInterface.call("showMessage()") ?
  #3  
Old May 20th, 2009, 11:21 AM
Member
 
Join Date: May 2009
Location: Goregaon, मुंबई IN :)
Posts: 85

re: Calling JavaScript from ActionScript


Got it..

Thanks a million...
Reply

Tags
actionscript, beginner help, javascript


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I access flash function using javascript? teenIce answers 5 September 14th, 2009 03:11 PM
"FOR" loop in flash to load xml data npm answers 3 October 29th, 2008 09:08 PM
problem with flash player vinniurheart answers 7 October 11th, 2007 12:05 PM
Flython? Peter Hansen answers 27 July 18th, 2005 02:59 PM