Macromedia Flash 8 Bible Free Open Book

Macromedia Flash 8 Bible

Previous Page
Next Page

Writing ActionScript with Dreamweaver

When creating large Flash movies, many programmers choose to keep their ActionScript in external text files — typically saved with the .as file extension. There are many benefits to this method:

  • You can start building libraries of code external to your .fla files, making it easier to reuse code in Flash movies that share common routines.

  • You don't have to work in the ActionScript window in Flash, which some coders find cramped and difficult to navigate, especially when writing large amounts of code.

  • You can take advantage of enhanced coding features in Dreamweaver 8, such as the flexible collapse and expand options and quick access to code snippets in the new Coding toolbar.

  • You can modularize your code files, allowing different developers to work on different parts of the same Flash movie simultaneously.

  • When code files are stored externally, you can use a version control system to track changes.

Since Dreamweaver MX, the Dreamweaver coding environment has supported external ActionScript files with full syntax coloring and code hinting features. This makes the process of creating code files much less error-prone than it was in early versions of Dreamweaver, where most methods of editing external ActionScript didn't offer any means of syntax checking.

Code hinting in Dreamweaver creates pop-up menus that automatically appear when you're typing the name of an object, as is true in the ActionScript panel in Flash. For example, if your object name ends in _mc, the code hint menu will show the methods and properties for a movieClip object. If your object name ends in xmlsocket, you see the methods and properties for an XMLSocket object.

Tip 

If you aren't using standard suffixes in your ActionScript and want to force code hints to appear, press Ctrl+spacebar.

To create an ActionScript .as file in Dreamweaver 8, follow these steps:

  1. In Dreamweaver, click More in the Create New column of the Start page (or if you are already in the authoring environment, choose File ð New from the application menu). Select ActionScript from the Basic page Category in the New Document dialog box and click the Create button.

  2. A new page opens in Code view with a comment at the start to indicate an ActionScript document file. You can begin writing ActionScript by typing directly in the code window.

  3. When you save the file, it is automatically given the .as extension; this is the format that will be recognized by Flash.

Some ActionScript is well-suited to being written in external files — long routines, groups of functions, and object definitions, for example.

New Feature 

The new Coding toolbar on the left side of the Code view window is a huge timesaver. The options to collapse or expand sections of code and to store and access custom code snippets are invaluable if you do any serious coding in Dreamweaver.

Cross-Reference 

To find documentation on these features, search Dreamweaver Help for "Snippets" or "Coding toolbar."

Though it may seem counterintuitive, it's practical to have more — rather than fewer — external files when writing code. A common method is to use a separate .as file for each object definition within your Flash project. In the Flash authoring environment, use the #include command in your Flash movie to load the code from an external file. External ActionScript is only included in the Flash movie when the .swf is published, so it will not be added to your .fla file. If you change any code in the external file, you'll need to publish the .swf again to include the changed ActionScript.

Cross-Reference 

For more information about using the #include directive to load external ActionScript from .as files into Flash movie files (.swf), refer to Chapter 35, "Building an Image Gallery Component."

Dreamweaver also has support for creating a wide range of other code format files, including ActionScript Communication files (.asc) and ActionScript Remote files (.asr). These are used with advanced ActionScripting features.

Cross-Reference 

For more details on ActionScript remoting and communications, refer to the Flash 8 ActionScript Bible (Wiley, 2006).


Previous Page
Next Page
Index: [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][Z]


     Main Menu
Table of Contents
Back Cover
Macromedia Flash 8 Bible
Foreword
Preface
Part I: An Introduction to Flash Web Production
Part II: Mastering the Flash Environment
Part III: Creating Animation and Effects
Part IV: Integrating Media Files with Flash
Part V: Adding Basic Interactivity to Flash Movies
Part VI: Distributing Flash Movies
Part VII: Approaching ActionScript
Part VIII: Applying ActionScript
Part IX: Integrating Components and Data-Binding
Part X: Expanding Flash
Chapter 36: Working with Raster Graphics
Chapter 37: Working with Vector Graphics
Chapter 38: Working with Dreamweaver 8
Why Use Dreamweaver with Flash?
What's New in Dreamweaver 8?
Importing Flash into Dreamweaver
Launch and Edit Flash from Dreamweaver
Using Built-In Flash Objects
Using Flash Elements
Adding Dreamweaver Behaviors
Site Map and Link Checker
Writing ActionScript with Dreamweaver
Summary
Part XI: Appendixes
Index
List of Figures
List of Tables
List of Listings
List of Sidebars


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