66 Responses to “ActionScript 3 XML MP3 Player 1.2”
jasun on
October 14th, 2008 8:25 am
So I downloaded this version, linked it directly to my .XML file and made all paths link correctly, and even this exact player has the same problem with ending each track early by about 1 second.
Very strange, now its driving me nuts. I can’t seem to figure out what the problem is, unless it has something to do with the actual audio files? Or maybe too many of them? My list includes about 36 files, and each one is no more than 30 seconds.
Very cool Jared. Have you taken a look at the new sound classes that will be available in CS4? For all of you doing sound visualization there will be some great stuff to make it a bit easier.
Try changing floor to ceil in the updateTimeDisplay function and let me know if this works.
Badscore on
October 16th, 2008 2:22 am
Hi there, I have loaded your player inside a MC, now I’ve got the message: TypeError: Error #1009 (Pointing to a non existing object) What I can do?
Do I have to change the all the routes in the Mp3Player.as??
I think it’s a document class. You need to call it in the properties of you document and it’s AS3.
Badscore on
October 16th, 2008 7:26 am
Yeah, I know that, in the properties of the movie mp3.swf there’s a statement calling the necessary AS. The problem is that now I’m loading that movie inside a clip in another movie:
var player = new Loader();
player.load(new URLRequest(“mp3_player/mp3.swf”));
my_mc.addChild(player);
in this case I created a “private function init(evt:Event):void {paste constructor here}”
good luck!
jasun on
October 17th, 2008 5:40 am
I finally got back to this and I tried like you said changing floor to ceil in the updateTimeDisplay function, and it didn’t seem to have any affect.
The problem still happens and it’s different per each track. Some of them cut off somewhere around 1 second, some cut only about a half second.
What could I do to force it to wait for the next track until the current track plays completely?
jasun, honestly i dont know. i tried changing from floor to ceil and it definitely did add at least one second to the end of each track. anyway flash 10 was just released a couple of days ago and its been having problems with latency… try clicking on stop or play and you’ll notice nearly a 1 second delay before the sound stops… i wouldnt expect too much accuracy from flash if i were you..!
jasun on
October 17th, 2008 4:32 pm
If you tried it and it worked, which line did you actually change it on from floor to ceil? I changed each instance where floor was in the actionscript. Perhaps if I just need to change only one line then I can try that.
If that isn’t going to work then yea, I’ll leave it be.
you need to change your publish settings to network only and make sure your xml file points to mp3’s within your own domain, and also in the document class, make sure the xml points to the complete path on your domain, i.e. http://www.simplistika.com/playlist.xml
if you can configure joomla this should be nothing! keep trying you’ll get it.
3) (*optional) you can tighten the security by setting the domain or leave as is if you player is going to be displayed on other sites too.
4) upload crossdomain.xml to the root level of the domain hosting the xml file.
that’s it! you shouldn’t need to worry about the access-network-only now. With the increased security in flash player 10 this may become the only work around.
thomas on
October 26th, 2008 5:32 pm
hi there,
how can i set volume to 50% when player starts?
i trieded to finde a volume function – but ???
That enables the html page to access our AS3 functions using Javascript, in this case, the loadTrack function, which requires 2 inputs, the track number, followed by the position, so loadTrack(0,0) means load first track at position 0, which is the beginning.
Then publish the flash project to generate a html file, and in your html file, change all the values for “allowScriptAccess” to “always”
mp3 refers to the id of the flash swf,
playSong was defined earlier in the .as file, can be named to anything you want,
and (0,0) follows the requirements for our loadTrack function.
watashi on
October 31st, 2008 3:55 am
anyone experienced with special characters in ID3 tags? I’ve problem with accent!
ex: Mustafà is displayed Mustaf
and also
It’s possible to use two different players in the same html page and have the spectrum works separately? Because mine works together when I played only one track.
try clicking on the text field and click on ‘embed fonts’ and try to include more glyph’s? Thats the only thing i can think of! and sorry I really don’t get why you want two players on one html page, what’s the point of that? i hope you’re not trying to be a party dj with this, there are better solutions.
Craig on
November 19th, 2008 4:26 pm
Hey Jared
I need your help here. I’m loading your player into another swf. I have a few URLrequests I’m loading and need to figure out how it pause the play when one of these buttons are clicked.
For example I have a function like this:
function cgVideoClick(event:MouseEvent):void{
navigateToURL(getCGVideo);
mp3_mc.stopTrack();
}
but it doesn’t seem to stop the player. Now I know this has to do with the differences with AS2 and AS3 which I’m having a hard time with.
could you help me?
delwyw on
December 18th, 2008 8:30 pm
Its a very nice player. However, I got a problem, when i test the player in flash, it works fine, but after i insert it into html, it doesn’t work. Don’t know why?
Dave on
December 19th, 2008 10:05 am
Bug: Make the first click the first song in the list. Should play the song.
jared on
December 19th, 2008 5:11 pm
dave, thanks but i wouldnt consider it a bug, its consistent for all tracks that when a track is selected, clicking on a list item is disabled.
1 question; everything is working great and it is playing my tracks with no issues.
However for some reason it won’t recognize my .mp3 track names. Is this a problem with my ID3 tags? Do I need to use a particular ID3 tag version. Any suggestions?
Thanks heaps!
Jacob on
January 21st, 2009 11:07 pm
Awesome job. Making an mp3 player myself, my biggest problem was:
once a song is paused it doesn’t make it to the next track because pausing it seems to change the length of the song.
So it never makes it to the end of the song.
if I trace the total length and the current position it stops a couple of milliseconds before the end. This only if the song has been paused. What did you do to fix this?
My guess is that it has to do with typing the currentPosition variable as a int or uint vs. a Number, but I am not sure.
Emma on
January 29th, 2009 6:50 am
Hi,
I’ve got the same problem as delwyw – the player works fine within Flash, but doesn’t load any songs when embedded in HTML! I’ve made sure that the links are correct on the playlist xml file and the /mp3 folder … any ideas?
Thanks!
Karloze on
January 31st, 2009 9:20 pm
Allo, I am looking for some helpful…welll, HELP =)
I have my own custom flash mp3 player that works off of XML as well. all of the .AS files and paths are correct, all the songs are correctly linked, and the .XML file is all spot on. Same problem as the others though, works fine in Flash, and flash player, even works fine straight from the FTP folder and webview, but when I actually try to put it in HTML, the player shows, but the scrolling text just says “UNDEFINED” and doesn’t play anything…even tried several different codes and still no dice, even tried another that pointed directly to the XML file and Mp3’s themselves.
Anyone got any clue what’s going on? I see so many other XML players on webpages, so what am I doing wrong?
Thanks
Cheers
I have been searching far and wide for an xml mp3 player this cool and well-made, so firstly thankyou!
Now, get ready for the noob question.
Im trying to add the player to a scene deep in my swf, and would be really grateful if you could explain how I go about doing this(I have tried importing the swf, but it doesnt work-im sure there is code that would need amending somewhere-e.g myswf.scene4.mp3player.swf???)
Here is the site: http://www.samueldixon.com
If you look in portfolio>artists, you will see my lame attempt at making an mp3 player! this is where yours will eventually go.
Ideally, I would like the player to sit in the artist’s timeline and automatically play different tracks (according to frame labels of different artists)-is this possible? or should I create an individual player for each artist.
As youll have been able to tell by now, I am very new to flash, so apologies for obvious questions etc.
Look forward to hearing back from you,
Many Thanks in advance,
Doodark x
Apollo on
February 21st, 2009 6:42 pm
Love The Player ……You Helped me understand a lot of things
about as3 and xml …but i’m having a problem I’ve made my own xml slideshow but i’m confused i need the slides to move automatically with the mp3 player i have the slideshow connected to the forward and back addventlisteners . but can you help me make the slideshow change with the mp3s thankyou for all your help and thanks for the player the best one i’ve seen yet..Thanks…apollo…
Apollo on
February 21st, 2009 8:08 pm
Hello….Apollo Here… i’ve solved my problem …thanks anyway…..peace…good work ….stay strong….
JSpot on
March 4th, 2009 10:49 pm
Thanks for the player man. I’ve been building my own mp3 player but decided to switch from AS2 to AS3. I’m still learning the new scripts and I’m having the same issue as Jonathan.
For some reason, the player won’t display the title from the ID3 tags in my mp3 files.
Also, I would like to change the sound spectrum from one long vertical line to say 6 or short horizontal lines like on the myspace music player.
Lastly, how do you display the total time.
I’ll definitely buy the pro player if I can get these 3 things accomplished.
Alex on
March 8th, 2009 2:04 pm
Fantastic player – best I’ve seen yet. I’m not quite up to reverse engineering it, and I’ve made an effort to change the appearance of the player to match the theme of my website, but if I change the slightest thing, the entire player stops working. Is this intentional, or is there a workaround?
JSpot on
March 9th, 2009 8:39 am
Alex, you can change the appearance of the player, but you have to make sure to keep the same instance names for all the buttons and MCs. One misspelled or missing instance could prevent the player from working.
What exactly are you trying to change?
tori on
March 12th, 2009 9:15 am
The player work fine but when you take other songs from different server with http link it plays fine but no mater what you do the spectrum wont work.! if the song is on my server then the spectrum work, look like a bug I think
Joe Andersen on
April 22nd, 2009 8:14 am
I down loaded the player and it works great, but when I try to put it in to another flash file it doesn’t. I’ve tried copying and pasting the frames and drag and drop. Thanks for your help.
jared on
April 23rd, 2009 4:02 am
you probably want to use a loader to load in the swf instead.
Joe Andersen on
April 23rd, 2009 7:33 am
Hi Jared, Thanks for your quick response! I used a loader and it worked great when testing on my PC but I can’t seem to get it to function on line. I up loaded the .com folder, simplistica folder, with the as files. I have the xml playlist and songs in the main directory. I don’t know what else to check. The player does appear on the web page but only as a graphic. Any ideas? Sorry to be a pain but I appreciate your help……. Joe
Hi, I have the player working with one song on one page, but how do I make it play a different song on a different page that is embedded in a different page later in the site? It’s not online yet, I’m just getting things together offline, but that first page works.
As many said above – when I change the file and folder names, of the MP3 files – nothing works anymore! How do you get this to work in other folders with different MP3 files?
Hey – I got the player to play a different song per page as I wanted, but I have another – probably very easy question for you Jared – or any of you Flash gurus on this program.
When the song gets to the end, it loops and starts playing again – which is I guess it’s way of going to the next song, even though I have loop turned off. How do I get it to finish that song and just totally STOP? Possibly reset back to the beginning ready to play again if that’s not too much to go into. Thanks
Thank you for the great player! But i have a Problem with loading the XML-File, i think. I import the player in my Main swf.
when i call the html from my server the first time, then nothing happens. i make a refresh and all is fine… the music play. when i clean the cache and repeat loading the site, then nothing happens again. can you help me please?
Headi on
May 18th, 2009 8:51 am
Okay, the problem is solved. It was a conflict with another xmlLoader
Ben on
May 18th, 2009 5:17 pm
Hi Jared,
Nice player.
I was digging the sound visualiser, but that has turned out to be my problem.
Depending on the file it sometimes kicks out:
Error: Error #2030: End of file was encountered.at flash.utils::ByteArray/readFloat()
I found this error from a few other people in the net forums, using the same script, but haven’t seen an answer.
Trouble is the error wipes out the Flash player and crashes CS4.
I was wondering if you have ran into this problem and whether you figured out the fix?
Thanks for putting up this player, first of all. I saw other people have gotten the same error I have been getting when I switch the XML url to the xml on my local computer. It will start playing my mp3s(with out titles) but when I hit the forward button it gives me this error.
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at com.simplistika::cMP3Player/fLoad()
at com.simplistika::cMP3Player/fOnClick()
If you could help me out with this I would be so appreciative. Thanks.
i believe this happens when the current mp3 has not completed loading, then trying to change tracks. you’ll have to add an event listener to listen out for ioerrorevent’s, i’ll fix this in the next update.
Hey Jared this does not seem to want to work for me.
Please help thanks
thomas on October 26th, 2008 6:36 pm
“”"thanks! that was fast!
vBar.vBarKnob.x = 50*((vBar.vBarBg.width)/100);
solves it
by the way: you used a non system font in the player
best regards and keep on going!
thomas”"”
Filemon on
June 26th, 2009 8:43 am
Hi,
I just downloaded the .mp3 player and started playing around with it and I have a couple of issues.
1- issue
I’m adding the .swf to to my main .fla file stage using actionsript 3.0 but as soon as I add it to stage the albums don’t show (I’m using the files that came with the download), any idea?
2- Issu
I’m unloading the .swf also using actionscript 3.0, the problem is that it keeps playing after being unloaded, I would like to be able to stop it as soon as I unload it, is this possible?
// this is the code
var myLoader:Loader = new Loader();
var mySwfLink:URLRequest = new URLRequest(“path.swf”);
myLoader.load(mySwfLink);
//to unload it
myLoader.unload();
Thanks
Filemon Salas on
June 30th, 2009 2:24 pm
Hi,
I just downloaded the .mp3 player (the PRO-version) and started playing around with it and I have a couple of issues.
1- Issue
I’m adding the .swf to to my main .fla file stage using actionsript 3.0 but as soon as I add it to stage the albums don’t show (I’m using the files that came with the download), any idea?
2- Issue
I’m unloading the .swf also using actionscript 3.0, the problem is that it keeps playing after being unloaded, I would like to be able to stop it as soon as I unload it, is this possible?
// this is the code
var myLoader:Loader = new Loader();
var mySwfLink:URLRequest = new URLRequest(”path.swf”);
myLoader.load(mySwfLink);
hai there…I just down loaded the player…The fla works perfectly…I satarted digging it with a sample website.but when i use it with the website fla., im getting an error…
Hi again Jared. I have the basic player and can’t get it to stop looping. I only have one song playing but it just loops eternally when the song reaches the end. I tried messing around in the XML file but nothing stops it.
My XML file is copied below. What do I need to change to stop it from automatically looping? I clicked the “Repeat Off” button as well… but that doesn’t have any effect. (of course it would never be that easy – lol) Is the XML file what I even need to be editing? Anyone else having this problem?
//—————————————————————————————————-
// class definition
//—————————————————————————————————-
public class cXMLApp extends Sprite
{
//—————————————————————————————————-
// member data
//—————————————————————————————————-
private var mURLLoader : URLLoader;
protected var mData : XML;
protected var mItems : uint;
protected var mState : String;
//—————————————————————————————————-
// constructor
//—————————————————————————————————-
public function
cXMLApp(
vFile : String
) : void
{
trace(this + ” ” + “cXMLApp.constructor”);
var urlRequest : URLRequest = new URLRequest(vFile);
mURLLoader = new URLLoader();
mURLLoader.load(urlRequest);
mURLLoader.addEventListener(Event.COMPLETE, fLoaded);
}
//—————————————————————————————————-
// fLoaded
//—————————————————————————————————-
private function
fLoaded(
e :Event
):void
{
trace(this + ” ” + “cXMLApp.fLoaded()”);
var vDoc : XMLDocument = new XMLDocument();
vDoc.ignoreWhite = true;
mData = XML(mURLLoader.data);
vDoc.parseXML(mData.toXMLString());
mItems = vDoc.firstChild.childNodes.length;
dispatchEvent(new Event(“XMLLoaded”));
}
//—————————————————————————————————-
} // class XMLHelper
//—————————————————————————————————-
} // package
Bob on
August 13th, 2009 8:37 am
Awesome MP3 player.
I was able to get it to work easily enough, but strange thing…
The artist and title do not appear in the txtDisplay control.
The MP3 attributes were added with WMP11.
Should I be using some other tool to tag my MP3’s?
thanks for saving me a lot of time… this is almost exactly was I was going to try to create from scratch.
Filemon on
August 13th, 2009 3:42 pm
Good luck getting help here!
Bob on
August 13th, 2009 11:36 pm
String(mData.mp3[vTrack].artist and String(mData.mp3[vTrack].title were returning nothing, I made a slight alteration.
I saw that someone didn’t want the set of mp3s to loop once they are all done playing. that shouldn’t be too hard.
In fOnComplete(), the call to fLoad() is unconditional.
This means that a song is going to be loaded and played no matter what. The following version will NOT replay the song list after the last song has completed.
private function fOnComplete(e : Event) : void
{
if (txtRepeat.text == “REPEAT ON”)
mChannel.stop();
fLoad(mTrack,0);
else
{
mTrack++;
mChannel.stop();
if (mTrack <= mItems – 1)
fLoad(mTrack,0);
}
}
Of course, a better solution would be to add a looping ON/OFF control and let user toggle the setting with a mouse click.
Ricky on
September 8th, 2009 9:53 am
How do you get this to play random songs
flower on
September 21st, 2009 2:19 am
Hi!! I love it! but I can´t set it to stop playing when it starts , can you help me please?
I´ve already uncommented the 3 lines but no success.
Hey what do i change the (package com.simplistika) to? Do I put my site name? Also what else do I need to change throughout the file? I would appreciate the help. By the way, cool player
jared on
October 13th, 2009 5:38 pm
no, com.simplistika simply refers to the folder in which the .as files are placed. All you have to change is your xml file and republish with CTRL + Enter.
I just forked over some cash for your AS3 XML MP3 Player PRO, don’t spend it all at once The clean code has been very helpfull for me, thanks man.
I was looking through the code and opened the spectrum class. I cannot quite wrap my head around the SoundMixer.computeSpectrum(mSpectrum) / mSpectrum.readFloat() statements.
this is what i get:
* fUpdate is called every frame en generates a ‘SoundMixer.computeSpectrum’ which is stored in ByteArray ‘mSpectrum’
* ‘mBMP.fillRect(mBMP.rect, 0×000000);’ <– draws a black rectangle to prevent spectrums overlapping.
* 'for (var i:int=0; i<mWidth; i++)
mBMP.setPixel32(i, 10 + mSpectrum.readFloat() * 20, 0xAAAAAAAA);' <– This for-loop draws a 'mWidth'-amount of pixels with a 1px horizontal increment and a (for me) mysterious Y position.
The part i don't understand is how the 'wave' pattern is generated. The Y-position of the setPixel32 is set by 'mSpectrum.readFloat() * 20'. I would expect this to give the same Y value for the entire for-loop (thus creating a horizontal line). Obviously it doesn't and the 'wave' pattern or spectrum is created. This means the 'mSpectrum.readFloat()' value changes during the for loop, doesn't it? Could you help me explain what exactly this readFloat does and how this results in the different Y positions within the same for-loop?
Hopefully my question is clear.
Thanks in advance for any answers.
greatings,
Tom from The Netherlands
navibd on
April 29th, 2010 6:05 am
thx. I have a simple question. how can i change to play from local host.I mean from hard drive?
jared on
May 8th, 2010 6:01 am
try installing something like WAMP to enable a localhost web server.www.wampserver.com/en/
Feel free to leave a comment... and oh, if you want a pic to show with your comment, go get a gravatar!
So I downloaded this version, linked it directly to my .XML file and made all paths link correctly, and even this exact player has the same problem with ending each track early by about 1 second.
Very strange, now its driving me nuts. I can’t seem to figure out what the problem is, unless it has something to do with the actual audio files? Or maybe too many of them? My list includes about 36 files, and each one is no more than 30 seconds.
Could it be that they are too short?
Very cool Jared. Have you taken a look at the new sound classes that will be available in CS4? For all of you doing sound visualization there will be some great stuff to make it a bit easier.
Thanks!
Quince
Try changing floor to ceil in the updateTimeDisplay function and let me know if this works.
Hi there, I have loaded your player inside a MC, now I’ve got the message: TypeError: Error #1009 (Pointing to a non existing object) What I can do?
Do I have to change the all the routes in the Mp3Player.as??
Like:
btnForward.addEventListener(MouseEvent.CLICK, nextTrack);
TO
mycontainer.btnForward.addEventListener(MouseEvent.CLICK, nextTrack);
Or this is not the problem??
I think it’s a document class. You need to call it in the properties of you document and it’s AS3.
Yeah, I know that, in the properties of the movie mp3.swf there’s a statement calling the necessary AS. The problem is that now I’m loading that movie inside a clip in another movie:
var player = new Loader();
player.load(new URLRequest(“mp3_player/mp3.swf”));
my_mc.addChild(player);
so now i wonder if the roots should change to:
my_mc.player.btnForward.addEventListener(MouseEvent.CLICK, nextTrack);
what you need to do is copy and paste everything in the constructor into a separate function, and add this line into the constructor.
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
in this case I created a “private function init(evt:Event):void {paste constructor here}”
good luck!
I finally got back to this and I tried like you said changing floor to ceil in the updateTimeDisplay function, and it didn’t seem to have any affect.
The problem still happens and it’s different per each track. Some of them cut off somewhere around 1 second, some cut only about a half second.
What could I do to force it to wait for the next track until the current track plays completely?
jasun, honestly i dont know. i tried changing from floor to ceil and it definitely did add at least one second to the end of each track. anyway flash 10 was just released a couple of days ago and its been having problems with latency… try clicking on stop or play and you’ll notice nearly a 1 second delay before the sound stops… i wouldnt expect too much accuracy from flash if i were you..!
If you tried it and it worked, which line did you actually change it on from floor to ceil? I changed each instance where floor was in the actionscript. Perhaps if I just need to change only one line then I can try that.
If that isn’t going to work then yea, I’ll leave it be.
how to put this player in a module in joomla …1.5
everything good but music don’t play because of the html code
any help
Thanks
you need to change your publish settings to network only and make sure your xml file points to mp3’s within your own domain, and also in the document class, make sure the xml points to the complete path on your domain, i.e. http://www.simplistika.com/playlist.xml
if you can configure joomla this should be nothing! keep trying you’ll get it.
jasun i only changed the updateTime function.
For Joomla you can always set a crossdomain policy file.
1) create a new xml file named crossdomain.xml
2) place the code below in the file.
http://www.yourdomain.com/crossdomain.xml
3) (*optional) you can tighten the security by setting the domain or leave as is if you player is going to be displayed on other sites too.
4) upload crossdomain.xml to the root level of the domain hosting the xml file.
that’s it! you shouldn’t need to worry about the access-network-only now. With the increased security in flash player 10 this may become the only work around.
hi there,
how can i set volume to 50% when player starts?
i trieded to finde a volume function – but ???
to turn “repeat on” onload i added in 197
addEventListener(“repeet”, toggleRepeat);
dispatchEvent(new Event(“repeet”));
but how can i set the volume???
thanks,
thomas
!! GREAT PLAYER !!
to change the volume find this line
vBar.vBarKnob.x = vBar.vBarBg.width;
and change the x position from there.
thanks! that was fast!
vBar.vBarKnob.x = 50*((vBar.vBarBg.width)/100);
solves it
by the way: you used a non system font in the player
best regards and keep on going!
thomas
Jared,
I like your MP3 player. It is done very nicely and I am excited to dig a little deeper.
This is built to work from xml based play lists. How hard would it be to get external files in an html page to be directed to play in it?
Forrest
In Mp3Player.as, import the external interface with
import flash.external.ExternalInterface;
add this into the init() function
ExternalInterface.addCallback(“playSong”, loadTrack);
That enables the html page to access our AS3 functions using Javascript, in this case, the loadTrack function, which requires 2 inputs, the track number, followed by the position, so loadTrack(0,0) means load first track at position 0, which is the beginning.
Then publish the flash project to generate a html file, and in your html file, change all the values for “allowScriptAccess” to “always”
Then just append this line inside the body.
<a href=”#” onClick=”mp3.playSong(0,0)”>Track 1</a>
mp3 refers to the id of the flash swf,
playSong was defined earlier in the .as file, can be named to anything you want,
and (0,0) follows the requirements for our loadTrack function.
anyone experienced with special characters in ID3 tags? I’ve problem with accent!
ex: Mustafà is displayed Mustaf
and also
It’s possible to use two different players in the same html page and have the spectrum works separately? Because mine works together when I played only one track.
Thanks a lot!
try clicking on the text field and click on ‘embed fonts’ and try to include more glyph’s? Thats the only thing i can think of! and sorry I really don’t get why you want two players on one html page, what’s the point of that? i hope you’re not trying to be a party dj with this, there are better solutions.
Hey Jared
I need your help here. I’m loading your player into another swf. I have a few URLrequests I’m loading and need to figure out how it pause the play when one of these buttons are clicked.
For example I have a function like this:
function cgVideoClick(event:MouseEvent):void{
navigateToURL(getCGVideo);
mp3_mc.stopTrack();
}
but it doesn’t seem to stop the player. Now I know this has to do with the differences with AS2 and AS3 which I’m having a hard time with.
could you help me?
Its a very nice player. However, I got a problem, when i test the player in flash, it works fine, but after i insert it into html, it doesn’t work. Don’t know why?
Bug: Make the first click the first song in the list. Should play the song.
dave, thanks but i wouldnt consider it a bug, its consistent for all tracks that when a track is selected, clicking on a list item is disabled.
Hi Jared,
Thanks 4 your awesome player.
1 question; everything is working great and it is playing my tracks with no issues.
However for some reason it won’t recognize my .mp3 track names. Is this a problem with my ID3 tags? Do I need to use a particular ID3 tag version. Any suggestions?
Thanks heaps!
Awesome job. Making an mp3 player myself, my biggest problem was:
once a song is paused it doesn’t make it to the next track because pausing it seems to change the length of the song.
So it never makes it to the end of the song.
if I trace the total length and the current position it stops a couple of milliseconds before the end. This only if the song has been paused. What did you do to fix this?
My guess is that it has to do with typing the currentPosition variable as a int or uint vs. a Number, but I am not sure.
Hi,
I’ve got the same problem as delwyw – the player works fine within Flash, but doesn’t load any songs when embedded in HTML! I’ve made sure that the links are correct on the playlist xml file and the /mp3 folder … any ideas?
Thanks!
Allo, I am looking for some helpful…welll, HELP =)
I have my own custom flash mp3 player that works off of XML as well. all of the .AS files and paths are correct, all the songs are correctly linked, and the .XML file is all spot on. Same problem as the others though, works fine in Flash, and flash player, even works fine straight from the FTP folder and webview, but when I actually try to put it in HTML, the player shows, but the scrolling text just says “UNDEFINED” and doesn’t play anything…even tried several different codes and still no dice, even tried another that pointed directly to the XML file and Mp3’s themselves.
Anyone got any clue what’s going on? I see so many other XML players on webpages, so what am I doing wrong?
Thanks
Cheers
try using a direct http link in your xml file to the mp3s, ie. http://www.yoursite.com/song.mp3
and in the super statement, point it directly to the http xml, ie. http://www.yoursite.com/playlist.xml
Jared
Hey Jared,
I have been searching far and wide for an xml mp3 player this cool and well-made, so firstly thankyou!
Now, get ready for the noob question.
Im trying to add the player to a scene deep in my swf, and would be really grateful if you could explain how I go about doing this(I have tried importing the swf, but it doesnt work-im sure there is code that would need amending somewhere-e.g myswf.scene4.mp3player.swf???)
Here is the site: http://www.samueldixon.com
If you look in portfolio>artists, you will see my lame attempt at making an mp3 player! this is where yours will eventually go.
Ideally, I would like the player to sit in the artist’s timeline and automatically play different tracks (according to frame labels of different artists)-is this possible? or should I create an individual player for each artist.
As youll have been able to tell by now, I am very new to flash, so apologies for obvious questions etc.
Look forward to hearing back from you,
Many Thanks in advance,
Doodark x
Love The Player ……You Helped me understand a lot of things
about as3 and xml …but i’m having a problem I’ve made my own xml slideshow but i’m confused i need the slides to move automatically with the mp3 player i have the slideshow connected to the forward and back addventlisteners . but can you help me make the slideshow change with the mp3s thankyou for all your help and thanks for the player the best one i’ve seen yet..Thanks…apollo…
Hello….Apollo Here… i’ve solved my problem …thanks anyway…..peace…good work ….stay strong….
Thanks for the player man. I’ve been building my own mp3 player but decided to switch from AS2 to AS3. I’m still learning the new scripts and I’m having the same issue as Jonathan.
For some reason, the player won’t display the title from the ID3 tags in my mp3 files.
Also, I would like to change the sound spectrum from one long vertical line to say 6 or short horizontal lines like on the myspace music player.
Lastly, how do you display the total time.
I’ll definitely buy the pro player if I can get these 3 things accomplished.
Fantastic player – best I’ve seen yet. I’m not quite up to reverse engineering it, and I’ve made an effort to change the appearance of the player to match the theme of my website, but if I change the slightest thing, the entire player stops working. Is this intentional, or is there a workaround?
Alex, you can change the appearance of the player, but you have to make sure to keep the same instance names for all the buttons and MCs. One misspelled or missing instance could prevent the player from working.
What exactly are you trying to change?
The player work fine but when you take other songs from different server with http link it plays fine but no mater what you do the spectrum wont work.! if the song is on my server then the spectrum work, look like a bug I think
I down loaded the player and it works great, but when I try to put it in to another flash file it doesn’t. I’ve tried copying and pasting the frames and drag and drop. Thanks for your help.
you probably want to use a loader to load in the swf instead.
Hi Jared, Thanks for your quick response! I used a loader and it worked great when testing on my PC but I can’t seem to get it to function on line. I up loaded the .com folder, simplistica folder, with the as files. I have the xml playlist and songs in the main directory. I don’t know what else to check. The player does appear on the web page but only as a graphic. Any ideas? Sorry to be a pain but I appreciate your help……. Joe
Hi, I have the player working with one song on one page, but how do I make it play a different song on a different page that is embedded in a different page later in the site? It’s not online yet, I’m just getting things together offline, but that first page works.
As many said above – when I change the file and folder names, of the MP3 files – nothing works anymore! How do you get this to work in other folders with different MP3 files?
Hey – I got the player to play a different song per page as I wanted, but I have another – probably very easy question for you Jared – or any of you Flash gurus on this program.
When the song gets to the end, it loops and starts playing again – which is I guess it’s way of going to the next song, even though I have loop turned off. How do I get it to finish that song and just totally STOP? Possibly reset back to the beginning ready to play again if that’s not too much to go into. Thanks
How do I set the volume to 50% instead of 100%
when it starts up (pro 1.1 version of the MP3 player with playlist)
check it out on the link above
Thanks
Lorenzo Giles
I finally go the player to work but now I can’t figure out why i cannot see the track names when the song is playing.
Any help would be great
Same here all i get for a track title is a – instead of the track title and its really fustrating.
Thank you for the great player! But i have a Problem with loading the XML-File, i think. I import the player in my Main swf.
when i call the html from my server the first time, then nothing happens. i make a refresh and all is fine… the music play. when i clean the cache and repeat loading the site, then nothing happens again. can you help me please?
Okay, the problem is solved. It was a conflict with another xmlLoader
Hi Jared,
Nice player.
I was digging the sound visualiser, but that has turned out to be my problem.
Depending on the file it sometimes kicks out:
Error: Error #2030: End of file was encountered.at flash.utils::ByteArray/readFloat()
I found this error from a few other people in the net forums, using the same script, but haven’t seen an answer.
Trouble is the error wipes out the Flash player and crashes CS4.
I was wondering if you have ran into this problem and whether you figured out the fix?
Thanks.
Thanks for putting up this player, first of all. I saw other people have gotten the same error I have been getting when I switch the XML url to the xml on my local computer. It will start playing my mp3s(with out titles) but when I hit the forward button it gives me this error.
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at com.simplistika::cMP3Player/fLoad()
at com.simplistika::cMP3Player/fOnClick()
If you could help me out with this I would be so appreciative. Thanks.
i believe this happens when the current mp3 has not completed loading, then trying to change tracks. you’ll have to add an event listener to listen out for ioerrorevent’s, i’ll fix this in the next update.
Hey Jared this does not seem to want to work for me.
Please help thanks
thomas on October 26th, 2008 6:36 pm
“”"thanks! that was fast!
vBar.vBarKnob.x = 50*((vBar.vBarBg.width)/100);
solves it
by the way: you used a non system font in the player
best regards and keep on going!
thomas”"”
Hi,
I just downloaded the .mp3 player and started playing around with it and I have a couple of issues.
1- issue
I’m adding the .swf to to my main .fla file stage using actionsript 3.0 but as soon as I add it to stage the albums don’t show (I’m using the files that came with the download), any idea?
2- Issu
I’m unloading the .swf also using actionscript 3.0, the problem is that it keeps playing after being unloaded, I would like to be able to stop it as soon as I unload it, is this possible?
// this is the code
var myLoader:Loader = new Loader();
var mySwfLink:URLRequest = new URLRequest(“path.swf”);
myLoader.load(mySwfLink);
//to unload it
myLoader.unload();
Thanks
Hi,
I just downloaded the .mp3 player (the PRO-version) and started playing around with it and I have a couple of issues.
1- Issue
I’m adding the .swf to to my main .fla file stage using actionsript 3.0 but as soon as I add it to stage the albums don’t show (I’m using the files that came with the download), any idea?
2- Issue
I’m unloading the .swf also using actionscript 3.0, the problem is that it keeps playing after being unloaded, I would like to be able to stop it as soon as I unload it, is this possible?
// this is the code
var myLoader:Loader = new Loader();
var mySwfLink:URLRequest = new URLRequest(”path.swf”);
myLoader.load(mySwfLink);
//to unload it
myLoader.unload();
Thanks
hai there…I just down loaded the player…The fla works perfectly…I satarted digging it with a sample website.but when i use it with the website fla., im getting an error…
1037: Packages cannot be nested.
Hi again Jared. I have the basic player and can’t get it to stop looping. I only have one song playing but it just loops eternally when the song reaches the end. I tried messing around in the XML file but nothing stops it.
My XML file is copied below. What do I need to change to stop it from automatically looping? I clicked the “Repeat Off” button as well… but that doesn’t have any effect. (of course it would never be that easy – lol) Is the XML file what I even need to be editing? Anyone else having this problem?
Thanks in advance
//—————————————————————————————————-
// cXMLApp.as
//—————————————————————————————————-
package com.hello_love
{
import flash.display.Sprite;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.xml.XMLDocument;
//—————————————————————————————————-
// class definition
//—————————————————————————————————-
public class cXMLApp extends Sprite
{
//—————————————————————————————————-
// member data
//—————————————————————————————————-
private var mURLLoader : URLLoader;
protected var mData : XML;
protected var mItems : uint;
protected var mState : String;
//—————————————————————————————————-
// constructor
//—————————————————————————————————-
public function
cXMLApp(
vFile : String
) : void
{
trace(this + ” ” + “cXMLApp.constructor”);
var urlRequest : URLRequest = new URLRequest(vFile);
mURLLoader = new URLLoader();
mURLLoader.load(urlRequest);
mURLLoader.addEventListener(Event.COMPLETE, fLoaded);
}
//—————————————————————————————————-
// fLoaded
//—————————————————————————————————-
private function
fLoaded(
e :Event
):void
{
trace(this + ” ” + “cXMLApp.fLoaded()”);
var vDoc : XMLDocument = new XMLDocument();
vDoc.ignoreWhite = true;
mData = XML(mURLLoader.data);
vDoc.parseXML(mData.toXMLString());
mItems = vDoc.firstChild.childNodes.length;
dispatchEvent(new Event(“XMLLoaded”));
}
//—————————————————————————————————-
} // class XMLHelper
//—————————————————————————————————-
} // package
Awesome MP3 player.
I was able to get it to work easily enough, but strange thing…
The artist and title do not appear in the txtDisplay control.
The MP3 attributes were added with WMP11.
Should I be using some other tool to tag my MP3’s?
thanks for saving me a lot of time… this is almost exactly was I was going to try to create from scratch.
Good luck getting help here!
String(mData.mp3[vTrack].artist and String(mData.mp3[vTrack].title were returning nothing, I made a slight alteration.
private function DispSongInfo (vTrack : int) {
txtDisplay.text = String(mData.mp3[vTrack].url);
}
In fStart, added call to the new function:
DispSongInfo(0) ;
Also, in fLoad:
DispSongInfo(vTrack) ;
I saw that someone didn’t want the set of mp3s to loop once they are all done playing. that shouldn’t be too hard.
In fOnComplete(), the call to fLoad() is unconditional.
This means that a song is going to be loaded and played no matter what. The following version will NOT replay the song list after the last song has completed.
private function fOnComplete(e : Event) : void
{
if (txtRepeat.text == “REPEAT ON”)
mChannel.stop();
fLoad(mTrack,0);
else
{
mTrack++;
mChannel.stop();
if (mTrack <= mItems – 1)
fLoad(mTrack,0);
}
}
Of course, a better solution would be to add a looping ON/OFF control and let user toggle the setting with a mouse click.
How do you get this to play random songs
Hi!! I love it! but I can´t set it to stop playing when it starts , can you help me please?
I´ve already uncommented the 3 lines but no success.
Thanks a lot!!!
In order to display the artist and songs names your xml file must look like this:
http://www.simplistika.com/files/as3mp3/playlistpro.xml
thanks for the mp3 player
thanks a lot mi amigo!
Hey what do i change the (package com.simplistika) to? Do I put my site name? Also what else do I need to change throughout the file? I would appreciate the help. By the way, cool player
no, com.simplistika simply refers to the folder in which the .as files are placed. All you have to change is your xml file and republish with CTRL + Enter.
Hi Jared,
I just forked over some cash for your AS3 XML MP3 Player PRO, don’t spend it all at once
The clean code has been very helpfull for me, thanks man.
I was looking through the code and opened the spectrum class. I cannot quite wrap my head around the SoundMixer.computeSpectrum(mSpectrum) / mSpectrum.readFloat() statements.
this is what i get:
* fUpdate is called every frame en generates a ‘SoundMixer.computeSpectrum’ which is stored in ByteArray ‘mSpectrum’
* ‘mBMP.fillRect(mBMP.rect, 0×000000);’ <– draws a black rectangle to prevent spectrums overlapping.
* 'for (var i:int=0; i<mWidth; i++)
mBMP.setPixel32(i, 10 + mSpectrum.readFloat() * 20, 0xAAAAAAAA);' <– This for-loop draws a 'mWidth'-amount of pixels with a 1px horizontal increment and a (for me) mysterious Y position.
The part i don't understand is how the 'wave' pattern is generated. The Y-position of the setPixel32 is set by 'mSpectrum.readFloat() * 20'. I would expect this to give the same Y value for the entire for-loop (thus creating a horizontal line). Obviously it doesn't and the 'wave' pattern or spectrum is created. This means the 'mSpectrum.readFloat()' value changes during the for loop, doesn't it? Could you help me explain what exactly this readFloat does and how this results in the different Y positions within the same for-loop?
Hopefully my question is clear.
Thanks in advance for any answers.
greatings,
Tom from The Netherlands
thx. I have a simple question. how can i change to play from local host.I mean from hard drive?
try installing something like WAMP to enable a localhost web server.www.wampserver.com/en/