Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Location
    Stillwater, Minnesota
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ~ Coding Media Player ~

    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!



  • #2
    New Coder
    Join Date
    Feb 2007
    Location
    Austin
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Coding a Media Player

    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.
    Last edited by db2six9; 02-10-2007 at 12:36 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •