Distributing Transforms

If you write Web pages that use the two-dimensional (2-D) transforms described in the Transform Reference section, anyone with Microsoft® Internet Explorer 5 installed will be able to see the transform output on your pages. This is because the standard Internet Explorer 5 installation includes .dll files that contain these transforms. In addition, graphics programmers can write new transforms that produce different effects on images and meshes. After getting permission from the authors, you will be able to use these new transforms in your Web pages. However, Internet Explorer 5 visitors to your site can only see the transform output if they first download the transform to their computer.

You can make it easy for visitors to download new transforms in the following way. First, the transform .dll file must be placed into a cabinet file (.cab) that is digitally signed. If you are using a transform from another programmer or company, they should provide this .cab file for you. You then need to make this file available on a Web server for users to download. Sometimes the transform authors will provide space on their server for the file, although you will likely need to provide space on your own server.

On any Web page that uses this new transform, insert an OBJECT tag. The value for the tag's CODEBASE attribute should be a link to the .cab file that contains the new transform. The CLASSID attribute must contain the class identifier of one of the transforms in the .dll file. This associates the .dll file with the Web page object and initiates a download of the file to the user's computer.

You then need to make sure that the OnLoad event handler for the page calls the script that creates the Microsoft ActiveX® object for the transform. This ensures that the browser will download and install the file on the user's computer before the script uses the file to create the transform object.

The following sample HTML file shows how you can do this by using Microsoft JScript®. The line that contains the OBJECT tag for file transfer is in bold text.

Sample Code

The BODY tag for the page contains a script function called Main, which will use a Microsoft DirectAnimation® control to display the transform output. However, this function is not called until the rest of the page finishes loading. Next, a script creates the DAControl object, followed by the object that loads the new transform file. The browser will then prompt the user about whether to download and install the specified transform .dll file. When the download is complete, the Main function is called and the page will display as usual.

There are a number of transforms that produce three-dimensional (3-D) output on your Web page. The method described in this article will enable users to download and view these transforms. In addition, users must have Microsoft DirectX® version 6.x or later installed on their computer. You can download the latest version of DirectX from the DirectX Web site.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.