arcticPigs release V1.0 helpefiles |
Example: The Movie Player script (3) |
The OnModelInstanced event handler does the main initialisations for the Movie Player web page. All models will fire this event so you need to test which object you are handling. The test on the handling mode being equal to 1 is a quick (and dirty) test for the slider button as this is the only model instance that can be moved around (handlingmode = 1). For the slider model all events are added to the model whereas the '_moviecontrol' model has events added only to certain groups.
<SCRIPT Language="JScript" for="movieplayer" event="OnScriptReady(sScript)">
if( movieplayer.window.renderQuality < 0.8) {
movieplayer.window.autoRenderQuality = false;
movieplayer.window.renderQuality = 0.8;
}
</SCRIPT>
<SCRIPT Language="JScript" for="movieplayer" event="OnModelInstanced(sModel)">
if(sModel.handling == 1) {
hSlider = sModel;
hSlider.onlbuttondown = StartLocationChange;
hSlider.onlbuttonup = EndLocationChange;
hSlider.ondrag = OnSliderDrag;
bMPTimerReady = true; // possible to start timer
StartSliderTimer();
}
else if(sModel.name == "Shortcut to _moviecontrol") {
hPlayLight = sModel.groups("playlight");
hPauseLight = sModel.groups("pauselight");
sModel.groups("play").onclick = new Function("SetMode(mPlay)");
sModel.groups("pause").onclick = new Function("SetMode(mPause)");
sModel.groups("panic").onclick = new Function("arctic.world.camera.clearOffsets(0)");
// initialise
hPlayLight.ambient = 0.9;
hPauseLight.ambient = 0;
mode = mPlay;
}
</SCRIPT>
Last Updated: 06/22/02 |