Scripting between the VMP and the VMP flash 5 player:


* VMP to Flash:
Rotate the cube and click on any of the surfaces. The flash background contains a square and a textfield. The square will change colors depending on the material you clicked on, and the textfield will show the RGB values (in VMP terms [0-1]).
An interactor handles the MTSEvent.Material event when the user clicks on the cube and passes the diffuse color (difc) value (val) to the setFlashVar action:

<MTSAction Name="setFlashVar">
<!-- setting the value of a variable in flash -->
<MTSSetProperty Target="flashMovie.SWF._root.colorText" Value="val"/>
<!-- calling a function in flash where Value passes the function parameter -->
<MTSSetProperty Target="flashMovie.SWF._root.changeColor()" Value="val"/>
<!-- calling a built-in flash function (action, object, etc.) -->
<MTSSetProperty Target="flashMovie.SWF._root.gotoAndPlay(3)" Value=""/>
</MTSAction>

 

* Flash to VMP:
Drag any of the color sliders to change the color of the material on the top face of the cube, this is done via fscommand:

onClipEvent (enterFrame) {
if (dragging) {
_root.red=(_x+70)/70;
colors=_root.red+" "+_root.green+" "+_root.blue;
cmdStr = "Target=MTSMaterial.material4::difc; Value="+colors;
fscommand ("MTSAssignProperty " + cmdStr);
}
}