Skip to main content
Inspiring
August 14, 2018
Question

Sound starts without a command

  • August 14, 2018
  • 2 replies
  • 496 views

I am facing a problem with audios.

I am putting to execute a certain audio in .mp3 in a button event (click), however, just by me testing the movie (ctrl + enter) the sound is already exited without the need to press the button.

I have already tried to use the instance.pause or .clouse ... But to no avail.

Could someone give a solution? Thanks in advance!

import flash.events.MouseEvent;

stop();

var TEST:green = new green ();

button1.addEventListener(MouseEvent.CLICK, soundTest);

function soundTest (Event:MouseEvent) {

     TEST.play();

}

This topic has been closed for replies.

2 replies

JoãoCésar17023019
Community Expert
Community Expert
August 17, 2018

Would you mind sharing your FLA?

JoãoCésar17023019
Community Expert
Community Expert
August 14, 2018

Hi.

Probably the green class is playing the sound when it is instantiated.

Can you check this? Or maybe you could show us the code of this class.

Regards,

JC

Colin Holgate
Inspiring
August 14, 2018

I took green() to be the sound, not a class that is playing the sound.

Do you have. copy of the sound in the timeline? Failing that, work around the problem by making the sound when it's first played, like:

import flash.events.MouseEvent; 

 

stop(); 

 

var TEST:green; 

button1.addEventListener(MouseEvent.CLICK, soundTest); 

 

function soundTest (Event:MouseEvent) { 

     if(TEST==null) TEST = new green();

     TEST.play(); 

}

vvvverTAuthor
Inspiring
August 17, 2018

The problem has not been solved, even by applying the method described.

Accidentally, I accessed a small panel that asked how I would want this audio, among the options were:

> Start

> Loop

> Stop

I chose to stop and the problem was solved, but I do not know where to find the panel. Would you help me?