Macromedia Flash 8 Bible Free Open Book

Macromedia Flash 8 Bible

Previous Page
Next Page

Adding Dreamweaver Behaviors

Dreamweaver 8 also includes several prewritten JavaScript behaviors to supply a variety of different client-side interactions. These include routines to perform image rollovers and DHTML functions. There are two routines that are of particular interest to Flash developers: the Check Plugin behavior and the Control Shockwave or Flash behavior.

Caution 

Unfortunately, browser compatibility on the Mac side for JavaScript behaviors is not as robust as it is for Windows. For a complete list of features supported by specific browsers on Mac and Windows, visit www.macromedia.com/go/tn_14159. It is always a good idea to test any JavaScript on all the target browsers that you expect to support.

Check Plugin Behavior

While this is not the most foolproof way of detecting Flash, it's quick and easy to implement.

  1. Create a new Dreamweaver document or open an existing one.

  2. Select an element on the page such as an image or a link. If you want to apply the behavior to the entire page, click the <body> tag in the tag selector at the bottom left of the Document window.

  3. In the Behaviors tab of the Tag inspector panel (Window ð Tag inspector, or Alt+Shift+F9), click in the event column on the left-hand side to invoke a drop-down menu icon that you can use to select an event that will trigger the Check Plugin behavior (after it is added), as shown in Figure 38-18.

  4. Next click the Add (+) button and select the Check Plugin behavior from the drop-down list, as shown in Figure 38-19.

  5. The Check Plugin dialog box opens, as shown in Figure 38-20. Select Flash from the Plugin drop-down menu.

  6. In the If found, Go to URL field, enter the path to the page that you want to load if the visitor has the Flash Player. This can be a relative or an absolute address.

  7. In the Otherwise, go to URL field, specify an alternative page to go to if the visitor does not have the Flash Player. This can be a relative or an absolute address.

  8. Click OK. The Behaviors panel should show the Check Plugin behavior and the event on which it happens, typically the onLoad event, as shown in Figure 38-21.

Image from book
Figure 38-18: Select an event to associate with a behavior — the most common event for the Check Plugin behavior is onLoad.
Image from book
Figure 38-19: Click the Add button (+) in the Behaviors panel to select from a list of common JavaScript and DHTML functions.
Image from book
Figure 38-20: The Check Plugin behavior enables you to apply simple Flash detection easily.
Image from book
Figure 38-21: The event associated with the behavior can be changed, but onLoad is generally used for the Check Plugin behavior.

Should you need to modify the behavior settings, double-click the behavior text in the Tag inspector to reopen the Check Plugin dialog box. You can also click once in the event text area of the Tag inspector to activate the drop-down menu used to select a different trigger event for the behavior.

Control Shockwave or Flash Behavior

This enables simple JavaScript control of a Flash movie, telling the movie to Play, Stop, Rewind, or Go To a certain frame. You can apply these behaviors to regular HTML images or hyperlinks and use them to control the timeline of your Flash movie.

  1. Add a Flash movie (.swf) to your Dreamweaver page.

    Note 

    This behavior is dimmed in the Behaviors panel if there is no Shockwave or Flash content in the current HTML document.

  2. Add a name for the Flash movie in the Property inspector. Dreamweaver requires an instance name for the item that will be targeted with a behavior — if you don't add one now, you will be prompted to return to the Property inspector when you try to add the behavior (in Step 4).

  3. Typically, you'd use images or hyperlinks to control the Flash movie. If you want to use images, select the image in your HTML layout. If you want to use text, make sure you at least have a number sign (#) in the link section of the Property inspector and that the text is selected in the Code or Design view of the Document window.

    Note 

    Behaviors cannot be added to plain text, but you can add a behavior to a link. The best way to attach a behavior to text is to add a null link (or a link that won't take the user to another document). Entering a number sign (#) in the Link field of the Property inspector will work to convert the text into a null link, but it is preferable to enter javascript:; (include the colon and the semicolon) because using a number sign will cause some browsers to jump to the top of the document when the user clicks the null link.

  4. In the Behaviors tab of the Tag inspector panel (Window ð Behaviors), click the Add (+) button and choose Control Shockwave or Flash. The Control Shockwave or Flash dialog box appears, shown in Figure 38-22.

  5. If you have more than one movie on your page, choose the correct one from the Movie drop-down list. Choose either Play, Stop, Rewind, or Go to frame. When choosing Go to frame, enter the frame number.

  6. Click OK. Check that the event listed in the Behaviors panel is correct, or click in the event name field to access the drop-down menu and select a different event (as shown in Figure 38-23).

Image from book
Figure 38-22: The Control Shockwave or Flash dialog box is used to set playback options that will be applied to the Flash timeline when the behavior is triggered.
Image from book
Figure 38-23: Use the drop-down menu in the Behavior panel as needed to change the event associated with the Control Shockwave or Flash behavior.
Caution 

These behaviors may not test successfully on a local drive because they are intended to work from a Web server. If you have not yet defined a testing server, upload your files to a temporary subfolder on any Web server that you have access to so that you can do live testing with different browsers.

When you test your file in a browser, you may run into the Global Security Settings warning. Don't be alarmed. Simply follow the instructions for modifying your FlashPlayer Security settings with the panel on Macromedia's Web site, as shown in Figure 38-24.

Image from book
Figure 38-24: The FlashPlayer Settings Manager on Macromedia's site is used to set "trusted locations" on your system for testing purposes, which will enable JavaScript behaviors to control Flash content in your Dreamweaver pages without triggering a warning dialog box.

Another way of making sure that JavaScript will be able to control the Flash content is to set a Parameter for any Flash items that you want to target. Select the Flash preview in the Design window, then click the Parameters button in the Property inspector to launch the Parameters dialog box. As shown in Figure 38-25, enter the Parameter name allowScriptAccess in the left column and a Value of always in the right column. This will automatically add a new line of code to the existing parameters (defined in the Code window) for the selected Flash content.

Image from book
Figure 38-25: You can manually add an allowScriptAccess parameter in the Parameter dialog box to ensure JavaScript commands successfully target inserted Flash content.
Web Resource 

For more about JavaScript behaviors and events in Dreamweaver, check the Help documentation (search for "Using JavaScript Behaviors") and Macromedia's Dreamweaver support area at www.macromedia.com. Other behaviors are also available for download at the Macromedia Exchange at www.macromedia.com/cfusion/exchange/index.cfm.


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