cult3d和java综合运用 - Cult3D
When you call first executeMapped05 in Designer then JAS will execute the block "init" because is mapped to index 5. But the last action of the "init" block is to map the block "test" to index 5.
If you call again executeMapped05 in Designer JAS will execute the block "test". The block "test" contains also a mapping action and it maps block "init" to index 5 so next time you call executeMapped05 "init" will be executed and so on.
Mapping is a reusable feature.
Because Designer set the string param on click events you can imagine another way of executing blocks.
javaActionsScript(1, 0, 0) {
}
actionsList ("Cube"){
printOut("in Cube ...");
}
After the script is loaded and you assigned a mouse click to object "Cube" like this:
then when you click on "Cube" JAS will execute the block "Cube" because Designer put the object name as the string parameter of the executeBlock method.
The "Cube" block contains only a printOut action, which prints a message to the Java console. But where is the Java console ?
To open the Java console in NS 4.7 choose Communicator/Tools/Java Console menu command.
To open the Java console in IE choose View/Java Console menu command. If this command does not appear on you IE menu you must choose the Tools/Internet Options menu command and in the dialog that appears select the Advanced tab. From the options tree go to the Microsoft VM category and select the Java Console Enabled option. You must then restart IE (and maybe the computer) before the View/Java Console command menu to be visible.
Now you may choose the View/Java Console menu command. Here is an example of Java console when I've loaded the Happy Easter gallery object.
I believe that you are loaded with theory now, maybe its better to finalize a simple cult object and see JAS in action.
In the next step will add some geometry to our JAS project, create the JAS script, compile the project and see the result.