Jump to Viewlet Slide using a URL parameter

General Tips & Tricks
Site Admin
User avatar
Posts: 51
Joined: Sat May 27, 2006 1:27 am
Location: Dolny Kubin, Slovakia

Jump to Viewlet Slide using a URL parameter

Postby Rado » Tue Oct 29, 2013 5:13 am

While not directly supported as a feature, it is possible to send your users to a pre-selected slide of your Viewlet using a simple parameter in the Viewlet's URL. To achieve this, all you need is a little piece of custom JavaScript code on the first slide's On Unload Event. Please follow the step-by-step instructions below:

  1. Insert a blank slide at the beginning of your project.
  2. Adjust its duration to about half a second, and make sure it doesn't have a pause zone.
  3. Click the "Lightning Bolt" toolbar button to open the "Slide Events" dialog.
  4. Select the "On Unload" tab, and click the "Add" button to add a new action.
  5. Select "JavaScript" from the list of actions and enter the code displayed at the bottom of this post.
  6. Click "OK" to confirm the change.

That's it! You can now use a "gotoslide" parameter at the end of your Viewlet's URL to have it jump to the selected slide at the beginning. For example, if your Viewlet's URL is:

changing the URL to:

your Viewlet will start playing from slide number 4. Just remember that inserting the blank slide with JavaScript at the beginning has pushed all your slides by one, so your original opening slide is now actually the slide number 2.

A sample project for ViewletBuilder7 is attached to this post, just download it and give it a try! Or you can just paste the JavaScript code below to your On Unload event's JavaScript action using your own project:

Code: Select all
    var flashObject = window.document[$VIEWLET_NAME$];
    var slide = 2;
    var maxSlide = flashObject.viewletGetVariable("SLIDE_COUNT");
    var regexS = "[\\?&]gotoslide=([0-9]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results != null )
    slide = parseInt(results[1]);
    if(slide > maxSlide)
      slide = maxSlide;
    if(slide < 2)
      slide = 2;
    unpauseTimeout = setTimeout('window.document[$VIEWLET_NAME$].viewletUnpause(); clearTimeout(unpauseTimeout);', 500);
JavaScript Jump to Slide example project
(6.72 KiB) Downloaded 311 times

Return to FAQs - ViewletBuilder 7.x

Who is online

Users browsing this forum: No registered users and 1 guest