About the object and embed tags

The <object> and <embed> tags
embed SWF files in HTML. The wrapper generated by Flash Builder
hides the details of these tags from you for most common use cases.

Adobe recommends using SWFObject 2 rather than the <object> and <embed> tags
to embed your SWF file, but these tags are useful in some cases, such
as if you want to create a custom wrapper or if there is a likelihood
that your users will have JavaScript disabled in their browsers.

For browsers with scripting disabled, the default HTML template
uses the <object> and <embed> tags
to embed your application. These tags are children of the <noscript> tag,
which means that the browser executes them when scripting is disabled
on the client. When you compile a project in Flash Builder, Flex
Builder sets the values of the tokens within these tags for you.
When you compile an application with the SDK, you must manually
edit the template and set the values of these tags.

You can also use the <object> and <embed> tags
tags in simple HTML wrappers. For more complex wrappers, or wrappers
that support features such as Express Install, you should use the
SWFObject 2 functionality as described in About SWFObject 2.

The <object> and <embed> tags
support a set of properties that add additional functionality to
the wrapper. These properties let you change the appearance of the
SWF file on the page or change some of its properties such as the
title or language. If you want to customize your wrapper, you can
add these properties to the wrapper.

The <object> tag is supported by Internet
Explorer 3.0 or later on Windows platforms or any browser that supports
the use of the Flash ActiveX control. The <embed> tag
is supported by Netscape Navigator 2.0 or later, or browsers that support
the use of the Netscape-compatible plug-in version of Flash Player.

When an ActiveX-enabled browser loads the HTML page, it reads
the values set on the <object> and ignores
the <embed> tag. When browsers using the
Flash plug-in load the HTML page, they read the values set on the <embed> tag
and ignore the <object> tag. Make sure that
the properties for each tag are identical, unless you want different
results depending on the user’s browser.

The following are required attributes of the <object> tag:

height

width

classid

All other properties are optional and you set their values in
separate, named <param> tags.

Although the movie property is technically an
optional tag, without it, there is no reference to the SWF file
you want the client to load. Therefore, your wrapper should always
set the movie parameter in the <object> tag.

The following example shows the required properties as attributes
of the <object> tag, and two optional properties, movie and quality,
as <param> child tags:

For the <embed> tag, all settings are
attributes that appear between the angle brackets of the opening <embed> tag.
The <embed> tag requires the height and width attributes.
The <embed> tag does not require a classid attribute. As
with the movie parameter of the <object> tag,
the src attribute of the <embed> tag
provides the reference to the application. Without it, there would be
no SWF file, so you should consider it a required attribute.

The following
example shows a simple <embed> tag with the
optional quality attribute:

When you define parameters for the <object> tag,
also add them as tag properties to the <embed> tag
so that the SWF file appears the same on the page regardless of
the client’s browser.

If you are using the included HTML wrapper template, you will
need to replace tokens such as ${height} and ${width} with
absolute values before deploying the wrapper. For more information,
see About the HTML template.

Not all properties are supported by both the <object> and
the <embed> tags. For example, the id property
is used only by the <object> tag, just as
the name property is used only by the <embed> tag.

In some cases, the <object> and <embed> tag
properties duplicate properties that you can set on the <s:Application> tag
in the application source code. For example, you can set the height and width properties
of the SWF file on the <object> and <embed> tags
or you can set them on the <s:Application> tag.

The following table describes the supported <object> and <embed> tag properties:

Property

Type

Description

align

String

Specifies the position of the SWF file.

The align property
supports the following values:

bottom:
Vertically aligns the bottom of the SWF file with the current baseline.
This is typically the default value.

middle: Vertically aligns the middle of
the SWF file with the current baseline.

top: Vertically aligns the top of the SWF
file with the top of the current text line.

left: Horizontally aligns the SWF file to
the left margin.

right: Horizontally aligns the SWF file
to the right margin.

allowNetworking

String

Restricts communication between the HTML
page and the SWF file. This property affects more APIs than the allowScriptAccess property.

The allowNetworking property
supports the following values:

all:
No networking restrictions. Flash Player behaves normally. This
is typically the default.

none: SWF files cannot call networking or
SWF-to-SWF file communication APIs. In addition to the APIs restricted
by the internal value, these include other methods
such as URLLoader.load(), Security.loadPolicyFile(),
and SharedObject.getLocal().

