Sams Teach Yourself JavaScript in 24 Hours Free Open Book

Sams Teach Yourself JavaScript in 24 Hours

Previous Page
Next Page

JavaScript and Flash

Adobe (formerly Macromedia) Flash is the Web's most popular format for movies and interactive content that require a bit more graphical splendor than HTML and JavaScript can provide. Flash's programming language is similar to JavaScript, and JavaScript can work with Flash.

ActionScript

If you program scripts for a Flash movie, you use a language called ActionScript. You may find that ActionScript has a strong similarity to JavaScript, and for good reasonthe version of ActionScript used in Flash 5.0 and later is based on the same ECMAScript standard that specifies the syntax for JavaScript.

Although the language is the same, Flash programming is quite different from writing JavaScript for the Webyou are scripting Flash objects rather than working with the DOM. However, you'll find that the basic syntax of the language is the same, which makes it easy for a JavaScript programmer to work with Flash when its capabilities are needed.

JavaScript and Flash Communication

JavaScript and Flash can communicate and work together. Adobe's Flash/JavaScript Integration Kit, available as a free download, enables JavaScript to call ActionScript functions within Flash objects, and also enables Flash scripts to call JavaScript functions within the page that contains them.

The Flash/JavaScript Integration Kit works best with Flash Player 6.0 or later, although it also includes basic support for earlier versions of Flash. If you are developing a Flash application and need it to communicate with JavaScript, you can download the kit from http://weblogs.macromedia.com/flashjavascript/.

If you're using an existing Flash object, the author might have already set it up to work with JavaScript, in which case it will have a list of methods available like other plug-in objects.

Embedding Flash with JavaScript

One other common use of JavaScript with Flash is to use JavaScript to generate the <object> or <embed> tag to embed a Flash object. Although you could use HTML directly, using JavaScript enables you to sidestep Internet Explorer's warning dialog that pops up whenever an embedded object is in use. JavaScript can also pass parameters, such as the user's screen size, to Flash by writing them into the <embed> or <object> tag.

Did you Know?

Microsoft added the warning dialog for embedded objects in response to a patent dispute. See the Try It Yourself section later this hour for an example that uses JavaScript to embed objects in a page and avoid this warning.


Previous Page
Next Page
Index: [SYMBOL][A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][P][Q][R][S][T][U][V][W][X][Y]


     Main Menu
Sams Teach Yourself JavaScript in 24 Hours
Table of Contents
Copyright
About the Author
Acknowledgments
Part I: Introducing the Concept of Web scripting and the JavaScript Language
Part II: Learning JavaScript Basics
Part III: Learning More About the DOM
Part IV: Working with Advanced JavaScript Features
Part V: Building Multimedia Applications with JavaScript
Hour 19. Using Graphics and Animation
Hour 20. Working with Sound and Plug-Ins
Introducing Plug-Ins
JavaScript and Flash
Playing Sounds with JavaScript
Testing Sounds in JavaScript
Summary
Q&A
Quiz Questions
Quiz Answers
Exercises
Part VI: Creating Complex Scripts
Part VII: Appendixes
Index


More Books
PHP Hacks
Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
The Koran (Holy Qur'an)
Macromedia Flash 8 Bible
Search Engine Optimization for Dummies
YouTube Traffic
PHP 5 for Dummies
Harry Potter and The Chamber of Secrets
Harry Potter and the Sorcerer's Stone
The Pilgrim's Progress
Wireless Hacks
Flash Hacks. 100 Industrial-Strength Tips & Tools
PayPal Hacks. 100 Industrial-Strength Tips and Tools
Amazon Hacks
Pdf Hacks
The Da Vinci Code
Google Hacks
The Holy Bible
Windows XP For Dummies
Harry Potter and the Half-Blood Prince
Seo Book
Upgrading and Repairing Networks
Macromedia Dreamweaver 8 UNLEASHED
Windows XP Annoyances
Windows XP Hacks
Microsoft Windows XP Power Toolkit
Teach Yourself MS Office In 24Hours
iPod & iTunes Missing Manual
PC Hacks 100 Industrial-Strength Tips and Tools
PC Overclocking, Optimization, and Tuning - 2th Edition
PC Hardware In A Nutshell 3rd Edition
PC Hardware in a Nutshell, 2nd Edition
Upgrading and Repairing PCs
Google for Dummies
MySQL Cookbook
Teach Yourself Macromedia Flash 8 In 24 Hours
PHP CookBook
Sams Teach Yourself JavaScript in 24 Hours
PHP5 Manual
Free Games Paper Airplanes
500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele