|
-
June 23rd, 2009, 09:32 AM
#1
flash music player?
hello i have been given this school assignment to create a music player with flash.
I am loading the playlist with XML. and i have been given 3 WMA files.
My question: What is the best way to play these wma files? Convert them to another format?
And when i converted them to the "correct" format how do i know when its finished playing so i can play the next song? And how will i even load the song. Thanks!
-
June 23rd, 2009, 01:23 PM
#2
Re: flash music player?
Your best shot is to work with MP3s. There is already quite a support base for that and flash. While you're at it, check out some Flash + MP3 tutorials.
http://theflashblog.com/?p=228
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
June 24th, 2009, 06:31 AM
#3
Re: flash music player?
thanks alot.
i already made the music played, the next thing i need to do is make it play in random order and every song has to be played before it can be played again. i was thinking about making a shuffled array that contains the index of the song to be played.
Code:
var xmlPlaylist:XML;
var iCurrentSong:int;
var sCurrentSong:Sound;
var cCurrentSong:SoundChannel;
var txtSongTitle:TextField;
var urlLoader:URLLoader = new URLLoader(new URLRequest("jukebox.xml"));
urlLoader.addEventListener(Event.COMPLETE, function(e:Event):void
{
xmlPlaylist = new XML(e.target.data);
urlLoader = null;
iCurrentSong = 0;
txtSongTitle = new TextField();
stage.addChild(txtSongTitle);
txtSongTitle.autoSize = TextFieldAutoSize.LEFT;
PlayCurrentSong();
});
function PlayNextSong():void
{
++iCurrentSong;
if(iCurrentSong >= xmlPlaylist.SONG.length())
iCurrentSong = 0;
PlayCurrentSong();
}
function PlayPrevSong():void()
{
--iCurrentSong;
if(iCurrentSong < 0)
iCurrentSong = xmlPlaylist.SONG.length() - 1;
PlayCurrentSong();
}
function PlayCurrentSong():void
{
txtSongTitle.text = "<font color=\"white\">" + xmlPlaylist.SONG[iCurrentSong].@TITLE + "</color>";
sCurrentSong = new Sound(new URLRequest(xmlPlaylist.SONG[iCurrentSong].@FILE));
cCurrentSong = sCurrentSong.play();
cCurrentSong.addEventListener(Event.SOUND_COMPLETE, function(event:Event):void
{
PlayNextSong();
});
}
Last edited by wigga; June 24th, 2009 at 06:37 AM.
-
July 6th, 2011, 08:37 AM
#4
Re: flash music player?
 Originally Posted by PeejAvery
I consider that the best way is to use someone's tutorial. For sure it may seem that the easiest option is to use ready script which is done instead of you but it will not teach you anything.
-
July 11th, 2011, 07:48 AM
#5
Re: flash music player?
Every flash mp3 player has a shuffle function but that's shuffle only for users, every player has a particular algorithm like to play 1 then 11th then 21 and this way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|