Flash and HTML
If you’re creating your own HTML pages and prefer to insert your Flash movies yourself, you can do using the <object> and <embed> tags. <object> is used for Internet Explorer on Windows; <embed> is used for Netscape on Windows and Mac, and for Internet Explorer on Mac. You can include both these tags in the same HTML page—the browser will read the appropriate one.
Below is a screenshot of the HTML source produced by Flash’s publish settings and showing the use of the <object> tag:
We cleaned up the source to set off the parameters of the <object> tag that have been included. The classid is the ActiveX identifier for the Flash Player control. This must be copied exactly when creating your own pages.
The codebase attribute specifies the URL of the ActiveX control installer. Right now, version 7 of the Flash Player is specified, but you can change this to an earlier version if you need to.
The width and height specify the dimensions of the movie in the Web page. You can also specify these dimensions in percent by adding the percent sign (%). The align attribute specifies how the movie is aligned in the Web page (left, right, top, bottom or middle).
The remainder of the code inside the <object> tags specifies parameters for the object. Following is an explanation of those parameters, as well as others that don’t appear in the source above:
- movie specifies the movie being loaded. The value is the name of the SWF file.
- play (optional) tells the Flash Player whether or not to start playing the movie as it downloads. The value is true or false.
- loop (optional) tells the Flash Player whether or not to loop when the playh
ead reaches the end of the Timeline. The value is true or false.
- menu determines whether or not the Flash Player includes the shortcut menu when the user right-clicks on the movie. The value is true or false. This value is overridden when you set the Stage.showMenu property to true or false during authoring.
- quality determines how artwork in the movie is rendered. Values can be low, autolow, autohigh, high or best. High forces the Flash Player to render elements using antialiasing.
- scale (optional) determines the scale of the movie based on the width and height properties specified earlier. The default value, showall, fits the movie within the width and height boundaries without distorting the original aspect ratio. Other values are noborder, exactfit and noscale.
- salign aligns the movie inside the assigned viewing space. Values can be l (left edge), r (right edge), t (top edge), b (bottom edge), lt (left and top edge), rt (right and top edge), lb (left and bottom edge) and rb (right and bottom edge).
- wmode controls the background color of the Flash movie: window displays the background color of the movie’s Stage with the height and width specified earlier; opaque is used when animating DHTML objects in layers behind or on top of the movie; and transparent makes the edges of the Stage transparent. wmode only works with later versions of Windows Internet Explorer (version 3 or higher) and Flash Player 6 or higher in Mac browsers, including Internet Explorer.
- devicefont controls how fonts appear in Windows browsers, though the control is unpredictable and the setting isn’t used very often. When the value is true, embedded text is displayed using system fonts. The default setting is false.
- bgcolor overrides the movie background color set during authoring. The value is a hexadecimal code for the color.
- flashvars lets you declare variables in the Flash movie when it loads into the browser, thus enabling you to pass information dynamically into the movie. The value is the variable declaration and its value (for example, “myname=Susan”, with the value of the variable using URL-encoded format).
The screenshot below shows the properties and parameters of the <embed> tag: