0

Hello
I have purchase a template and need some help with changing the music in the template. I have never seen this type of action script before so I am not sure how the music is loading. I am used to seeing it in the time line and library which it is not.
I don't see a icon for the music in the libary. I only see a movie clip called player and a movie clip called sound componet that both have some action script ing that reads the following:

var numtrack = 1;
var maxTracks = 3;
var my_sound:Sound = new Sound();

var _this:MovieClip = this;

var txt:TextField = this.txt;
txt.autoSize = true;

//
my_sound.onLoad = function(success:Boolean) {
    if (success) {
        _this.txt.text = "";

        my_sound.start();
        _this.txt._x = 0;
        clearInterval(_this.interval);
    }
};

my_sound.loadSound("music/track1.mp3", false);

function loader(sound:Sound) {
    if (sound.getBytesLoaded() != undefined && sound.getBytesTotal() != undefined){
        var gbl:Number = sound.getBytesLoaded();
        var gbt:Number = sound.getBytesTotal();
    } else {
        var gbl:Number = 0;
        var gbt:Number = 100;
    }
    _this.txt.text = "track "+numtrack+" "+"loading "+Math.round(gbl/gbt*100)+"%";
    //_this.txt._x = -15 - _this.txt._width;
   
    if (gbl >= gbt){
        _this.txt.text = "";
    }
}

my_sound.onSoundComplete = function() {
    numtrack++;
    if (numtrack == 4) {
    numtrack = 1;
    }
    my_sound.loadSound("music/track"+numtrack+".mp3", false); var interval:Number = setInterval(_this, "loader", 1, my_sound); } // var interval:Number = setInterval(_this, "loader", 1, my_sound); // player controls btnNext.onRelease = function() {
    numtrack++;
    if (numtrack == maxTracks+1) {
        numtrack = 1;
    }
    my_sound.loadSound("music/track"+numtrack+".mp3", false);
    _this.interval = setInterval(_this, "loader", 1, my_sound); };

btnPrev.onRelease = function() {
    numtrack--;
    if (numtrack == 0) {
        numtrack = 3;
    }
    my_sound.loadSound("music/track"+numtrack+".mp3", false);
    _this.interval = setInterval(_this, "loader", 1, my_sound); };

btnStop.onRelease = function() {
    my_sound.start();
    my_sound.stop();
};

btnPlay.onRelease = function() {
    my_sound.stop();
    my_sound.start();
};

THIS WAS ALSO SOME ADDED SCRIPT IN A MOVIE CLIP CALL SOUND- COMPONET

var s_volume = 40;
var widthVolumeLine = s._width;
s._width = s_volume*widthVolumeLine/100; var mySound = new Sound(); var maxvolume = 100; var minvolume = 0; var soundFlag = false; controlSound.onEnterFrame = function() {
    mySound.setVolume(s_volume);
    if (soundFlag == true) {
        s._width = _xmouse;
        if (s._width>69) {
            s._width = 69;
        }
        // end if             
        if (s._width<0 || _xmouse<0) {
            s._width = 0;
        }
        // end if             
        s_volume = s._width*1.520000;
    }
};
var mouseListenerVolume:Object = new Object(); mouseListenerVolume.onMouseDown = function() {
    if (controlSound.hitTest(_root._xmouse, _root._ymouse)) {
        soundFlag = true;
    }
};
mouseListenerVolume.onMouseUp = function() {
    soundFlag = false;
};
Mouse.addListener(mouseListenerVolume);

Hopefully this is something simple. I just want to change the song and I am not sure what is happening here.
Please help anyone.
I am new at this which I sure you can tell.
Thanks
Mary

2
Contributors
6
Replies
7
Views
9 Years
Discussion Span
Last Post by webgirl
1

my_sound.loadSound("music/track1.mp3", false); This tells me that the music is being downloaded and is not actually in the flash movie or library. Look in the folder that you downloaded. It should contain a subfolder named music. Inside (I think) will contain mp3's named track1.mp3,track2.mp3, & track3.mp3.

my_sound.onSoundComplete = function() {
numtrack++;
if (numtrack == 4) {
numtrack = 1;
}

This is incrementing the track number by one at the end of the song and resetting the song number after track3.mp3. To change the songs, take the mp3's that you want in the player and name them track1.mp3, track2.mp3...and replace the current songs in the music folder.

This is all just a guess but hopefully it will help get you going in the right direction.

Votes + Comments
Good code example
0

Thanks this helped what if I want to just have one song. What do I need tho change

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.