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.
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: