Groups | Blog | Home
all groups > macromedia flash flashcom > september 2006 >

macromedia flash flashcom : simple mp3 player



Kjup
9/15/2006 10:05:08 PM
Outside of the clunky media player component can someone give me guidance on
how to setup a custom player with these functions. A counter/timer would be
nice too but all I have is script for play and stop which looks like this:
client_nc = new NetConnection();
client_nc.connect("rtmp://"+_level0.rtmpserver+"/fooserver/");
play_btn.onPress = function() {
in_ns.close();
in_ns = new NetStream(client_nc);
Replay_video.attachVideo(in_ns);
in_ns.setBufferTime(5);
in_ns.play("audio.mp3");
};
stop_btn.onPress = function() {
in_ns.close();
};

I'm basically just looking to add some script to this to add a scubber and a
timmer/clock if possible. Many thanks for any help in advance!

Regards,
-Kjup

bbgirl
9/22/2006 12:00:00 AM
It looks like you are using code to play flash video (FLV), and not an MP3.
Make sure you are using the sound object to play mp3s.

Here are a couple good tutorials:
http://kennybellew.cowfly.com/tutorial/
http://www.lynda.com/info/books/flash8btb/sample.aspx

First steps to play an mp3 using actionscript (see the tuts for more details)

- Define an empty movie clip in actionscript
- Create the sound object variable
- Load the sound set it either to start streaming/playing right away (true),
or load completely without playing (false)
- Start the sound (using movieclips)

Play, pause/stop buttons
PLAY - use the start(); command. to start at beginning of mp3 you don't need
to set any value.
PAUSE - capture the POSITION of the mp3 to a variable when this button is
pressed. In your start button, you add the variable inside the brackets
start(). position is captured in milliseconds so you have to divide by 1000 to
get seconds.
STOP - use stop('name of sound'); , or stop(); or stopAllSounds();

Progress Bar:
Adobe LiveDocs

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?hr
ef=00001581.html
AddThis Social Bookmark Button