<OBJECT> and <EMBED> TagsTechnically, you don't need to use HTML to display your Flash file, but if you don't, the SWF file will scale to fit the height of the browser window. If you want to control the appearance of your movie, use HTML to do it. The <OBJECT> tag, which is used by Internet Explorer on Windows, uses an ActiveX control to play Flash content. The <EMBED> tag, which is used by Internet Explorer on Macintosh and Netscape on both Macintosh and Windows platforms, uses the Netscape plug-in technology to display Flash content. For you as a developer, this means that you need to have both tags sets on your page to make sure that your movie plays. It's important to nest the <EMBED> tag within the <OBJECT> tag. ActiveX-enabled browsers will ignore the <EMBED> tag inside the <OBJECT> tag. Browsers using Netscape's Flash plug-in technology will ignore the <OBJECT> tag and will read only the <EMBED> tag. You can write the HTML to embed the Flash movie manually, or you can use Flash's Publish feature, which will automatically create HTML that contains both the <OBJECT> and <EMBED> tags. Alternately, you can use Dreamweaver/UltraDev to add your Flash object. The <OBJECT> tag requires these attributes and parameters:
The required <EMBED> tag attributes are listed here:
You also can use a series of optional attributes and parameters with the <OBJECT> and <EMBED> tags. These are implemented as parameters in the <OBJECT> tag and as attributes of the <EMBED> tag. The ones that you'll use most often are these:
To see an example of this code in action, check Listing 26.2. This sample has been formatted for easy viewing. This example shows the HTML created by Flash during publishing. Notice that the <EMBED> tag is nested inside the <OBJECT> tag. Listing 26.2 The Code for Embedding a Flash Movie in an HTML File<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=5,0,0,0" WIDTH=550 HEIGHT=400> <PARAM NAME=movie VALUE="myMovie.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="myMovie.swf" quality=high bgcolor=#FFFFFF WIDTH=550 HEIGHT=400 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/ index.cgi? P1_Prod_Version=ShockwaveFlash"> </EMBED> </OBJECT> So now you have your Flash movie neatly embedded in your HTML page. All your troubles are over, right? Well, not exactly. Now you have to worry about the other differences between the browsers. Netscape IdiosyncrasiesNetscape 6 has been completely rewritten from previous versions. In fact, Netscape 6 is now vying for the position of the browser most hated by Flash developers. Macromedia and Netscape are working to resolve the following known issues in Netscape 6:
Some versions of Netscape cannot display a Flash movie if the filename contains a space. Spaces in filenames can also cause problems with getURL() and loadMovie() actions in Netscape. You should use the underscore (_) instead of spaces for these and other reasons. Internet Explorer 4.5 for the MacintoshQuite possibly the most evil browser in existence is Internet Explorer 4.5 for the Macintosh. You must address a number of unique issues if you are developing for older versions of Internet Explorer on the Macintosh platform. Most of these issues have been fixed in Internet Explorer 5.0 for the Macintosh:
You could redirect users with Internet Explorer 4.5 on a Macintosh to a page without Flash or to a page with a movie but without browser detection. This involves creating a small Flash movie that asks users if they can properly see it playing. If they can, the browser has the proper Flash Player installed. You should also provide a link on this page for users to download the Flash Player if they can't see the test movie. You could also redirect users before the page loads if they are using Internet Explorer on a Macintosh by adding the following in the <HEAD> tag: <SCRIPT LANGUAGE="JavaScript"> <!-- var myURL = "mac_ie_alternative.html"; if (navigator. appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Mac") != -1 ) { location = myURL; } //--> </SCRIPT> Remember, you'll need to change the value of myURL to be the alternate page for users of Internet Explorer on a Macintosh. Internet Explorer 5.5 IntegrationInternet Explorer 5.5 has new behaviors and a new rendering interface that works with Flash 5. These behaviors enable the browser to access the ActionScript Object model of the Flash 5 player. The new rendering interface allows Flash content to be attached as an element rather than as a traditional object with an <OBJECT> tag. These behaviors allow the document to directly interact with and control the properties of the Flash movie and its movie clips to do the following dynamically:
The Rendering Interface allows the document to render Flash content as an attached element. Its properties can be accessed and modified to do such actions as the following:
You need to be aware of one final issue. Even the standalone player isn't completely issue-free. And, of course, its problem starts when it needs to open a browser window. Netscape, Explorer, and Standalone PlayersA standalone player is also called a projector. When a standalone projector is running on Windows and you use the getURL() function to open a Web page, the page always opens in Internet Explorer. The page opens in Explorer even if Netscape is chosen as the default browser. If the user doesn't have Internet Explorer, the Web page will not be displayed. Currently, there is no reliable workaround for this problem. Although this might be annoying, for the most part, it's not catastrophic because the vast majority of computers do have IE installed. Refer to TechNote 14486 on Macromedia's Web site to see if a solution has been found. |