Previous Topic Tutorial Home Page Next Topic
Constructing a Windowless Control


This template demonstrates how to construct an animation that makes use of IE4 windowless controls. It illustrates the following: - Using the modelmaker applet - Using the dxactrl (DirectAnimation windowless control) - Constructing the model and passing it to the control
import com.ms.dxmedia.*;
import module.*;
This gets ReactiveCube
import java.net.*;

When designing windowless controls, the Java applet is used purely to construct the model. At runtime, hand the finished model over to the windowless control to be displayed.
class WindowlessModel extends Model {
public void createModel(BvrsToRun blist) {

Create any type of animation you like here... it is completely up to you what goes into the model.

The image is simply the rendered cube without any background. Since you want to overlay the windowless control with other HTML elements, specifically avoid a solidColor background.
setImage(cubeGeo.render(Cam));
setSound(cube.getSoundBvr());
}
}

Here is the important part, rather than extending DXMApplet as usual, extend ModelMakerApplet. Aside from the name, the construction is exactly the same as if you were doing a normal applet.
public class WindowlessApplet extends ModelMakerApplet {

public void init() {

Always call the super classes init first to ensure codeBase is set.
super.init() ;

Now set the model.
setModel (new WindowlessModel());
}
}

<!--

In the HTML file we place the DirectAnimation windowless control. This is what will actually display our model. Notice you can set it's style properties to get the proper layout and sizing. See IE4 documentation on style sheets for more information about using them.
-->
<OBJECT STYLE="POSITION:ABSOLUTE; TOP:45; LEFT:35%; WIDTH:375; HEIGHT:375; Z-INDEX:1"
ID="dxactrl" CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D"></OBJECT>

<!--

Also insert the applet which constructs your model. Notice that it's width and height are zero since it is only used to construct the animation
-->
<APPLET CODEBASE="IE4_Windowless" CODE=WindowlessApplet.class WIDTH=0 HEIGHT=0 ID=javaApp></APPLET>


<!--

A script is used to bridge the gap and pass the needed view, image and sound to the dxactrl for display.
-->
<SCRIPT LANGUAGE="VBScript">
<!--
AnimationOnTop = false

sub window_onLoad
dxactrl.View = javaApp.grabViewComPtr
dxactrl.Image = javaApp.grabImageComPtr
dxactrl.Sound = javaApp.grabSoundComPtr

' Start the control viewing
dxactrl.Start
end sub

Sub ChangeZ_OnClick
If AnimationOnTop Then
AnimationOnTop = false
dxactrl.style.zindex = 1
Else
AnimationOnTop = true
dxactrl.style.zindex = -1
End If
End Sub
-->
</SCRIPT>

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

Previous Topic Tutorial Home Page Next Topic