Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

23.5. Scripting Flash 8

Version 8 of the Flash Player includes a class named ExternalInterface that revolutionizes Flash scripting by greatly simplifying JavaScript-to-Flash communication and Flash-to-JavaScript communication. ExternalInterface defines a static call() function for calling named JavaScript functions and obtaining their return values. It also defines a static addCallback() method for exporting ActionScript functions for use by JavaScript. ExternalInterface is documented in Part IV.

To demonstrate the ease of scripting with ExternalInterface, let's convert Example 23-4 and Example 23-5 to use it. Example 23-6 lists the converted ActionScript code, and Example 23-7 shows the converted JavaScript code (the <object>, <embed>, and <form> tags are not altered from Example 23-5 and are omitted here).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint