A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Dynamically loading mp3s into the flash player

  1. #1
    Senior Member
    Join Date
    Feb 2002
    Posts
    166

    Dynamically loading mp3s into the flash player

    I notice that in the 'What's new?' section of Flash mx's help menu it talks about being able to 'Dynamically load mp3s into the flash player using actionscript'

    Can anybody point me to a tutorial/paste me the script to do this?

    Thanks a lot

    Mark

  2. #2
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    look at the sound object in the AS reference amongst it's methods you'll find a new one:

    Sound.loadSound()

    However it can only load mp3 files.

    Unfortunatly I do not know of any good tutorials but here is an example of a nonstreaming sound loading:

    Code:
    mySound = new Sound();
    mySound.onLoad = function()
    {
        this.play()
    }
    
    mySound.loadSound("yourSound.mp3", false);
    /Mirandir

  3. #3
    Senior Member
    Join Date
    Feb 2002
    Posts
    166
    thanks

  4. #4
    Senior Member
    Join Date
    Feb 2002
    Posts
    166
    Thanks for the code
    However I can't make it work
    Where do you put it
    Is it an object action on the button?

    What I'm trying to achieve is the way that some large sites load up really quickly and yet they have loads of audio on the site.

    I assume this is because they are dynamicaly loading it in rather than than including it in the swf

    Thanks
    Mark

  5. #5
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    Well the code should be useful anywere. If you wan't to stream the audio you can change the loadSound like this:

    Code:
    // second argument = true means streaming sound.
    mySound.loadSound("yourSound.mp3", true);
    I would have made a .fla but unfortunatly I don't have access to flash this weekend.

    /Mirandir

  6. #6
    Junior Member
    Join Date
    May 2002
    Posts
    11
    Here you'll find some of the best information about the sound object. Bear in mind though that when loading mp3 as a stream looping becomes a bit erratic.
    http://www.kennybellew.com/

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