Comunidad de diseño web y desarrollo en internet online

sonido en un archivo precargado externamente

Citar            
MensajeEscrito el 24 Ene 2009 02:18 am
mi dificultad es que un archivo swf cuando lo pruebo si se oye el sonido, pero cuando lo subo al servidor con su precargador externo no se oye el sonido que le puse, otros sonidos si.

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 02:23 am
lo anexe a un mc a la vez anexado con attachMovie con este codigo:

var JINGLE:Sound=new Sound();
JINGLE.attachSound("JINGLE");
JINGLE.start();

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 02:29 am
ok, entonces lo cargas externamente?, o lo tienes incorporado a la biblioteca?

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 24 Ene 2009 02:34 am
Bueno para cargarlo externamente prueba con este ejemplo y me cuentas que ha pasado.

Código ActionScript :

this.createTextField("message_txt", this.getNextHighestDepth(), 10,10,300,22)
this.createTextField("status_txt", this.getNextHighestDepth(), 10, 50, 300, 40);
status_txt.autoSize = true;
status_txt.multiline = true;
status_txt.border = false;

var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean) {
    if (success) {
    this.start();
    message_txt.text = "Finished loading";
    }
};
my_sound.onSoundComplete = function() {
    message_txt.text = "Clearing interval";
    clearInterval(my_interval);
};
my_sound.loadSound("JINGLE.mp3", true);
var my_interval:Number;
my_interval = setInterval(checkProgress, 100, my_sound);
function checkProgress(the_sound:Sound):Void {
    var pct:Number = Math.round(the_sound.getBytesLoaded()/the_sound.getBytesTotal() 100);
    var pos:Number = Math.round(the_sound.position/the_sound.duration 100);
    status_txt.text = the_sound.getBytesLoaded()+" of "+the_sound.getBytesTotal()+" bytes ("+pct+"%)"+newline;
    status_txt.text += the_sound.position+" of "+the_sound.duration+" milliseconds ("+pos+"%)"+newline;
}

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 24 Ene 2009 02:34 am
el sonido lo tengo en la biblioteca y lo llamo con attachSound, y todo esto lo tengo en una pelicula que es cargada por un preloader externo.

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 02:37 am
ha ya entendi, bueno, entonces si ya cargas el swf, ese swf tiene que tener el sonido en la biblioteca, y tiene que estar exportado para actionScript con el nombre JINGLE_id

Ese codigo va en el swf que se va a cargar

Código ActionScript :

var JINGLE:Sound=new Sound();
JINGLE.attachSound("JINGLE_id");
JINGLE.start(); 

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 24 Ene 2009 02:41 am
el sonido ya esta cargado en el swf, cuando lo pruebo solo, suena, pero cuando lo pruebo con el cargador ya no, talvez el error esta en el cargador.

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 02:44 am
el codigo que tengo en el cargador es este:


var CARGADOR:MovieClipLoader=new MovieClipLoader();
var listener:Object=new Object();
Stage.showMenu=false;
listener.onLoadStart=function(target_mc){
_root.attachMovie("PRECARGADOR","PRECARGADOR",_root.getNextHighestDepth());
_root.PRECARGADOR._x=475
_root.PRECARGADOR._y=300
_root.PRECARGADOR._xscale=333.333
_root.PRECARGADOR._yscale=333.333
};
listener.onLoadProgress=function(target_mc,loadedBytes,totalBytes){
var porcentaje:Number;
porcentaje = Math.round((loadedBytes*100)/totalBytes);
_root.PRECARGADOR.gotoAndStop(porcentaje);
target_mc._visible=false;
target_mc.stop();
};
listener.onLoadComplete=function(target_mc){
_root.PRECARGADOR.removeMovieClip();
target_mc._visible=true;
target_mc.play();
};
CARGADOR.addListener(listener);
var nochache:String;
nocache="?nocaching="+random(65000);
CARGADOR.loadClip("JIMMYTHECLOWN.swf"+nocache,CAJA);

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 03:06 am
en el onloadProgress, esto no va:
target_mc._visible=false;
target_mc.stop();

en el onLoadComplete, esto no va:
target_mc._visible=true;
target_mc.play();

crea el evento onLoadInit:

Código ActionScript :

listener.onLoadInit = function( target_mc:MovieClip ):Void
{
   trace("-> " + target_mc.JINGLE)
   JINGLE.start();
};


Me dices que te saca el trace

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 24 Ene 2009 03:13 am
es que lo que esta cargando ahi el preloader es toda un pelicula, la cual contiene el sonido, que es llamado por un attachsound.
no esta cargando solo el sonido.

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 03:15 am
Si eso ya lo se. pero dime, que te saca el trace?

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 24 Ene 2009 03:28 am
ya le quite las dos cosas que me dijiste y le puse el codigo que me posteaste, y me sale solo esto en la salida:

Error al abrir la URL 'file:///C|/Documents%20and%20Settings/JIMMY%20THE%20CLOWN/Desktop/JIMMYTHECLOWN.swf?nocaching=1419'

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 03:30 am

Código ActionScript :

CARGADOR.loadClip("JIMMYTHECLOWN.swf"+nocache,CAJA); 

Cuando usas no cache, solo funciona probandolo desde un servidor.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 24 Ene 2009 03:33 am
ya lo probe en el servidor y sigue sin sonar

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 03:37 am
lo que no entiendo es porque el sonido de la pelicula sirve cuando la toco sola y no sirve cuando la cargo con el preloader, que puede estar mal?, la pelicula principal o el preloader?, aprecio tu ayuda como no te imaginas, deveras te lo agradesco.

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie
Citar            
MensajeEscrito el 24 Ene 2009 04:01 am
no deberia estar mal, si la pelicula se carga sin problemas e individualmente si lo reproduce, pero al cargar el swf lo unico que no reproduce es el sonido, pero si las animaciones, puede que sea un problema de seguridad, prueba poniendo esto en las 2 peliculas:

Código ActionScript :

System.security.allowDomain("http://www.jimmytheclown.com/")

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 25 Ene 2009 08:20 pm
ya lo puse en las dos peliculas y nada

Por JIMMYTHECLOWN

25 de clabLevel



 

MÉXICO

msie

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.