Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: KEY STROKE INTERACTION!
From: Nigel Randsley-Pena
Date: Sun, 20 Sep 1998 21:59:45 +0100

Steve,

Long time no see.
Yes what you want is possible, via JavaScript, it's version dependent
because it's based on event handlers but 4.x browsers will be OK.
Bellow you'll find a transcript from a message I posted here some time
ago that will get you atarted in the right direction.
keyHandler intercepts keyboard press events and returns the ASCII
equivilent that is directly passed on to function react.
Here you can filter the key and act accordingly.
In this example a 25 frame movie is advanced with the 'a' keypress and
moved back with the 's' keypress.

<!-- Cut Below
<SCRIPT LANGUAGE="JavaScript">
document.onkeypress = keyHandler;
var IE=(typeof window.event=='object');
var theMovie = IE ? movie : document.movie;

function keyHandler (e)
{
if (IE)
{
theKey = String.fromCharCode(event.keyCode);
}
else
{
theKey = String.fromCharCode(e.which);
}
react (theKey);
return false;
}

function react (key)
{
if ( key =='a' || key =='A' )
{
if ( theMovie.TCurrentFrame(_level0)== 25)
theMovie.TGoToFrame(_level0, 1);
else
theMovie.TGotoFrame(_level0,
TCurrentFrame(_level0) + 1);
}
if ( key =='s' || key =='S' )
{
if ( theMovie.TCurrentFrame(_level0)==1)
theMovie.TGoToFrame(_level0, 25)
else
theMovie.TGotoFrame(_level0,
TCurrentFrame(_level0) -1);
}
return false;
}

</SCRIPT>

<-- Cut above

------------------------------------------------------------------------
To UNSUBSCRIBE send: unsubscribe flasher in the body of an
email to list-manageratshocker [dot] com. Problems to: owneratshocker [dot] com
N.B. Email address must be the same as the one you used to subscribe.
For info on digest mode send: info flasher to list-manageratshocker [dot] com


Replies
  FLASH: KEY STROKE INTERACTION!, Steve Couture

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]