home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CyberMycha 2003 October
/
cmycha200310.iso
/
NHL2004
/
NHL2004Demo.exe
/
fe
/
COMMON
/
htc
/
button
/
EAHTML_button.htc
< prev
Wrap
Text File
|
2003-08-20
|
9KB
|
314 lines
<html>
<head>
<PUBLIC:COMPONENT URN='EAHTML_Button' tagName='EAHTML_Button'>
<PUBLIC:PROPERTY NAME='btnName'/>
<PUBLIC:PROPERTY NAME='btnText'/>
<PUBLIC:PROPERTY NAME='btnPositionType'/>
<PUBLIC:PROPERTY NAME='btnX'/>
<PUBLIC:PROPERTY NAME='btnY'/>
<PUBLIC:PROPERTY NAME='btnZ'/>
<PUBLIC:PROPERTY NAME='btnWidth'/>
<PUBLIC:PROPERTY NAME='btnNrmColour'/>
<PUBLIC:PROPERTY NAME='btnHovColour'/>
<PUBLIC:PROPERTY NAME='btnDwnColour'/>
<PUBLIC:PROPERTY NAME='btnNrmText'/>
<PUBLIC:PROPERTY NAME='btnHovText'/>
<PUBLIC:PROPERTY NAME='btnDwnText'/>
<PUBLIC:PROPERTY NAME='btnImgPath'/>
<PUBLIC:ATTACH EVENT='ondocumentready' HANDLER='DoInit' />
<PUBLIC:ATTACH EVENT='onpropertychange' HANDLER='DoPropChange' />
<PUBLIC:ATTACH EVENT='onclick' HANDLER='DoBtnClick' />
<PUBLIC:ATTACH EVENT='onmouseenter' HANDLER='DoBtnOver' />
<PUBLIC:ATTACH EVENT='onmouseleave' HANDLER='DoBtnOut' />
<PUBLIC:ATTACH EVENT='onmousedown' HANDLER='DoBtnDown' />
<PUBLIC:ATTACH EVENT='onmouseup' HANDLER='DoBtnUp' />
<PUBLIC:EVENT NAME='btnEvent' ID='btnEvent'/>
<PUBLIC:METHOD NAME='show'/>
<PUBLIC:METHOD NAME='hide'/>
<PUBLIC:METHOD NAME='disable'/>
<PUBLIC:METHOD NAME='enable'/>
<PUBLIC:METHOD NAME='setText'/>
<PUBLIC:METHOD NAME='setFunction'/>
<PUBLIC:METHOD NAME='clearFunction'/>
</PUBLIC:COMPONENT>
<script>
var oAudioInterface = oGameFace.AudioInterface;
var oBtn;
var oBtnFrame;
var oBtnLeft;
var oBtnRight;
var oBtnBody;
var isOver = false;
var enabled = true;
var overCursor = "hand";
var outCursor = "default";
var normArray = new Array(3);
var hovArray = new Array(3);
var dwnArray = new Array(3);
var blueArray = new Array("med_button_l.gif","med_button_m.gif","med_button_r.gif");
var darkBlueArray = new Array("btn_dark_blue_l.gif","btn_dark_blue_m.gif","btn_dark_blue_r.gif");
var yellowArray = new Array("btn_yellow_l.gif","btn_yellow_m.gif","btn_yellow_r.gif");
var greyArray = new Array("btn_grey_l.gif","btn_grey_m.gif","btn_grey_r.gif");
var redArray = new Array("btn_red_l.gif","btn_red_m.gif","btn_red_r.gif");
var nrmcolor = "#ffffff";
var nrmfontSize = "10px";
var nrmfontFamily = "Verdana";
var nrmfontWeight = "bold"
var hovcolor = "#000080";
var hovfontSize = "10px";
var hovfontFamily = "Verdana";
var hovfontWeight = "bold"
var dwncolor = "#ffffff";
var dwnfontSize = "10px";
var dwnfontFamily = "Verdana";
var dwnfontWeight = "bold"
var root = System.getInstallFolder();
function DoInit() {
imageFolder = (btnImgPath) ? btnImgPath : root + "fe/nhl/images2/widgets/";
defaults.viewLink = document;
defaults.viewInheritStyle = true;
oBtn = document.body.childNodes(0);
oBtnFrame = oBtn.childNodes(0);
oBtnLeft = oBtnFrame.childNodes(0).childNodes(0).childNodes(0).childNodes(0);
oBtnRight = oBtnFrame.childNodes(0).childNodes(0).childNodes(2).childNodes(0);
oBtnBody = oBtnFrame.childNodes(0).childNodes(0).childNodes(1);
nrmArray = (btnNrmColour) ? eval(btnNrmColour+"Array") : blueArray;
hovArray = (btnHovColour) ? eval(btnHovColour+"Array") : blueArray;
dwnArray = (btnDwnColour) ? eval(btnDwnColour+"Array") : blueArray;
nrmcolor = (btnNrmText) ? btnNrmText.split(":")[2] : 'black';
nrmfontSize = (btnNrmText) ? btnNrmText.split(":")[0] : nrmfontSize;
nrmfontFamily = (btnNrmText) ? btnNrmText.split(":")[1] : nrmfontFamily;
nrmfontWeight = (btnNrmText) ? btnNrmText.split(":")[3] : nrmfontWeight;
hovcolor = (btnHovText) ? btnHovText.split(":")[2] : 'gold';
hovfontSize = (btnHovText) ? btnHovText.split(":")[0] : hovfontSize;
hovfontFamily = (btnHovText) ? btnHovText.split(":")[1] : hovfontFamily;
hovfontWeight = (btnHovText) ? btnHovText.split(":")[3] : hovfontWeight;
dwncolor = (btnDwnText) ? btnDwnText.split(":")[2] : 'gold';
dwnfontSize = (btnDwnText) ? btnDwnText.split(":")[0] : dwnfontSize;
dwnfontFamily = (btnDwnText) ? btnDwnText.split(":")[1] : dwnfontFamily;
dwnfontWeight = (btnDwnText) ? btnDwnText.split(":")[3] : dwnfontWeight;
SetProps();
};
function SetProps(){
with (element) {
id = btnName;
type = "EAHTML_Button";
};
with (element.style) {
position = (btnPositionType) ? btnPositionType : "relative";
left = (btnX) ? btnX+"px" : "0px";
top = (btnY) ? btnY+"px" : "0px";
zIndex = (btnZ) ? btnZ : 1;
cursor = overCursor;
};
with (oBtn) {
id = name+"_btn";
};
with (oBtn.style) {overflow='hidden';};
with (oBtnLeft) {
src = imageFolder+nrmArray[0];
};
with (oBtnLeft.style) {};
with (oBtnRight) {
src = imageFolder+nrmArray[2];
};
with (oBtnRight.style) {};
with (oBtnBody) {
background = imageFolder+nrmArray[1];
innerText = (btnText) ? scMsg(btnText,true) : "";
};
with (oBtnFrame) {
width = (btnWidth) ? btnWidth : "";
};
document.body.style.pixelWidth = oBtn.offsetWidth;
document.body.style.overflow = 'hidden';
document.body.scroll = 'no';
element.style.pixelWidth = oBtn.offsetWidth;
element.style.overflow = 'hidden';
with (oBtnFrame.style) {};
with (oBtnBody.style) {
color = nrmcolor;
fontSize = nrmfontSize;
fontFamily = nrmfontFamily;
fontWeight = nrmfontWeight;
};
};
/*************************
EVENTS
************************/
function DoBtnOver(){
if(enabled == false) return;
isOver = true;
with (oBtnLeft) {
src = imageFolder+hovArray[0];
};
with (oBtnRight) {
src = imageFolder+hovArray[2];
};
with (oBtnBody) {
background = imageFolder+hovArray[1];
};
with (oBtnBody.style) {
color = hovcolor;
fontSize = hovfontSize;
fontFamily = hovfontFamily;
fontWeight = hovfontWeight;
};
};
function DoBtnOut(){
if(enabled == false) return;
isOver = false;
with (oBtnLeft) {
src = imageFolder+nrmArray[0];
};
with (oBtnRight) {
src = imageFolder+nrmArray[2];
};
with (oBtnBody) {
background = imageFolder+nrmArray[1];
};
with (oBtnBody.style) {
color = nrmcolor;
fontSize = nrmfontSize;
fontFamily = nrmfontFamily;
fontWeight = nrmfontWeight;
};
};
function DoBtnDown(){
if(enabled == false) return;
System.GUI.playSFX("ok");
with (oBtnLeft) {
src = imageFolder+dwnArray[0];
};
with (oBtnRight) {
src = imageFolder+dwnArray[2];
};
with (oBtnBody) {
background = imageFolder+dwnArray[1];
};
with (oBtnBody.style) {
color = dwncolor;
fontSize = dwnfontSize;
fontFamily = dwnfontFamily;
fontWeight = dwnfontWeight;
};
};
function DoBtnUp(){
if(enabled == false) return;
(isOver) ? DoBtnOver() : "";
};
function DoBtnClick(){
if(enabled == false) return;
clickEvent();
};
function clickEvent(){
oAudioInterface.PlaySFX(1099);
var oEvent = createEventObject();
btnEvent.fire(oEvent);
};
/*************************
MEATHODS
************************/
function setFunction(func){
clickEvent = func;
};
function clearFunction(){
clickEvent = function(){return false};
};
function show(){
element.style.visibility = "inherit";
};
function hide(){
element.style.visibility = "hidden";
};
function setText(text){
oBtnBody.innerText = text;
};
function disable(){
oBtnLeft.src = imageFolder+greyArray[0];
oBtnRight.src = imageFolder+greyArray[2];
oBtnBody.background = imageFolder+greyArray[1];
enabled = false;
element.style.cursor = outCursor;
};
function enable(){
enabled = true;
DoBtnOut();
element.style.cursor = overCursor;
};
</script>
</head>
<body style="background:transparent;overflow:hidden;">
<span>
<table cellpadding="0" cellspacing="0" border="0"><tr>
<td width=3><img src="" ></td>
<td width=100% align="center" valign="middle" background="" nowrap></td>
<td width=3><img src="" ></td>
</tr></table>
</span>
<script>
oBtn = document.body.childNodes(0);
oBtnFrame = oBtn.childNodes(0);
oBtnBody = oBtnFrame.childNodes(0).childNodes(0).childNodes(1);
function DoPropChange()
{
switch (event.propertyName)
{
case "btnText":
oBtnBody.innerText = element.btnText;
break;
};
};
</script>
</body>
</html>