Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Sound starts without a command

Explorer ,
Aug 14, 2018 Aug 14, 2018

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();

}

TOPICS
ActionScript
456
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 14, 2018 Aug 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2018 Aug 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(); 

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 17, 2018 Aug 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2018 Aug 17, 2018
LATEST

Would you mind sharing your FLA?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines