Jump to content

Recommended Posts

Posted

Verifica se consegues perceber a lógica do som. Podes também utilizar parâmetros na função start para realizar loops na música [mais info]

var mySound = new Sound(this);//Criar o objecto de som no stage
mySound.attachSound("music.mp3"); // Carregar o ficheiro que pretende ouvir
mySound.setVolume(25); // Colocar o volume inicial
mySound.start();
Posted

Para ficar mais limpo podes colocar assim

var mySound = new Sound(this);//Criar o objecto de som no stage
  mySound.attachSound("musica.mp3"); // Carregar o ficheiro que pretende ouvir
  mySound.setVolume(25); // Colocar o volume inicial

on (release) {
  mySound.start();
   
}

Assim tens a possibilidade de captar o objecto mySound a partir de um outro botão para parar por exemplo.

Se utilizares como sugeris-te apenas terás o objecto mySound dentro do release do botão.

Posted

Verifica assim.

Este código é para ActionScript 2.0, visto que não mencionas-te que linguagem estavas a utilizar...

var mySound = new Sound(this);//Criar o objecto de som no stage
mySound.loadSound("http://www.a1sounddownload.com/freesounds5/flatline.mp3");// Carregar o ficheiro que pretende ouvir fora da libraria
mySound.setVolume(100);// Colocar o volume inicial

this.createEmptyMovieClip("btn",0); 
btn.beginFill("0x000000",100); 
btn.lineTo(0, 0);
btn.lineTo(20, 80);
btn.lineTo(80, 20);
btn.endFill();
btn.onRelease = function() {
  mySound.start(0,1);
}
Posted

Verifica se não tens de criar duas frames e colocar na primeira

var mySound = new Sound(this);//Criar o objecto de som no stage
mySound.loadSound("http://www.a1sounddownload.com/freesounds5/flatline.mp3");// Carregar o ficheiro que pretende ouvir fora da libraria
mySound.setVolume(100);// Colocar o volume inicial

e na segunda:

mySound.start(0,1);
stop();
Posted

Espero que percebas bem o código que estás a utilizar, pois dá para simplificar em 200% 😛

mas respondendo à tua dúvida....

_global.Behaviors.Sound.duzentosecinco.mp3.start(0,1000);

//1000 = Número de loops
//0 = Posição inicial do som

Se pretenderes parar o som utiliza;

_global.Behaviors.Sound.duzentosecinco.mp3.stop();
Posted

Sim...

Verifica

....
_global.Behaviors.Sound.duzentosecinco.mp3.loadSound("duzentosecinco.mp3",true);
_global.Behaviors.Sound.duzentosecinco.mp3.start(0,1000);

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.