Topic: call xml file parameters to for field

Hello,

I have been happily using SimpleViewer for a few years now and would really like to try customising it more but I don't see the option I require in SV builder.

What I would like to do is display 'current' selected image number in a Form Field as well as the image display area where it is now. I want to do this so that a viewer can comment by posting my Form without having to input the Image Number themselves.

Can this be done?

Re: call xml file parameters to for field

You can fetch the currently displayed image number (and then use it elsewhere in your web page) with the SimpleViewer-Pro API.

Each time a new image is selected the svImageChange(index) event is fired. The event data contains the new image index number. The index starts as zero for the first image in the gallery so you may want to add one to find the actual image number which corresponds to the showImageNumber configuration option.

Here is an example which simply displays the image number in a JavaScript alert box. (You could do whatever you like with the number using your own custom JavaScript.)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>SimpleViewer-Pro Gallery</title>
</head>
<body>
    <script type="text/javascript" src="svcore/js/simpleviewer.js"></script>
    <script type="text/javascript">
        var svAPI;
        
        function svComplete() {
            svAPI = document.getElementById('svInstance');        
        };

        function svImageChange(index){
            var imageNumber = index + 1;
            alert("Current Image: " + imageNumber);
        }

        var flashvars = {};
        flashvars.enableAPI = "true";

        var params = {};
        params.allowfullscreen = true;
        params.allowscriptaccess = "always";

        var attributes = {};
        attributes.id = "svInstance";
        attributes.name = "svInstance";

        simpleviewer.ready(function() {
            svAPI = simpleviewer.load('sv-container', '100%', '100%', '222222', true, flashvars, params, attributes);
        });    
    </script>
    <div id="sv-container"></div>
</body>
</html>

Please note that this is possible only with SimpleViewer-Pro v2 (and can be achieved manually only and not within svBuilder-Pro).
You have posted this in the SimpleViewer-Pro v1 forum and if you are a SimpleViewer-Pro v1 user, then the API will not be available to you and you will need to upgrade your version of SimpleViewer-Pro.
Please see this FAQ regarding the SimpleViewer Pro upgrade policy.
Customers who purchased SimpleViewer Pro v1.9 on or after 9 December 2008 are eligible for a free courtesy upgrade to v2.
If this is the case, then please fill out this form to receive a new link.

Steven Speirs
SimpleViewer Support Team.

Re: call xml file parameters to for field

Thank you for this, I will check my version tomorrow.

Re: call xml file parameters to for field

Steven,

Having checked my installation, I have version v2.0.3 so I apologise for having posted to the incorrect forum thread in the first place.

Having tried your script I still get no displayed results but clearly the path to src="svcore/js/simpleviewer.js" is incomplete and should be an absolute URL surely?

I cannot find this file within my SVBuilder program folder. Is it downloadable from simpleviewer.net?

Edwind

Re: call xml file parameters to for field

The 'svcore' folder was introduced in SimpleViewer v2.1.0 to support Universal Playback.

Please upgrade your version of SimpleViewer-Pro to the current version (v2.3.1) by following the instructions on the Upgrading SimpleViewer-Pro page. (As a SimpleViewer-Pro v2.0.3 user, you can upgrade for free.)

Once you have installed the latest version of svBuilder-Pro (you will need to uninstall your existing version first), just create a test gallery with the application and replace the gallery's 'index.html' file with the code I posted above.

The relative path to the 'simpleviewer.js' file will work fine when the code above is used in a gallery's 'index.html' file (and the 'index.html' file is in its default location) but you could change it to an absolute path if you like.

Steven Speirs
SimpleViewer Support Team.

Re: call xml file parameters to for field

Thanks again Steven,

I no longer have the email that included the download link. Can your re-send please?

Edwind

Re: call xml file parameters to for field

Please fill in the SimpleViewer-Pro Product Upgrade Request form to request a new download link.
I do not personally have the ability to search through transaction records or generate new download links (otherwise I would happily do so for you) but filling out the form will ensure that the necessary information is passed on to the correct department who will be able to process your request and send you a new download link.

Steven Speirs
SimpleViewer Support Team.

Re: call xml file parameters to for field

Further help please.
I have now successfully upgraded my installation and followed your instructions about installing the API code to access the instance (quote 'Each time a new image is selected the svImageChange(index) event is fired.') but it keeps returning for each image, the same result, i.e. Current Image: NaN
I would imagine there is something relatively simple here that js coders would recognize instantly. Unfortunately I am not a js coder.

I am going to move this with more info into where it should be simpleviewer pro v2

Last edited by edwind (2014-01-09 15:51:42)

Re: call xml file parameters to for field

[Discussion continued here.]

Steven Speirs
SimpleViewer Support Team.