How to stop a streaming sound ,when I change the scene(director)?

Hi this is a a test for Nook,I have a button called local audio that upon press play the sound1(audio stream)
but I have trouble figuring out how to stop the sound when I change scene using the other 3 button.
I have tried putting audio.stop and rewind in the changeScene function and it dose not respond.
I would appreciate if somebody know the answer to this:)

module(…,package.seeall)
–some code
—sound
local sound1 = audio.loadStream(“s1.ogg”);

local playsound = function(event)

audio.play(sound1,{channel=1})

end
–UI
–play the A
local audio=display.newImage(“audio.png”,_W,_H)
audio:setReferencePoint(display.CenterReferencePoint)
audio:scale(0.25,0.25)
audio.x=_W*0.5+((audio.width*0.27)/2) ;audio.y=_H*0.07

–some code

–for changing scene
function changeScene(event)
if (event.phase== “ended”) then
director:changeScene(event.target.scene);
end

end

–I have tried this .this dose not work–[[function changeScene:touch(event)
if (event.phase == “began”) then
audio.fade(sound1) – fades out soundtrack here!
elseif (event.phase == “ended”) then
print(“Home, ended phase”)
timer.performWithDelay(1000, function() director:changeScene(event.target.scene) end, 1)
end
end]]

localGroup:insert(bg1)
localGroup:insert(audio)
localGroup:insert(home)
localGroup:insert(back)
home:addEventListener(“touch”,changeScene);
back:addEventListener(“touch”,changeScene);
forth:addEventListener(“touch”,changeScene);
audio:addEventListener(“touch”,playsound)
return localGroup;
end
I have figured this out,but I still like to hear your way,to see what is better:)
thanks [import]uid: 141482 topic_id: 28788 reply_id: 328788[/import]

Insert sound1 into localGroup :slight_smile: [import]uid: 27760 topic_id: 28788 reply_id: 116004[/import]

This is how I have handled the music and sounds for my game.
[lua]-- Pre-loads our sounds
music = audio.loadStream(“LevelTwoSongFinal.mp3”) – after setting up variables

audio.play(music, {loops = -1}) ---- just before you return localGroup at the end of the code

—then when the game ends I do this

function titleScreen( event)

audio.pause(music)
music = nil
gameIsActive = nil
director:changeScene(“mainmenu”)
end

[import]uid: 49863 topic_id: 28788 reply_id: 116039[/import]