各スクリプトについては、以下のように記述します。
キャスト51のムービースクリプト
on startMovie
global URLList,gWidth
set URLList = []
append URLList,externalParamValue(4)
append URLList,externalParamValue(5)
append URLList,externalParamValue(6)
append URLList,externalParamValue(7)
append URLList,externalParamValue(8)
append URLList,externalParamValue(9)
append URLList,externalParamValue(10)
append URLList,externalParamValue(11)
append URLList,externalParamValue(12)
append URLList,externalParamValue(13)
append URLList,externalParamValue(14)
append URLList,externalParamValue(15)
set mySoundFiles to externalParamCount() - 3
repeat with i = mySoundFiles + 11 to 22
set the visible of sprite i to FALSE
end repeat
set gWidth = the width of cast 3
set the preLoadTime of member "SWASOUND" to 5
puppetsprite 2,TRUE
repeat with i = 11 to 22
puppetsprite i,TRUE
end repeat
set the width of sprite 2 to 1
end
on nowPlaying
global gWidth
set the width of sprite 2 = (the percentPlayed of member "SWASOUND") * gWidth/100
updateStage
end
on soundUp
if the soundLevel < 7 then
set the soundLevel to the soundLevel + 1
end if
end
on soundDown
if the soundLevel > 0 then
set the soundLevel to the soundLevel - 1
end if
end
ここでは、グローバル変数URLListを定義し、そのリストに、HTMLのEMBED Tag内に書かれたswaファイルのURLを順次入れていきます。
次の「set mySoundFiles to externalParamCount() - 3・・・・・end repeat」ですが、URLが12種類設定されていないときには、指定されている曲たけのボタンを表示させるためのスクリプトです。以下、グローバル変数gWidthの設定、PreLoadTimeの設定、11〜22スプライトのpuppet設定です。
nowPlayingハンドラは、曲がどのくらい再生されたかをバーで表示させるためのハンドラです。
soundUp、soundDownハンドラは、ボリュームコントロールのためのハンドラです。
キャスト8のスクリプト
on mouseDown
set mySprite to clickOn()
repeat with i = 11 to 22
set the castNum of sprite i to i
end repeat
set the castNum of sprite mySprite to mySprite + 20
updateStage
stop (member "SWASOUND")
global URLList
set mySound to getAt(URLList,mySprite - 10)
set the URL of member "SWASOUND" to mySound
play (member "SWASOUND")
end
スプライト11〜22の曲再生ボタンに使用するスプライトスクリプトです。
キャスト9のスクリプト
on mouseDown
soundUp
end
スプライト3のボリュームアップに使用するスプライトスクリプトです。
キャスト10のスクリプト
on mouseDown
soundDown
end
スプライト3のボリュームダウンに使用するスプライトスクリプトです。
キャスト16のキャストスクリプト
on exitFrame
go the frame
end
キャスト52のスクリプト
on exitFrame
nowPlaying
go the frame
end
フレーム1のスクリプトチャンネルに使用するフレームスクリプトです。
以上で、スクリプト関係は終わりです。
このShockwaveとEMBED Tagを設定したHTMLファイルを作成します。できましたら、HTMLファイルをネットスケープにドロップしてみましょう。仮にEMBED Tag内に3曲しかURLを指定していないと、以下のように表示され、指定された3曲に関しては、ボタンクリックで、再生されます。