problem with making a button please help


hi guys

 

i have problem making button play/stop music using code snippets

 

first imported music file mb3 format library dragged button components panal

 

the thing want make button when hit once music starts , when hit again stops

 

so, went code snippets choose audio , video choose click play/stop sound

 

 

 

and actionscript

 

 

 

 

/* click play/stop sound

clicking on symbol instance plays specified sound.

clicking on symbol instance second time stops sound.

 

instructions:

1. replace "http://www.helpexamples.com/flash/sound/song1.mp3" below desired url address of sound file. keep quotation marks ("").

*/

 

btn.addeventlistener(mouseevent.click, fl_clicktoplaystopsound_5);

 

var fl_sc_5:soundchannel;

 

//this variable keeps track of whether want play or stop sound

var fl_toplay_5:boolean = true;

 

function fl_clicktoplaystopsound_5(evt:mouseevent):void

{

    if(fl_toplay_5)

    {

        var s:sound = new sound(new urlrequest("http://www.helpexamples.com/flash/sound/song1.mp3"));

        fl_sc_5 = s.play();

    }

    else

    {

        fl_sc_5.stop();

    }

    fl_toplay_5 = !fl_toplay_5;

}

 

 

 

 

 

 

anyway in instructions says should replace url music file have in library

 

not url how can put in actionscript without making errors cus tried hundreds of time , im

 

trying month , has error .

 

im mad pleeeese  pleeeeeeese  meee.

try convert .wav format , import library , give linkage name. should use linkage name playing sound in actionscrpt3.0



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support