I have a combo box set up in a movie which loads into my main movie.
The combo box is part of an mp3 player, and displays track listings, the mp3 has other elements and i think all paths in movie are relative and basically when it loads in all the functions work , panning, volume etc.
but when you open the combo box you can try to select a new track but it is not reflected when you click on it.
Basically to summarise the combo box wont work properly when its loaded into my main movie.
Any help welcome…!!
Show us the code, a fla, something…
pom
Here is the MP3 player itself.
This loads into level 1 of the main movie.
Would be excellent if you can help i am truly baffled by it ??
If you play the movie seperately it works fine, but if you load it into another movie the combo box doesnt work.
I looked at the prewritten code inside the combo box item component and im pretty sure thats where the problem is
(some sort of pathing problem??)
Still anyway if you could look at it would be cool
EDITED: hmm having problems attaching the file it says its too big… will post it below.
Ok i will write the code but this is gonna take some time:
There are 5 frames with this code:
[AS]
FRAME 1:
playing=false;
mySound = new Sound();
whichSong();
//This function is called by the changehandler
//of the comboBox. It loads the selected MP3 file and
//if the sounds are playing, then it plays it and
// causes the counter to show by going to frame 2. If
//the music is not playing, then it goes to frame 4 which
//sets the counter to 0 and stops.
function whichSong(){
myIndex=SongList.getSelectedIndex();
mySong=SongList.getItemAt(myIndex).label;
mySound.loadSound(mySong,false);
myPosition=0;
if (playing) {
mySound.start();
gotoAndPlay(2);
}
if (playing==false) {
gotoAndPlay(4);
}
}
//This function is called in frame 2 in the OnSoundComplete function.
//It increments the index of the comboBox and selects the next sound.
//When the comboBox is incremented, it calls the changeHandler, whichSong.
function nextSong() {
myPosition=0;
if (myIndex==SongList.getLength()-1) {
myIndex=0;
} else {
myIndex=myIndex+1;
}
SongList.setSelectedIndex(myIndex);
}
myStop.onRelease =function () {
playing=false;
myPosition = mySound.position;
mySound.stop();
};
myRewind.onRelease = function() {
if (playing==false) {
myPosition=0;
gotoAndPlay(4);
}
if (playing) {
mySound.stop();
myPosition = mySound.position - 5000;
if (myPosition<=0) {
myPosition=0;
}
mySound.start(myPosition/1000,1);
}
};
//start the sound playing.
myPlay.onRelease = function() {
if (playing==false) {
mySound.start(myPosition/1000,1);
playing=true;
gotoAndPlay(2);
}
};
myFastForward.onRelease=function() {
if (playing==false) {
myPosition=myPosition+5000;
if (myPosition>=mySound.duration) {
myPosition=mySound.duration;
}
gotoAndPlay(4);
}
if (playing) {
mySound.stop();
myPosition = mySound.position + 5000;
if (myPosition>=mySound.duration) {
myPosition=mySound.duration-5000;
}
mySound.start(myPosition/1000,1);
}
};
FRAME 2:
//frames 2 and 3 set and reset the counter.
myCounter=math.round(mySound.Position/1000);
//this function is called when the sound is complete.
//It goes to the next sound and restarts playing.
mySound.onSoundComplete = function() {
nextSong();
mySound.start();
gotoAndPlay(3);
}
FRAME3:
//this sets the counter
myCounter=math.round(mySound.position/1000);
gotoAndPlay(2);
FRAME4:
//The counter shows the new position set by the
//fast forward or reverse buttons while the sound
//is not playing.
myCounter=math.round(myPosition/1000);
FRAME5:
gotoAndPlay(4);
[/AS]
Right other than that theres some code on the sliderbars and some other bits of code but they all work fine and i understand them fully, the only other thing of interest is the code that flash creates inside the combo box item to create it.
I think this is where the problem is!!
If you cant be arsed reading all that code then tell me and ill upload the files to my site for you to look at!!
Or alternatively just create a basic combo box in a test movie and load it into another without changing any code and it probably wont work either!!