Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 17-01-2006, 12:48   #1 (permalink)
Neuer User
 
Registriert seit: Jan 2006
Beiträge: 39
Loop einfügen

Hallo Leute

Ich hab ein Problem und ich hoffe ihr könnt mir helfen. Ich habe einen Player der über eine externe Datei, ich glaube Action Script Sounds abspielt. Ich würde aber gerne die Sounds loopen lassen, nur macht der Player das nicht und ich weiss nicht was ich da einfügen muss. Genau gesagt, es soll der erste Sound spielen und solange loopen bis der User auf weiter klickt, dann soll der 2te Sound endlos loopen. Könnt ihr mir sagen was ich da einfügen muss bitte? Das wäre sehr nett! Ich danke euch. Ich glaube da ist auch ein Random Start drinnen, der sollte auch weg wenns geht.

Vielen Dank für eure Hilfe!

Hier der Code:
Code:
stop();
playlist = new XML();
playlist.ignoreWhite = true;
playlist.onLoad = function(success) {
	if (success) {
		_global.songname = [];
		_global.songband = [];
		_global.songfile = [];
		for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
			_global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
			_global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;
			_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
			// trace(songname[i]+"  "+songfile[i]+" "+songband[i]);
		}
	}
	_root.createEmptyMovieClip("sound_mc", 1);
	_global.song_nr = random(songfile.length);
	_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
function timer(sound_obj) {
	time = sound_obj.position/1000;
	min = Math.floor(time/60);
	min = (min<10) ? "0"+min : min;
	sec = Math.floor(time%60);
	sec = (sec<10) ? "0"+sec : sec;
	timeDisplay_txt.text = min+":"+sec;
}
MovieClip.prototype.songStarter = function(file, name, band) {
	if (this.sound_obj) {
		this.sound_obj.stop();
		delete this.sound_obj;
	}
	this.sound_obj = new Sound(s);
	this.sound_obj.loadSound(file, false);
	this.onEnterFrame = function() {
		if (this.sound_obj.position>0) {
			delete this.onEnterFrame;
			this._parent.display_txt.text = name+" / "+band;
			timeInterval = setInterval(timer, 1000, this.sound_obj);
		} else {
			this._parent.display_txt.text = "loading...";
		}
	};
	this.sound_obj.onSoundComplete = function() {
		clearInterval(timeInterval);
		this._parent.timeDisplay_txt.text = "00:00";
		(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
		_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
	};
	this._parent.volume1.dragger.onPress = function() {
		startDrag(this, true, 0, this._y, this._parent.volBG._width, this._y);
		this.onEnterFrame = function() {
			var p = (this._x/this._parent.volBG._width)*100;
			this._parent._parent.sound_mc.sound_obj.setVolume(p);
		};
	};
	this._parent.volume1.dragger.onRelease = function() {
		delete this.onEnterFrame;
		stopDrag();
	};
	this._parent.volume1.dragger.onReleaseOutside = function() {
		stopDrag();
	};
};
btn_play.onRelease = function() {
	clearInterval(timeInterval);
	this._parent.timeDisplay_txt.text = "00:00";
	this._parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
btn_stop.onRelease = function() {
	clearInterval(timeInterval);
	this._parent.timeDisplay_txt.text = "00:00";
	this._parent.sound_mc.sound_obj.stop();
};
btn_fw.onRelease = function() {
	clearInterval(timeInterval);
	this._parent.timeDisplay_txt.text = "00:00";
	(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
	_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
btn_rev.onRelease = function() {
	clearInterval(timeInterval);
	this._parent.timeDisplay_txt.text = "00:00";
	(song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;
	_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
playlist.load("playlist.xml")
Denedar ist offline   Mit Zitat antworten
Alt 17-01-2006, 13:09   #2 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Ich würde hier ansetzen:
ActionScript:
  1. this.sound_obj.onSoundComplete = function() {
  2.    this.play(0,1);
  3.    //usw.
  4. }
  Mit Zitat antworten
Alt 17-01-2006, 13:11   #3 (permalink)
Neuer User
 
Registriert seit: Jan 2006
Beiträge: 39
Hi!

Vielen Dank für deine Antwort, aber kannst du mir vielleicht sagen welchen Code ich wo einfügen muss? Ich kenn mich damit leider überhaupt nicht aus

Wäre lieb von dir!

Danke!
Denedar ist offline   Mit Zitat antworten
Alt 17-01-2006, 13:14   #4 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Der soundComplete steht doch in deinem Script... Wer lesen kann, ist klar im Vorteil

Davon mal ganz abgesehen: ohne Flash-Basiskenntnisse wirst du da kaum weiterkommen. Schau mal in die Flash-Hilfe und den Flash beiliegenden Samples...
  Mit Zitat antworten
Alt 17-01-2006, 13:18   #5 (permalink)
Neuer User
 
Registriert seit: Jan 2006
Beiträge: 39
muss ich da nur dieses this.play(0,1); darunter einfügen und alles andere lassen?

Ich weiss, in Flash kenn ich mich leider nicht aus, ich brauch nur einen Player für meine Webseite. Und der wäre genau das was ich mir Vorstelle nur halt das ich gerne hätte das der Loops spielt. Denn ich habe oft nur 3 sekunden sounds und wenn die nicht geloopt werden dann hört sich das ja doof an.

Naja, will euch nicht länger nerven. Ich schau mal ob ich das irgendwie hin bekomme.

Danke jedenfalls für die Hilfe!

LG, Denedar
Denedar ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 19:03 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele