Copy link to clipboard
Copied
I am making application for children as a part of my media course at uni.
I have included four different types of sounds - right answer, wrong answer, win game and loose game.
Each of these sounds have been imported into my library and exported for actionscript.
I used the following code for each sound;
var correctSound:WellDone = new WellDone();
var correctChannel: SoundChannel = new SoundChannel();
var wrongSound:WrongAnswer = new WrongAnswer();
var wrongChannel: SoundChannel = new SoundChannel();
var winnerSound:Winner = new Winner();
var winnerChannel: SoundChannel = new SoundChannel();
var loserSound:Loser = new Loser();
var loserChannel: SoundChannel = new SoundChannel();
Then I have used the following code in the places that i need it..
correctChannel = correctSound.play(); |
wrongChannel = wrongSound.play();
loserChannel = Loser.play();
winnerChannel = Winner.play();
The first two sounds work perfectly but i am getting the error for the next two saying i am trying to call to an undefined method play.
Game, Layer 'Actions', Frame 9, Line 174 | 1061: Call to a possibly undefined method play through a reference with static type Class. |
I haven't been learning ActionScript 3 for very long so any help is much appreciated!!
Thank you!
Copy link to clipboard
Copied
does WellDone extend the sound class?
if yes, try:
correctChannel = Sound(correctSound).play();
Find more inspiration, events, and resources on the new Adobe Community
Explore Now