Cult3d object interaction with Web script

Source: Internet
Author: User
Tags object object time interval

Here we will describe the scripting features of Cult3d, and how to use the Scripting and Cult3d objects in a Web page to interact with each other, by interacting we can start an animation after the user chooses the correct answer, or change the color of the object according to the user's choice, and so on. There is a difference in invocation when Cult3d is running under Netscape Communicator and Microsoft Internet Explorer browsers, as we will explain here.

?? Netscape Navigator uses JavaScript (JS) and Cult3d plug-ins to communicate, using ActiveX technology under Windows. In fact, the Cult3d browser is an ActiveX component, whether it is Netscape's plug-in or Internet Explorer's plug-in.

The

ActiveX component scripting language is Microsoft Visual Basic script (VBS). JS and VBS are subtly different in syntax, which is why we make "cult3d.js". You can only use the JS script in the Web page, because the JS script can be executed by Internet Explorer and Netscape. We recommend using JS script unless you are using an Internet Explorer (Windows 9x/nt) that does not support JS scripts. VBS is not supported by non-Windows operating systems.
Cult3d Event  
triggers an event when the condition is met, and the following four events can occur:
1. The scene is loaded scene is booted
2. The complete object is loaded scene boot completes
3. The object is invalid or missing objects are illegal or missing
4. Custom messages created by the Cult3d designer customized message
When the event is triggered, it can activate the Web script, if the Web script does not contain the activation event handle, the event will be ignored.
Event: Onsceneloaded 
Triggers the event when the appropriate information is started on the scene Cult3d the browser. At this point textures and cursors may not have been booted to complete.
Netscape Example:

<embed name= "Object name" pluginspage= "http://www.cult3d.com/newuser/index.html" src= "yourobject.co" width= "HEIGHT" = "onsceneloaded=" (' onsceneloaded triggered ') "</EMBED>
Event: onloadfinished
The Cult3d browser triggers the event when the file is downloaded and uncompressed.
Netscape Example:

<embed name= "Cult3d" pluginspage= "http://www.cult3d.com/newuser/index.html" src= "yourobject.co" width= "400" height= "onsceneloaded=" document.embeds["Cult3d"].triggerevent ("event name") ' ></EMBED>------event: onloadaborted
The Cult3d browser triggers the event when a file download error or the object does not exist.
Event: Onsendmessage

The returned message can be received with "getlastmessage ()" When the Cult3d browser receives the "Send message to Host" action specified through Cult3d Designer or triggers the event when invoked by the Java program.

Example: JavaScript code used under Internet Explorer:


<script language= "javascript" ><!--function onloadfinished () {//Insert required code here}//--></script> <script language=javascript For=cult3d event=onloadfinished><!--//Invoke the specified method onloadfinished ()//--></ Script><object id=cult3dclassid= "clsid:31b7eb4e-8b4b-11d1-a789-00a0cc6651a8" width=192 height=192>< PARAM name= "SRC" value= "test.co" The VBScript code used under >></object>internet Explorer: <script language= " VBScript "><!--Sub cult3d_onloadfinished ()" Inserts the need for code end Sub--></script><object id=cult3dclassid= "Clsid:31b7eb4e-8b4b-11d1-a789-00a0cc6651a8" width=192 height=192><param name= "SRC" VALUE= "Test.co" ></ Object>
Although Microsoft Internet Explorer supports VBScript scripting, it is recommended that JavaScript scripts be used for convenience. JavaScript code used under Netscape Communicator:


<script language= "javascript" ><!--function onloadfinished () {//Insert required code here}//--></script> <embed name=cult3dpluginspage= "http://www.cult3d.com/newuser/index.html" src= "test.co" width= "192" height= " Onloadfinished= "onloadfinished ()" ></EMBED> JavaScript method  
You can control the Cult3d object object

by using the following methods on a Web page


Netscape:object.setAntiAliasing (Mode) object.getantialiasing () Internet explorer:object. antialiasing
This method enables the Web page to set the anti-aliasing mode of the Cult3d object, which can be changed when using software rendering, and has three different values:
0? In automatic mode, you can specify the time interval that occurs by setting the "Antialiasingdelay" time value, but when objects move in the scene, Anti-aliasing properties are blocked to ensure that the scene is demonstrated at a speed.  
1? Disable forbid
2? Enable Promise
Refer to the "antialiasing" parameter.
Netscape:object.setAntiAliasingDelay (delay) object.getantialiasingdelay () Internet explorer:object. Antialiasingdelay
This property causes the page to specify the time interval for automatic anti-aliasing by setting a "Antialiasingdelay" time value, which can be changed only when using software rendering, see "Antialiasingdelay".
Netscape:object.triggerEvent (name) Internet Explorer:object. Triggerevent (name)
The method triggers a named target event and returns a Boolean value that returns True when Cult3d discovers the target event.

  Netscape Example:


var Cult3d = document.embeds["Cult"];var triggered = cult3d.triggerevent ("Moveclock"); if (!triggered) alert (" Event did not find! "); -netscape:object.getversion () Internet explorer:object. Version This method returns the Cult3d browser version number. Netscape Example: var Cult3d = document.embeds["Cult"];var cultversion = Cult3d.getversion (); Window.alert ("Cult3d version" + cultversion) Netscape:object.getLastMessage () Internet explorer:object. Lastmessage
This method receives the latest message that is sent when activated by the "Send Message to Host" action specified by Cult3d designer. If the message is empty, it will also be set to null.
Netscape:object.getFrame () Internet explorer:object. Frame
This method returns the current number of frames for the Cult3d object, which becomes larger as the rendering time.
Netscape:object.setFocus () Internet explorer:object. Focus
This method sets the keyboard focal point of the Cult3d object, and you can manually set the keyboard focus of the current Web page to the Cult3d object without clicking the Cult3d object by the user. This method is mandatory for Internet Explorer to enable users to interact with the Cult3d object using the keyboard, a method Netscape does not apply because Netscape automatically sets the keyboard focus to the embedded Cult3d object. If you do not use this attribute, the user may not respond when using the keyboard to manipulate Cult3d objects.
Netscape:object.getActionStatus (name) Internet Explorer:object. Getactionstatus (name)
This method returns the action state of the specified event, its return value:
-1? Event name not found  
0? The event did not execute &NBSP;
1? event has been executed

  Netscape Example:

var Cult3d = document.embeds["cult"];var status = Cult3d.getactionstatus ("Opendoor"); if (status = = 1) alert ("Event not found!") ; else if (status = = 1) cult3d.triggerevent ("Closedoor"); Elsecult3d.triggerevent ("Opendoor"); Netscape:object.triggerAction (name,action) Internet explorer:object. TriggerAction (name,action)
This method sends a message with parameters to the Cult3d Java event, unlike the "triggerevent" method without parameters. The action argument must be a string, and if Cult3d discovers the Java event, its return value is true.

  Netscape Example:

var Cult3d = document.embeds["cult"]; var triggered = Cult3d.triggeraction ("Setclock", "" + New Date (). GetTime ()); if (! triggered) alert ("Event not found!"); Netscape example use JavaScript code example:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.