home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
nhl
/
js
/
credits.js
< prev
next >
Wrap
Text File
|
2003-08-20
|
4KB
|
147 lines
//Copyright (c) 2002 Electronic Arts Inc. All rights reserved.
var oGameFace = window.external.GameInterface;
document.onselectstart = function() { return false; };
var TIME = 4000;
var MAX_PAGES = 35;
var currentPage = 0;
var nValue = 0;
var bStopAnim = false;
function initCredits()
{
System.GUI.setLeftNavBackground("fe/NHL/images2/backgrounds/background_left_credits.jpg");
System.GUI.setBackground("fe/NHL/images2/backgrounds/background_right_credits.jpg");
credits0.innerHTML = "<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>" +
oGameFace.GetCreditsText(0) + "<BR><BR>" +
oGameFace.GetCreditsText(1) + "<BR><BR>" +
oGameFace.GetCreditsText(2) + "<BR><BR>" +
oGameFace.GetCreditsText(3) + "<BR><BR>" +
oGameFace.GetCreditsText(4).substring(0, oGameFace.GetCreditsText(4).indexOf("STATS, Inc")) +
"<img src='../images2/screen_images/credits_statsinc.jpg' />" +
oGameFace.GetCreditsText(4).substring(oGameFace.GetCreditsText(4).indexOf("STATS, Inc")-3, oGameFace.GetCreditsText(4).length) +
"<BR><BR>" +
oGameFace.GetCreditsText(5) + "<BR><BR>" +
oGameFace.GetCreditsText(6) + "<BR><BR>" +
"<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>";
var oElOuterContainer = document.getElementById("container");
var oElInnerContainer = document.getElementById("credits0");
verticalScroller.max_value = parseInt((oElInnerContainer.offsetHeight < oElOuterContainer.offsetHeight ) ? 0 : (oElInnerContainer.offsetHeight - oElOuterContainer.offsetHeight));
verticalScroller.style.visibilty = "visible";
setTimeout("doAnimation()", 1500);
}
function verticalScroll()
{
var oElOuterContainer = document.getElementById("container");
var oElInnerContainer = document.getElementById("credits0");
oElInnerContainer.style.pixelTop = 0 - verticalScroller.value;
nValue = verticalScroller.value;
}
function doAnimation()
{
if (!bStopAnim)
{
if (nValue != verticalScroller.max_value)
{
nValue+=1;
credits0.style.pixelTop = -5 - nValue;
}
else
{
credits0.style.pixelTop = -5;
nValue=0;
}
setTimeout("doAnimation()", 125);
}
}
function changePage()
{
if (currentPage > 0 && currentPage <= MAX_PAGES)
{
document.all[ "credits" + (currentPage-1) ].style.visibility = "hidden";
document.all[ "credits" + currentPage ].style.visibility = "visible";
document.all[ "credits" + (currentPage+1) ].style.visibility = "hidden";
}
else if (currentPage > MAX_PAGES || currentPage == 0)
{
document.all[ "credits35" ].style.visibility = "hidden";
document.all[ "credits0" ].style.visibility = "visible";
document.all[ "credits1" ].style.visibility = "hidden";
currentPage = 0;
}
else if (currentPage < 0)
{
document.all[ "credits34" ].style.visibility = "hidden";
document.all[ "credits35" ].style.visibility = "visible";
document.all[ "credits0" ].style.visibility = "hidden";
currentPage = MAX_PAGES;
}
}
function keyListener()
{
if (event.keyCode == 52)
{
pageBackward();
}
else if (event.keyCode == 53 || event.keyCode == 27)
{
pagePause();
}
else
{
pageForward();
}
}
function mouseListener()
{
if (event.button == 2)
{
pageForward();
}
else if (event.button == 1)
{
pageBackward();
}
else if (event.button == 3 || event.button == 4)
{
pagePause;
}
}
function pageForward()
{
bStopAnim = true;
changePage();
currentPage++;
changePage();
setTimeout("bStopAnim=false", TIME);
}
function pageBackward()
{
bStopAnim = true;
changePage();
currentPage--;
changePage();
setTimeout("bStopAnim=false", TIME);
}
function pagePause()
{
bStopAnim = !bStopAnim;
setTimeout("bStopAnim=false", TIME);
}