A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: media player script

  1. #1
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79

    media player script

    the following script is working great, but can anyone tell me how i would amend the it, so that the mp3 doesn't start playing until it is fully loaded

    thanks

    imladris

    onClipEvent (load) {
    Sound = new Sound();
    Sound.LoadSound("iwd.mp3", true);
    Sound.start();

    }

    onClipEvent (enterFrame) {
    _root.dl4=Sound.getBytesLoaded()/1024;
    _root.dl5=Sound.getBytesTotal()/1024;
    Sound.onSoundComplete = function() {_root.gotoAndPlay("MENU");}

    }
    onClipEvent (enterFrame) {
    Sound.setVolume(_root.volume);
    Sound.setPan(_root.pan);

    }

  2. #2
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890

    onClipEvent (load) {
    Sound = new Sound();
    Sound.LoadSound("iwd.mp3", false);
    Sound.start();
    }


    In other words: the sound is not streamed.

  3. #3
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    d'oh !!!!

    what an idiot i am hahahahahahahaha

  4. #4
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    i've replaced the true with false and the song now loads in full but the song doesn't start playing after loading is complete - any thoughts???

    the full script is now :

    onClipEvent (load) {
    Sound = new Sound();

    Sound.LoadSound("iwd.mp3", false);
    Sound.start();


    }

    onClipEvent (enterFrame) {
    _root.dl4=Sound.getBytesLoaded()/1024;
    _root.dl5=Sound.getBytesTotal()/1024;
    //to load the next song
    Sound.onSoundComplete = function() {_root.gotoAndPlay("MENU");}


    }
    onClipEvent (enterFrame) {
    Sound.setVolume(_root.volume);
    Sound.setPan(_root.pan);

    }

  5. #5
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Remove the Sound.start(); from "onClipEvent (load)" and create this function:
    Code:
    Sound.onLoad = function(success) {
         if (success) {
              Sound.start();
         }
    };

  6. #6
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    ok - i now have the following, but the mp3 still doesn't play -
    onClipEvent (load) {
    Sound = new Sound();
    //to stream
    Sound.LoadSound("iwd.mp3", false);
    Sound.onLoad = function(success) {
    if (success) {
    Sound.start();
    }
    };


    }

    onClipEvent (enterFrame) {
    _root.dl4=Sound.getBytesLoaded()/1024;
    _root.dl5=Sound.getBytesTotal()/1024;
    //to load the next song
    Sound.onSoundComplete = function() {_root.gotoAndPlay("MENU");}


    }
    onClipEvent (enterFrame) {
    Sound.setVolume(_root.volume);
    Sound.setPan(_root.pan);

    }

  7. #7
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Ohhh ...

    Script for the child movieclip :

    onClipEvent (enterFrame) {
    _root.dl4=Sound.getBytesLoaded()/1024;
    _root.dl5=Sound.getBytesTotal()/1024;
    Sound.onSoundComplete = function() {_root.gotoAndPlay("MENU");}
    Sound.setVolume(_root.volume);
    Sound.setPan(_root.pan);

    }


    Script INSIDE of the child movieclip:

    Sound = new Sound();
    Sound.LoadSound("iwd.mp3", false);
    Sound.onLoad = function(success) {
    if (success) {
    Sound.start();
    }
    };
    stop();


    I'm going home now.

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