Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Sound player (preload)

  1. #1
    Utente di HTML.it L'avatar di Spyfil
    Registrato dal
    Dec 2001
    Messaggi
    801

    Sound player (preload)

    Ho un player, che devo inserire in un popup.

    L'ho racattato in giro ed è pronto per funzionare, unico problema, il preload.
    Allego il codice che uso per il player, (il suono è un mp3 esterno e leggo le var da un txt)

    è possibile utilizzando questo metodo, fare un preload?

    codice:
    myData = new LoadVars();
    myData.onLoad = function (){
    	s = new Sound();
    	s.loadSound(this.thesong, true);
    	songdata.text=this.songinfo;
    	loadBar.loader._width=0;
    	setInterval(getTime,100);
    	setInterval(videoStatus,100);
    };
    function getTime(){
    	theposition=s.position / 1000;
    	theduration=s.duration / 1000;
    	amountLoaded=(s.getBytesLoaded() / s.getBytesTotal()) * 100;
    	totalLoaded.text=amountLoaded;
    	songtime.text=theposition;
    	totalduration.text=theduration;
    	loopme=myData.doloop;
    	if(loopme == "yes"){
    	if(theposition == theduration){
    		theposition=0;
    		s = new Sound();
    		s.loadSound(myData.thesong, true);
    	}
    	}
    	else if(loopme == "no"){
    		if(theposition == theduration){
    		s.start(0);
    		s.stop();
    		}
    	}
    }
    function videoStatus() {
    	amountLoaded2 = theposition / theduration;
    	loadBar.loader._width = amountLoaded2 * 133.5;
    }
    myData.load("songs.txt");
    vol = 100;
    laeuft = 0;
    pulsar._visible = 0;
    pulsar._xscale = vol + 15;
    pulsar._yscale = vol + 15;
    stopButton.onPress = function(){
    	s.start(0);
        s.stop();
        laeuft = 0;
    }
    playButton.onPress = function(){
        if (laeuft == 0)
        {
            s.start(0);
            laeuft = 1;
        } // end if
    }
    volDown.onPress = function(){
        vol = vol - 10;
        if (vol < 0)
        {
            vol = 0;
        } // end if
        s.setVolume(vol);
    }
    volUp.onPress = function(){
        vol = vol + 10;
        if (vol > 100)
        {
            vol = 100;
        } // end if
        s.setVolume(vol);
    }

  2. #2
    Utente di HTML.it L'avatar di Spyfil
    Registrato dal
    Dec 2001
    Messaggi
    801
    fa niente! Ne ho usato uno che ho trovato in giro!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.