A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help with Flash MP3 player

  1. #1
    Junior Member
    Join Date
    Dec 2005
    Posts
    1

    Help with Flash MP3 player

    Help with Flash MP3 player

    I'm sure this is very simple but I'm retarded. I am brand new to flash and am having trouble using this cool flash mp3 player at:
    http://www.flashkit.com/movies/Sound...-561/index.php

    I wrote a song that I saved as “goodbye.mp3” and want to play it on a website using this player. I’m doing something wrong because when I view the HTML page with the player, I’m not getting any sound. When I test the swf file without the player it works.

    Here is what I did for the "TRACK1.swf" file

    It says to create usable SWF music files to create a new swf file with 3 keyframes.

    1st KeyFrame stop action, so I put this:
    ------------------------------------------------------------------------------------------
    // Stops the playhead at Frame 1.
    stop();


    2nd KeyFrame insert your music file, so I put this:
    ----------------(this is where I think I messed up)--------------------------------
    bg_sound.loadSound("goodbye.mp3", true);
    bg_sound.onID3 = function() {
    songinfo_txt.text = "(" + this.id3.artist + ") " + this.id3.album + " - " + this.id3.track + " - "
    + this.id3.songname;
    for (prop in this.id3) {
    trace(prop+" = "+this.id3[prop]);
    }
    trace("ID3 loaded.");
    };
    this.play_mc.onRelease = function() {
    /* get the current offset. if you stop all sounds and click the play button, the MP3 continues from
    where it was stopped, instead of restarting from the beginning. */
    var numSecondsOffset:Number = (bg_sound.position/1000);
    bg_sound.start(numSecondsOffset);
    };
    this.stop_mc.onRelease = function() {
    stopAllSounds();
    };

    -----------------------------------------------------------------------------------------------
    3rd KeyFrame to stop all sounds so I put this:
    stopAllSounds();

    OK, then I exported the file at “TRACK1.swf”
    Then my HTML file looks like this:

    <html>
    <head>
    </head>
    <body>
    <p>&nbsp;</p>
    <p>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="545" height="172">
    <param name="movie" value="player.swf">
    <param name="quality" value="high">
    <embed src="player.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="545" height="172"></embed></object>
    </p>
    </body>
    </html>


    I’ve uploaded everything correctly and had even tried using full file paths in the coding of the swf files and the html files but when I view it the song just the player looks great but there is no sound. How should the "TRACK1.swf" action script look? Please help!

  2. #2
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    i have no idea how to convert sound files into .swf files... but if you like, I can hook you up with a normal MP3 player that loads & streams actual MP3 files, has an XML playlist, a time display indicating length of track played/total track length, & volume control. I'm planning on adding ID3 tag support, but haven't gotten around to it yet. It works in Flash Player 6 and 7 and i think 8....

    Let me know if you're interested
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  3. #3
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    That player uses the Flash 5 method of importing an mp3 into flash and exporting the .swf. The way that mp3 player is set up, you would create a 3 frame movie. Stop actions on the first and third frame and the mp3 on the second frame. However, if your using FlashMX or higher, you have the ability to load mp3 files dynamically at runtime with the sound object. It is very easy to use......
    code:

    mySound=new Sound(this);
    mySound.loadSound("someFile.mp3",true);


    Here is a nice sound tutorial......

    http://www.kennybellew.com/tutorial/

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center