home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CyberMycha 2003 October
/
cmycha200310.iso
/
NHL2004
/
NHL2004Demo.exe
/
fe
/
nhl
/
htc
/
button
/
ControllerConfigButton.htc
< prev
next >
Wrap
Text File
|
2003-08-20
|
3KB
|
105 lines
<!-- Copyright (c) 2002 Electronic Arts Inc. All rights reserved. -->
<PUBLIC:COMPONENT lightweight=true>
<PUBLIC:PROPERTY NAME="imgSrc" />
<ATTACH EVENT="ondocumentready" HANDLER="doInit" />
<ATTACH EVENT="onmousedown" HANDLER="doMouseDown" />
<ATTACH EVENT="onmouseenter" HANDLER="doMouseEnter" />
<ATTACH EVENT="onmouseleave" HANDLER="doMouseLeave" />
<ATTACH EVENT="onmouseup" HANDLER="doMouseUp" />
<ATTACH EVENT="onselectstart" HANDLER="cancelCursorSelect" />
<script language="javascript">
var aButton = new Array();
var strImgSrc = (imgSrc != null) ? imgSrc : "../../NHL/images/button/controller_config_nml.gif";
var strImgPath;
function doInit()
{
var strImgName = strImgSrc.split('/');
strImgName.reverse();
strImgName = strImgName[0];
strImgPath = strImgSrc.substr(0, strImgSrc.length - strImgName.length);
createImg( "normal" , strImgName );
createImg( "hover" , strImgName.replace(/nml/ , "hov" ));
createImg( "down" , strImgName.replace(/nml/ , "dwn"));
CustomDefault('nml-text-color', 'nmlTextColor', 'black');
CustomDefault('dwn-text-color', 'dwnTextColor', 'white');
CustomDefault('hov-text-color', 'hovTextColor', 'white');
}
function CustomDefault(sCSSName, sScriptName, sDefault)
{
if (currentStyle[sCSSName] == null)
{
style[sCSSName] = sDefault;
}
else style[sCSSName] = currentStyle[sCSSName];
style[sScriptName] = style[sCSSName];
}
function createImg( sId , sImgName )
{
var oImg = new Image();
oImg.src = strImgPath + sImgName;
aButton[ sId ] = oImg;
}
function doMouseEnter()
{
doColorChange('white' , 'hov');
}
function doMouseLeave()
{
doColorChange('black' , 'nml');
}
function doMouseDown()
{
doColorChange( 'white' , 'dwn');
}
function doMouseUp()
{
doColorChange('#FFDF60' , 'hov');
}
function doColorChange(sColor , sState )
{
srcEl = event.srcElement;
if(srcEl.id.match(/_/)) srcEl = srcEl.parentElement;
btnText = element.document.all[ srcEl.id + "_text" ];
btnImg = element.document.all[ srcEl.id + "_img" ];
if(btnImg != null)
{
if(sState.match(/nml/))btnImg.src = aButton[ "normal" ].src;
if(sState.match(/hov/))btnImg.src = aButton[ "hover" ].src;
if(sState.match(/dwn/))btnImg.src = aButton[ "down" ].src;
}
switch( sState )
{
case "dwn":
if(btnText != null)
btnText.style.color = element.currentStyle.dwnTextColor;
break;
case "nml":
if(btnText != null)
btnText.style.color = element.currentStyle.nmlTextColor;
break;
case "hov":
if(btnText != null)
btnText.style.color = element.currentStyle.hovTextColor;
break;
}
}
function cancelCursorSelect()
{
event.cancelBubble = true;
event.returnValue = false;
}
</script>
</PUBLIC:COMPONENT>