A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Song duration/streaming help

  1. #1
    Junior Member
    Join Date
    Feb 2010

    Song duration/streaming help

    Hi, I am new to this site. I am working on a website where users can upload music to be rated by other users. I recently discovered a problem where the song duration doesn't appear correctly if the user's computer hasn't streamed that particular song before. It will play with the incorrect song duration displayed and then once the song has been loaded fully, the correct information appears and the song starts over. You can view the site here www.songfeedback.com and login with username 'tester' and password 'tester' so you dont have to register. I posted the functions that deal with the time display. I can post more if needed. Thanks! Chris

    This code just selects the song that will play (this code is only showing 1 out of the 15 songs on the list)
    Actionscript Code:
    //initiate sound
    var sound1 = new Sound();
    //select song
    _root.list1.onRelease = function(){
        playertitle = title1;
        playerartist = artist1;
        currentfile = filename1;
        artistcom = artistcom1;
        sound1.loadSound("uploads/"+filename1, true);
        sound1.onLoad = function(){
            sound1playing = true;
            durpos ();

    This all runs once a song has been selected:
    Actionscript Code:
    //song time
    function durpos () {
        cont1 = false;//these reset some buttons when a new song is selected
        cont2 = false;
        cont3 = false;
        cont4 = false;
        cont5 = false;
        cont6 = false;
        cont7 = false;
        cont8 = false;
        cont9 = false;
        cont10 = false;
        submitted = 0;
        _root.resetme = 1;
        commentz.currentfile = currentfile;//these two lines load the comments section for the song playing
        commentz.sendAndLoad("comment.php", commentz, "POST");
        //get the total time for the song
        soundpos = sound1.duration/1000;
        minutesTotal = Math.floor(soundpos / 60);
        secondsTotal = Math.floor(soundpos-minutesTotal*60);
        if (secondsTotal <= 9){
            totaltime = "/ " + minutesTotal + ":0" + secondsTotal;
            totaltime = "/ " + minutesTotal + ":" + secondsTotal;

    var doInterval;
    doInterval = setInterval(pos,100);
    function pos () {
        soundposition = sound1.position/1000;
        seconds = Math.floor((sound1.position/1000)%60);
        minutes = Math.floor((sound1.position/1000)/60);
        if (isNaN(seconds)){
            timegone = "0:00";
        else if (seconds <= 9){
            timegone = minutes + ":0" + seconds;
            timegone = minutes + ":" + seconds;
        //submittal permission
        halfway = soundpos/2;
        if (soundposition > halfway && _root.submitted == 0){
            _root.ratebutton._x= 501;
            _root.ratebutton._x = 600;

  2. #2
    Join Date
    Jan 2010

    Song duration/streaming help

    check for the duration property of your sound in its ... As for the other tips, the duration property only gets called in the durpos ...

    Sound Effects

  3. #3
    Join Date
    Apr 2001
    Akron OH, USA
    Elainey, if you are going to make posts here at FlashKit, make sure they are meaningful and a sincere attempt to answer the question. I've reviewed your posts and all of them have been incomplete sentences and do not answer any questions. If you make another post like this in the music and sound forum I will remove the post.
    aviarts.com - web development and flash development

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