Page 1 of 1

Updated - javascript slideshow that includes quicktime movie

Posted: Sun Nov 28, 2004 12:29 pm
by dardsemail
Hi,

I have developed a simple javascript slideshow that works pretty well. The only thing is that the client would like to have the second 'slide' actually play a movie.

I've got the exception generated - but the movie opens in a new window. How do I get it to open in the current window? I suspect it has to do with setting the window or self property - but I'm not sure how or where to do that.


Here's the code that I have thus far:

Code: Select all

<script type="text/javascript">
 var photos=new Array()
 var photoslink=new Array()
 var which=1

 //define images. You can have as many as you want:
 photos&#1111;1]="images/ir1.jpg"
 photos&#1111;2]="images/ir2.jpg"
 photos&#1111;3]="images/ir3.jpg"
 photos&#1111;4]="images/ir4.jpg"
 photos&#1111;5]="images/ir5.jpg"
 photos&#1111;6]='images/ir6.jpg';
photos&#1111;7]='images/ir7.jpg';
photos&#1111;8]='images/ir8.jpg';
photos&#1111;9]='images/ir9.jpg';
photos&#1111;10]='images/ir10.jpg';
photos&#1111;11]='images/ir11.jpg';
photos&#1111;12]='images/ir12.jpg';
photos&#1111;13]='images/ir13.jpg';
photos&#1111;14]='images/ir14.jpg';
photos&#1111;15]='images/ir15.jpg';
photos&#1111;16]='images/ir16.jpg';
photos&#1111;17]='images/ir17.jpg';
photos&#1111;18]='images/ir18.jpg';
photos&#1111;19]='images/ir19.jpg';
photos&#1111;20]='images/ir20.jpg';
photos&#1111;21]='images/ir21.jpg';
photos&#1111;22]='images/ir22.jpg';
photos&#1111;23]='images/ir23.jpg';
photos&#1111;24]='images/ir24.jpg';
photos&#1111;25]='images/ir25.jpg';
photos&#1111;26]='images/ir26.jpg';
photos&#1111;27]='images/ir27.jpg';
photos&#1111;28]='images/ir28.jpg';
photos&#1111;29]='images/ir29.jpg';
photos&#1111;30]='images/ir30.jpg';
photos&#1111;31]='images/ir31.jpg';
photos&#1111;32]='images/ir32.jpg';
photos&#1111;33]='images/ir33.jpg';
photos&#1111;34]='images/ir34.jpg';
photos&#1111;35]='images/ir35.jpg';
photos&#1111;36]='images/ir36.jpg';
photos&#1111;37]='images/ir37.jpg';
photos&#1111;38]='images/ir38.jpg';
photos&#1111;39]='images/ir39.jpg';

 //Specify whether images should be linked or not (1=linked)
 var linkornot=0

 //do NOT edit pass this line

 var preloadedimages=new Array()
 for (i=0;i<photos.length;i++)&#123;
 preloadedimages&#1111;i]=new Image()
 preloadedimages&#1111;i].src=photos&#1111;i]
 &#125;

 function applyeffect()&#123;
 if (document.all && photoslider.filters)&#123;
 photoslider.filters.revealTrans.Transition = 7
 photoslider.filters.revealTrans.stop()
 photoslider.filters.revealTrans.apply()
 &#125;
 &#125;

 function playeffect()&#123;
 if (document.all && photoslider.filters)
 photoslider.filters.revealTrans.play()
 &#125;

 function keeptrack()&#123;
 window.status="Image "+(which+1)+" of "+photos.length
 &#125;

function backward()&#123;
if(which==0) which =photos.length-1
if (which>1)&#123;
which--
if (which == 2)
	showMovie()
else
applyeffect()
document.images.photoslider.src=photos&#1111;which]
playeffect()
keeptrack()
&#125;
&#125;

function forward()&#123;
if(which>photos.length-1) which = 0
if (which<photos.length-1)&#123;
which++
if (which == 2)
	showMovie()
else
applyeffect()
document.images.photoslider.src=photos&#1111;which]
playeffect()
keeptrack()
&#125;
&#125;

function photoNum(num)&#123;
which = num
if (which == 2)
	showMovie()
else
applyeffect()
document.images.photoslider.src=photos&#1111;which]
playeffect()
keeptrack()
&#125;

 function transport()&#123;
 window.location=photoslink&#1111;which]
 &#125;

 </script>
Here's the code embedded in the body... you can see where I was going with this - but it doesn't seem to be working.

Code: Select all

<script>
									
function showMovie()
					&#123;
					document.write('<EMBED src="images/video.mov" border="0" width="700" autoplay="true" scale="Aspect" pluginspage="http://www.apple.com/quicktime/download/" height="491" target="webbrowser" controller="true"></EMBED>')
					&#125;					document.write('<img src="'+photos&#1111;1]+'" name="photoslider" style="filter:revealTrans(duration=2,transition=12)" border=0>')
 					
				</script>
any help would be GREATLY appreciated!

Posted: Thu Dec 09, 2004 5:32 am
by Chris Corbyn
Take out the bit that says

Code: Select all

target="webbrowser"
Unless of course you have two windows open and are directing the movie to play in the other window. If you have no window open called "webbrowser" the target attribute will force a new one to be created and name it accordingly.