Foros del Web » Creando para Internet » Flash y Actionscript »

Ayuda con Reproductor

Estas en el tema de Ayuda con Reproductor en el foro de Flash y Actionscript en Foros del Web. Hola muchachos, encontre un reproductor que me gusta y anda bien. pero quiero que no empieze tocando, si no que arranque con el primer tema ...
  #1 (permalink)  
Antiguo 26/01/2011, 07:40
 
Fecha de Ingreso: noviembre-2010
Mensajes: 7
Antigüedad: 13 años, 5 meses
Puntos: 0
Ayuda con Reproductor

Hola muchachos, encontre un reproductor que me gusta y anda bien.
pero quiero que no empieze tocando, si no que arranque con el primer tema pausado y que yo le de play para que empieze.

este es el codigo que tiene:

codigo en as2
Cita:
//
// INITIAL SETTINGS
//
boundryWidth = mask_mc._width;
boundryHeight = mask_mc._height;
buffer = (menu_mc.bttn_mc._height)*2;
// Set tween speed of menu here
tweenSpeed = 5;
//
// MENU SCROLLING
//
onMouseMove = function () {
if (this._xmouse>0 && this._xmouse<(boundryWidth)) {
if (this._ymouse>0 && this._ymouse<(boundryHeight)) {
ratio = this._ymouse/boundryHeight;
diff = menu_mc._height-boundryHeight+buffer;
destY = Math.floor(-ratio*diff)+buffer/2;
}
}
};
//
// PRELOADER, TIME, MENUSCROLLING SCRIPT
//
onEnterFrame = function () {
// Loading bar
loading = my_sound.getBytesLoaded();
filesize = my_sound.getBytesTotal();
percentage = Math.round((loading/filesize)*100);
controls_mc.progress_mc.buffer_mc._xscale = percentage;
controls_mc.progress_mc.played_mc._xscale = (my_sound.position/my_sound.duration)*percentage;
// Get current time
seconds = my_sound.position/1000;
minutes = Math.floor(seconds/60);
if (minutes<10) {
minutes = "0"+minutes;
}
seconds = Math.floor(seconds%60);
if (seconds<10) {
seconds = "0"+seconds;
}
if (durationDisplay == undefined) {
durationDisplay = "-----";
}
controls_mc.time_txt.text = minutes+":"+seconds+" / "+durationDisplay;
// Menu scrolling
if (menu_mc._height>boundryHeight) {
menu_mc._y += Math.floor((destY-menu_mc._y)/tweenSpeed);
if (menu_mc._y>0) {
menu_mc._y = 0;
} else if (menu_mc._y<(boundryHeight-menu_mc._height)) {
menu_mc._y = boundryHeight-menu_mc._height;
}
}
//
};
//
// PLAYER CONTROL BUTTONS
//
// Rewind
doRewind = function () {
if (ID>0) {
ID--;
} else {
ID = total-1;
}
doHighlight();
loadTrack();
};
// Pause
doPause = function () {
my_sound.stop();
controls_mc.bttnPlay.icon_mc.gotoAndStop(2);
};
// Play
doPlay = function () {
my_sound.start(my_sound.position/1000);
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
};
// Next track
doForward = function () {
if (ID<total-1) {
ID++;
} else {
ID = 0;
}
doHighlight();
loadTrack();
};
controls_mc.bttnPlay.bttn.onPress = function() {
if (controls_mc.bttnPlay.icon_mc._currentframe == 1) {
doPause();
} else {
doPlay();
}
};
controls_mc.bttnRewind.bttn.onPress = function() {
doRewind();
};
controls_mc.bttnForward.bttn.onPress = function() {
doForward();
};
//
// TRACK HIGHLIGHTING
//
doHighlight = function () {
for (n=0; n<total; n++) {
if (n != ID) {
menu_mc["bttn_mc"+n].gotoAndStop(1);
} else {
menu_mc["bttn_mc"+ID].gotoAndStop(2);
}
}
};
//
// LOAD SOUND
//
var my_sound:Sound = new Sound(this);
my_sound.onLoad = function(success:Boolean) {
if (success) {
totalSeconds = this.duration/1000;
minutes2 = Math.floor(totalSeconds/60);
if (minutes2<10) {
minutes2 = "0"+minutes2;
}
seconds2 = Math.floor(totalSeconds)%60;
if (seconds2<10) {
seconds2 = "0"+seconds2;
}
durationDisplay = minutes2+":"+seconds2;
menu_mc["bttn_mc"+ID].txt_mc.durationDisplay.text = durationDisplay;
}
};
my_sound.onSoundComplete = function() {
doForward();
};
//
// ON MENU PRESS
//
loadTrack = function () {
my_sound.start();
controls_mc.bttnPlay.icon_mc.gotoAndStop(1);
my_sound.loadSound(Path[ID], true);
doHighlight();
};
//
// BUILD PLAYER
//
buildPlayer = function () {
for (i=0; i<total; i++) {
// Get track name and path
Title[i] = xmlNode.childNodes[i].attributes.Title;
Path[i] = xmlNode.childNodes[i].attributes.Path;
// Build menu
menu_mc.bttn_mc.duplicateMovieClip("bttn_mc"+i, i);
menu_mc["bttn_mc"+i]._y = (menu_mc.bttn_mc._height+1)*i;
menu_mc["bttn_mc"+i].txt_mc.titleDisplay.text = Title[i];
if (i<9) {
num = "0"+(i+1);
} else {
num = i+1;
}
menu_mc["bttn_mc"+i].num_mc.numDisplay.text = num;
menu_mc["bttn_mc"+i].ID = i;
}
ID = 0;
loadTrack();
menu_mc.bttn_mc._visible = false
};
//
// LOAD XML
//
loadXML = function (loaded) {
if (loaded) {
xmlNode = this.firstChild;
total = xmlNode.childNodes.length;
Title = [];
Path = [];
buildPlayer();
} else {
trace("Error loading XML");
}
};
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("playlist/content.xml");
stop();
y este es el xml :
Cita:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<content>
<mp3 Title="tema1" Path="playlist/track1.mp3"/>
<mp3 Title="tema2" Path="playlist/track2.mp3"/>
<mp3 Title="tema3" Path="playlist/track3.mp3"/>
<mp3 Title="tema4" Path="playlist/track4.mp3"/>

</content>
Gracias !!
  #2 (permalink)  
Antiguo 26/01/2011, 14:44
 
Fecha de Ingreso: diciembre-2010
Ubicación: Madrid
Mensajes: 342
Antigüedad: 13 años, 4 meses
Puntos: 28
Respuesta: Ayuda con Reproductor

en "INITIAL SETTINGS"
prueba a poner esto:
my_sound.stop();

saludos

Etiquetas: reproductor
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:02.