begin process at 2012 05 27 19:37:47
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Flash / Flash MX

 > 

Scripts

 > 

ActionScript

 > 

Problème d'affichage du temps sur player mp3


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Problème d'affichage du temps sur player mp3

samedi 20 février 2010 à 15:49:47 | Problème d'affichage du temps sur player mp3

BBFUNK01

Salut à toutes et à tous,

je suis en train de modifier mon player mp3 afin de permettre de lire les mp3 en progressiv download.
Je suis donc parvenu à mes fins, mais comme des modifications engendrent toujours des problèmes, et bien le souci c'est que le temps de chaque mp3 lu ne s'affiche plus correctement, pour faire court et résumer comment fonctionne mon player mp3 :
- Mon player mp3 permet de charger plusieurs playlists à partir d'un coverflow.
- Lorsque je clique sur une des couvertures du coverflow, cela lance le 1er mp3 de la playlist, et pour ce mp3 le temps s'affiche correctement.
- Lorsque je sélectionne un autre mp3 de la playlist chargée, l'affichage du temps n'est pas réinitialisé et par conséquent le temps affiché au début de la lecture de ce mp3 est celui du précédent mp3, exemple :
si je lance la lecture d'un nouveau mp3 et que le temps affiché du précédent mp3 en lecture était 1min30sec, le nouveau mp3 lancé en lecture affichera dans le textfield "temps" 1min30sec au lieu de 0.

Voici le lien de mon player mp3 pour vous montrer plus simplement le problème :
mon player mp3

pour ceux qui auront le courage de jeter un oeil à mon code :
Code ActionScript :
var songInfo:Array;

var commandeTab:Array = new Array();
var TotalCommande:Array = new Array();

info = "";
total = "0";
info2 = "";

clip_charge._visible = false;
barre_charge._visible = false;
fond_charge._visible = false;
pc_charge._visible = false;

function envoyerCommande() {
	// On crée les objets LoadVars nécessaires : un pour l'envoi et un pour la réception
	reception = new LoadVars();
	envoi = new LoadVars();
	// Fonction appelée quand l'objet LoadVars est utilisé
	reception.onLoad = function(succes) {
		if(succes) {
			// Si le php indique que l'envoi a été effectué
			if(this.retour == "OK"){
				info2 = "Votre commande a bien été envoyée";
				_parent.panier.message2.textColor = 0x00FF00;
				}
			}
			// Si le php indique une erreur lors de l'envoi
			if(this.retour == "ERREUR"){
				info2 = "Erreur lors de l'envoi de la commande";
				_parent.panier.message2.textColor = 0xFF0000;
		}
	}
	// Ici on définit les variables qui seront envoyées au script PHP
	// On peut en rajouter à loisir : envoi.nomdelavariable = xxx;
	envoi.nom = this._parent.panier.nomID.text;
	envoi.prenom = this._parent.panier.prenomID.text;
	envoi.phone = this._parent.panier.phoneID.text;
	envoi.expediteur = this._parent.panier.courrielID.text;
	envoi.destinataire = "contact@musichrono.com";
	envoi.objet = "Commande de musique libre de droit";
	envoi.commande = this._parent.panier.commande.text;
	envoi.prixtotal = this._parent.panier.calcul.text;
	// Enfin on appelle le script PHP en indiquant quel objet LoadVars appeler en retour
	envoi.sendAndLoad("commande2.php", reception, POST);
}

