I have the songs already starting to play in the action script code. All I
need to do is change the button from the pause to a play button and vise
versa when the user clicks on the button. Below is the action script that I
have that is controlling the whole movie it is on frame one of an action
layer. I also need to know where in the script it will have to go?
Bare with me I am new at Flash. I know how to do all of this in Director but
now we have to do it all in Flash. All your help is GREATLY appreciated.
The buttons are called "playMusic" and "pauseMusic"
var musicFolderName:String = "Music/";
var curTrackNum:Number = 0;
var curPlaybackPos:Number;
var mySound:Sound;
var trackInfoArray:Array;
var trackInfoTracker:Number = 0;
var infoChangerInterv:Number;
_root.volume = 85
this.onEnterFrame=function() {
ratio.text=mySlider.ratio;
mySound.setVolume(_root.volume);
}
function playMusicFunc() {
mySound = new Sound();
mySound.loadSound((musicFolderName + "song" + curTrackNum + ".mp3") ,
true);
mySound.onID3 = function() {
trackInfoArray = new Array();
trackInfoArray[0] = "Track : " + mySound.id3.TIT2;
trackInfoArray[1] = "Track " + (curTrackNum + 1) + " of " +
myLV.totalTracks;
clearInterval(infoChangerInterv);
infoChangerInterv = setInterval(infoChanger, 5000);
infoChanger();
}
if (curTrackNum == (myLV.totalTracks - 1)) {
nextTrack.enabled = false;
nextTrack._alpha = 50;
} else {
nextTrack.enabled = true;
nextTrack._alpha = 100;
}
if (curTrackNum == 0) {
prevTrack.enabled = false;
prevtrack._alpha = 50;
} else {
prevTrack.enabled = true;
prevTrack._alpha = 100;
}
}
function infoChanger() {
trackInfo.text = trackInfoArray[trackInfoTracker];
if (trackInfoTracker == (trackInfoArray.length - 1)) {
trackInfoTracker = 0;
} else {
trackInfoTracker++;
}
}
var myLV:LoadVars = new LoadVars();
myLV.load("total_tracks.txt");
myLV.onLoad = function(success) {
if (success) {
playMusicFunc();
}
}
// --------- [Next Track / Previous Track]--------- \\
this.nextTrack.onRelease = function() {
if (curTrackNum < (myLV.totalTracks - 1)) {
curTrackNum++;
playMusicFunc();
}
}
this.prevTrack.onRelease = function() {
if (curTrackNum > 0) {
curTrackNum--;
playMusicFunc();
}
}
// --------- [/Next Track / Previous Track]--------- \\
// --------------[/play/pause]--------------- \\
this.pauseMusic.onRelease = function() {
curPlaybackPos = mySound.position;
mySound.stop();
disablePause();
}
this.playMusic.onRelease = function() {
mySound.start((curPlaybackPos/1000), 9999);
disablePlay();
}
function disablePlay() {
playMusic.enabled = false;
playMusic._alpha = 0;
pauseMusic.enabled = true;
pauseMusic._alpha = 100;
}
function disablePause() {
playMusic.enabled = true;
playMusic._alpha = 100;
pauseMusic.enabled = false;
pauseMusic._alpha = 0;
}
[quoted text, click to view] "kglad" <webforumsuser@macromedia.com> wrote in message
news:e0rcma$q8q$1@forums.macromedia.com...
> if you want one pause/play button and you want it to start your sound on
> first
> release, replace your code with:
>
>
> this.playToggleBtn.onRelease = function() {
> if(!this.toggle){
> if(!curPlaybackPos){
> curPlaybackPos=0;
> }
> mySound.start((curPlaybackPos/1000), 9999);
> } else {
> curPlaybackPos = mySound.position;
> mySound.stop();
> }
> this.toggle=!this.toggle;
> }
> }
>