Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/01/2011, 15:31
Avatar de Manuellama
Manuellama
 
Fecha de Ingreso: noviembre-2006
Ubicación: Zafra, Extremadura, Spain, Spain
Mensajes: 174
Antigüedad: 17 años, 5 meses
Puntos: 10
Respuesta: controlar sonido en diferentes escenas,flash

if (!_global.ratio){
_global.ratio= 100;
}
_global.setvolume = function (){
_root.volumen_txt.text = _global.ratio;
_root.volumen_txt.type = "input";
_root.volumen_txt.restrict = "0123456789";
_root.volumen_txt.maxChars = 3;
_root.volumen_txt.onChanged = function ()
{
if (int (this.text) > 100)
{
this.text = 100;
}
_global.ratio = int (this.text);
_global.sound.setVolume (_global.ratio);
};
}
_global.sound = new Sound ();
sound.loadSound ("typewriter.mp3",true);
sound.start ();
setvolume();
stop();


Este es un código más o menos parecido, pero te dará una idea "global". Nunca mejor dicho.

Tienes que utilizar variables y funciones globales. Las variables globales permanecen entre frames. Si las vuelves a invocar en otros frames o escenas, tendrán el valor que tú le hayas dado.

En este ejemplo, escribe un número del 1 al 100 en el textfield del escenario y verás como cambia el volumen. En los siguientes frames sólo tienes que llamar a setvolume(), y ya está.