User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Graphics and Multimedia section within the Web Development category of DaniWeb, a massive community of 391,662 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,853 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Graphics and Multimedia advertiser:
Views: 573 | Replies: 6 | Solved
Reply
Join Date: May 2008
Posts: 4
Reputation: webgirl is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
webgirl webgirl is offline Offline
Newbie Poster

Help with Music in Flash

  #1  
May 28th, 2008
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
Last edited by peter_budo : May 28th, 2008 at 6:47 pm. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 347
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 68
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: Help with Music in Flash

  #2  
May 28th, 2008
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.
Last edited by buddylee17 : May 28th, 2008 at 5:39 pm.
Reply With Quote  
Join Date: May 2008
Posts: 4
Reputation: webgirl is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
webgirl webgirl is offline Offline
Newbie Poster

Re: Help with Music in Flash

  #3  
May 28th, 2008
Thanks this helped what if I want to just have one song. What do I need tho change
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 347
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 68
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: Help with Music in Flash

  #4  
May 28th, 2008
my_sound.onSoundComplete = function() {
numtrack++;
if (numtrack == 2) {
numtrack = 1;
}
Reply With Quote  
Join Date: May 2008
Posts: 4
Reputation: webgirl is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
webgirl webgirl is offline Offline
Newbie Poster

Re: Help with Music in Flash

  #5  
May 28th, 2008
Thanks for the help
Appreciate it very much
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 347
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 68
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: Help with Music in Flash

  #6  
May 28th, 2008
No problem, please dont forget to mark the post as solved.
Reply With Quote  
Join Date: May 2008
Posts: 4
Reputation: webgirl is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
webgirl webgirl is offline Offline
Newbie Poster

Re: Help with Music in Flash

  #7  
May 29th, 2008
How do I marked it solved
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Graphics and Multimedia Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Graphics and Multimedia Forum

All times are GMT -4. The time now is 1:45 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC