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:
y este es el xml ://
// 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();
// 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();
Cita:
Gracias !! <?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>
<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>