Jump to content


Photo

my 1st mp3 player


  • Please log in to reply
73 replies to this topic

#1 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 15 July 2005 - 11:43 AM

Hey all. I just finished my 1st mp3 player, with the help of this kick A site.

So far I'm liking what I have done. But there's 1 problem. I was wondering if it's possible to have the dynamic text field to put the bands name on the top line, then the song on a 2nd line?
I used the tutorial here
Also..the songs start on page load. But only 1 plays at a time. So I need to keep going back and start the next one.

Here's the code from the tutorial
stop();
playlist= new XML();
playlist.ignoreWhite=true;
playlist.onload = function (success) {
if(success) {
_global.songname = [];
_global.songfile = [];
for (var i=0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname = playlist.firstChild.childNodes[i].attributes.name;
_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
trace(songname[i]+" "+songfile[i]); }
_root.createEmptyMovieClip("sound_mc",1);
_root.sound_mc.sound_obj = new Sound();
_global.song_nr = random(songfile.length); _root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]); 
} else {display_txt.text="Error Loading XML"}
}

MovieClip.prototype.songStarter = function (file, name) {
this.sound_obj.loadSound(file,true)
this.onEnterFrame = function () {
if(this.sound_obj.position>0) {
delete this.onEnterFrame;
this._parent.display_txt.text=name; 
} else {
this._parent.display_txt.text="loading..." 
}
}
this.sound_obj.onSoundComplete = function () (song_nr==songfiles.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
}

btn_play.onRelease = function () {
this._parent.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
btn_stop.onRelease = function() {
this._parent.sound_mc.sound_obj.stop(); 
}
btn_next.onRelease = function () {
(song_nr==songfile.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
btn_prev.onRelease = function () {
(song_nr==0)? _global.song_nr=songfile.length-1 : _global.song_nr--;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}

playlist.load("playlist.xml");

Can someone please clarify if this code should do what I want, or do I need to change it?

Sorry for such a long question...but I hope I'm clear on what I need fixed.

Thanks.. Hooch

Edited by Hooch, 15 July 2005 - 12:15 PM.


#2 Donna

Donna

    Retired P2L Queen!

  • P2L Staff
  • PipPipPipPip
  • 12,330 posts
  • Gender:Female
  • Location:B.C Canada

Posted 15 July 2005 - 11:50 AM

Hey Hooch, you know thats illegal lol I'm sure you know.

#3 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 15 July 2005 - 11:59 AM

what's illegal?
Playing that music?

Edited by Hooch, 15 July 2005 - 12:01 PM.


#4 Donna

Donna

    Retired P2L Queen!

  • P2L Staff
  • PipPipPipPip
  • 12,330 posts
  • Gender:Female
  • Location:B.C Canada

Posted 15 July 2005 - 12:00 PM

what's illeagle?
Playing that music?

Yes

#5 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 15 July 2005 - 12:02 PM

ok..gotcha.
I thought it was ok, if I paid for the music. SO it's broadcasting music that's copyrighted. That's the ilegal part?

#6 Donna

Donna

    Retired P2L Queen!

  • P2L Staff
  • PipPipPipPip
  • 12,330 posts
  • Gender:Female
  • Location:B.C Canada

Posted 15 July 2005 - 12:14 PM

Playing copyrighted music to the public without a licence, no permission to play and distribute live.

Go here: http://www.riaa.com/ btw fines are huge upto $250,000

#7 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 15 July 2005 - 12:16 PM

ok, Thanks Donna.
I have removed the link to my page.

But I would still love some help if anyone could try.
Thanks.. Hooch

#8 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 15 July 2005 - 07:12 PM

btw.. I'm writing part 2 of the mp3 player tutorial.. :)

I've marked the lines I've changed with "//<---NEW".
Short explanation:

I've created a new global variable that holds the band name
And passed it as the other variables.

and your error was just a typo, you typed songfiles instead of songfile. <3

Don't forget to update also your XML file.. :D

EDITED CODE:
stop();
playlist= new XML();
playlist.ignoreWhite=true;
playlist.onload = function (success) {
if(success) {
_global.songname = [];
_global.songband = []; //<---NEW
_global.songfile = [];
for (var i=0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname = playlist.firstChild.childNodes[i].attributes.name;
_global.songband = playlist.firstChild.childNodes[i].attributes.band; //<---NEW
_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
trace(songname[i]+" "+songfile[i]+" "+songband[i]); } //<---NEW
_root.createEmptyMovieClip("sound_mc",1);
_root.sound_mc.sound_obj = new Sound();
_global.song_nr = random(songfile.length); _root.sound_mc.songStarter(songfile[song_nr],songname[song_nr],songband[song_nr]);  //<---NEW
} else {display_txt.text="Error Loading XML"}
}

MovieClip.prototype.songStarter = function (file, name, band) { //<---NEW
this.sound_obj.loadSound(file,true)
this.onEnterFrame = function () {
if(this.sound_obj.position>0) {
delete this.onEnterFrame;
this._parent.display_txt.text=band+" -- "+name;  //<---NEW
} else {
this._parent.display_txt.text="loading..." 
}
}
this.sound_obj.onSoundComplete = function () (song_nr==songfile.length-1)? _global.song_nr=0 : _global.song_nr++;//typo error songfileS instead of songfile
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr],songband[song_nr]); //<---NEW
}
}

btn_play.onRelease = function () {
this._parent.sound_mc.songStarter(songfile[song_nr],songname[song_nr],songband[song_nr]); //<---NEW
}
btn_stop.onRelease = function() {
this._parent.sound_mc.sound_obj.stop(); 
}
btn_next.onRelease = function () {
(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]); //<---NEW
}
btn_prev.onRelease = function () {
(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]); //<---NEW
}

