2 error problems for simple music players

35 views Asked by At

I have 2 Errors: #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.

I tested a few times, and I have both Unhandled IOErrorEvent and Stream Error for a Music Player Scene. I found this video how to create a simple MP3 Player using actionscript 3.0, Anyone can fix these errors?

    var myMusic:Sound = new Sound();
    var musicChannel: SoundChannel = new SoundChannel();
    var musicIndex: Number = 0;
    var music: Array = new Array();
    var pp: Boolean = true;
    
    music = ['Aqua Man- Guitar Remix', 'Summer Treasure Hunt Event 1', 'Summer Treasure Hunt Event 2',
        'Sizzling Heat! Splendid Summer Event', 'Brick Dive', 'Bloocheep Ocean','Dire Dire Docks Remix - Calm Waters', 
        'Dire Dire Docks Remix - Calm Waters', 'Mario Teaches Typing 2 (1996) - Underwater', 'Treasure Cove! Level 1', 
        'Treasure Cove! Level 2', 'Treasure Cove! Level 3', 'Under Pressure'];
    
    myMusic.load(new URLRequest("E:/Flash Animations/Folder 1/Games/Bit-Bot Math Voyage/Music"+[musicIndex]));
1

There are 1 answers

1
Michael On

Looks like you have an error in your array access approach:

myMusic.load(
    new URLRequest(
        "E:/Flash Animations/Folder 1/Games/Bit-Bot Math Voyage/Music" +
        [musicIndex] // This creates a new array with one integer element
));

I think you want:

myMusic.load(
    new URLRequest(
        "E:/Flash Animations/Folder 1/Games/Bit-Bot Math Voyage/Music" +
        music[musicIndex] // This returns the musicIndex element from the music array
));

You might want a / at the end of Music too?

myMusic.load(
    new URLRequest(
        "E:/Flash Animations/Folder 1/Games/Bit-Bot Math Voyage/Music/" +
        music[musicIndex] // This returns the musicIndex element from the music array
));