I have an audio player I made in Flash CS3 that runs off an XML Playlist.
I've been trying to add a fade-in effect to the mp3's that is triggered when the user clicks the play button but unfortunately, I've been running into a few problems...
I know that easiest way to code up the fade-in effect is using the this.onEnterFrame event, but due to the way my player's coded, I can't use this.
To make up for the event, I created two functions. The first is called when the user clicks on the play button:
Code:
function startFade()
{
vols = 0;
id = setInterval(volStep, 500);
}
Code:
function volStep(){
if(stopfade==false)
{
step = 5;
vols = vols + step;
if(vols>=100)
{
vols =100;
}
_sound.setVolume(vols);
}
if(vols==100)
{
stopfade=true;
clearInterval(id);
}
updateAfterEvent();
}
Now, I've tested both these loops and the "vol" variable increments correctly the way it should. When I test out the value for _sound.getVolume() it's value is also correct after being updated..but for some reason...the actual sound levels for the object won't correspond to this (i.e I dont hear anything at all).
For reference sakes, I'm also including a snippet of where/how I'm using the above in my play button
Code:
//redfine the object each time we change tracks
_sound = new Sound();
_sound.onSoundComplete = mp3.playNext;
var path = mp3.path;
if (path.indexOf("://")<0) {
path = _root.urlpath+path;
}
_sound.loadSound(path, true);
startFade();
With the exception of the fade-in problems, everything else in the player works perfectly..
I'd love to get some help with this problem as I've tried over 5 or 6 different solutions from actionscript.org so far and neither have worked yet.