Flash actionScript HJÆLP
Hej allesammen.Jeg har brug for hjælp til noget actionScript. Jeg har lavet en MP3 afspiller men kan ikk helt få den til at virke. Den kommer med fejlen:
Error opening URL "file:///F|/Tutorials/flash%20tuts/mp3player/undefined"
Når jeg launcher den, jeg har kodet mit actionScipt i SE | PY actionScript Editor.
Her er koden. Håber i kan se hvad der er galt.
//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));
}
playSong();
}
xml.load("songs.xml");
//Play mp3 filen
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);
}
playPause.gotoAndStop("pause");
}
// Pause musiken
function pauselt():Void
{
pos = s.position;
s.stop();
}
function unPauselt():Void
{
s.start(pos/1000);
}
// playPause knap
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");
}
playPause.onRelease = function()
{
if(this._currentframe == 10)
{
this.gotoAndStop("playOver");
this._parent.pauselt();
}
else
{
this.gotoAndStop("pauseOver");
this._parent.unPauselt();
}
}
// Next knap
next.onRollOver = function()
{
this.gotoAndStop("nextOver");
}
next.onRollOut = next.onReleaseOutside = function()
{
this.gotoAndStop("next");
}
next.onRelease = function()
{
this._parent.playSong();
}
//Mute knap
mute.onRollOver = function()
{
if(this._currentframe == 1) this.gotoAndStop("onOver");
else this.gotoAndStop("offOver");
}
mute.onRollOut = playPause.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);
}
}
