Topic: Embed two autoplay galleries in html

Is it possible to embed two autoplay galleries in one html page? I read an answer to a previous post to a similar question, but can't get it to work:

<div id="flashcontent">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>
<script type="text/javascript">
    var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "8", "#000000");
    fo.addVariable("xmlURL", "TheNameOfTheXMLForThatGallery.xml");
    fo.write("flashcontent");
</script>

Re: Embed two autoplay galleries in html

For SimpleViewer 2 you need to make some changes, viewer.swf should be simpleviewer.swf and xmlURL is an AutoViewer option and should be changed to galleryURL.

<div id="flashcontent1">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>
<script type="text/javascript">
    var fo = new SWFObject("simpleviewer.swf", "viewer", "100%", "100%", "9", "#000000");
    fo.addVariable("galleryURL", "gallery1.xml");
    fo.write("flashcontent1");
</script>

<div id="flashcontent2">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>
<script type="text/javascript">
    var fo = new SWFObject("simpleviewer.swf", "viewer", "100%", "100%", "9", "#000000");
    fo.addVariable("galleryURL", "gallery2.xml");
    fo.write("flashcontent2");
</script>

Mike Richards
SimpleViewer Support Team.

Re: Embed two autoplay galleries in html

I'm trying to do something similar, requiring multiple galleries within a single page (while having it run in IE).

I haven't been able to get a single gallery to show up using the script tag within the Body of my HTML.
I've edited the sample html file included with the SimpleViewer-Pro download. You can check out my code here: http://www.kwiriousphotography.com/test/

Is there something I'm doing wrong?

Re: Embed two autoplay galleries in html

soopah256 - a better way of doing it would be as follows in your head tag

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript">
            var flashvars = {};
            flashvars.galleryURL = "gallery1.xml";
            var params = {};            
            params.allowfullscreen = true;
            params.allowscriptaccess = "always";
            params.bgcolor = "222222";
            swfobject.embedSWF("simpleviewer.swf", "flashContent1", "100%", "100%", "10.0.0", false, flashvars, params);
</script>

<script type="text/javascript">
            var flashvars = {};
            flashvars.galleryURL = "gallery2.xml";
            var params = {};            
            params.allowfullscreen = true;
            params.allowscriptaccess = "always";
            params.bgcolor = "222222";
            swfobject.embedSWF("simpleviewer.swf", "flashContent2", "100%", "100%", "10.0.0", false, flashvars, params);
</script>

In the body:

<div id="flashcontent1">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>

<div id="flashcontent2">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>
Mike Richards
SimpleViewer Support Team.

Re: Embed two autoplay galleries in html

Thanks for the suggestion Mike!

One of the issues with my page (http://www.kwiriousphotography.com) is that the the separate gallery divs are loaded dynamically with javascript.
So when you click on one, gallery in the nav bar, a div from another page gets loaded.

When I tried using the script tags in the Head (as you suggested), the dynamically loaded divs don't get replaced with the swfobject.

The only method i've found that works is using the <embed> tags, which doesn't work with IE.

So I wanted to try keeping the script tags within the div that is loaded dynamically.
But I'm not even able to get it to work on a single page with one gallery.
Do you have a live example of it working, that I could check out?

Last edited by soopah256 (2009-12-31 16:21:11)

Re: Embed two autoplay galleries in html

The page seems to mostly work in FF, but not IE. Took a quick look at the code and it looks like you might be missing a close div,</div>, tag for <div id="header">? That maybe some of IE's issue. Loading multiple galleries into a single page dynamically can be tricky, also sometimes jQuery and SWFObject have issues.  We tend to suggest 1 gallery per page or embedding multiple galleries in one swf.

I thought we had an example up of more then one gall per page, but I can seem to find it. This will work with the example in the web folder of the download.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>SimpleViewer Gallery</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
        <script type="text/javascript">
            var flashvars = {};
            flashvars.galleryURL = "gallery.xml";
            var params = {};            
            params.allowfullscreen = true;
            params.allowscriptaccess = "always";
            params.bgcolor = "222222";
            swfobject.embedSWF("simpleviewer.swf", "flashContent1", "100%", "100%", "10.0.0", false, flashvars, params);
        </script>
            <script type="text/javascript">
            var flashvars = {};
            flashvars.galleryURL = "gallery.xml";
            var params = {};            
            params.allowfullscreen = true;
            params.allowscriptaccess = "always";
            params.bgcolor = "222222";
            swfobject.embedSWF("simpleviewer.swf", "flashContent2", "100%", "100%", "10.0.0", false, flashvars, params);
        </script>
        
        <style type="text/css" media="screen">    
            html, body    { height:100%; }
            body {            
                margin:0;
                padding:0;
                overflow:auto;
                background-color: #222;
                color:#666;
                font-family:sans-serif;
                font-size:20px;        
            }
            a {    
                color:#ff0000;    
            }
        </style>
        
    </head><body><div id="flashContent1">SimpleViewer requires JavaScript and the Flash Player. <a href="http://get.adobe.com/flashplayer/">Get Flash</a></div>
    <div id="flashContent2">SimpleViewer requires JavaScript and the Flash Player. <a href="http://get.adobe.com/flashplayer/">Get Flash</a></div>
    </body>
</html>
Mike Richards
SimpleViewer Support Team.

Re: Embed two autoplay galleries in html

Ah yeah, I'm able to get 2 galleries to show up with that method. It just doesn't seem to work with the dynamic divs.

I was wondering if you have a live example of this code:

<div id="flashcontent1">SimpleViewer requires JavaScript and the Flash Player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>
<script type="text/javascript">
    var fo = new SWFObject("simpleviewer.swf", "viewer", "100%", "100%", "9", "#000000");
    fo.addVariable("galleryURL", "gallery1.xml");
    fo.write("flashcontent1");
</script>

Thanks for the closing </div> check!

Re: Embed two autoplay galleries in html

Hi,

Please check the following instructions for adding multiple galleries: http://www.simpleviewer.net/simpleviewe … l#multiple

Felix Turner
SimpleViewer Support Team.

Re: Embed two autoplay galleries in html

Hi sorry to tag myself to this post but I have a similar issue.

I have the two galleries working side by side on the same page after a great deal of messing around. They can be seen at http://www.stonetroughs.co.uk/stone-troughs-home I was really happy as it took me ages to get them there.

I then noticed that the one on the left freezes after a few transitions. Anyone got any ideas as to why?

Regards, TheTyke.

Re: Embed two autoplay galleries in html

I can't see anything right off the bat.

Why don't you try enabling "showAutoPlayStatus" to see if that var gets disabled during one of the transitions.
Also have you checked to see if the left gallery will play continuously if your remove/disable the right one?

Re: Embed two autoplay galleries in html

soopah256

Thanks for the use of logic. It's been a bit of a long day so I'll give that a try tomorrow.

Many thanks, TheTyke. smile

Re: Embed two autoplay galleries in html

No problem. Good luck!

And be sure to report back any findings.  smile

Re: Embed two autoplay galleries in html

I then noticed that the one on the left freezes after a few transitions. Anyone got any ideas as to why?

One of your images is missing which causes autoplay to stop: http://www.stonetroughs.co.uk/web/images/4.jpg

Felix Turner
SimpleViewer Support Team.

Re: Embed two autoplay galleries in html

Felix

Many thanks for that. smile

Yes it was my fault. It had been a long hard day and I'd miss counted the images when numbering. hmm

It's running fine now and I look forward to using it on a number of projects in the future.

Again many thanks for your swift support.

TheTyke