YUI recommends YUI3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

This documentation is no longer maintained.

YUI Library Examples: SWF Utility: Simple SWF Utility Example

SWF Utility: Simple SWF Utility Example

This example has been deprecated and will no longer be supported. YUI 2 is now in maintenance mode, so no future updates are planned and only critical fixes will be considered. For more information, please refer to the following blog posts:

This is a simple example of the YUI SWF Utility's features.

Note: This example of the YUI SWF Utility usage requires Flash Player 9.0.115 or higher. The latest version of Flash Player is available at the Adobe Flash Player Download Center.

The version of the Flash player installed on your computer is outdated. Please download and install the newest version.

Simple SWF Utility Example

In this example, we demonstrate how to embed a SWF on a page and pass it some configuration parameters.

First, include the following JS source files:

Next, create a container where the SWF will be placed. The size of the container will be the size of the SWF (in this case, we set it to 400 by 200 pixels). The current (HTML) content of the container is what will be displayed if there is no Flash installed on the user's machine, or if the version of the Flash player installed does not match the minimum required.

Now, create an object with the necessary parameters to pass to the SWF. In this case, we specify the minimum version of Flash player required, whether to use the ExpressInstall capability of the Flash player, and a few SWF-specific fixed attributes, namely the scale attribute (which specifies whether to shrink or stretch the Flash content to fit the viewport; in this case, no shrinking or stretching is allowed), and the salign attribute (which specifies how to align the content in the viewport; in this case, we align it to top left):

Finally, create an instance of the SWF, passing the name of the container in which to embed it, the URL of the SWF, and the parameter object created above:

YUI Logger Output:

SWF Utility Examples:

More SWF Utility Resources:

Copyright © 2013 Yahoo! Inc. All rights reserved.

Privacy Policy - Copyright Policy - Job Openings