Skip to main content
March 17, 2013
Question

Keep getting this error - 1061: Call to a possibly undefined method play...

  • March 17, 2013
  • 1 reply
  • 478 views

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 1741061: 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!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 17, 2013

does WellDone extend the sound class?

if yes, try:

correctChannel = Sound(correctSound).play();