Example 8

In this example we are re-directing the external "Link to Page" to Javascript (rather than a traditional link out to another page). If you're tricky, you'll realize that you do not have to use a URL in the <link> of your XML data loaded into the player. Instead, you can use data, and that data will be re-directed back to javascript.

There are two options available for this feature: Info Button Action, and Click Video Window Action. By default, these options are set to "link" so, technically, you don't have to establish them, however in the source code, we've explicitly set them so you can see. These features only work when there is actual data in the <link> tag of an XML playlist item.

To "wire" these options, set them to "Link to Page", then set the "External Link-to Window" option to "javascript". See the source code for how to set up these options manually.

In the example below, start a video, then click the video window. OR roll over an item in the playlist, then click the -> (arrow) to the left of the line item. You can use Skin Machine to set the -> (arrow) to a graphic (e.g. JPG, or PNG image).

Within rave.js, there is an event handler function named "handleLinkClick", which gets pinged when "linkToWindow" is set to "javascript". For example purposes, we've included some dummy data within the <link> tag of playlist4.xml. And we're using the alert() function to display the data in an alert window.

This DIV contents to be replaced by Rave.

 

Source Code

<script language='javascript' src='rave.js'></script>
<div id="flashcontent">This DIV contents to be replaced by Rave.</div>
<script language="JavaScript" >

// NOTE: See actual source code of this page for detailed comments.

// Set config options:
defaultWimpyConfigs.wimpyWidth = "332";
defaultWimpyConfigs.wimpyHeight = "389";
defaultWimpyConfigs.wimpySkin = "skins/skin_js_examples.xml";


// Set the behavior to "link":
defaultWimpyConfigs.clickWindowAction="link";
defaultWimpyConfigs.infoButtonAction="link";


// Wire the linkToWindow to javascript:
defaultWimpyConfigs.linkToWindow="javascript";

// Enable handler events:
enableWimpyEvents = true;

// Re-write the handler function:
function handleLinkClick(returnedObject){
   alert(returnedObject);
}


// Set the default playlist:
defaultWimpyConfigs.wimpyApp = "playlist4.xml";

// Render the player using the default configs:
makeWimpyPlayer();

</script>

 

 

 

 

 

 

Part of the Wimpy Rave documentation.
©2009 Plaino