Προβλημα κωδικα mp3 player

Λύσεις προβλημάτων για το δημοφιλές πρόγραμμα κατασκευής παρουσιάσεων στο διαδίκτυο.

Συντονιστές: WebDev Moderators, Super-Moderators

Απάντηση
philduke
Δημοσιεύσεις: 9
Εγγραφή: 21 Φεβ 2010 16:18

Προβλημα κωδικα mp3 player

Δημοσίευση από philduke » 26 Φεβ 2010 13:36

Γεια σας

εχω ενσωματωσει ενα mp3 player στο site μου το οποιο ειναι φτιαγμενο σε flash
αλλα εχω μερικα προβληματα αν μπορουσατε να βοηθησετε

Το mp3 player ξεκιναει αυτοματα οταν καποιος επισκευτει το site εγω θελω να μην παιζει μονο του αλλα να χρειαζετε να πατησει καποιος το play και δευτερον το mp3 player ξεκιναει με 100% στην ενταση του εγω θελω να ξεκιναει περιπου στο 40% . Ποια σημεια του κωδικα πρεπει να πειραξω για να γινουν αυτα που ζηταω? μπορει καποιος να βοηθησει?

o κωδικας ειναι ο εξης:

Κώδικας: Επιλογή όλων


stop();
var songs:Array = new Array();
var curtrack:Number = 0;
var playingsong:Sound = new Sound();
if (_root.playlist == undefined || _root.playlist == "") {
	_root.playlist = "playlist.xml";
}
var playlistXml:XML = new XML();
playlistXml.ignoreWhite = true;
playlistXml.load(_root.playlist);
playlistXml.onLoad = function() {
	loadSongs();
	loadplaylistbox();
	loadSong(curtrack);
	if (_root.autostart == "false") {
		toggleplaypause();
	}
};
function loadSongs() {
	for &#40;songIndex=0; songIndex<playlistXml.childNodes&#91;0&#93;.childNodes&#91;0&#93;.childNodes.length; songIndex++&#41; &#123;
		var songdata&#58;Object = new Object&#40;&#41;;
		for &#40;songNode=0; songNode<playlistXml.childNodes&#91;0&#93;.childNodes&#91;0&#93;.childNodes&#91;songIndex&#93;.childNodes.length; songNode++&#41; &#123;
			switch&#40;playlistXml.childNodes&#91;0&#93;.childNodes&#91;0&#93;.childNodes&#91;songIndex&#93;.childNodes&#91;songNode&#93;.nodeName&#41;&#123;
			case "creator"&#58;
				songdata.artist = playlistXml.childNodes&#91;0&#93;.childNodes&#91;0&#93;.childNodes&#91;songIndex&#93;.childNodes&#91;songNode&#93;.childNodes&#91;0&#93;.nodeValue;
				break;
			case "title"&#58;
				songdata.title = playlistXml.childNodes&#91;0&#93;.childNodes&#91;0&#93;.childNodes&#91;songIndex&#93;.childNodes&#91;songNode&#93;.childNodes&#91;0&#93;.nodeValue;
				break;
			case "location"&#58;
				songdata.location = playlistXml.childNodes&#91;0&#93;.childNodes&#91;0&#93;.childNodes&#91;songIndex&#93;.childNodes&#91;songNode&#93;.childNodes&#91;0&#93;.nodeValue;
				break;
			&#125;
		&#125;
		songs&#91;songIndex&#93; = songdata;
	&#125;
&#125;
function loadSong&#40;track&#41; &#123;
	playingsong = new Sound&#40;&#41;;
	playingsong.loadSound&#40;songs&#91;track&#93;.location, true&#41;;
	playingsong.start&#40;0&#41;;
	updatevolume&#40;&#41;;
	playingsong.onSoundComplete = function&#40;&#41; &#123;
		loadSong&#40;&#40;curtrack+1&#41;%&#40;songs.length&#41;&#41;;
	&#125;;
	playpause.gotoAndStop&#40;1&#41;;
	playpause.playpausebutton.onPress = function&#40;&#41; &#123;
		toggleplaypause&#40;&#41;;
	&#125;;
	songdisplay.text = songs&#91;track&#93;.artist+" - "+songs&#91;track&#93;.title;
	eval&#40;"playlistbox.playlistitemcontainer.playlistitem"+curtrack+".playlistitemhighlight"&#41;._alpha = 4;
	eval&#40;"playlistbox.playlistitemcontainer.playlistitem"+track+".playlistitemhighlight"&#41;._alpha = 20;
	curtrack = track;
&#125;
function loadplaylistbox&#40;&#41; &#123;
	for &#40;songIndex=0; songIndex<playlistXml.childNodes&#91;0&#93;.childNodes&#91;0&#93;.childNodes.length; songIndex++&#41; &#123;
		playlistbox.playlistitemcontainer.attachMovie&#40;"playlistitem", "playlistitem"+songIndex, playlistbox.playlistitemcontainer.getNextHighestDepth&#40;&#41;, &#123;_x&#58;0, _y&#58;15*songIndex&#125;&#41;;
		eval&#40;"playlistbox.playlistitemcontainer.playlistitem"+songIndex+".playlistitemtext"&#41;.text = songs&#91;songIndex&#93;.artist+" - "+songs&#91;songIndex&#93;.title;
		eval&#40;"playlistbox.playlistitemcontainer.playlistitem"+songIndex&#41;.songindex = songIndex;
	&#125;
&#125;
playpause.playpausebutton.onPress = function&#40;&#41; &#123;
	toggleplaypause&#40;&#41;;
&#125;;
function toggleplaypause&#40;&#41; &#123;
	if &#40;playpause._currentframe == 1&#41; &#123;
		playpause.gotoAndStop&#40;2&#41;;
		playpause.curpos = playingsong.position;
		playingsong.stop&#40;&#41;;
	&#125; else &#123;
		playpause.gotoAndStop&#40;1&#41;;
		playingsong.start&#40;playpause.curpos/1000, 0&#41;;
	&#125;
	playpause.playpausebutton.onPress = function&#40;&#41; &#123;
		toggleplaypause&#40;&#41;;
	&#125;;
&#125;
onEnterFrame = function &#40;&#41; &#123;
	if &#40;songdisplay.movingright&#41; &#123;
		songdisplay.hscroll -= 10;
		if &#40;songdisplay.hscroll<=0&#41; &#123;
			songdisplay.movingright = false;
		&#125;
	&#125; else &#123;
		songdisplay.hscroll += 10;
		if &#40;songdisplay.hscroll>=songdisplay.maxhscroll&#41; &#123;
			songdisplay.movingright = true;
		&#125;
	&#125;
	if &#40;!draggingslider&#41; &#123;
		progressslider._x = &#40;playingsong.position/playingsong.duration&#41;*182+61;
		if &#40;progressslider._x == 0&#41; &#123;
			progressslider._x = 61;
		&#125;
	&#125;
	if &#40;draggingplaylistscroller&#41; &#123;
		updateplaylistscroll&#40;&#41;;
	&#125;
	if &#40;draggingvolmeslider&#41; &#123;
		updatevolume&#40;&#41;;
	&#125;
	tempsongtime = "";
	if &#40;Math.floor&#40;playingsong.position/60000&#41; == 0&#41; &#123;
		tempsongtime += "0";
	&#125; else &#123;
		tempsongtime += Math.floor&#40;playingsong.position/60000&#41;;
	&#125;
	tempsongtime += "&#58;";
	if &#40;Math.floor&#40;&#40;playingsong.position/1000&#41;%60&#41;<10&#41; &#123;
		tempsongtime += "0";
	&#125;
	tempsongtime += Math.floor&#40;&#40;playingsong.position/1000&#41;%60&#41;;
	tempsongtime += "/";
	if &#40;Math.floor&#40;playingsong.duration/60000&#41; == 0&#41; &#123;
		tempsongtime += "0";
	&#125; else &#123;
		tempsongtime += Math.floor&#40;playingsong.duration/60000&#41;;
	&#125;
	tempsongtime += "&#58;";
	if &#40;Math.floor&#40;&#40;playingsong.duration/1000&#41;%60&#41;<10&#41; &#123;
		tempsongtime += "0";
	&#125;
	tempsongtime += Math.floor&#40;&#40;playingsong.duration/1000&#41;%60&#41;;
	songtime.text = tempsongtime;
	//trace&#40;Math.floor&#40;playingsong.position/60000&#41;&#41;;
	//if&#40;Math.floor&#40;playingsong.position/1000&#41;%60&#41;
	//songtime.text=Math.floor&#40;playingsong.position/1000&#41;%60+"/"+Math.floor&#40;playingsong.duration/1000&#41;%60;
&#125;;
progressslider.onPress = function&#40;&#41; &#123;
	draggingslider = true;
	progressslider.startDrag&#40;true, 61, progressslider._y, 243, progressslider._y&#41;;
&#125;;
progressslider.onRelease = progressslider.onReleaseOutside=function &#40;&#41; &#123;
	progressslider.stopDrag&#40;&#41;;
	playingsong.start&#40;&#40;&#40;progressslider._x-61&#41;/182&#41;*playingsong.duration/1000, 0&#41;;
	playpause.gotoAndStop&#40;1&#41;;
	playpause.playpausebutton.onPress = function&#40;&#41; &#123;
		toggleplaypause&#40;&#41;;
	&#125;;
	draggingslider = false;
&#125;;
progressbar.onPress = function&#40;&#41; &#123;
	playingsong.start&#40;&#40;&#40;_xmouse-61&#41;/182&#41;*playingsong.duration/1000, 0&#41;;
	playpause.gotoAndStop&#40;1&#41;;
	playpause.playpausebutton.onPress = function&#40;&#41; &#123;
		toggleplaypause&#40;&#41;;
	&#125;;
&#125;;
volumebar.onPress = function&#40;&#41; &#123;
	draggingvolmeslider = true;
	volumebar.volumeslider.startDrag&#40;true, 0, volumebar.volumeslider._y, 47, volumebar.volumeslider._y&#41;;
&#125;;
volumebar.onRelease = volumebar.onReleaseOutside=function &#40;&#41; &#123;
	draggingvolmeslider = false;
	volumebar.volumeslider.stopDrag&#40;&#41;;
	updatevolume&#40;&#41;;
&#125;;
function updatevolume&#40;&#41; &#123;
	playingsong.setVolume&#40;&#40;volumebar.volumeslider._x/47&#41;*100&#41;;
&#125;
previoussong.onPress = function&#40;&#41; &#123;
	loadprevioussong&#40;&#41;;
&#125;;
function loadprevioussong&#40;&#41; &#123;
	var loadtrack = &#40;curtrack-1&#41;%&#40;songs.length&#41;;
	if &#40;loadtrack<0&#41; &#123;
		loadtrack = songs.length-1;
	&#125;
	loadSong&#40;loadtrack&#41;;
&#125;
nextsong.onPress = function&#40;&#41; &#123;
	loadnextsong&#40;&#41;;
&#125;;
function loadnextsong&#40;&#41; &#123;
	var loadtrack = &#40;curtrack+1&#41;%&#40;songs.length&#41;;
	loadSong&#40;loadtrack&#41;;
&#125;
playlistscroller.onPress = function&#40;&#41; &#123;
	draggingplaylistscroller = true;
	playlistscroller.startDrag&#40;true, 283, 70, 283, 171&#41;;
&#125;;
playlistscroller.onRelease = playlistscroller.onReleaseOutside=function &#40;&#41; &#123;
	draggingplaylistscroller = false;
	playlistscroller.stopDrag&#40;&#41;;
&#125;;
playlistscrollup.onPress = function&#40;&#41; &#123;
	playlistscroller._y = Math.max&#40;70, playlistscroller._y-10&#41;;
	updateplaylistscroll&#40;&#41;;
&#125;;
playlistscrolldown.onPress = function&#40;&#41; &#123;
	playlistscroller._y = Math.min&#40;171, playlistscroller._y+10&#41;;
	updateplaylistscroll&#40;&#41;;
&#125;;
var mouseListener&#58;Object = new Object&#40;&#41;;
mouseListener.onMouseWheel = function&#40;delta&#58;Number&#41; &#123;
	playlistscroller._y = Math.min&#40;171, Math.max&#40;70, playlistscroller._y-delta&#41;&#41;;
	updateplaylistscroll&#40;&#41;;
&#125;;
Mouse.addListener&#40;mouseListener&#41;;
playlistscrollbar.onPress = function&#40;&#41; &#123;
	playlistscroller._y = Math.min&#40;171, Math.max&#40;70, _ymouse&#41;&#41;;
	updateplaylistscroll&#40;&#41;;
&#125;;
function updateplaylistscroll&#40;&#41; &#123;
	playlistbox.playlistitemcontainer._y = -&#40;&#40;playlistscroller._y-70&#41;/101&#41;*&#40;playlistbox.playlistitemcontainer._height-149&#41;;
&#125;
function visitswfspot&#40;&#41; &#123;
	getURL&#40;"http&#58;//www.swfspot.com", "_blank"&#41;;
&#125;
var myMenu = new ContextMenu&#40;&#41;;
var menubezz = new ContextMenuItem&#40;"SWF Spot Mp3 Player", visitswfspot&#41;;
myMenu.customItems.push&#40;menubezz&#41;;
var menuplaypause = new ContextMenuItem&#40;"Play / Pause", toggleplaypause&#41;;
menuplaypause.separatorBefore = true;
myMenu.customItems.push&#40;menuplaypause&#41;;
var menuprevioustrack = new ContextMenuItem&#40;"Previous Song", loadprevioussong&#41;;
myMenu.customItems.push&#40;menuprevioustrack&#41;;
var menunexttrack = new ContextMenuItem&#40;"Next Song", loadnextsong&#41;;
myMenu.customItems.push&#40;menunexttrack&#41;;
myMenu.hideBuiltInItems&#40;&#41;;
_root.menu = myMenu;

Απάντηση

Επιστροφή στο “Flash γενικά”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες