Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Details on a Podcast Player

This is a discussion on Details on a Podcast Player within the FlepStudio users utilities forums, part of the Tutorials category; Alright, I've figured out Events, and the new way to handle buttons in AS3.0. So now I'm ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Tutorials > FlepStudio users utilities

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 13-12-07, 22:06
this.AS_newb();
 
Join Date: Nov 2007
Location: San Francisco, CA
Posts: 29
Rep Power: 0
theuprock is on a distinguished road
Send a message via AIM to theuprock
Details on a Podcast Player

Alright, I've figured out Events, and the new way to handle buttons in AS3.0. So now I'm on to the next step for this podcast player application, and once again here I am in need of some help. Before I go any further, you can DOWNLOAD the source .FLA and the currently exported .SWF from my server -- http://www.theuprock.com/archive/podcastFiles.zip

Because I'm personally a visual learner, I felt the need to make a visual diagram of the properties, in hopes that it would generate interest, and get some people on board willing to help me figure this out. So, here's your visual diagram!



HERE ARE THE SOURCE .FLA and .SWF FILES: http://www.theuprock.com/archive/podcastFiles.zip
Here are the final goals for the project that I need some guidance in figuring out:

1. The "Dynamically Driven List And Built From XML". I've read some stuff and seen some examples on this one, but to be honest, I really want to get this figured out once and for all and build it myself, instead of just copying and pasting someone else's module into my file. How does this work? I am guessing something like this. I put a blank movie clip on the stage, define it's size parameter and instantiate it with an instance name, and then put a mask over it to fit into the window area of the application, right? So after that, I need to basically use the XML data to BUILD the list. This list will be ever-growing too as we release more and more podcasts. So for now we'll launch the podcast player with like four or five episodes, but as it grows, I want it to remain dynamic and be built in a way that lets it expand as more content is added. I played around with it a little, read some tutorials, read my Moock book some more, and still can't figure out how to generate new dynamic text fields for each title instance in my XML. I'm guessing I need to use a for{} loop first to determine the size of the list? Then after that, what do I need to do in order to actually BUILD the list with AS?

2. The "Scrollpane Component". This is the part that really baffles me. Logically, I understand how it should work, but as far as enacting it, and making it happen, I'm utterly confused. The part that's tripping up my logic of how this could work is controlling the masked area. I don't want the scroll speed to be super-fast as a result of the masked content box being triple the size of the scrollbar itself.

3. The "Download Currently Playing .MP3". This is probably the easiest part of my question. I want the user to be able to click the arrow, and it will download the currently playing .MP3 onto their computer. Simple as that, but I'm not sure how to broadcast the currently playing .MP3's URL to Flash, so that it always knows which episode is playing.

4. The "getBytesLoaded(); ???". I am still unsure of how to do a timeclock with colons like that with Flash math. Can someone point me in the right direction, or give me the right search terms to be Googling to learn more about this?

5. The "Playhead" Stuff. Last but not least, I think this part I've pretty much got figured out, but I'm having issues figuring out how to make the orange tic draggable in accordance with the loaded .MP3's timeline.

I know that's a LOT to ask, but I also know you guys are really accommodating around here when it comes to giving out tips and pointing people in the right direction. I don't expect anyone to solve all these issues for me, but any assistance you can give would be highly appreciated. Thanks in advance, and I hope to hear from you guys soon.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 14-12-07, 10:42
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,489
Rep Power: 6
Flep is on a distinguished road
Re: Details on a Podcast Player

Hi there

I' ve code the first step.
I created an XML file like this one:
HTML Code:
<?xml version="1.0" encoding="UTF-8"?>
<tracks>
	<track artist="Dire Straits" album="Making Movies" title="Southbound Again" link="http://www.flepstudio.org/music/dire_straits/12 - Southbound Again.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Solid Rock" link="http://www.flepstudio.org/music/dire_straits/06 - Solid Rock.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Tunnel of Love" link="http://www.flepstudio.org/music/dire_straits/01 - Tunnel of Love.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Romeo and Juliet" link="http://www.flepstudio.org/music/dire_straits/02 - Romeo and Juliet.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Skateaway" link="http://www.flepstudio.org/music/dire_straits/03 - Skateaway.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Expresso Love" link="http://www.flepstudio.org/music/dire_straits/04 - Expresso Love.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Hand in Hand" link="http://www.flepstudio.org/music/dire_straits/05 - Hand in Hand.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Les Boys" link="http://www.flepstudio.org/music/dire_straits/07 - Les Boys.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Thunderstruck" link="http://www.flepstudio.org/music/ac_dc/01 - Thunderstruck.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Shoot To Thrill" link="http://www.flepstudio.org/music/ac_dc/02 - Shoot To Thrill.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Back In Black" link="http://www.flepstudio.org/music/ac_dc/03 - Back In Black.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Sin City" link="http://www.flepstudio.org/music/ac_dc/04 - Sin City.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Who Made Who" link="http://www.flepstudio.org/music/ac_dc/05 - Who Made Who.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Heatseeker" link="http://www.flepstudio.org/music/ac_dc/06 - Heatseeker.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Fire Your Guns" link="http://www.flepstudio.org/music/ac_dc/07 - Fire Your Guns.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Jailbreak" link="http://www.flepstudio.org/music/ac_dc/08 - Jailbreak.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="The Jack" link="http://www.flepstudio.org/music/ac_dc/09 - The Jack.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="The Razors Edge" link="http://www.flepstudio.org/music/ac_dc/10 - The Razors Edge.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Dirty Deeds Done Dirt Cheap" link="http://www.flepstudio.org/music/ac_dc/11 - Dirty Deeds Done Dirt Cheap.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Money Talks" link="http://www.flepstudio.org/music/ac_dc/12 - Money Talks.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Hells Bells" link="http://www.flepstudio.org/music/ac_dc/13 - Hells Bells.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Are you Ready" link="http://www.flepstudio.org/music/ac_dc/14 - Are you Ready.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="That's the Way I want My Rock and Roll" link="http://www.flepstudio.org/music/ac_dc/15 - That's the Way I want My Rock and Roll.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="High Voltage" link="http://www.flepstudio.org/music/ac_dc/16 - High Voltage.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="You Shook Me All Night Long" link="http://www.flepstudio.org/music/ac_dc/17 - You Shook Me All Night Long.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Whole Lotta Rosie" link="http://www.flepstudio.org/music/ac_dc/18 - Whole Lotta Rosie.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Let There Be Rock" link="http://www.flepstudio.org/music/ac_dc/19 - Let There Be Rock.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Bonny" link="http://www.flepstudio.org/music/ac_dc/20 - Bonny.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="Highway to Hell" link="http://www.flepstudio.org/music/ac_dc/21 - Highway to Hell.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="T N T" link="http://www.flepstudio.org/music/ac_dc/22 - T_N_T_.mp3"></track>
	<track artist="ac/dc" album="Live Collector's Edition" title="For Those About to Rock" link="http://www.flepstudio.org/music/ac_dc/23 - For Those About to Rock.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Down to the Waterline" link="http://www.flepstudio.org/music/dire_straits/08 - Down to the Waterline.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Water of Love" link="http://www.flepstudio.org/music/dire_straits/08 - 09 - Water of Love.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Setting Me Up" link="http://www.flepstudio.org/music/dire_straits/10 - Setting Me Up.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Six Blade Knife" link="http://www.flepstudio.org/music/dire_straits/11 - Six Blade Knife.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Sultans of Swing" link="http://www.flepstudio.org/music/dire_straits/13 - Sultans of Swing.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="In the Gallery" link="http://www.flepstudio.org/music/dire_straits/14 - In the Gallery.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Wild West End" link="http://www.flepstudio.org/music/dire_straits/15 - Wild West End.mp3"></track>
	<track artist="Dire Straits" album="Making Movies" title="Lions" link="http://www.flepstudio.org/music/dire_straits/16 - Lions.mp3"></track>
</tracks>
As you see, the XML file has 4 attributes:
- track
- album
- title
- link

Actionscript side:
I did the parse of the XML so I created an object for each track using a loop.
For each iteration loop I create an Object and I assign to its 4 properties the 4 values of each XML attribute ( artist, album, title and link ):
Code:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
 
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
 
xmlLoader.load(new URLRequest("tracks.xml"));
 
function LoadXML(e:Event):void
{
	var xmlData:XML=new XML(e.target.data);
	var myXML:XMLDocument=new XMLDocument();
	myXML.ignoreWhite=true;
	myXML.parseXML(xmlData.toXMLString());
	var node:XMLNode=myXML.firstChild;
	var n_tracks:int=int(node.childNodes.length);
	for(var i:int=0;i<n_tracks;i++)
	{
		var obj:Object=new Object();
		obj.artist=(node.childNodes[i].attributes['artist']);
		obj.album=(node.childNodes[i].attributes['album']);
		obj.title=(node.childNodes[i].attributes['title']);
		obj.link=(node.childNodes[i].attributes['link']);
		tracks_array.push(obj);
	}
	// call the function startMusic that will play the track of the Array index with value of the variable id
	startMusic();
}
Ok, when it finishes to push datas into array, i call the playMusic function that will play the music.

Next steps will be managing the songs, stop, play, pause etc etc

You can get the new files here:
http://www.flepstudio.org/sharing/podcastFiles_1.zip

Last edited by Flep; 14-12-07 at 22:47..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 14-12-07, 17:11
this.AS_newb();
 
Join Date: Nov 2007
Location: San Francisco, CA
Posts: 29
Rep Power: 0
theuprock is on a distinguished road
Send a message via AIM to theuprock
Re: Details on a Podcast Player

I got a 404 on that link you posted, but everything is great. I'll go ahead and give that a shot in a few moments. Just got into work this morning, so I'll need a little while before I can start testing what you've posted.

Thanks SO much. You're a saviour!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 14-12-07, 22:47
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,489
Rep Power: 6
Flep is on a distinguished road
Re: Details on a Podcast Player

ops... sorry... forgot the zip extension. Try now
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 17-12-07, 21:08
this.AS_newb();
 
Join Date: Nov 2007
Location: San Francisco, CA
Posts: 29
Rep Power: 0
theuprock is on a distinguished road
Send a message via AIM to theuprock
Re: Details on a Podcast Player

Ok, Flep. I've taken a look at what you did there, and now I've learned how to correctly parse and process the XML list. I even made a smaller version on my own, just to get it stuck in my head how to do that.

Now I'm wondering how do I get the list to "build out" on the stage, as describe up above? How do I get Flash to create a new text MC on the stage for each song, and then build them into a a list inside of the scrollbar area?

I appreciate you helping me thus far!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Flash Multi Gallery
  #6 (permalink)  
Old 18-12-07, 19:54
this.AS_newb();
 
Join Date: Nov 2007
Location: San Francisco, CA
Posts: 29
Rep Power: 0
theuprock is on a distinguished road
Send a message via AIM to theuprock
Re: Details on a Podcast Player

Here's the updated source files. I went through, deconstructed what you did to figure out how everything worked, and then with that knowledge in-hand, I re-formatted how I want the output to look eventually in the masked, scrollable area.

When you get a chance, do you think you could give me some help getting through the next part, which would be having the AS code build the source array text into actual text fields on the stage, inside that black scrollable area (the top-left arrow in the original diagram)? Thanks a ton so far. Really helping me to beef up my AS3.0 and make the jump into the new platform.

HERE IS THE SOURCE FILES -- podcastUpdated.zip
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #7 (permalink)  
Old 19-12-07, 08:10
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,489
Rep Power: 6
Flep is on a distinguished road
Re: Details on a Podcast Player

Hi theuprock

I will do it in a few days.... as soon as possible.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #8 (permalink)  
Old 19-12-07, 16:43
this.AS_newb();
 
Join Date: Nov 2007
Location: San Francisco, CA
Posts: 29
Rep Power: 0
theuprock is on a distinguished road
Send a message via AIM to theuprock
Re: Details on a Podcast Player

Sweet. Thank you so much.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #9 (permalink)  
Old 24-12-07, 19:42
this.AS_newb();
 
Join Date: Nov 2007
Location: San Francisco, CA
Posts: 29
Rep Power: 0
theuprock is on a distinguished road
Send a message via AIM to theuprock
Re: Details on a Podcast Player

Took another shot at this on my own, but ran into the same errors. It's the holiday season, so everyone's busy, but let me know if you can give me another one-on-one after the holidays, if you have some time.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
PlayMe - mp3 player Flep Componenti di FlepStudio 16 20-11-08 09:27
PlayMe mp3 player Flep FlepStudio components 19 13-11-08 19:50
[AS2]player mp3 in AS2 dla86 Flash CS3 generale 3 01-08-08 09:17
Flash CS3 Player per webradio lu91 Flash CS3 generale 2 19-06-08 08:06
Web flv player bastek89 FlepStudio users utilities 3 04-05-08 10:46


All times are GMT. The time now is 19:36.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406