What can I do with the Javascript event option you have?

General Tips & Tricks
Site Admin
Posts: 1092
Joined: Fri May 26, 2006 3:15 pm
Location: San Jose, CA

What can I do with the Javascript event option you have?

Postby James » Wed Jul 25, 2007 2:08 pm

This is a powerful feature for someone who has a programming background. Since there are many possible way to use this, we decided to pick a few examples to give you some ideas.

1) Communicate with an application that supports a Javascript API

We have used this in the past to communicate with a Flash Avatar/Talking Head to send commands to the TTS (Text-To-Speech) engine to make it talk. An example might be
Code: Select all

The API would need to be initialized in the HTML frame which you can do now since you can edit this yourself in the Viewlet Profile.




2) Open/Create a browser window

Here is an example of something simple I did.

Here is the code I added to the OnLoad Event on Slide 2

Code: Select all
var w ='window','Some Window','height=200,width=300');
w.document.write('Viewlet Language: ' + '<b>' + $VIEWLET_LANGUAGE$ + '</b><br>');
w.document.write('Viewlet Size: ' + '<b>' + $VIEWLET_WIDTH$ + '</b>' + ' x ' + '<b>' + $VIEWLET_WIDTH$ + '</b><br>');
w.document.write('Current Slide#: ' + '<b>' + $CURRENT_SLIDE_NUMBER$ + '</b><br>');
w.document.write('Time Elapsed in Milliseconds: ' + '<b>' + $TIME_ELAPSED$ + '</b><br>');

Something you may not be aware of is the addition of Javascript Variables which you can access now. If you click on the Javascript Event option, there is a button on the lower right for the variables. If you click that...a list will open up and if you click on one and hit ADD, it will insert this variable into your code for you.

3) Use the $CURRENT_SLIDE NOTES$ variable option in conjuction with a TTS engine to speak your slide rather than record your voice. All you would need to do is type what you want the slide to say and send that to the speech engine (like a talking head, etc)

4) Call any webpage and pass parameters to it. Based on those values, you could do something else...launch another Viewlet, etc. This would be a form of branching external to the Viewlet.

Hopefully this is get you started and after some Google browsing you can find other code examples and ways to use it within the Viewlet.


Return to FAQs - ViewletBuilder 5.x

Who is online

Users browsing this forum: No registered users and 1 guest