PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Musicplayer soll nich sofort starten
Beitrag
<blockquote data-quote="smallgrapher" data-source="post: 1418527" data-attributes="member: 92523"><p><strong>AW: Musicplayer soll nich sofort starten</strong></p><p></p><p>Hier nun mein aktueller Code:</p><p>[CODE]</p><p>// Setup sound object</p><p>var s:Sound = new Sound();</p><p>s.onSoundComplete = playSong;</p><p>s.setVolume(75);</p><p>// Array of songs</p><p>var sa:Array = new Array();</p><p>// Currently playing song</p><p>var cps:Number = -1;</p><p>// Position of music</p><p>var pos:Number;</p><p>// Load the songs XML</p><p>var xml:XML = new XML();</p><p>xml.ignoreWhite = true;</p><p>xml.onLoad = function()</p><p>{</p><p> var nodes:Array = this.firstChild.childNodes;</p><p> for(var i=0;i<nodes.length;i++)</p><p> {</p><p> sa.push(new Song(nodes[i].attributes.url, nodes[i].attributes.artist, nodes[i].attributes.track));</p><p> }</p><p>}</p><p>xml.load("playlist.xml");</p><p>// Play the MP3 File</p><p>function playSong():Void</p><p>{</p><p> s = new Sound();</p><p> s.onSoundComplete = playSong;</p><p> s.setVolume(75);</p><p> mute.gotoAndStop("on");</p><p> if(cps == sa.length - 1)</p><p> {</p><p> cps = 0;</p><p> s.loadSound(sa[cps].earl, true);</p><p> }</p><p> else</p><p> {</p><p> s.loadSound(sa[++cps].earl, true);</p><p> }</p><p> trackInfo.text = sa[cps].artist + " - " + sa[cps].track;</p><p> playPause.gotoAndStop("pause");</p><p> textPos = 0;</p><p>}</p><p>// Pauses the music</p><p>function pauseIt():Void</p><p>{</p><p> pos = s.position;</p><p> s.stop();</p><p>}</p><p>// Pauses the music</p><p>function unPauseIt():Void</p><p>{</p><p> s.start(pos/1000);</p><p>}</p><p>// Music Controls</p><p>// Play/Pause Toggle</p><p>playPause.onRollOver = function()</p><p>{</p><p> if(this._currentframe == 1) this.gotoAndStop("pauseOver");</p><p> else this.gotoAndStop("playOver");</p><p>}</p><p>playPause.onRollOut = playPause.onReleaseOutside = function()</p><p>{</p><p> if(this._currentframe == 10) this.gotoAndStop("pause");</p><p> else this.gotoAndStop("play");</p><p>}</p><p>autoplay=true;</p><p>playPause.onRelease = function()</p><p>{</p><p> if(this._currentframe == 10)</p><p> {</p><p> this.gotoAndStop("playOver");</p><p> this._parent.pauseIt();</p><p> }</p><p> else if(autoplay==false)</p><p> {</p><p> this.gotoAndStop("pauseOver");</p><p> this._parent.unPauseIt();</p><p> }</p><p>else{</p><p>this._parent.autoplay=false;</p><p> this.gotoAndStop("pauseOver");</p><p>this._parent.playSong();</p><p>}</p><p>}</p><p>// Next Button</p><p>next.onRollOver = function()</p><p>{</p><p> this.gotoAndStop("nextOver");</p><p>}</p><p>next.onRollOut = next.onReleaseOutside = function()</p><p>{</p><p> this.gotoAndStop("next");</p><p>}</p><p>next.onRelease = function()</p><p>{</p><p> this._parent.playSong();</p><p>}</p><p>// Mute Button</p><p>mute.onRollOver = function()</p><p>{</p><p> if(this._currentframe == 1) this.gotoAndStop("onOver");</p><p> else this.gotoAndStop("offOver");</p><p>}</p><p>mute.onRollOut = mute.onReleaseOutside = function()</p><p>{</p><p> if(this._currentframe == 10) this.gotoAndStop("on");</p><p> else this.gotoAndStop("off");</p><p>}</p><p>mute.onRelease = function()</p><p>{</p><p> if(this._currentframe == 10)</p><p> {</p><p> this.gotoAndStop("offOver");</p><p> s.setVolume(0);</p><p> }</p><p> else</p><p> {</p><p> this.gotoAndStop("onOver");</p><p> s.setVolume(75);</p><p> }</p><p>}</p><p> </p><p>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////</p><p>// Text scroller bonus code</p><p>var size:Number = 21;</p><p>var textPos:Number = 0;</p><p>var intervalID:Number = setInterval(scroller, 1000);</p><p>function scroller():Void</p><p>{</p><p> var t:String = (sa[cps].artist + " - " + sa[cps].track);</p><p> if(textPos+size < t.length)</p><p> {</p><p> textPos++;</p><p> trackInfo.text = (sa[cps].artist + " - " + sa[cps].track).substring(textPos, textPos+size);</p><p> }</p><p> else </p><p> {</p><p> clearInterval(intervalID);</p><p> intervalID = setInterval(scroller2, 1000);</p><p> }</p><p>}</p><p>function scroller2():Void</p><p>{</p><p> var t:String = (sa[cps].artist + " - " + sa[cps].track);</p><p> if(textPos > 0)</p><p> {</p><p> textPos--;</p><p> trackInfo.text = (sa[cps].artist + " - " + sa[cps].track).substring(textPos, size);</p><p> }</p><p> else </p><p> {</p><p> clearInterval(intervalID);</p><p> intervalID = setInterval(scroller, 1000);</p><p> }</p><p>}[/CODE]</p><p> </p><p>ich habe alle möglichen vatiablen ausprobiert, zu verstehen und zu ändern. Bin schon ein ganzes Stück weiter mit meinem Wissen, nur hab ich immer noch das Problem, das er die Pausetaste zuerst anzeigt und nicht mehr auf Stop geht. Könnte sich vielleicht einer mal erbarmen und sich den Code noch einmal anschauen?</p></blockquote><p></p>
[QUOTE="smallgrapher, post: 1418527, member: 92523"] [b]AW: Musicplayer soll nich sofort starten[/b] Hier nun mein aktueller Code: [CODE] // Setup sound object var s:Sound = new Sound(); s.onSoundComplete = playSong; s.setVolume(75); // Array of songs var sa:Array = new Array(); // Currently playing song var cps:Number = -1; // Position of music var pos:Number; // Load the songs XML var xml:XML = new XML(); xml.ignoreWhite = true; xml.onLoad = function() { var nodes:Array = this.firstChild.childNodes; for(var i=0;i<nodes.length;i++) { sa.push(new Song(nodes[i].attributes.url, nodes[i].attributes.artist, nodes[i].attributes.track)); } } xml.load("playlist.xml"); // Play the MP3 File function playSong():Void { s = new Sound(); s.onSoundComplete = playSong; s.setVolume(75); mute.gotoAndStop("on"); if(cps == sa.length - 1) { cps = 0; s.loadSound(sa[cps].earl, true); } else { s.loadSound(sa[++cps].earl, true); } trackInfo.text = sa[cps].artist + " - " + sa[cps].track; playPause.gotoAndStop("pause"); textPos = 0; } // Pauses the music function pauseIt():Void { pos = s.position; s.stop(); } // Pauses the music function unPauseIt():Void { s.start(pos/1000); } // Music Controls // Play/Pause Toggle playPause.onRollOver = function() { if(this._currentframe == 1) this.gotoAndStop("pauseOver"); else this.gotoAndStop("playOver"); } playPause.onRollOut = playPause.onReleaseOutside = function() { if(this._currentframe == 10) this.gotoAndStop("pause"); else this.gotoAndStop("play"); } autoplay=true; playPause.onRelease = function() { if(this._currentframe == 10) { this.gotoAndStop("playOver"); this._parent.pauseIt(); } else if(autoplay==false) { this.gotoAndStop("pauseOver"); this._parent.unPauseIt(); } else{ this._parent.autoplay=false; this.gotoAndStop("pauseOver"); this._parent.playSong(); } } // Next Button next.onRollOver = function() { this.gotoAndStop("nextOver"); } next.onRollOut = next.onReleaseOutside = function() { this.gotoAndStop("next"); } next.onRelease = function() { this._parent.playSong(); } // Mute Button mute.onRollOver = function() { if(this._currentframe == 1) this.gotoAndStop("onOver"); else this.gotoAndStop("offOver"); } mute.onRollOut = mute.onReleaseOutside = function() { if(this._currentframe == 10) this.gotoAndStop("on"); else this.gotoAndStop("off"); } mute.onRelease = function() { if(this._currentframe == 10) { this.gotoAndStop("offOver"); s.setVolume(0); } else { this.gotoAndStop("onOver"); s.setVolume(75); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Text scroller bonus code var size:Number = 21; var textPos:Number = 0; var intervalID:Number = setInterval(scroller, 1000); function scroller():Void { var t:String = (sa[cps].artist + " - " + sa[cps].track); if(textPos+size < t.length) { textPos++; trackInfo.text = (sa[cps].artist + " - " + sa[cps].track).substring(textPos, textPos+size); } else { clearInterval(intervalID); intervalID = setInterval(scroller2, 1000); } } function scroller2():Void { var t:String = (sa[cps].artist + " - " + sa[cps].track); if(textPos > 0) { textPos--; trackInfo.text = (sa[cps].artist + " - " + sa[cps].track).substring(textPos, size); } else { clearInterval(intervalID); intervalID = setInterval(scroller, 1000); } }[/CODE] ich habe alle möglichen vatiablen ausprobiert, zu verstehen und zu ändern. Bin schon ein ganzes Stück weiter mit meinem Wissen, nur hab ich immer noch das Problem, das er die Pausetaste zuerst anzeigt und nicht mehr auf Stop geht. Könnte sich vielleicht einer mal erbarmen und sich den Code noch einmal anschauen? [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Musicplayer soll nich sofort starten
Oben