I've been browsing through all flash related webpages looking for a tutorial on how to import or play a midi file in Flash, but still couldn't find it ! can anyone help ? since mp3 and wav file is pretty slowing down the movie. Midi isn't such a bad alternative right ?
This is some Javascript that has been posted in the past to control Midi files within Flash. I don't know if you want to go through this much trouble, but here it is.
The first step is to create a flash movie with the following links under the GETURL: command.
to stop: Javascript: stopmusic ()
to start: Javascript: startmusic ()
Next, place the ENTIRE section below into your html document.
PASTE THIS:
<head>
<title>Midi In Flash</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!-- function MM_controlSound(sndAction,_sndObj) { //v2.0 var sndObj = eval( _sndObj );
if (sndObj != null) {
if (sndAction=='stop') { sndObj.stop(); } else {
if (navigator.appName == 'Netscape' ) { sndObj.play(); }
else {
if (document.MM_WMP_DETECTED == null) { document.MM_WMP_DETECTED = false; var i; for( i in sndObj )
if ( i == "ActiveMovie" ) { document.MM_WMP_DETECTED = true; break; } }
if (document.MM_WMP_DETECTED) sndObj.play();
else
if ( sndObj.FileName ) sndObj.run(); }}}} //-->
</script>
</head>
<script language="JavaScript">
function startmusic(){
MM_controlSound('play','document.CS930346114680',' yourmidifile.mid') }
</script>
<script language="JavaScript">
function stopmusic(){
MM_controlSound('stop','document.CS930346114680',' yourmidifile.mid') }
</script>
Thanks Mike-Edwards for your hard-work, but is it possible to load somewhat the midi files directly from the harddisk or server instead of embedding the files to flash or webpages ? i tried loading it with loadMovie(), but it's fruitless
I've actually thought of converting the file to wav but still it surely slows down my movie a lot .