Copy link to clipboard
Copied
ISSUE #1
I can't figure out what is going wrong here. It's simple but I get the following errors:
1046: Type was not found or was not a compile-time constant: LetterSoundC.
1180: Call to a possibly undefined method LetterSoundC.
Here is the code:
// Plays sound
var LetterC:LetterSoundC = new LetterSoundC();
LetterC.play();
I have the AS Linkage property in the library set to "LetterSoundC".
Ironically, I have same code in a different section and it works:
// Plays sound
var LetterSound_A:Letter_A_Sound = new Letter_A_Sound();
LetterSound_A.play();
ISSUE #2 - I want to stop a sound (if its playing) when the user goes to another scene but I ge the following error when button is clicked:
TypeError: Error #1006: stop is not a function.
at Penmanship_fla::MainTimeline/goButtons()[Penmanship_fla.MainTimeline::frame2:63]
I have sound object that plays:
//Intro Sounds
var IntroSoundMain:Intro_Sound;
var IntroSoundMainChannel:SoundChannel;
//plays the sound only once
for (var i:Number=0; i<=1; i++)
{
IntroSoundMain = new Intro_Sound();
IntroSoundMainChannel = IntroSoundMain.play();
}
if (i<=1)
{
IntroSoundMain = null;
IntroSoundMainChannel = null;
}
If the user clicks a button the sound is still playing I want that specific sound to stop playing. I don't want all of the sounds to stop playing thoug, just that specific sound:
if (event.target == Object(MainScene).bnt_letters)
{
IntroSoundMain.stop();
checkNumber = false;
letters.play();
gotoAndPlay("1","Letters");
stage.removeEventListener(MouseEvent.MOUSE_DOWN, goButtons);
//SoundMixer.stopAll();
//removeMainScene();
}
I deleted the files and reimported them and renamed them in the AS Linkage. I works fine now.
I don't understand the issue though.
Copy link to clipboard
Copied
attach a screenshot showing your library panel and the object with class=LetterSoundC.
to stop a sound, you need access to that sounds soundchannel or you need to globally stop all sounds (SoundMixer.stopAll())
Copy link to clipboard
Copied
Copy link to clipboard
Copied
i see no problem.
but, rename that class to Letter_CSound in your library and in your code. retest.
Copy link to clipboard
Copied
I deleted the files and reimported them and renamed them in the AS Linkage. I works fine now.
I don't understand the issue though.
Copy link to clipboard
Copied
you could have had white space at the end of LetterSoundC, for example.
Copy link to clipboard
Copied
1) What base class do you define LetterSoundC in its properties?
2) IntroSoundMainChannel.stop();
Copy link to clipboard
Copied
1) The base class is flash.media.Sound.