all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

Defining a SOund Instance and playing with click of button


Defining a SOund Instance and playing with click of button Erinlong1
11/11/2004 10:09:17 PM
flash actionscript: :brokenheart;

I have been trying to get this script to work for three days!!
I have a wav sound in my movie clip...to control it i have a play and stop
button. I have tried making the sound an "instance" and attaching/linking.
WHen i export nothing happens...my sound does not play from clicking the play
button/nor does it stop....nothing happens!

Please help!Text

I have tried this:

Soundsample4 = newound(this);
Soundsample4 = attachSound ("Voice4")
Soundsample4.start(0,1);

and in the button "start":

on(release) {Soundsample_4.start();
}

and then the"stop" button:

on (release) {Soundsample_4.stop("Voice4");
}
Re: Defining a SOund Instance and playing with click of button proxmaster
11/11/2004 10:26:33 PM
This here usually works for me:

mySound=new Sound();
mySound.loadSound("Voice4", false);

and in the button "start":

on(release) {
mySound.start(0,1);
}

and then the"stop" button:

on (release) {
mySound.stop();
}
Re: Defining a SOund Instance and playing with click of button VisionaryStudios
11/11/2004 10:31:03 PM
Originally posted by: Erinlong1
:brokenheart;<BR><BR>I have been trying to get this script to work for three
days!!<BR>I have a wav sound in my movie clip...to control it i have a play and
stop button. I have tried making the sound an "instance" and attaching/linking.
WHen i export nothing happens...my sound does not play from clicking the play
button/nor does it stop....nothing happens!<BR><BR>Please help!Text

What I see in your code is two typos...mb you have it right in your script but
I can't assume that.

Soundsample4 = newound(this) <---- should be new Sound(); Dont know why
you have 'this' in there.

and

SoundSample4 = attachSound("Voice4"); <--- should be
SoundSample4.attachSound("Voice4");


Then Voice4 must be the name of the sound file in the LINKAGE Properties
dialog box. If you do not specify the LINKAGE property it will never work.


Re: Defining a SOund Instance and playing with click of button Erinlong1
11/12/2004 2:39:17 PM
:D

thank you so much!

i am going to try your code!

i will let you know how it goes!

Re: Defining a SOund Instance and playing with click of button Erinlong1
11/12/2004 3:58:30 PM
:confused;

I still cannot get the sound to play.....I tried this...and nothing works......

mySound=new Sound();
mySound.loadSound("Voice4", false);

and in the button "start":

on(release) {
mySound.start(0,1);
}

and then the"stop" button:

on (release) {
mySound.stop();
}

















Re: Defining a SOund Instance and playing with click of button VisionaryStudios
11/12/2004 5:53:18 PM
Well mySound in the button my not be defined. You should make the mySound
global to make sure the path is consistant.

_global.mySound = new Sound();
_global.mySound.loadSound("Voice4",false);

on(release)
{
_global.mySound.Start(0,1);
}

Also, did you remember to set up the Linkage Properties for the sound
"Voice4" ? then make sure the upper/lower case of the names are exactly the
same.
AddThis Social Bookmark Button