Log in

View Full Version : dynamically embedding an array of quicktime videos using js



shabam
11-27-2006, 01:37 AM
hi there,

I am wondering how i can go about loading an array with quicktime videos then using js to dynamically embedd movies as they are needed into the webpage (Im also a newbie to programming in general and am wondering if this is even possible?)

I have a js file that loads information in an array for an image map as to what it should do when onmouseover and onmouseout. I then call that array when the mouse moves around.

however on .onclick, i'd like the image to turn the image into a quicktime movie. I can make this work the brut force way (by makeing another html page that has a quicktime movie embedded), but id like to do it in a more elegant way if possible.

here is a simplified/shortened version of my js so far if my explaination is unclear as to what im doing (which is likely:P). any sort of guidance would be greatly appreciated!





var mouseOvers = new Array();
var mouseOuts;
var mouseIsClicked;

window.onload = function()
{
loadAll(document.getElementById('map1'));

}

function loadAll(arrayLoading)
{
var areas = arrayLoading.getElementsByTagName('area');

for(var i=0;i<areas.length;i++)
{
areas[i].onmouseover = mouseIsOver;
areas[i].onmouseout = mouseIsOut;
areas[i].onclick = mouseIsClicked;
areas[i].number = i;

mouseOvers[i] = new Image();
mouseOvers[i].number = i;

switch(i)
{
case 0: mouseOvers[i].main = './pics/ortho/mortho_wd.jpg';
//stuck here
//mouseIsClicked[i].movie = './quick/quick1.mov';
break;
default: alert('Oops! Make sure you have enough cases to match your number of areas!')
break;
}
}



}


function mouseIsOver()
{

var navigate = document.getElementById('map1');
var navImg = navigate.getElementsByTagName('img');

navImg[0].src = mouseOvers[this.number].main;

}

function mouseIsOut()
{

var navigate = document.getElementById('map1');
var navImg = navigate.getElementsByTagName('img');

navImg[0].src = './pics/ortho/mortho.jpg';
}

function mouseIsClicked()

{
alert('im in the click')
//content.innerHTML= mouseOvers[this.number].txt

}