playlist.load("playlist.xml");


#9 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 16 July 2005 - 09:28 PM

Hey man...I'll be looking forward to part 2.
I just cut and pasted your action script. It's a no go.
It's not even loading anything.

Here's the errors for your own info.
**Error** Scene=Scene 1, layer=Actionscript, frame=1:Line 28: '{' expected
     this.sound_obj.onSoundComplete = function () (song_nr==songfiles.length-1)? _global.song_nr=0 : _global.song_nr++;

**Error** Scene=Scene 1, layer=controls, frame=1:Line 1: Statement block must be terminated by '}'
     btn_play.onRelease = function () {

**Error** Scene=Scene 1, layer=controls, frame=1:Line 2: Operator '=' must be followed by an operand
     this._parent.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);

**Error** Scene=Scene 1, layer=controls, frame=1:Line 1: Statement must appear within on handler
     btn_play.onRelease = function () {

**Error** Scene=Scene 1, layer=controls, frame=1:Line 1: Statement must appear within on handler
     btn_stop.onRelease = function() {

**Error** Scene=Scene 1, layer=controls, frame=1:Line 1: Statement must appear within on handler
     btn_prev.onRelease = function () {

**Error** Scene=Scene 1, layer=controls, frame=1:Line 1: Statement must appear within on handler
     btn_next.onRelease = function () {

Total ActionScript Errors: 7   Reported Errors: 7

Laterz

Edited by Hooch, 16 July 2005 - 09:28 PM.


#10 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 16 July 2005 - 09:35 PM

oh, btw I assume the .xml should look like this?

<song name="blah" band="blahX2" file="music/01.mp3" />
The red is what I added.

Thanks man!! That's one awsome tut!!

#11 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 17 July 2005 - 02:49 PM

yeh, that xml is correct

Here the new code I've written for you:

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);
                _root.sound_mc.sound_obj = new Sound();
                _global.song_nr = random(songfile.length); 
                _root.sound_mc.songStarter(songfile[song_nr],songname[song_nr],songband[song_nr]); 
}

MovieClip.prototype.songStarter = function (file, name, band) {
        this.sound_obj.loadSound(file,true)
        this.onEnterFrame = function () {
                if(this.sound_obj.position>0) {
                        delete this.onEnterFrame; 
                        this._parent.display_txt.text=name+"--"+band; 
                } else {
                        this._parent.display_txt.text="loading..." 
                }
        }
        this.sound_obj.onSoundComplete = function () {
                (song_nr==songfiles.length-1)? _global.song_nr=0 : _global.song_nr++;
                _root.sound_mc.songStarter(songfiles[song_nr],songname[song_nr],songband[song_nr]);
        }
}

btn_play.onRelease = function () {
        this._parent.sound_mc.songStarter(songfile[song_nr],songname[song_nr],songband[song_nr]);
}
btn_stop.onRelease = function() {
        this._parent.sound_mc.sound_obj.stop(); 
}
btn_fw.onRelease = function () {
        (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 () {
        (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");

Tested a few times.. and it works.. just copy&paste

#12 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 17 July 2005 - 07:28 PM

Terrific, thank you.
Wow..that's a nice gesture funky. I'll be attempting the volume/fade sliders next.

Hopefully I'll be able to show it off soon. This time with legal music.. :blink:

#13 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 17 July 2005 - 08:13 PM

Well, the volume slider issue is at hand.
I have checked a few tuts out. But it's impossible to find one
that would work with an .xml file.
I found this tut Click Here But it's not what I want. Atleast I assume.
The page the link is on, that's where I think a little scipt change would fix things up. Or am I way off?

This is really fun to make, so I would love and really appreciate more help.
If anyone could show me a tut for a volume slider to work with this mp3 player, I'll say thanks in advance.

Laterz..Hooch

#14 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 18 July 2005 - 04:53 AM

Nope, that tutorial will not help you..
You will soon get part II of the mp3 player tutorial..

#15 dEcade

dEcade

    P2L Staff

  • P2L Staff
  • PipPipPipPip
  • 1,850 posts
  • Gender:Male
  • Location:Saskatoon, Saskatchewan
  • Interests:Guitar, Programming, Storm Chasing, Games (Designing and playing), Hockey, Photography

Posted 18 July 2005 - 09:51 AM

He can play the music if he has permission from the band. other wise it is illegal.

dEcade

#16 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 18 July 2005 - 02:12 PM

Part II is arriving very soon! ;)

#17 Ninja

Ninja

    Young Padawan

  • Members
  • Pip
  • 11 posts
  • Location:California
  • Interests:Video Editing | Photo manipulation/enhancement | Audio Editing | TomorrowFX | Website Design | Acting | Teching | Theatre | Drama | Photoshop | NINJA! | Making movies

Posted 18 July 2005 - 02:50 PM

If he payed for the music than its perfectly legal. Even to play it to the public. What is illegal is for the public to take the song from him. If they do that, its not his fault its the publics for commiting the illegal act. He payed for the song with his own money.

It's like sharing your Ipod with your friend and letting him listen to your music. Your friend didnt pay for it but you did. It's not illegal. Similar case with this.

#18 Jaymz

Jaymz

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 4,104 posts

Posted 18 July 2005 - 02:55 PM

If he payed for the music than its perfectly legal. Even to play it to the public. What is illegal is for the public to take the song from him. If they do that, its not his fault its the publics for commiting the illegal act. He payed for the song with his own money.

It's like sharing your Ipod with your friend and letting him listen to your music. Your friend didnt pay for it but you did. It's not illegal. Similar case with this.

No. You cannot broadcast music to the public without a license, per the RIAA regulations. You buy the music with a license for personal use only.

#19 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 18 July 2005 - 03:52 PM

I work in the broadcast business, and I know that even when you buy a license for any song, you are not allowed to broadcast it via the internet, tv or radio.. depending on the contract. BUT.. there are tracks that are allowed to be streamed, but not downloaded.

there are just a few things you can do.
- create your own music
- buy a license from some royalty free music makers. (broadcast licensed)
- know someone who makes music, and make a deal with him ;)

edit: one of the best places to get royalty free music for an affordable price is
http://www.partnersinrhyme.com/ they allow you even to broadcast your music everywhere.

Edited by funkysoul, 18 July 2005 - 03:54 PM.


#20 Hooch

Hooch

    Young Padawan

  • Members
  • Pip
  • 158 posts
  • Location:Brockville, Ontario

Posted 18 July 2005 - 07:47 PM

Part II is arriving very soon! :D

Yee haa!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users