Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issue with Media Player

Status
Not open for further replies.

MrGNewport

Instructor
Jun 29, 2010
7
0
0
GB
I have created a media player but am encountering the folowing error: Error opening URL 'file:///C|/Program%20Files/xampp/htdocs/rro2/player/undefined'

I have used the following AS2.0:

Code:
strImage = "germany.png";
loadMovie(strImage,picture);

stop();
playlist = new XML();
playlist.ignoreWhite = true;
playlist.load("../history/germany/playlist.xml");
playlist.onLoad = function(success)
	{
	if (success)
		{
		_global.songtitle = [];
		_global.songtrack = [];
		_global.songfile = [];

		for (var i = 0; i<playlist.firstChild.childNodes.length; i++)
			{
			_global.songtitle[i] = playlist.firstChild.childNodes[i].attributes.name;
			_global.songtrack[i] = playlist.firstChild.childNodes[i].attributes.track;
			_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
			}
		}
		_root.createEmptyMovieClip("sound_mc", 1);
	};
	
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, song, track)
	{
	if (this.sound_obj)
		{
		this.sound_obj.stop();
		delete this.sound_obj;
		}
	
	this.sound_obj = new Sound(this);
	this.sound_obj.loadSound(file, true);
	
	this.onEnterFrame = function()
		{
		if (this.sound_obj.position>0)
			{
			delete this.onEnterFrame;
			this._parent.titleDisplay_txt.text = "'"+song+"'";
			this._parent.trackDisplay_txt.text = track;
			this._parent.timeDisplay_txt.text = "00:00";
			timeInterval = setInterval(timer, 1000, this.sound_obj);
			}
		else
			{
			this._parent.titleDisplay_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], songtitle[song_nr], songtrack[song_nr]);
		};
	};
	
play_btn.onRelease = function()
	{
	clearInterval(timeInterval);
	this._parent.timeDisplay_txt.text = "00:00";
	_root.playHead._x = 7;
	this._parent.sound_mc.songStarter(songfile[song_nr], songtitle[song_nr], songtrack[song_nr]);
	};
	
stop_btn.onRelease = function()
	{
	clearInterval(timeInterval);
	_root.playHead._x = 7;
	this._parent.timeDisplay_txt.text = "00:00";
	this._parent.titleDisplay_txt.text = "";
	this._parent.trackDisplay_txt.text = "";
	this._parent.sound_mc.sound_obj.stop();
	};

This loads this XML file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<songs>
<song name ="End of WWI and the Treaty of Versailles" track ="1" file="history/germany/01 End of WWI and the Treaty of Versailles.mp3" />
</songs>

I note the corrupted path but cannot see where it is deriving the full path from and therefore how to limit it to a relative path; which is what I was hoping for.

Any ideas anyone?
 
I have indeed.

The thing is that the image that this loads and the XML file are all loaded without issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top