Controls the ability to perform outbound
scripting from within the SWF file.

The allowScriptAccess property
can prevent a SWF file hosted from one domain from accessing a script
in an HTML page that comes from another domain.

Valid values
are as follows:

always: Outbound
scripting always succeeds.

samedomain: Outbound scripting succeds only
if the application is from the same domain as the HTML page.

never: Outbound scripting always fails.
Using this value is deprecated and not recommended, and should not
be necessary if you do not serve untrusted SWF files from your own
domain. If you do need to serve untrusted SWF files, Adobe recommends
that you create a distinct subdomain and place all untrusted content
there.

This property affects the following
operations:

ExternalInterface.call()

fscommand()

navigateToURL(), when used with javascript or
another scripting scheme

navigateToURL(), when used with window name
of _self, _parent, or _top.

Specifies a space-separated list of URIs
for archives containing resources used by the application, which
may include the resources specified by the classid and data properties.

Preloading
archives can result in reduced load times for applications. Archives
specified as relative URIs are interpreted relative to the codebase property.

base

String

Specifies the base directory or URL used
to resolve relative path statements in ActionScript.

bgcolor

String

Specifies the background color of the application.

border

int

Specifies the width of the SWF file’s border,
in pixels. The default value for this property depends on the user
agent.

classid

String

Defines the classid of
Flash Player. This identifies the ActiveX control for the browser.
Internet Explorer 3.0 or later on Windows 9x, Windows 2000, Windows
NT, Windows ME, and Windows XP prompt the user with a dialog box
asking if they would like to auto-install Flash Player if it's not already
installed. This process can occur without the user having to restart
the browser.

This property is used for the <object> tag
only.

For the <object> tag, you set
the value of this property as an attribute of the <object> tag
and not as a <param> tag.

codetype

String

Defines
the content type of data expected when downloading the application
specified by the classid property

The codetype property
is optional but recommended when the classid property
is specified; it lets the browser avoid loading unsupported content
types.

The default value of the codetype property
is the value of the type property.

data

String

Specifies the location of the application’s
data; for example, instance image data for objects that define images.

declare

Boolean

Makes the current SWF file’s definition
a declaration only. The SWF file must be instantiated by a subsequent
object definition referring to this declaration.

devicefont

Boolean

Specifies whether static text objects for
which the deviceFont option is not selected are
drawn using a device font anyway, if the needed fonts are available
from the operating system.

dir

String

Specifies the base direction of text in
an element’s content and attribute values. It also specifies the directionality
of tables. Valid values are LTR (left-to-right
text or table) and RTL (right-to-left text or table).

flashVars

String

Sends variables to the application. The
format is a set of name-value pairs, each separated by an ampersand
(&).

Most browsers support string sizes of up to 64 KB
(65535 bytes) in length.

The default value of this property
is typically an empty string.

The value of this property is
URL encoded prior to being sent to the application.

For
the <object> tag, you set the value of this
property as an attribute of the <object> tag
and not as a <param> child tag.

hspace

int

Specifies the amount of white space inserted
to the left and right of the SWF file. The default value is typically
not specified, but is generally a small, nonzero length.

id

String

Identifies the SWF file to the host environment
(a web browser, for example) so that it can be referenced by using
a scripting language such as VBScript or JavaScript.

The id property
is only used with the <object> tag. It is
equivalent to the name property used with the <embed> tag.

lang

String

Specifies the base language of an element’s
property values and text content.

The default value is typically unknown.
The browser can use language information specified using the lang property
to control rendering in a variety of ways.

menu

Boolean

Changes the appearance of the menu that
appears when users right-click over an application in Flash Player.
Set to true to display the entire menu. Set to false to
display only the About and Settings options on the menu.

The
default value is typically true.

movie

String

Specifies the location of the SWF file.

The movie property
is only used with the <object> tag. It is
equivalent to the src property used with the <embed> tag.

name

String

Identifies the SWF file to the host environment
(a web browser, typically) so that it can be referenced by using
a scripting language.

The name property is
only used with the <embed> tag. It is equivalent
to the id property used with the <object> tag.

quality

String

Defines the quality of playback in Flash
Player. Valid values of quality are low, medium, high, autolow, autohigh,
and best. The default value is typically best.

The low setting
favors playback speed over appearance and never uses anti-aliasing.

The autolow setting
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.

The autohigh setting
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.

The medium setting
applies some anti-aliasing and does not smooth bitmaps.

The high setting
favors appearance over playback speed and always applies anti-aliasing.

The best setting
provides the best display quality and does not consider playback
speed. All output is anti-aliased and all bitmaps are smoothed.

L, R, T,
and B align the SWF file along the left, right,
top, or bottom edge, respectively, of the browser window and crop
the remaining three sides as needed.

TL and TR align
the SWF file to the top-left and top-right corner, respectively,
of the browser window and crop the bottom and remaining right or
left side as needed.

BL and BR align
the SWF file to the bottom-left and bottom-right corner, respectively,
of the browser window and crop the top and remaining right or left
side as needed.

scale

String

Defines
how the browser fills the screen with the SWF file. The default
value is typically showall. Valid values of the scale property
are showall, noborder, and exactfit.

Set
to showall to make the entire SWF file visible
in the specified area without distortion, while maintaining the
original aspect ratio of the SWF file. Borders may appear on two
sides of the SWF file.

Set to noborder to
scale the SWF file to fill the specified area, without distortion
but possibly with some cropping, while maintaining the original
aspect ratio of the SWF file.

Set to exactfit to make the
entire SWF file visible in the specified area without trying to
preserve the original aspect ratio. Distortion may occur.

src

String

Specifies the location of the SWF file.

The src property
is only used with the <embed> tag. It is
equivalent to the movie property used with the <object> tag.

standby

String

Defines a message that the browser displays
while loading the object’s implementation and data.

style

String

Specifies style information for the SWF
file.

The syntax of the value of the style property
is determined by the default style sheet language. In CSS, property
declarations have the form "name:value" and are separated by a semicolon.

Styles
set with this property do not affect components or the Application
container in the application. Rather, they apply to the SWF file
as it appears on the HTML page.

supportembed

Boolean

Determines whether the Netscape-specific <embed> tag
is supported. The supportembed property is optional,
and the default value is typically true.

Set
to false to prevent the <embed> tag
from being read by the browser.

tabindex

int

Specifies the position of the SWF file in
the tabbing order for the current document. This value must be a
number between 0 and 32767. User agents should ignore leading zeros.

title

String

Displays information about the SWF file.

Values
of the title property can be rendered by browsers
or other user agents in different ways. For example, some browsers
display the title as a ToolTip. Audio user agents might speak the
title information in a similar context.

type

String

Specifies the content type for the data
specified by the data property.

The type property
is optional but recommended when data is specified; it prevents
the browser from loading unsupported content types.

If the
value of this property differs from the HTTP Content-Type returned
by the server, the HTTP Content-Type takes precedence.

usemap

String

Associates an image map with the SWF file.
The image map is defined by a map element. The
value of usemap must match the value of the name attribute
of the associated map element.

vspace

int

Specifies the amount of white space inserted
above and below the SWF file. The default value is typically not
specified, but is generally a small, nonzero length.

width

int

The width of the application SWF file.

For
the <object> tag, you set the value of this
property as an attribute of the <object> tag
and not as a <param> tag.

wmode

String

Sets the Window Mode property of the SWF
file for transparency, layering, and positioning in the browser.
Valid values of wmode are window, opaque,
and transparent.

Set to window to
play the SWF in its own rectangular window on a web page.

Set
to opaque to hide everything on the page behind
it.

Set to transparent so that the background
of the HTML page shows through all transparent portions of the SWF
file. This can slow animation performance.

To make sections
of your SWF file transparent, you must set the alpha property
to 0. To make your application’s background transparent, set the backgroundAlpha property
on the <fx:Application> tag to 0.

The wmode property
is not supported in all browsers and platforms.

The <object> and <embed> tags
can also take additional properties that are not supported by applications
built with Flex. These unsupported properties are listed in Unsupported Flash Player properties.

Unsupported Flash Player properties

Some
optional Flash Player properties do not apply to applications built
with Flex. These are properties that involve movie frames and looping.
The following properties have no effect when used with Flex:

loop

play

Twitter™ and Facebook posts are not covered under the terms of Creative Commons.