Laurent - you're welcome <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">
I've updated the capx to provide a solution for multiple tile sounds:
https://www.dropbox.com/s/kwh2ci35iikao ... .capx?dl=0
There's no function, instead I use an array:
There are 3 global volume variables. These control (1) the volume for the currently occupied tile type, (2) the volume for the previously occupied tile type, and (3) the volume for the type before that.
Each time the sprite walks onto a new tile type a) Sprite.onTile is set to the tileNo, and b) the tileNo is pushed to the back of the array. This means that in the array we have a record of the order that the tile types have been stepped on - we can use this to determine which sounds to start, fade in, fade out and stop. By counting back from the end of the array we can identify the current and last two sounds played and apply the corresponding volume variables.
The sound file is then called by name - each sound filename is suffixed with the corresponding tileNo so if you walk onto tile 1 for example, you can play "sound_1" by calling "sound_"&Sprite.onTile".
The current volumes are then shifted one along: 2 to 3, 1 to 2 and 0 to 1, then volume 0 is reset to -40. This is so they correspond to the new positions in the array of the currently playing sounds.
The loop volume for the currently stepped on tile types fades in from -40 to 0.
The loop volumes for the previously stepped on tile types are gradually faded out - if the tag of a loop is more than 2 behind the newest tag then the sound is stopped.