...

View Full Version : ~ Coding Media Player ~



Saint 2 Cal
01-25-2007, 04:17 PM
Thanks;

I'd like to know how to code a media player. I want to make the media player out of a custom image, and make it interactive. Please someone inform me how to do so...Might pay for extra good help!


;)

db2six9
02-10-2007, 01:32 AM
You will not be coding a media player as much as assigning actionscript to buttons. There are a few things you need to do before writing your script;
Create your media player with your play and stop buttons designated as "Buttons,"
Place your music file into your site folder
Import your music file into your library and name the file in your library *This is imaprative* Right click on the music file in your library and select "Linkage." Check the box next to "Export for actionscript" and click. OK

Place your player on the stage and name your buttons and the instances of those buttons. I have pasted an example of script below, this script will load the song from your library. In this example I have named my sound "house" (this is different from the actual song), I have named my song "JHouse" This is the name of the music file in my library. My buttons are named "Play" and "Stop"

house = new Sound(); //introduces your new sound//
house.attachSound("JHouse"); //attaches the song you have in your library//
house.start(0,9999); //starts your song when the page is loaded. If you
dont want to start the song on the page load simply
omit this line of script. The (0,9999); refers to the
delay the song will take before starting, in this case 0
seconds, and the number of times the song will loop, in
this case 9999 times. You can set this to any number
you like.//

Play.enabled = false, Play._alpha = 0;

Play.onRelease = function() {
house.start(0,9999), Play.enabled = false, Play._alpha = 0,

Stop.enabled = true, Stop._alpha = 100;
}
Stop.onRelease = function () {
house.stop(), Play.enabled = true, Play._alpha = 100, Stop.enabled = false, Stop._alpha = 0;
}


This script automattacly disables the play button so the viewer cannot click on it while the song is playing. If it were enabled and the viewer clicked on it the sont would start another loop of the song over the exhisiting, kinda like two players running the same song at once.

The stop button disables itself when clicked and enables the play button, then the play button disables itself when clicked and enables the stop button.
Good luck, post if you have any issues.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum