DOM Flash OBJECT and EMBED tag attributes

황제낙엽 2011.03.02 16:26 조회 수 : 61

sitelink1  
sitelink2  
sitelink3 http://1 
sitelink4 http://ko 
extra_vars5 http://kb2.adobe.com/cps/127/tn_12701.html#main_Required_attributes 
extra_vars6 sitelink1 

Flash OBJECT and EMBED tag attributesProducts affected


Was this helpful?

This document lists the required and optional 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) 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/or 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/or 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 (e.g., JavaScript) to reference the SWF content. For cross-browser compatibility, id and name should be 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 (e.g., Zoom, Quality, Play, Loop, Rewind, Forward, Back).
    • false displays a menu that hides movie playback controls (e.g., Zoom, Quality, Play, Loop, Rewind, Forward, Back). This is useful for SWF content that does not rely on the Timeline, such as content controlled entirely by ActionScript. The short menu will include "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 will override 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 the 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 should scale 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 may crop the content, but no distortion will occur
    • exactfit makes the entire SWF file visible in the specified area without trying to preserve the original aspect ratio. Distortion may occur.
    • noscale prevents the SWF file from scaling to fit the area of the object or embed tag. Cropping may 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.
    • lr, 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 top left and top right corner of the browser window and crop the bottom and remaining side as needed.
  • wmode - Possible values: window, direct, opaque, transparent, gpu. Sets the Window Mode property of the Flash movie 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 will determinehow the SWF content is layered against other HTML elements. With this value, you cannot explicitly specify if SWF content will appear above or below other HTML elements on the page.  
    • direct - Use direct to path rendering. This 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 and 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 is opaque and will hide everything layered behind it on the page. This option will reduce playback perfomance compared to wmode=window or wmode=direct.
    • transparent - The SWF content is layered together with other HTML elements on the page. The SWF background color (Stage color) is transparent, and HTML elements beneath the SWF will be visible through any transparent areas of the SWF, with alpha blending. This option will reduce 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. 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 will allow the SWF 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 will use the specified screen orientation (portrait or landscape) when the SWF is viewed in full screen mode, regardless of how the device is oriented. If this attribute is not specified, orientation of content in full screen mode will follow the screen orientation used by the browser.  
  • flashvars - Variables, defined as a string of key=value pairs, that will be passed to the SWF file.
    • Use flashvars to specify root-level variables in the SWF. 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).

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. Note that regardless of the wmode value, Flash Player will display content viewed in full screen mode using direct path rendering, enabling hardware accelerated presentation capabilities such as Stage Video and Stage 3D.

To deliver the highest performance playback of Flash-enabled content in the browser, usewmode=direct to enable hardware accelerated presentation capabilities, including Stage Video and Stage 3D. Avoid overlapping the SWF content with HTML elements (e.g., HTML-based drop-down menus) intended to appear above the SWF, as explicit layering control is only supported with some modern browsers (see table below). In other browsers, the SWF content will always appear 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 will reduce playback performance compared to wmode=window (the default) and wmode=direct.

Use caseRecommended 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 will handle 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.

WmodeBenefitsIE 6, 7, 8 WinIE 9 WinFirefox WinChrome WinFirefox 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)
windowBroadest accessibilty support-/-/A-/-/A-/-/A-/-/A-/-/-L/-/--/-/-L/-/--/-/-L/-/-
transparentTransparency 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/-/-
opaqueHTML elements can overlap SWF content. Explicit layering control (all browsers).L/-/-L/-/-L/-/-L/-/-L/-/-L/-/-L/-/-L/-/-L/-/-L/-/-
directBest performance. Hardware accelerated presentation, including Stage Video and Stage 3D (all browsers).-/H/AL/H/--/H/A-/H/A-/H/-L/H/--/H/-L/H/--/H/-L/H/-
gpuAdditional hardware acceleration on some internet connected TVs and mobile devices.-/H/AL/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.