So you want (1) download a MIDI file from the Internet, and then (2) play that MIDI in Director.
Why not?
The strategy would be:
1. Start downloading the MIDI file.
2. Wait for the download operation finishes.
3. If download error occurs, do something about it.
4. If download is successful, create new #quickTimeMedia member.
5. Assign downloaded MIDI file as the QuickTime member just created.
6. Put the MIDI-QuickTime onto the Stage and play the music.
Here are two frame scripts. The frame script 1 starts downloading the MIDI file. The frame script 2 does the rest. (I am creating member(23) as QuickTime/MIDI member and placing it in Sprite(1) in this example.)
--
-- Frame script 1
on enterFrame me
global gNetID
gNetID = preloadNetThing("
end
-- Frame script 2
global gNetID
on exitFrame me
if netDone(gNetID) then
tErrorCode = netError(gNetID)
if tErrorCode <> "OK" then
alert("Couldn't download the MIDI file. Error code:" && tErrorCode)
-- or do something upon netError.
else
new(#quickTimeMedia, member(23))
member(23).fileName = "
puppetSprite(1, 1)
sprite(1).member = member(23)
sprite(1).movieRate = 1
end if
else
go the frame
end if
end
--
I separated two scripts in order to demonstrate the concepts but they could be in one script/script object.
If you're using a local MIDI file, obviously you won't need to download the file - just assign the fileName to the local MIDI file.