function loadPlaylist(pString:String)
{
	songInfo = new Array();
	
    var myXML:XML = new XML();
    myXML.ignoreWhite = true;
    myXML.load(pString);
    myXML.onLoad = function(success)
    {
       if(success)
{
	for(var j=0; j< myXML.firstChild.childNodes.length; j++)
	{
		songInfo.push({
					  songNum: j,
					  title: myXML.firstChild.childNodes[j].attributes.title, 
					  artist: myXML.firstChild.childNodes[j].attributes.artist, 
					  path: myXML.firstChild.childNodes[j].attributes.path,
					  licence: myXML.firstChild.childNodes[j].attributes.licence,
					  prix: myXML.firstChild.childNodes[j].attributes.prix
					  });
	}

	playsongInfo();
}

playsongInfo = function(){

//defines a new sound object
music = new Sound(this);
trkInfo = new Date();

//comment these three lines if you don't want it to play on startup
playing = false;
paused = false;
loading = true;
///////////////////////////////////////////////////////////////////

//sets the beginning slider attributes
vol_mc.slider_mc._x = 70;
bal_mc.slider_mc._x = 50;
pos_mc.slider_mc._x = 0;
pos_mc.slider_mc._visible = true;
vol_mc.slider_mc.slider.useHandCursor = false;
bal_mc.slider_mc.slider.useHandCursor = false;
pos_mc.slider_mc.slider.useHandCursor = false;
scroller_mc.slider_mc.slider.useHandCursor = false;
loop_mc.radio_mc.useHandCursor = false;
shuffle_mc.radio_mc.useHandCursor = false;

//controls which song is highlighted in the playlist, see attacher
function select(){
	for(i in playlist_mc.target_mc){
		if(playlist_mc.target_mc[i].songNum != songNum){
			playlist_mc.target_mc[i].gotoAndStop(1);
		}
		else{
			playlist_mc.target_mc[i].gotoAndStop(2);
		}
	}
}

var LigneCommande:Object = new Object();

LigneCommande.titre = songInfo[songNum].title;
LigneCommande.licence = songInfo[songNum].licence;
LigneCommande.prix = songInfo[songNum].prix;

songNum = 0;
numTracks = songInfo.length;

//attacher: attaches the playlist movies, select() is called here
for(i = 0; i < numTracks; i++){
	playlist_mc.target_mc.attachMovie("playlistItem", "item" + i, (i+1), songInfo[i]);
	playlist_mc.target_mc["item" + i]._y = i * 18;
	if(playlist_mc.target_mc["item" + i].title == songInfo[songNum].title){
		playlist_mc.target_mc["item" + i].gotoAndStop(2);
	}
	else{
		playlist_mc.target_mc["item" + i].gotoAndStop(1);
	}
}

scrollWindowHeight = 72;
scrollMax = (playlist_mc.target_mc._y + playlist_mc.target_mc._height) - scrollWindowHeight;

//if there's not enough to scroll, there will be no handle

if(playlist_mc._height <= scrollWindowHeight){
	scroller_mc.slider_mc._visible = true;
}
else{
	scroller_mc.visible = true;
}

//loads the song
music.loadSound(songInfo[songNum].path, true);

//this is what makes the music fade when you hit the stop button
function fadeOut() {
	if (music.getVolume()>0) {
		music.setVolume(music.getVolume()-5);
	} else {
		music.stop();
		pos_mc.slider_mc._visible = true;
		pos_mc.slider_mc._x = 0;
	}
}

//this function is called when the first song ends, or the next button is press.  It moves to the next song
function nextSong(){
		if(loop == true and skipLoop != true){
			music.stop();
		}
		else{
			if(shuffle == true){
				songNum = Math.floor(Math.random()*(numTracks-1));
			}
			else{
				songNum++;
				if(songNum == songInfo.length){
					songNum = 0;
				}
			}
		loading = true;
		playing = false;
		paused = false;
		select();
		if(skipLoop == true){
			skipLoop = false;
		}
		music.loadSound(songInfo[songNum].path, true);
		}
}

//self explantory =)
function prevSong(){
	songNum--;
	if(songNum < 0){
		songNum = songInfo.length - 1;
	}
		loading = true;
		playing = false;
		paused = false;
		select();
		music.loadSound(songInfo[songNum].path, true);
}

//this function controls the text in the info window and what actions the player will take next based on what button is pressed
this.onEnterFrame = function() {
	clip_charge._visible = false;
	dur = music.duration;
	pos = music.position;
	total = music.getBytesTotal();
	loaded = music.getBytesLoaded();
	barre_charge._visible = true;
	fond_charge._visible = true;
	pc_charge._visible = true;
	barre_charge._xscale = 0;
	var pc = Math.round(music.getBytesLoaded()/music.getBytesTotal()*100);
    barre_charge._xscale = pc;
	pc_charge.text = pc+" %";
	
	if (pc >= 100){
				barre_charge._visible = false;
				fond_charge._visible = false;
				pc_charge._visible = false;
				clip_charge._visible = true;
			}
	
	//preloader
	if (loading == true) {
		if (music.getBytesLoaded() == music.getBytesTotal() and dur > 0){
			loading = false;
			playing = true;
			music.setVolume(vol_mc.slider_mc._x);
			music.setPan((bal_mc.slider_mc._x-50)*2);
			status = "playing";
		}
		else{
			if(music.getBytesTotal() != undefined){
				artist = Math.round(music.getBytesLoaded()/music.getBytesTotal()*100)+"% loaded";
			}
			else{
				artist = undefined;
			}
			
			title = undefined;
			status = "loading";
		}
	}
	
	//updates the sound attributes (vol, bal, etc...) and displays their info in the text fields
	else if (playing == true or loading == true) {
		vol = music.getVolume() + "%";
		bal = music.getPan();
		if(whichDrag != "pos_mc"){
			pos_mc.slider_mc._x = (music.position/music.duration)*100;
		}
		music.setVolume(vol_mc.slider_mc._x);
		music.setPan((bal_mc.slider_mc._x-50)*2);
		titleArtist = songInfo[songNum].path;
		title = songInfo[songNum].title;{
				function SommeTotale(){
					var totalAdd:Number = 0;
					totalAdd += (this._parent.panier.lice45.press) ? 45 : 0;
					totalAdd += (this._parent.panier.lice45.press) ? 69 : 0;
					totalAdd += (this._parent.panier.lice45.press) ? 79 : 0;
					totalAdd += (this._parent.panier.lice45.press) ? 99 : 0;
					trace(totalAdd);
					total = totalAdd;
				}
				this._parent.panier.message.text = info;
				this._parent.panier.message2.text = info2;
				this._parent.panier.commande.text = commandeTab.join("\n");
				this._parent.panier.calcul.text = total;
				this._parent.panier.commande_envoi.onRollOver = function(){
					info = "Appuyer sur Pause ou rester en mode lecture pour envoyer";
				}
				this._parent.panier.commande_envoi.onRollOut = function(){
					info = "";
				}
				this._parent.panier.licence_droit.onRollOver = function(){
					info = "Avant de commander, consultez en détail chaque licence";
				}
				this._parent.panier.licence_droit.onRollOut = function(){
					info = "";
				}
				this._parent.panier.licence_droit.onPress = function(){
					getURL("licence-musique_libre_de_droit.pdf", "_blank");
				}
				this._parent.panier.btn_vider.onRollOver = function(){
					info = "Vider tout le contenu de votre panier";
				}
				this._parent.panier.btn_vider.onRollOut = function(){
					info = "";
				}
				this._parent.panier.btn_vider.onPress = function(){
					commandeTab = new Array();
					TotalCommande = new Array();
					LigneCommande.titre = songInfo[songNum].title;
					LigneCommande.licence = songInfo[songNum].licence;
					LigneCommande.prix = songInfo[songNum].prix;
					info2 = "";
				}
				this._parent.panier.btn_moins.onRollOver = function(){
					info = "Supprimer du panier le dernier morceau ajouté";
				}
				this._parent.panier.btn_moins.onRollOut = function(){
					info = "";
				}
				this._parent.panier.btn_moins.onPress = function(){
					commandeTab.pop();
					TotalCommande.pop();
					SommeTotale();
					LigneCommande.titre = songInfo[songNum].title;
					LigneCommande.licence = songInfo[songNum].licence;
					LigneCommande.prix = songInfo[songNum].prix;
				}
				this._parent.panier.btn_panier.onRollOver = function(){
					info = "Ajouter au panier le morceau sélectionné dans la playlist";
				}
				this._parent.panier.btn_panier.onRollOut = function(){
					info = "";
				}
				this._parent.panier.btn_panier.onPress = function(){
				info = "";
				commandeTab.push(LigneCommande.titre+LigneCommande.licence+"Prix : "+LigneCommande.prix+" euros");
				trace(commandeTab);
				LigneCommande.titre = songInfo[songNum].title;
				LigneCommande.licence = songInfo[songNum].licence;
				LigneCommande.prix = songInfo[songNum].prix;
				this._parent._parent.panier.btn_moins._visible = false;
				this._parent._parent.panier.btn_vider._visible = false;
				this._parent._parent.panier.info_licence._visible = true;
				this._parent._parent.panier.btn_panier._visible = false;
				this._parent._parent.panier.btn_panier.enabled = false;
				this._parent._parent.panier.lice45._visible = true;
				this._parent._parent.panier.lice45.enabled = true;
				this._parent._parent.panier.lice69._visible = true;
				this._parent._parent.panier.lice69.enabled = true;
				this._parent._parent.panier.lice79._visible = true;
				this._parent._parent.panier.lice79.enabled = true;
				this._parent._parent.panier.lice99._visible = true;
				this._parent._parent.panier.lice99.enabled = true;
				}
				this._parent.panier.lice45.onRollOver = function(){
					info = "Licence standard : 45 euros";
				}
				this._parent.panier.lice45.onRollOut = function(){
					info = "";
				}
				this._parent.panier.lice45.onPress = function(){
						info = "";
						LigneCommande.licence = " - Licence standard - ";
						LigneCommande.prix = 45;
						commandeTab.pop();
						commandeTab.push(LigneCommande.titre+LigneCommande.licence+"Prix : "+LigneCommande.prix+" euros");
						TotalCommande.push(45);
						SommeTotale();
						trace(TotalAdd);
						LigneCommande.titre = songInfo[songNum].title;
						LigneCommande.licence = songInfo[songNum].licence;
						LigneCommande.prix = songInfo[songNum].prix;
						this._parent._parent.panier.btn_panier._visible = true;
						this._parent._parent.panier.btn_panier.enabled = true;
						this._parent._parent.panier.btn_moins._visible = true;
						this._parent._parent.panier.btn_vider._visible = true;
						this._parent._parent.panier.lice45._visible = false;
						this._parent._parent.panier.lice45.enabled = false;
						this._parent._parent.panier.lice69._visible = false;
						this._parent._parent.panier.lice69.enabled = false;
						this._parent._parent.panier.lice79._visible = false;
						this._parent._parent.panier.lice79.enabled = false;
						this._parent._parent.panier.lice99._visible = false;
						this._parent._parent.panier.lice99.enabled = false;
						this._parent._parent.panier.info_licence._visible = false;
				}
				this._parent.panier.lice69.onRollOver = function(){
					info = "Licence broadcasting : 69 euros";
				}
				this._parent.panier.lice69.onRollOut = function(){
					info = "";
				}
				this._parent.panier.lice69.onPress = function(){
						info = "";
						LigneCommande.licence = " - Licence broadcasting - ";
						LigneCommande.prix = Number(69);
						commandeTab.pop();
						commandeTab.push(LigneCommande.titre+LigneCommande.licence+"Prix : "+LigneCommande.prix+" euros");
						TotalCommande.push(69);
						LigneCommande.titre = songInfo[songNum].title;
						LigneCommande.licence = songInfo[songNum].licence;
						LigneCommande.prix = songInfo[songNum].prix;
						this._parent._parent.panier.commande.text = "69";
						this._parent._parent.panier.btn_panier._visible = true;
						this._parent._parent.panier.btn_panier.enabled = true;
						this._parent._parent.panier.btn_moins._visible = true;
						this._parent._parent.panier.btn_vider._visible = true;
						this._parent._parent.panier.lice45._visible = false;
						this._parent._parent.panier.lice45.enabled = false;
						this._parent._parent.panier.lice69._visible = false;
						this._parent._parent.panier.lice69.enabled = false;
						this._parent._parent.panier.lice79._visible = false;
						this._parent._parent.panier.lice79.enabled = false;
						this._parent._parent.panier.lice99._visible = false;
						this._parent._parent.panier.lice99.enabled = false;
						this._parent._parent.panier.info_licence._visible = false;
				}
				this._parent.panier.lice79.onRollOver = function(){
					info = "Licence reproduction 10 000 ex. : 79 euros";
				}
				this._parent.panier.lice79.onRollOut = function(){
					info = "";
				}
				this._parent.panier.lice79.onPress = function(){
						info = "";
						LigneCommande.licence = " - Licence 10 000 ex. - ";
						LigneCommande.prix = Number(79);
						commandeTab.pop();
						commandeTab.push(LigneCommande.titre+LigneCommande.licence+"Prix : "+LigneCommande.prix+" euros");
						TotalCommande.push(79);
						LigneCommande.titre = songInfo[songNum].title;
						LigneCommande.licence = songInfo[songNum].licence;
						LigneCommande.prix = songInfo[songNum].prix;
						this._parent._parent.panier.commande.text = "79";
						this._parent._parent.panier.btn_panier._visible = true;
						this._parent._parent.panier.btn_panier.enabled = true;
						this._parent._parent.panier.btn_moins._visible = true;
						this._parent._parent.panier.btn_vider._visible = true;
						this._parent._parent.panier.lice45._visible = false;
						this._parent._parent.panier.lice45.enabled = false;
						this._parent._parent.panier.lice69._visible = false;
						this._parent._parent.panier.lice69.enabled = false;
						this._parent._parent.panier.lice79._visible = false;
						this._parent._parent.panier.lice79.enabled = false;
						this._parent._parent.panier.lice99._visible = false;
						this._parent._parent.panier.lice99.enabled = false;
						this._parent._parent.panier.info_licence._visible = false;
				}
				this._parent.panier.lice99.onRollOver = function(){
					info = "Licence reproduction illimitée : 99 euros";
				}
				this._parent.panier.lice99.onRollOut = function(){
					info = "";
				}
				this._parent.panier.lice99.onPress = function(){
						info = "";
						LigneCommande.licence = " - Licence reproduction illimitée - ";
						LigneCommande.prix = Number(99);
						commandeTab.pop();
						commandeTab.push(LigneCommande.titre+LigneCommande.licence+"Prix : "+LigneCommande.prix+" euros");
						TotalCommande.push(99);
						LigneCommande.titre = songInfo[songNum].title;
						LigneCommande.licence = songInfo[songNum].licence;
						LigneCommande.prix = songInfo[songNum].prix;
						this._parent._parent.panier.commande.text = "99";
						this._parent._parent.panier.btn_panier._visible = true;
						this._parent._parent.panier.btn_panier.enabled = true;
						this._parent._parent.panier.btn_moins._visible = true;
						this._parent._parent.panier.btn_vider._visible = true;
						this._parent._parent.panier.lice45._visible = false;
						this._parent._parent.panier.lice45.enabled = false;
						this._parent._parent.panier.lice69._visible = false;
						this._parent._parent.panier.lice69.enabled = false;
						this._parent._parent.panier.lice79._visible = false;
						this._parent._parent.panier.lice79.enabled = false;
						this._parent._parent.panier.lice99._visible = false;
						this._parent._parent.panier.lice99.enabled = false;
						this._parent._parent.panier.info_licence._visible = false;
				}
				this._parent.panier.commande_envoi.onRelease = function(){
				this._parent._parent.panier.message2.textColor = 0xFF0000;
				if (this._parent._parent.panier.courrielID.text.indexOf("@") ==-1 ||  this._parent._parent.panier.courrielID.text.indexOf(".") ==-1){
				info2 = "E-MAIL INVALIDE !";
				}if (this._parent._parent.panier.courrielID.text == "" || this._parent._parent.panier.courrielID.text == "e-mail"){
				info2 = "Votre e-mail s.v.p.";
				}if ((this._parent._parent.panier.phoneID.text == "") || (this._parent._parent.panier.phoneID.text == "N° de tél.")){
				info2 = "Votre N° de téléphone s.v.p.";
				}if (this._parent._parent.panier.nomID.text == "" || this._parent._parent.panier.nomID.text == "Nom"){
				info2 = "Votre nom s.v.p.";
				}if (this._parent._parent.panier.prenomID.text == "" || this._parent._parent.panier.prenomID.text == "Prénom"){
				info2 = "Votre prénom s.v.p.";
				}if (this._parent._parent.panier.commande.text == ""){
				info2 = "Vous devez sélectionner un morceau";
				}if ((this._parent._parent.panier.phoneID.text.length == 1) || (this._parent._parent.panier.phoneID.text.length == 2) || (this._parent._parent.panier.phoneID.text.length == 3) || (this._parent._parent.panier.phoneID.text.length == 4) || (this._parent._parent.panier.phoneID.text.length == 5) || (this._parent._parent.panier.phoneID.text.length == 6) || (this._parent._parent.panier.phoneID.text.length == 7) || (this._parent._parent.panier.phoneID.text.length == 8) || (this._parent._parent.panier.phoneID.text.length == 9)){
				info2 = "N° de téléphone incorrect";
				}if (this._parent._parent.panier.courrielID.text.indexOf("@") !=-1 && this._parent._parent.panier.courrielID.text.indexOf(".") !=-1 && (this._parent._parent.panier.nomID.text !="" && this._parent._parent.panier.nomID.text !="Nom") && (this._parent._parent.panier.prenomID.text !="" && this._parent._parent.panier.prenomID.text !="Prénom") && ((this._parent._parent.panier.phoneID.text != "" && this._parent._parent.panier.phoneID.text != "N° de tél.") && (this._parent._parent.panier.phoneID.text.length == 10)) && (this._parent._parent.panier.commande.text != "")){
				envoyerCommande();
				info2 = "...envoi de votre commande en cours...";
				this._parent._parent.panier.message2.textColor = 0x00FF00;
				}
			}
		}
		artist = songInfo[songNum].artist;
		music.onSoundComplete = nextSong;
		
	} else{
		titleArtist = undefined;
		fadeOut();
		status = "stopped";
	}
	
	//controls the scrolling of the playlist
	if(scrolling == true){
		if(playlist_mc._height > scrollWindowHeight){
			percentScroll = (scroller_mc.slider_mc._y/(scroller_mc.scrollBg_mc._y + scroller_mc.scrollBg_mc._height));
			scrollValue = scrollMax*percentScroll;
			playlist_mc.target_mc._y = -(scrollValue);
		}
	}
	
	
	//displays the time
	if(timeWay == "forward" or timeWay == undefined){
		trkInfo.setSeconds(music.position/1000);
		trkInfo.setMinutes((music.position/1000)/60);
		trkInfo.setHours((music.position/1000)/3600);
	}
	else{
		trkInfo.setSeconds((music.duration -music.position)/1000);
		trkInfo.setMinutes(((music.duration -music.position)/1000)/60);
		trkInfo.setHours(((music.duration -music.position)/1000)/3600);
	}
	seconds = trkInfo.getSeconds();
	minutes = trkInfo.getMinutes();
	hours = trkInfo.getHours();

	if(seconds < 10){
		seconds = 0 + seconds.toString();
	}
	if(minutes < 10){
		minutes = 0 + minutes.toString();
	}
	if(hours < 10){
		hours = 0 + hours.toString();
	}
	
	trkHrs = Math.floor((music.duration/1000)/3600);
	trkMin = Math.floor((music.duration/1000)/60);
	trkSec = Math.floor((music.duration/1000) - (60*trkMin));
	if(trkSec < 10){
		trkSec = 0 + trkSec.toString();
	}
	if(trkMin < 10){
		trkMin = 0 + trkMin.toString();
	}
	if(trkHrs < 10){
		trkHrs = 0 + trkHrs.toString();
	}
	if(playing == true or loading == true){
		time = hours + ":" + minutes + ":" + seconds;
		totalTrkTime = trkHrs + ":" + trkMin + ":" + trkSec;
	}
	else{
		time = undefined;
		totalTrkTime = undefined;
	}
};

///////////////////////////////end onEnterFrame///////////////////////////////


//controls the play button
play_mc.onRelease = play_mc.onReleaseOutside = function() {
	if(playing != true or paused == true){
		if(loading != true){
			if(paused == true){
				seconds = pos/1000;
				music.start(seconds, 0);
				paused = false;
			}
			else if (loading != true) {
				loading = true;
				music.loadSound(songInfo[songNum].path, true);
				//music.start(0,0);
			}
		}
	}
};

//controls the stop button
stop_mc.onRelease = stop_mc.onReleaseOutside = function () {
	//if(loading != true){
		loading = false;
		playing = false;
		paused = false;
		artist = undefined;
		title = undefined;
	//}
};

//controls the pause button
pause_mc.onRelease = pause_mc.onReleaseOutside = function(){
	if(playing == true){
		if(paused == false){
			pos = music.position;
			music.stop();
			//playing = false;
			paused = true;
		}
		else{
			seconds = pos/1000;
			music.start(seconds, 0);
			paused = false;
		}
	}
}

//controls the next button
next_mc.onRelease = next_mc.onReleaseOutside = function(){
	if(loading == true or playing == true){
		skipLoop = true;
		nextSong();
	}
}

//controls the previous button
back_mc.onRelease = back_mc.onReleaseOutside = function(){
	if(loading == true or playing == true){
		prevSong();
	}
}

loop_mc.radio_mc.onRelease  = shuffle_mc.radio_mc.onRelease = function(){
	if(this._parent._currentframe == 1){
		this._parent.gotoAndStop(2);
	}
	else{
		this._parent.gotoAndStop(1);
	}
	if(this._parent._name == "loop_mc"){
		if(loop == true){
			loop = false;
		}
		else{
			loop = true;
		}
	}
	if(this._parent._name == "shuffle_mc"){
		if(shuffle == true){
			shuffle = false;
		}
		else{
			shuffle = true;
		}
	}
	
}

//controls the sliders
vol_mc.slider_mc.slider.onPress = bal_mc.slider_mc.slider.onPress=pos_mc.slider_mc.slider.onPress=function () {
	whichDrag = this._parent._parent._name;
	this._parent.onMouseMove = function() {
		updateAfterEvent();
	};
	this._parent.startDrag(false, 0, this._y, 100, this._y);
};

vol_mc.slider_mc.slider.onRelease = vol_mc.slider_mc.slider.onReleaseOutside=
bal_mc.slider_mc.slider.onRelease = bal_mc.slider_mc.slider.onReleaseOutside=
pos_mc.slider_mc.slider.onRelease = pos_mc.slider_mc.slider.onReleaseOutside=
function () {
	if(whichDrag == "pos_mc"){
		if(pos_mc.slider_mc._x == 100){
			pos_mc.slider_mc._x = 99.5;
		}
		newPos = (pos_mc.slider_mc._x*(music.duration/1000))/100;
		music.stop();
		music.start(newPos, 0);
	}
	whichDrag = undefined;
	beenDragged = "pos_mc";
	this._parent.onMouseMove = undefined;
	this._parent.stopDrag();
	if(bal_mc.slider_mc._x > 47 and bal_mc.slider_mc._x < 53){
		bal_mc.slider_mc._x=50;
	}
};
scroller_mc.slider_mc.slider.onPress = function(){
	scrolling = true;
	
	this._parent.startDrag(0, this._parent._x, this._parent._parent.scrollBg_mc._y,
	this._parent._x, this._parent._parent.scrollBg_mc._y + this._parent._parent.scrollBg_mc._height);
}
scroller_mc.slider_mc.slider.onRelease = function(){
	scrolling = false;
	this._parent.stopDrag();
}

//controls the button that changes the time display from time elapsed to time left, and vice versa
timeButton_mc.onRelease = function(){
	if(timeWay == undefined){
		timeWay = "back";
	}
	else if(timeWay == "forward"){
		timeWay = "back";
	}
	else if(timeWay == "back"){
		timeWay = "forward";
	}
}
    }
}
	}
	

