Apply OBJECT and EMBED tag attributes in Adobe Flash Professional

This document lists the attributes of the OBJECT and EMBED tags used to publish SWF (Flash-enabled) content in HTML pages for display in web browsers. The attributes allow you to specify certain parameters that control the details of how and where Flash Player displays the SWF file in the browser.

Information about including Flash-enabled (SWF file) content within web pages is also available in the TechNote OBJECT tag syntax | Flash (tn_4150).

Required attributes

The following attributes are required within the OBJECT and EMBED tags when adding a SWF file to an HTML page. The Publish command in Flash Professional creates HTML files with the required attributes specified for you. 

Note: Values in brackets and italics indicate that the developer chooses the value.

Required for both OBJECT and EMBED:

  • width - Specifies the width of the SWF content in either pixels or percentage of browser window.
  • height - Specifies the height of the SWF content in either pixels or percentage of browser window.

Required for OBJECT tag only:

  • classid - Identifies the ActiveX control for the browser. See example code in OBJECT tag syntax | Flash (tn_4150) for the correct value.
  • codebase - Identifies the location of the Flash Player ActiveX control so that the browser can automatically download it if it is not already installed. See example code in OBJECT tag syntax | Flash (tn_4150) for the correct value.
  • movie (param) - Specifies the source location (URL) of the SWF file to load.

Required for EMBED tag only

  • src - Specifies the source location (URL) of the SWF file to load.
  • pluginspage - Identifies the location of the Flash Player plug-in so that the user can download it if it is not already installed.

Optional attributes

