arcticPigs release V1.0 helpefiles |
![]() |
This event is fired as soon as the model instance has been created within the 3d scene.
As downloads within the viewer run asynchronously, you cannot easily script initialisations on models or model instances. This event gets fired as soon as the model instance has been created within the 3d scene. This creation could be because the model is part of a choreography, or because you explicitly loaded and created a mode instance within a script.
Firing of this event implies that the model is completely loaded. Generally you would only be interested in a model instance being created and ready to use, not whether the model file has finished loading.
You would typically use this event to initialise event handlers on your model instance or to access groups or poses on the model. Groups and poses can only be accessed on a completely initialised model instance.
Syntax: |
onModelInstanced(model modelobject) |
Parameters: |
|
Example: | This example is from the movieplayer template. This event will check for two different model-instances being initialised. The code here looks for specific groups belonging to these model instances and initialises some event handlers. <SCRIPT Language="JScript" for="movieplayer" event="OnModelInstanced(sModel)"> if(sModel.name == "Shortcut to _slider") { // set the hSlider to this model for easy reference elsewhere in the code hSlider = sModel; // set some event handlers on the model instance hSlider.onlbuttondown = StartLocationChange; hSlider.onlbuttonup = EndLocationChange; hSlider.ondrag = OnSliderDrag; } else if(sModel.name == "Shortcut to _moviecontrol") { // find a couple of groups so we can reference them elsewhere in the script hPlayLight = sModel.groups("playlight"); hPauseLight = sModel.groups("pauselight"); // set some event handlers on the groups within this model instance sModel.groups("play").onclick = new Function("SetMode(mPlay)"); sModel.groups("pause").onclick = new Function("SetMode(mPause)"); } </SCRIPT> |
Remarks: | notes |
Last Updated: 06/22/02 |