-
1. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
kglad May 3, 2010 5:37 PM (in response to Me2LoveIt2)use the id3 event to determine when id3 data are available and then parse your sound's id3 property.
-
2. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
Me2LoveIt2 May 3, 2010 6:16 PM (in response to kglad)Hey Kglad
Thank you for the answer, but it didn't help me at all.
Do you mean something like this? : http://www.socialvitamin.com/2009/04/03/reading-id3-tags-with-as3/
If so I tried it but failed. I tried so many things that I am really confused.
I need more detail please, and don't hesitate to ask if more detail from me are needed.
Thank you for trying to help me.
-
3. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
kglad May 3, 2010 7:23 PM (in response to Me2LoveIt2)yes, exactly.
now, show the code you're using and your policy file.
-
4. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
Me2LoveIt2 May 4, 2010 8:08 AM (in response to kglad)Here is my code:
var music:Sound = new Sound(new URLRequest("URL #1 (from my server)")); var sc:SoundChannel;//sound channel var isPlaying:Boolean = false;//checks f music is playing or not var pausePoint:Number = 0.00;//this variable is for the pause function stop_btn.addEventListener(MouseEvent.CLICK, stopMusic);//stop function call function stopMusic(e:Event):void//stop function { if(sc != null)//if music is playing { sc.stop();//stops the music from playing isPlaying = false;//sets it to false(off) playPause_mc.gotoAndStop(1);//modifies graphic item on stage } pausePoint = 0.00;//resets pause value } play_btn.addEventListener(MouseEvent.CLICK, playMusic);//pause / play function call function playMusic(e:Event):void//pause / play function { if (isPlaying) {// if it is playing pausePoint = sc.position;pausePoint get curreny value (position of song) sc.stop();//stops the music from playing isPlaying = false;//sets it to false(off) playPause_mc.gotoAndStop(1);//modifies graphic item on stage } else if (!isPlaying){// if it is not playing sc = music.play(pausePoint);//starts the music from the pausePoint value. isPlaying = true;//sets it to true(on) playPause_mc.gotoAndStop(2);//modifies graphic item on stage } } music2_btn.addEventListener(MouseEvent.CLICK, music2);//function call (if music is clicked) function music2(e:Event):void{//this function stops current playing music and resets graphics, assigns a new URL and starts playing it. if(isPlaying || pausePoint != 0) sc.stop(); playPause_mc.gotoAndStop(1); music = new Sound(new URLRequest("URL #2 (from my server)")); sc = music.play(); isPlaying = true; playPause_mc.gotoAndStop(2); } music1_btn.addEventListener(MouseEvent.CLICK, music1); function music1(e:Event):void{//this function stops current playing music and resets graphics, assigns a new URL and starts playing it. just like above only a different song. if(isPlaying || pausePoint != 0) sc.stop(); playPause_mc.gotoAndStop(1); music = new Sound(new URLRequest("URL #1 (from my server)")); sc = music.play(); isPlaying = true; playPause_mc.gotoAndStop(2); }It is a little player.With a Play/Pause and Stop function.and 2 song's to choose from.I do not have a policy file. What exactly is a policy file? do I need one?Thank you so much for your help! -
5. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
kglad May 4, 2010 8:35 AM (in response to Me2LoveIt2)you don't need a policy file if your loading mp3s from the same server as the swf. but i don't see an id3 event listener/handler.
-
6. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
Me2LoveIt2 May 4, 2010 9:24 AM (in response to kglad)I know I took it out because it didn't work. I had something like this: var soundLoaderContext:SoundLoaderContext = new SoundLoaderContext(); soundLoaderContext.checkPolicyFile = true; var music:Sound = new Sound(new URLRequest("URL #1 (from my server)")); var sc:SoundChannel;//sound channel var isPlaying:Boolean = false;//checks f music is playing or not var pausePoint:Number = 0.00;//this variable is for the pause function music.addEventListener(Event.ID3, id3Handler); stop_btn.addEventListener(MouseEvent.CLICK, stopMusic);//stop function call function stopMusic(e:Event):void//stop function { if(sc != null)//if music is playing { sc.stop();//stops the music from playing isPlaying = false;//sets it to false(off) playPause_mc.gotoAndStop(1);//modifies graphic item on stage } pausePoint = 0.00;//resets pause value } play_btn.addEventListener(MouseEvent.CLICK, playMusic);//pause / play function call function playMusic(e:Event):void//pause / play function { if (isPlaying) {// if it is playing pausePoint = sc.position;pausePoint get curreny value (position of song) sc.stop();//stops the music from playing isPlaying = false;//sets it to false(off) playPause_mc.gotoAndStop(1);//modifies graphic item on stage } else if (!isPlaying){// if it is not playing sc = music.play(pausePoint);//starts the music from the pausePoint value. isPlaying = true;//sets it to true(on) playPause_mc.gotoAndStop(2);//modifies graphic item on stage } } music2_btn.addEventListener(MouseEvent.CLICK, music2);//function call (if music is clicked) function music2(e:Event):void{//this function stops current playing music and resets graphics, assigns a new URL and starts playing it. if(isPlaying || pausePoint != 0) sc.stop(); playPause_mc.gotoAndStop(1); music = new Sound(new URLRequest("URL #2 (from my server)")); music.addEventListener(Event.ID3, id3Handler); sc = music.play(); isPlaying = true; playPause_mc.gotoAndStop(2); } music1_btn.addEventListener(MouseEvent.CLICK, music1); function music1(e:Event):void{//this function stops current playing music and resets graphics, assigns a new URL and starts playing it. just like above only a different song. if(isPlaying || pausePoint != 0) sc.stop(); playPause_mc.gotoAndStop(1); music = new Sound(new URLRequest("URL #1 (from my server)")); music.addEventListener(Event.ID3, id3Handler); sc = music.play(); isPlaying = true; playPause_mc.gotoAndStop(2); } function id3Handler(evt:Event):void { var id3:ID3Info = evt.target.id3; trace(id3.artist + ' - ' + id3.songName); name_txt = id3.songName; album_txt = id3.album; artist_txt = id3.artist; }This is mostly just taking the exact code from the website I mentioned earlier.
When I run this it outputs the trace command 1 time and nothing more. Only the trace(trace(id3.artist + ' - ' + id3.songName);) gets triggered once.
No errors. No warning. Not working.
Thank you for helping me!
-
7. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
kglad May 4, 2010 9:46 AM (in response to Me2LoveIt2)save your current fla.
using that fla save with another name (eg, test.fla) and replace all your actionscript with the following (using appropriate mp3 names). retest:
var music:Sound = new Sound(new URLRequest("mp3whatever"));
music.addEventListener(Event.ID3, id3Handler);
music2_btn.addEventListener(MouseEvent.CLICK, music2);
function music2(e:Event):void {
music = new Sound(new URLRequest("mp32"));
music.addEventListener(Event.ID3, id3Handler);
}
music1_btn.addEventListener(MouseEvent.CLICK, music1);
function music1(e:Event):void {
music = new Sound(new URLRequest("mp31"));
music.addEventListener(Event.ID3, id3Handler);
}
function id3Handler(evt:Event):void {
var id3:ID3Info = evt.target.id3;
trace(id3.artist + ' - ' + id3.songName);
} -
8. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
Me2LoveIt2 May 4, 2010 4:41 PM (in response to kglad)Yes It works.
I get two trace outputs each time the selected song changes.
I cannot really tell the difference, between this and what i had in my project.
I went ahead and copied that function into my project and it works now.(event listener after every newly assigned URL, and the function at the bottom);
I would be interested to know what the difference was or the problem, but for all I know My Project works now! I can read the id3 tags just fine!
Thank you for helping me through this! If your interested I can post the working code.
-
9. Re: Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0
kglad May 4, 2010 6:12 PM (in response to Me2LoveIt2)you're welcome.
please mark this thread as answered, if you can.


