home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Minami 73
/
MINAMI73.iso
/
Extra
/
MPSetup.exe
/
1033
/
RCDATA
/
CABINET
/
9SeriesDefault.wmz
/
corona_tiny.js
next >
Wrap
Text File
|
2002-10-15
|
6KB
|
202 lines
// timed event dispatcher
var g_grpTimerEvents = new Array();
function OnTinyLoad() {
view.width = view.minWidth;
view.height = view.minHeight;
// rem for 98: RegisterTimerEvent(new TimerEvent(50, 200, "MoveItX", "RegisterTimerEvent(new TimerEvent(50, 200, \"ResizeY\",\"\", svVideo, 0));", t1, 161, 300));
RegisterTimerEvent(new TimerEvent(50, 200, "MoveItX", "RegisterTimerEvent(new TimerEvent(50, 200, \"ResizeY\",\"\", 2, svVideo, 0));", 3, t1, 161, 300));
// rem for 98: RegisterTimerEvent(new TimerEvent(4000, -1, "OnTimerTransport", ""));
RegisterTimerEvent(new TimerEvent(4000, -1, "OnTimerTransport", "", 0));
OnOpenStateChangeTransport(player.openState);
OnPlayStateChangeTransport(player.playState);
OnStatusChangeTransport(player.status);
}
function OnTinyClose() {
}
function RestorePlayer() {
view.width = view.minWidth;
view.height = view.minHeight;
// rem for 98: RegisterTimerEvent(new TimerEvent(50, 200, "MoveItX", "RegisterTimerEvent(new TimerEvent(50, 200, \"ResizeY\", \"theme.currentViewID = \\\"vPlayer\\\";\", svVideo, 241));", t1, 0, 300));
RegisterTimerEvent(new TimerEvent(50, 200, "MoveItX", "RegisterTimerEvent(new TimerEvent(50, 200, \"ResizeY\", \"theme.currentViewID = \\\"vPlayer\\\";\", 2, svVideo, 241));", 3, t1, 0, 300));
}
function EventFire(timeStamp) {
var retVal = true;
this.curTime = timeStamp;
this.elapsed = this.curTime - this.prevTime;
if (this.elapsed >= this.interval) {
eval("retVal = " + this.funcName + "(this)");
this.init = true;
if (this.tLength > 0) {
if (this.elapsed > this.tLength) {
tLength = 0;
return false;
}
this.tLength -= this.elapsed;
}
this.prevTime = this.curTime;
}
return retVal;
}
// rem for 98: function TimerEvent(interval, tLength, funcName, end) {
function TimerEvent(interval, tLength, funcName, end, numExtraArgs) {
this.interval = interval;
this.tLength = tLength;
this.funcName = funcName;
this.args = new Array();
this.elapsed = 0;
this.curTime = this.prevTime = new Date().getTime();
this.state = new Array();
this.init = false;
this.end = end;
// fixed for Win98. The default JScript engine in 98 does not
// support the length property of the 'arguments' object. So,
// this function must be called with numExtraArgs defined as the total
// number of extra parameters being passed in.
// rem for 98: for (i = 4; i < arguments.length; i++) {
for (i = TimerEvent.length;i < TimerEvent.length + numExtraArgs;i++) {
// rem for 98: this.args.push(arguments[i]);
this.args[i - TimerEvent.length] = arguments[i];
}
this.fire = EventFire;
}
function TimerDispatch() {
if (g_grpTimerEvents.length == 0) {
view.timerInterval = 0;
return;
}
var curTime = new Date().getTime();
var tEvent;
var newGrpTimerEvents = new Array();
for (events in g_grpTimerEvents) {
tEvent = g_grpTimerEvents[events];
if (tEvent.fire(curTime) == false) {
// rem for 98: oldEvent = (g_grpTimerEvents.splice(events, 1)).pop();
if (tEvent.end)
eval(tEvent.end);
} else {
newGrpTimerEvents[newGrpTimerEvents.length] = tEvent;
}
}
var bEventsWereRemoved = g_grpTimerEvents.length > newGrpTimerEvents.length;
g_grpTimerEvents = newGrpTimerEvents;
if (bEventsWereRemoved)
SetTimerInterval();
}
function RegisterTimerEvent(tEvent) {
// rem for 98: g_grpTimerEvents.push(tEvent);
g_grpTimerEvents[g_grpTimerEvents.length] = tEvent;
SetTimerInterval();
}
function SetTimerInterval() {
if (!g_grpTimerEvents.length) {
view.timerInterval = 0;
}
var leastInterval = g_grpTimerEvents[0].interval;
for (i = 1;i < g_grpTimerEvents.length; i++) {
if (g_grpTimerEvents[i].interval < leastInterval)
leastInterval = g_grpTimerEvents[i].interval;
}
view.timerInterval = leastInterval;
}
function MoveItX(tEvent) {
controlID = tEvent.args[0];
newX = tEvent.args[1];
clipX = tEvent.args[2];
if (controlID.left == newX) {
return false;
}
var curTimer = tEvent.curTimer;
var elapsed = tEvent.elapsed;
var disRemain = newX - controlID.left;
var nPixels = 0;
if (!tEvent.init) {
tEvent.state.greaterThan = newX > controlID.left;
tEvent.state.nPixels = 0;
}
tEvent.state.nPixels += disRemain / (tEvent.tLength / elapsed);
nPixels = Math.floor(tEvent.state.nPixels);
if (tEvent.state.greaterThan ? controlID.left + nPixels > newX : controlID.left + nPixels < newX)
nPixels = newX - controlID.left;
controlID.left += nPixels;
controlID.width = clipX - controlID.left;
tEvent.state.nPixels -= nPixels;
return true;
}
function ResizeY(tEvent) {
controlID = tEvent.args[0];
newY = tEvent.args[1];
if (controlID.height == newY) {
return false;
}
var disRemain = newY - controlID.height;
var nPixels = 0;
if (!tEvent.init) {
tEvent.state.greaterThan = newY > controlID.height;
tEvent.state.nPixels = 0;
}
tEvent.state.nPixels += disRemain / (tEvent.tLength / tEvent.elapsed);
nPixels = Math.floor(tEvent.state.nPixels);
if (tEvent.state.greaterThan ? controlID.height + nPixels > newY : controlID.height + nPixels < newY)
nPixels = newY - controlID.height;
controlID.height += nPixels;
tEvent.state.nPixels -= nPixels;
return true;
}
function OpenMedia() {
newFile = theme.openDialog('FILE_OPEN', 'FILES_ALLMEDIA');
if (newFile) {
player.URL = newFile;
player.controls.play();
}
}