Use object handle in JavaScript™

Learn to use object handle in JavaScript.

You can refer to a 3D or FLV object’s name in a JavaScript™ using the FM_ prefix.

The following JavaScript™ example uses the FM_ prefix with the object name. This example JavaScript™ code makes the relevant object transparent.

  1. Insert an object in FrameMaker and name it as my3d in properties in the 3D menu.

  2. Attach the following JavaScript™ code to the object. The object my3d is referred to in this code as FM_my3d.

    var i,count,tempObj; 
    count=FM_my3d.context3D.scene.meshes.count; 
    var selObj; 
    for( i=0;i<count;i++){ 
    selObj=FM_my3d.context3D.scene.meshes.getByIndex(i); 
    tempObj=FM_my3d.context3D.scene.nodes.getByName(selObj.name); 
    tempObj.renderMode="transparent"; 
    }
  3. Create the PDF and click the link. The 3D object turns transparent.