JavaScript Textbox - How To |
|
||||||
GOAL:
Insert text into the ASF stream that is displayed on the HTML page next to
the Microsoft® Windows® Media Player control at specific times. To
do this, we insert events and parameters into the ASF stream, and target the TextBox <INPUT> tag to receive and display
the text at specified times. CODE TO PUT IN YOUR HTML: This subroutine is used to receive and interpret the
events and parameters being sent from the ASF stream. NSPlay1 refers to the Windows Media Player control. This segment
of code should come after the <TITLE> tag in your HTML. <SCRIPT LANGUAGE="JavaScript"
FOR="NSPlay1"
EVENT="ScriptCommand(bstrtype,bstrparam)"> if(navigator.appName == "Microsoft
Internet Explorer"){ document.status=
(bstrtype)+":"+(bstrparam) document.myform.Textbox1.value= (bstrparam) } } </script> function RegisterEventObservers(){ if(navigator.appName ==
"Netscape"){ var plugin = document.NSPlay1; } } document.status=
(scType)+":"+(scParam) document.myform.Textbox1.value= (scParam) } </script> This is the script that interprets the events being sent
down the stream. You will also need to include the ASF in the page, using the
Windows Media Player <OBJECT> tag in the body of your HTML page: <!-- GENERIC ALL BROWSER FRIENDLY HTML FOR
NETSHOW 3.0 SERVICES --> <PARAM NAME="FileName"
VALUE="http://servername/path/filename.asx"> pluginspage="http://www.microsoft.com/Windows/ </embed>
Next, you will need to include the <INPUT> tag for
the text box: <FORM NAME = "myform"> <INPUT TYPE="Textbox"
NAME="Textbox1" VALUE="This is the text before the script
command" SIZE="50"> </FORM> These three elements define what to do with the TextBox events being sent down the stream, insert
the Windows Media Player control on the page, and provide the place to put
the text when it's received in the stream. The NSPlay1
control receives events (bstrtype) and
parameters (bstrparam) and sends them to the
JavaScript code, which sends the events (bstrtype)
and parameters (bstrparam) to the Textbox <INPUT> tag so that it can display
the changed text. Remember
that this won't work unless your ASF stream contains these events and
parameters. EVENTS
AND PARAMETERS TO PUT IN YOUR ASF STREAM: The preceding subroutine will
wait for events and parameters from the ASF stream to be sent to it before it
will do anything. In this example, here is the event and the parameter we
used:
Once
the event named Textbox is received, the
JavaScript function will plug The Script Event just
changed into the Textbox <INPUT>
tag, which will display it on the page. If you insert multiple Textbox events and parameters into the stream, the
text box will change multiple times as the ASF plays. |
|
Seattle Flash Designer and Web Designer : Mikey Longr:
I specialize in Seattle
Web Design and Seattle Flash Design. Michael has been working on the web for
over ten years and specializes not only in web design technologies like Macromedia
Flash and HTML but web development technologies including the asp, asp.net and
PHP4. As a Flash Designer in Seattle Washington I have done work for top names
in the ever expanding Flash Animation industry. I owned a new media and multimedia
design company for three years. OverDrive Media specilized in multimedia development
including Flash, streaming, web design and database driven media systems.
Flash has revolutionized the way that web graphics are created and built an
entirely new market for 3d Animation and motion graphics. Flash Animation started
as a very simple method for creating vector based web animation. The Flash Movie
was little more than a slight advancement of the animated gif. The files were
large, the drawing options limited and the end result clunky. In the early days
of the Internet (5 years ago) this was enough to blow the competition out of
the water. While their have been numerous ways to create motion graphics none
of these methods has combined the impact and usability of Flash. Flash became
the standard for online motion graphics because it was easy to use. Web animators
did not have to understand code or advanced scripting language. You could design
in flash, move things around, restructure the animation and duplicate effects
with ease. None of this was possible before Macromedia Flash.