The following attributes are optional when defining the OBJECT and EMBED tags. For OBJECT, all attributes are defined in param tags unless otherwise specified:

  • id (attribute for OBJECT tag) and name (attribute for EMBED tag) - SWF file identifier. Identifies the SWF file to the web browser, allowing browser scripting languages (for example, JavaScript) to reference the SWF content. For cross-browser compatibility, make sure that the id and name are set to the same value.
  • play - Possible values: true, false. Specifies whether a timeline-based SWF file begins playing immediately on loading in the browser. If this attribute is omitted, the default value is true.
  • loop - Possible values: true, false. Specifies whether a timeline-based SWF file repeats indefinitely or stops when it reaches the last frame. If this attribute is omitted, the default value is true.
  • menu - Possible values: true, false. Specifies if movie playback controls are available in the Flash Player context menu.
    • true displays a full menu that provides expanded movie playback controls (for example, Zoom, Quality, Play, Loop, Rewind, Forward, Back).
    • false displays a menu that hides movie playback controls (for example, Zoom, Quality, Play, Loop, Rewind, Forward, Back). This attribute is useful for SWF content that does not rely on the Timeline, such as content controlled entirely by ActionScript. The short menu includes "Settings" and "About Flash Player" menu items.
  • quality - Possible values: low, autolow, autohigh, medium, high, best. Specifies the display list Stage rendering quality. Setting the Stage.quality property via ActionScript overrides this value.
    • low favors playback speed over appearance and never uses anti-aliasing.
    • autolow emphasizes speed at first but improves appearance whenever possible. Playback begins with anti-aliasing turned off. If Flash Player detects that the processor can handle it, anti-aliasing is turned on.
    • autohigh emphasizes playback speed and appearance equally at first but sacrifices appearance for playback speed if necessary. Playback begins with anti-aliasing turned on. If the actual frame rate drops below the specified frame rate, anti-aliasing is turned off to improve playback speed. Use this setting to emulate the View > Antialias setting in Flash Professional.
    • medium applies some anti-aliasing and does not smooth bitmaps. It produces a better quality than the Low setting, but lower quality than the High setting.
    • high favors appearance over playback speed and always applies anti-aliasing. If the movie does not contain animation, bitmaps are smoothed; if the movie has animation, bitmaps are not smoothed.
    • best provides the best display quality and does not consider playback speed. All output is anti-aliased and all bitmaps are smoothed.
  • scale - Possible values: showall, noborder, exactfit, noscale. Specifies how Flash Player scales SWF content to fit the pixel area specified by the OBJECT or EMBED tag.
    • default (Show all) makes the entire SWF file visible in the specified area without distortion, while maintaining the original aspect ratio of the movie. Borders can appear on two sides of the movie.
    • noborder scales the SWF file to fill the specified area, while maintaining the original aspect ratio of the file. Flash Player can crop the content, but no distortion occurs.
    • exactfit makes the entire SWF file visible in the specified area without trying to preserve the original aspect ratio. Distortion can occur.
    • noscale prevents the SWF file from scaling to fit the area of the OBJECT or EMBED tag. Cropping can occur.
  • align (attribute for Object) - Possible values: l, t, r.
    • Default centers the movie in the browser window and crops edges if the browser window is smaller than the movie.
    • l (left), r (right), and t (top) align the movie along the corresponding edge of the browser window and crop the remaining three sides as needed.
  • salign - Possible values: l, t, r, tl, tr.
    • l, r, and t align the movie along the left, right, or top edge of the browser window and crop the remaining sides as needed.
    • tl and tr align the movie to the upper-left and top upper-corner of the browser window and crop the bottom and remaining side as necessary.
  • wmode - Possible values: window, direct, opaque, transparent, gpu. Sets the Window Mode property of the SWF file for transparency, layering, positioning, and rendering in the browser. If this attribute is omitted, the default value is "window". For more information, see Using Window Mode (wmode) values below.
    • window - The SWF content plays in its own rectangle ("window") on a web page. The browser determines how the SWF content is layered against other HTML elements. With this value, you cannot explicitly specify if SWF content appears above or below other HTML elements on the page.  
    • direct - Use direct to path rendering. This attribute bypasses compositing in the screen buffer and renders the SWF content directly to the screen. This wmode value is recommended to provide the best performance for content playback. It enables hardware accelerated presentation of SWF content that uses Stage Video or Stage 3D.
    • opaque - The SWF content is layered together with other HTML elements on the page. The SWF file is opaque and hides everything layered behind it on the page. This option reduces playback performance compared to wmode=window or wmode=direct.
    • transparent - The SWF content is layered together with other HTML elements on the page. The SWF file background color (Stage color) is transparent. HTML elements beneath the SWF file are visible through any transparent areas of the SWF, with alpha blending. This option reduces playback performance compared to wmode=window or wmode=direct.
    • gpu - Use additional hardware acceleration on some Internet-connected TVs and mobile devices. In contrast to other wmode values, pixel fidelity for display list graphics is not guaranteed. Otherwise, this value is similar to wmode=direct.
  • bgcolor - [hexadecimal RGB value] in the format #RRGGBB. Specifies the background color of the SWF content. Use this attribute to override the background color (Stage color) setting specified in the SWF file. (This attribute does not affect the background color of the HTML page.)
  • base[base directory] or [URL]. Specifies the base directory or URL used to resolve all relative path statements in the SWF file. This attribute is helpful when your SWF file is kept in a different directory from your other files.
  • allowFullScreen - Possible values: true or false. Setting this value to true allows the SWF file to enter full screen mode via ActionScript. For more information, see Exploring full screen mode in Flash Player. If this attribute is omitted, the default value is false.
  • fullScreenAspectRatio - Possible values: portrait or landscape. Used to control how full screen SWF content appears on mobile devices that support automatic screen rotation, such as phones and tablets. If this attribute is specified, Flash Player uses the specified screen orientation (portrait or landscape) when the SWF is viewed in full screen mode. It doesn't matter how the device is oriented. If this attribute is not specified, orientation of content in full screen mode follows the screen orientation used by the browser. 
  • flashvars - Variables, defined as a string of key=value pairs, that are passed to the SWF file.
    • Use flashvars to specify root-level variables in the SWF file. The format of the string is a set of key=value combinations separated by the '&' character.
    • Browsers support string sizes of up to 64 KB (65535 bytes) in length.
    • For more information on using flashvars, see Using FlashVars to pass variables to a SWF (tn_16417).
  • browserzoom - The following OBJECT and EMBED tags are available in Flash Player to change the the size of Flash content in response to change in browser zoom factor:
    • scale: turn on the browser zoom factor behavior
    • noscale: turn off the browser zoom factor behavior

