fazelit
Member
با سلام من یه فایل صوتی رو لود کردم می خوام مدت کلی فایل رو بگه ولی همش صفر میزنه این هم کدش.
[JSS]
stop();
/* Click to Play/Stop Sound
Clicking on the symbol instance plays the specified sound.
Clicking on the symbol instance a second time stops the sound.
Instructions:
1. Replace "http://www.helpexamples.com/flash/sound/song1.mp3" below with the desired URL address of your sound file. Keep the quotation marks ("").
*/
b1.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound_4);
var fl_SC_4:SoundChannel;
var time:int=0;
//This variable keeps track of whether you want to play or stop the sound
var fl_ToPlay_4:Boolean = true;
function fl_ClickToPlayStopSound_4(evt:MouseEvent):void
{
if(fl_ToPlay_4)
{
var snd:Sound = new Sound();
var req:URLRequest=new URLRequest("1.mp3");
snd.load(req);
trace(snd.length);
fl_SC_4 = snd.play(time);
}
else
{
time= fl_SC_4.position;
fl_SC_4.stop();
}
fl_ToPlay_4 = !fl_ToPlay_4;
}
[/JSS]
[JSS]
stop();
/* Click to Play/Stop Sound
Clicking on the symbol instance plays the specified sound.
Clicking on the symbol instance a second time stops the sound.
Instructions:
1. Replace "http://www.helpexamples.com/flash/sound/song1.mp3" below with the desired URL address of your sound file. Keep the quotation marks ("").
*/
b1.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound_4);
var fl_SC_4:SoundChannel;
var time:int=0;
//This variable keeps track of whether you want to play or stop the sound
var fl_ToPlay_4:Boolean = true;
function fl_ClickToPlayStopSound_4(evt:MouseEvent):void
{
if(fl_ToPlay_4)
{
var snd:Sound = new Sound();
var req:URLRequest=new URLRequest("1.mp3");
snd.load(req);
trace(snd.length);
fl_SC_4 = snd.play(time);
}
else
{
time= fl_SC_4.position;
fl_SC_4.stop();
}
fl_ToPlay_4 = !fl_ToPlay_4;
}
[/JSS]