Home  >  Article  >  Web Front-end  >  Introduction to the difference between OBJECT and EMBED tags used when displaying flash content_HTML/Xhtml_Web page production

Introduction to the difference between OBJECT and EMBED tags used when displaying flash content_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:37:411253browse

1. Introduction:

If we want to display flash content normally in a web page, there must be a tag specifying the flash path in the page. That is, the OBJECT and EMBED tags. The OBJECT tag is used for the IE browser on the Windows platform, while EMBED is used on the Netscape Navigator browser on the Windows and Macintosh platforms and the IE browser on the Macintosh platform. IE on the windows platform uses Activex controls to play flash, while other browsers use Netscape plug-in technology to play flash.

The following is a simple code example for inserting flash into a web page:

Code:

Copy code
The code is as follows:

codebase="http://download.macromedia.com /pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
WIDTH="550" HEIGHT="400" id="myMovieName">



NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">



2. Why use all the above tags? Can some tags be omitted?

OBJECT tag is used in windows IE3.0 and later browsers or other browsers that support Activex controls. The "classid" and "codebase" attributes must be written exactly as shown in the above example. They tell the browser the address to automatically download the flash player. If you have not installed flash player, browsers after IE3.0 will pop up a prompt box asking whether you want to automatically install flash player. Of course, if you don't want users who don't have flash player installed to automatically download the player, maybe you can omit these codes.
EMBED tag is used in Netscape Navigator 2.0 and later browsers or other browsers that support Netscape plug-ins. The "pluginspage" attribute tells the browser the address to download the flash player. If the flash player has not been installed, the user needs to restart the browser after installation to use it normally.
To ensure that most browsers can display flash normally, you need to nest the EMBED tag within the OBJECT tag, just like the above code example. Browsers that support Activex controls will ignore the EMBED tag within the OBJECT tag. Netscape and IE browsers using plug-ins will only read the EMBED tag and will not recognize the OBJECT tag. In other words, if you omit the EMBED tag, then Firefox will not be able to recognize your flash (but what is surprising is that if you omit object and only write embed, IE can display flash normally, haha, let’s take a closer look) .

Listed below are the required and optional attributes of the OBJECT and EMBED tags used to publish videos.

1. Required attributes:

·CLASSID - Sets the browser's Activex control, only used for OBJECT tags.
·CODEBASE-Set the location of the flash Activex control, so that if the browser is not installed, it can be automatically downloaded and installed. Only used for OBJECT tags.
·WIDTH-Specify the width of the flash video in percentage or pixels.
·HEIGHT-Specify the height of the flash video in percentage or pixels.
·SRC-Specify the download address of the video. Only for EMBED tags.
·PLUGINSPAGE-Set the location of the flash plug-in, so that if the browser does not have it installed, it can be automatically downloaded and installed. Only for EMBED tags.
·MOVIE-Specify the download address of the video. Only used for OBJECT tags.

2. Optional attributes and available values:

·ID-Set variable name for reference in script code. For OBJECT only.
·NAME - Set the variable name for reference in script code (such as javascript). For EMBED only.
·SWLIVECONNECT - (true or false) specifies whether to enable java when the flash player is downloaded for the first time. If these attributes are omitted, the default value is false. If you use javascript and flash on the same page, java must use FSCommand to work.
·PLAY - (true or false) specifies whether the flash movie will automatically play after the download is completed. If this attribute is omitted, the default is true.
·LOOP - (true or false) specifies whether to stop or continue looping after the last frame of the video. If this attribute is omitted, it defaults to true.
·MENU - (true or false)
·True displays all menus, allowing users to zoom in, zoom out, etc. to control video playback and other operations.
·False displays only the menu containing setting options and about flash.
·QUALITY - (low, high, autolow, autohigh, best)
·Low is faster than beautiful and does not apply anti-aliasing.
·Autolow focuses on speed at first, but can always improve the beauty when needed.
·Autohigh focuses on both playback speed and aesthetics, but sacrifices aesthetics to ensure playback speed when necessary.
·Medium applies some anti-aliasing without smoothing the bitmap. Its quality is higher than the low setting and lower than the high setting.
·High Beauty is better than playback speed, and anti-aliasing is always applied. If the movie does not contain animation, the bitmap will be smoothed; if the movie contains animation, the bitmap will not be smoothed.
·Best provides the best display quality regardless of playback speed. All output has anti-aliasing applied and all bitmaps smoothed.
·SCALE - (showall, noborder, exactfit)
·Default (Show all) The video is displayed in the specified area but maintains the original proportion. Borders will appear on both sides of the video.
·No Boder shrinks the video to fit the specified area, keeping the video undistorted, but part of the video may be cropped. However the original proportions of the film are maintained.
·Exact Fit causes the entire video to be displayed within a specified area. The video may be deformed and distorted, and the original proportions may not be maintained.
·ALIGN - (l, t, r, b)
·The default is centered. When the browser window is smaller than the video, the edges will be cropped.
·Left, Right, Top, Bottom are aligned along the edge of the browser according to the corresponding settings. If necessary, the other three sides will be trimmed.
·SALIGN - (l, t, r, b, tl, tr, bl, br)
·L,R,T,B
·TL,TR
·BL,BR
·WMODE- (window, opaque, transparent) Set the window mode attribute of the flash movie and specify the transparency, cascading and position of the flash in the browser.
·Window The video plays in its own rectangular window in the browser.
·Opaque video hides everything behind it.
·Transparent makes the flash video transparent and displays the web content behind the transparent video. This will reduce animation performance. And this property is not available in all browsers.
·BGCOLOR - (#RRGGBB, hexadecimal RGB value.) Specifies the background color of the video. Use this attribute to override the background color set in flash.
·BASE - Set the base directory or URL to resolve all relative paths in flash. Similar to the tag in web pages.
·FLASHVARS transfers variables to flash player, which requires flash player 6 and later versions.
·Pass root-level variables to the video. The format of the string is a name=value set separated by "&".
·Browser supports 64kB string length.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn