preload the next image to avoid flicker on my web cam page

Hi

I have a webcam page that is an asp page. the code is :
************************************************************************************************************************
<%@LANGUAGE="VBScript"%>
<HTML>
<HEAD>
<% response.write ("<META HTTP-EQUIV=""REFRESH"" CONTENT=""" & Session("TimeSet") & """>" ) %>
</HEAD>
<BODY>
<div align="center">
        <%
            select case session("CameraSet")
            case "Cam 01"
                  response.write ("<img BORDER=""1"" src=""http://111.111.111.111/image.cgi?resoloution=704x480"" width=""704"" height=""480"" alt=""Cam 01"">" )
            case "Cam 02"
                  response.write ("<img BORDER=""1"" src=""http://111.111.111.112/image.cgi?resoloution=704x480"" width=""704"" height=""480"" alt=""02"">" )
            case "Cam 03"
                  response.write ("<img BORDER=""1"" src=""http://111.111.111.113/image.cgi?resoloution=704x480"" width=""704"" height=""480"" alt=""03"">" )
            end select
      %>
</div>
</BODY>
</HTML>
*************************************************************************************************************************
this page is used with <iframe> in a parent page. the parent page sets the session variables, which are which camera to view(CameraSet) and what the refresh time is (TimeSet). Everything is working perfectly except everytime the page refreshes it flickers.

Now to the question:

Is it possible to preload the next image and then switch to that? I presume that if the next image is cached then the refreshing of the page would be instant and therfore no flicking.

Thanks in advance.
jclothierAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BatalfCommented:
I'm not VBScript person, so I'll have to give it to you by Javascript. You could refresh the src attribute of your images. Here's a shot

<%@LANGUAGE="VBScript"%>
<HTML>
<HEAD>
<% response.write ("<META HTTP-EQUIV=""REFRESH"" CONTENT=""" & Session("TimeSet") & """>" ) %>
</HEAD>
<BODY>
<div align="center">
        <%
          select case session("CameraSet")
          case "Cam 01"
               response.write ("<img name='image1' BORDER=""1"" src=""http://111.111.111.111/image.cgi?resoloution=704x480"" width=""704"" height=""480"" alt=""Cam 01"">" )
          case "Cam 02"
               response.write ("<img name='image2' BORDER=""1"" src=""http://111.111.111.112/image.cgi?resoloution=704x480"" width=""704"" height=""480"" alt=""02"">" )
          case "Cam 03"
               response.write ("<img name='image3' BORDER=""1"" src=""http://111.111.111.113/image.cgi?resoloution=704x480"" width=""704"" height=""480"" alt=""03"">" )
          end select
     %>
</div>
<script type="text/javascript">
var seconds = 30 * 1000; // 30 seconds

function reloadImages(){
    self.image1.src = "http://111.111.111.111/image.cgi?resoloution=704x480&random="+Math.random();
    self.image2.src = "http://111.111.111.112/image.cgi?resoloution=704x480&random="+Math.random();
    self.image3.src = "http://111.111.111.113/image.cgi?resoloution=704x480&random="+Math.random();
    setTimeout('reloadImages()',seconds);
}

setTimeout('reloadImages()',seconds);

</script>
</BODY>
</HTML>
0
BatalfCommented:
I forgot to remove

<% response.write ("<META HTTP-EQUIV=""REFRESH"" CONTENT=""" & Session("TimeSet") & """>" ) %>

It should not be a part of my code. You modify the interval between each refresh here

var seconds = 30 * 1000; // 30 seconds

 
0
jclothierAuthor Commented:
To Batalf

That works great, one thing though. how do I get my "session(TimeSet)" variable into "var seconds = 30 * 1000; // 30 seconds"
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

BatalfCommented:
What's the format of it? If it's seconds, you could probably do it like this:

instead of:

var seconds = 30 * 1000; // 30 seconds

use this:

<% response.write ("var seconds=" & Session("TimeSet") & "*1000;" ) %>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jclothierAuthor Commented:
Funny I'd tried that and it didn't work, tried it again and it works like a dream. Thanks for your help and a quick response.
0
BatalfCommented:
Glad I could help!

Thanks for the "A"

Batalf
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.