stop();


Bref, je cherche toujours à résoudre le problème mais je ne vois pas trop pour l'instant comment faire, donc si jamais vous voyez où peut se trouver le souci je veux bien un coup de main.

Merci,

BBFUNK01
samedi 20 février 2010 à 23:13:49 | Re : Problème d'affichage du temps sur player mp3

BBFUNK01

Réponse acceptée !
Bon ben du coup j'ai trouvé :

il suffisait de réinitialiser "music" dans les fonctions permettant de changer de mp3 :

music = new Sound();
trkInfo = new Date();

et ainsi ça marche.

BBFUNK01


Cette discussion est classée dans : text, visible, false, parent, panier


Répondre à ce message

Sujets en rapport avec ce message

Problème pour "boutons.enabled = false" [ par BBFUNK01 ] Bonsoir à toutes et à tous, je suis en train de rédiger un code pour créer petit système de panier dans Flash et pour cela j'ai besoin à un moment qu Problème avec "Send and load" - formulaire avec fichier php [ par BBFUNK01 ] Bonsoir à toutes et à tous, je vous explique rapidement mon problème : je suis en train de bidouiller le script d'un formulaire e-mail afin de le tra Petit probleme de code [ par jobe06 ] Bonjour, je suis entrain de faire un diaporama en as2, avec des image importer par loadMovie, et les animation faite par Tween, mais mon soucis c'est Preload >> visible=false ne marche pas [ par vassilisix ] Bonjour à tous, 7 heures de recherches sans résultat! A l'aide! Mon animation principale comporte 6 boutons qui appellent 6 swf externes. Je voudra lecteur flv + coverflow playlist - comment faire le lien ? [ par BBFUNK01 ] Salut à toutes et à tous, une fois de plus je me retrouve confronté à un problème que j'ai du mal à résoudre : j'ai modifié un lecteur flv qui marche envoi mail par flash [ par mehdib4 ] Bonjour, je vous explique mon problème : je veux envoyer un mail a partir d'un site flash. es que quel qu'un peut m'aider SVP ? voila mon script: acti arreter une fonction [ par jobe06 ] Bonjour, Voila jaimerai faire un diapo, a l'aide de tween, j'ai une fonction (tourne), qui lance les tween a la suite, quand je lance que la (fonctio as2 to as3 [ par Oorihime ] bonsoir tout le monde, je suis nouvelle sur le forum ... j'ai besoin de votre aide,donc voilà,j'ai un code en as2 pour un jeu de mots cachés et je vou Probleme de setInterval [ par jobe06 ] Bonjour, Voila mon probleme, j'ai une carte, lorsque je clique dessus elle se retourne de la face A a la face B... J'aimerai faire en sorte que lorsq creeaction d une galerie videos [ par lcf360 ] bonjour a tous voila j ai plancher sur une page vidéos en flash avec lecteur et j ai réussi. 1 j ai crée mon lecteur avec les bouton play ,pause et


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,437 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales