#1 [FLASH] Barra de Sonido
Hola queridos psico-foreros:
Quisiera saber si alguien puede ayudarme...
Tengo este codigo para una barra de sonido. pero al ponerlo en la pelicula principal por(unloadMovie......) no suena. Por casualidad alguien sabe cual es el problema?
- Muchas Gracias -
:: PabloArt ::
Quisiera saber si alguien puede ayudarme...
Tengo este codigo para una barra de sonido. pero al ponerlo en la pelicula principal por(unloadMovie......) no suena. Por casualidad alguien sabe cual es el problema?
Stage.scaleMode = "noScale";
Stage.align = "LT";
// --
var x = 0;
var y = 0;
var width = 100;
var height = 10;
// -- dibujar
function drawBox (target, w, h, alpha) {
if (alpha == undefined) {
alpha = 100;
}
target.clear ();
target.moveTo (0, 0);
target.beginFill (0xCCCCCC, alpha);
target.lineTo (w, 0);
target.lineTo (w, h);
target.lineTo (0, h);
target.lineTo (0, 0);
target.endFill ();
}
// -- volumen
function _setVolume () {
var point = new Object ();
point.x = _xmouse;
globalToLocal (point);
if (point.x > clipBounds.xMin && point.x <= clipBounds.xMax) {
slide_mc._width = point.x;
vol = (point.x / clipBounds.xMax) * 100;
sound.setVolume (vol);
updateAfterEvent ();
}
}
this.createEmptyMovieClip ("shadow_mc", this.getNextHighestDepth ());
shadow_mc._x = x;
shadow_mc._y = y;
drawBox (shadow_mc, width, height, 50);
// -- slide para manejar volumem
this.createEmptyMovieClip ("slide_mc", this.getNextHighestDepth ());
slide_mc._x = x;
slide_mc._y = y;
drawBox (slide_mc, width, height);
var clipBounds = slide_mc.getBounds ();
// -- botón apagar/encender sonido
this.createEmptyMovieClip ("switcher_mc", this.getNextHighestDepth ());
switcher_mc._x = width + 10;
switcher_mx._y = y;
drawBox (switcher_mc, 10, 10);
// -- Objeto sound
var sound:Sound = new Sound ();
sound.attachSound ("mySound");
sound.start (0, 999);
// -- subir - bajar volumen
slide_mc.onPress = function () {
idInterval = setInterval (_setVolume, 1);
};
// --
slide_mc.onRelease = slide_mc.onReleaseOutside = function () {
clearInterval (idInterval);
};
// -- apagar - encender sonido
switcher_mc.onRelease = function () {
if (!soundOff) {
sound.stop ();
soundOff = true;
} else {
sound.start (0, 999);
soundOff = false;
}
};
Espero alguien pueda ayudarme.Stage.align = "LT";
// --
var x = 0;
var y = 0;
var width = 100;
var height = 10;
// -- dibujar
function drawBox (target, w, h, alpha) {
if (alpha == undefined) {
alpha = 100;
}
target.clear ();
target.moveTo (0, 0);
target.beginFill (0xCCCCCC, alpha);
target.lineTo (w, 0);
target.lineTo (w, h);
target.lineTo (0, h);
target.lineTo (0, 0);
target.endFill ();
}
// -- volumen
function _setVolume () {
var point = new Object ();
point.x = _xmouse;
globalToLocal (point);
if (point.x > clipBounds.xMin && point.x <= clipBounds.xMax) {
slide_mc._width = point.x;
vol = (point.x / clipBounds.xMax) * 100;
sound.setVolume (vol);
updateAfterEvent ();
}
}
this.createEmptyMovieClip ("shadow_mc", this.getNextHighestDepth ());
shadow_mc._x = x;
shadow_mc._y = y;
drawBox (shadow_mc, width, height, 50);
// -- slide para manejar volumem
this.createEmptyMovieClip ("slide_mc", this.getNextHighestDepth ());
slide_mc._x = x;
slide_mc._y = y;
drawBox (slide_mc, width, height);
var clipBounds = slide_mc.getBounds ();
// -- botón apagar/encender sonido
this.createEmptyMovieClip ("switcher_mc", this.getNextHighestDepth ());
switcher_mc._x = width + 10;
switcher_mx._y = y;
drawBox (switcher_mc, 10, 10);
// -- Objeto sound
var sound:Sound = new Sound ();
sound.attachSound ("mySound");
sound.start (0, 999);
// -- subir - bajar volumen
slide_mc.onPress = function () {
idInterval = setInterval (_setVolume, 1);
};
// --
slide_mc.onRelease = slide_mc.onReleaseOutside = function () {
clearInterval (idInterval);
};
// -- apagar - encender sonido
switcher_mc.onRelease = function () {
if (!soundOff) {
sound.stop ();
soundOff = true;
} else {
sound.start (0, 999);
soundOff = false;
}
};
- Muchas Gracias -
:: PabloArt ::
0