Using Window Mode (wmode) values 

Developers can set the Window Mode (wmode) property of the SWF content to control layering and transparency of the content in the browser. Regardless of the wmode value, Flash Player displays content viewed in full screen mode using direct path rendering. Using direct path rendering enables hardware accelerated presentation capabilities such as Stage Video and Stage 3D.

To deliver the highest performance playback of Flash-enabled content in the browser, use wmode=direct. This attribute enables hardware accelerated presentation capabilities, including Stage Video and Stage 3D. Avoid overlapping the SWF content with HTML elements (for example, HTML-based pop-up menus) intended to appear above the SWF file. Explicit layering control is only supported with some modern browsers (see table below). In other browsers, the SWF content always appears above other HTML elements.

If you require explicit layering control, transparency, or HTML elements that float above SWF content, use wmode=opaque or wmode=transparent. You can then control layering in relationship to other elements on the page through HTML. However, these "windowless" modes reduce playback performance compared to wmode=window (the default) and wmode=direct.

Use case

Recommended wmode

Best performance, including support for hardware accelerated Stage Video and Stage 3D.

wmode=direct

Requires overlapping HTML elements to appear on top of SWF content, transparency, or explicit layering control relative to HTML elements (across all browsers).

wmode=opaque or wmode=transparent

Browser support for Window Mode (wmode) values

Different browsers rely on different approaches for rendering web page content and handles wmode values differently. The table above summarizes when to use different wmodes. The matrix below details the specific behaviors you can expect in each browser.

Wmode

Benefits

IE 6, 7, and 8 Win

IE 9 Win

Firefox Win

Chrome Win

Firefox 3 Mac (OSX 10.5 and later)

Firefox 4 Mac (OSX 10.6 and later)

Safari 3 (OSX 10.5)

Safari 4 (OSX 10.6 and later)

Chrome Mac (OSX 10.5)

Chrome Mac (OSX 10.6 and later)

window

Broadest accessibility support

-/-/A

-/-/A

-/-/A

-/-/A

-/-/-

L/-/-

-/-/-

L/-/-

-/-/-

L/-/-

transparent

Transparency and alpha blending over HTML elements supported. HTML elements can overlap SWF content. Explicit layering control (all browsers) 

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

opaque

HTML elements can overlap SWF content. Explicit layering control (all browsers).

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

L/-/-

direct

Best performance. Hardware accelerated presentation, including Stage Video and Stage 3D (all browsers).

-/H/A

L/H/-

-/H/A

-/H/A

-/H/-

L/H/-

-/H/-

L/H/-

-/H/-

L/H/-

gpu

Additional hardware acceleration on some Internet connected TVs and mobile devices.

-/H/A

L/H/-

-/H/A

-/H/A

-/H/-

L/H/-

-/H/-

L/H/-

-/H/-

L/H/-

L = HTML layering is supported. HTML elements can overlap SWF content. Supports explicit control of layering in relation to other HTML elements.

H = Hardware accelerated presentation is supported, including Stage Video and Stage 3D.

A = Accessibility is supported.

Keywords: code; value; attribute; tags; attributes; param; parameter; play; loop; quality; bgcolor; scale; salign; base; menu; width; height; src; pluginspage; movie; classid; codebase; background color; back ground color; tn_12701

 Adobe

Få hjælp hurtigere og nemmere

Ny bruger?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

14-16. oktober i Miami Beach og online

Adobe MAX 2024

Adobe MAX

The Creativity Conference

14-16. oktober i Miami Beach og online