I have made and mp3 player that the design expands and contracts the mp3 player like "itunes". It also has a "drag" on it so you can move the player around.
When you open the player it plays the 1st song straight away, which is fine, BUT when u contract the player then re-open it plays its self again, but u are hearing both at the same time but one delayed. This also screws up the buttons as well.
Any ideas how I can make this wk the way it should?
I originally used a tutorial to get as far as making it work, my additions were the "drag" & "contract & expand".
unfortunatly, I dont have time to look at your FLA, maybe someone else can.
-----
BUT when u contract the player then re-open it plays its self again, but u are hearing both at the same time but one delayed. This also screws up the buttons as well.
-----
To me this sounds as if the code to expand and contract the interface is reloading the sound. Review the code and make sure it does not re-execute a function or replay a frame containing your code to load sound.
//play button
on (release) {
//Play button.
//Sound is not playing and has not been paused
if (playing!=true) {
if (paused!=true) {
playing=true;
paused=false;
stopped=false;
myConditionText="playing";
s.start(0,0);
}
//Sound has been paused
if (paused==true) {
playing=true;
paused=false;
stopped=false
s.start(myMusicPosition,0);
myConditionText="playing";
s.onSoundComplete = function() {
s.start();
}
}
}
}
GRIP "on contracted player"
1st frame
on (press) {
startDrag(getProperty(_x, _y));
}
on (release) {
stopDrag();
}
--------------------------------------
Thanks reading to blubering desperation, be easy on me...Cheers
Hi Tonypa, u made my day just replying!!!. I tried the code, but still seems to have the same problem of the song playing over each other when expanded the 2nd time.
I feel real close finishing this but its just this hurdle. Very frustrating, better have a coffee to wake up a little.
Ok, I think we are nearly there (WaaHoo!). It wks Tonypa, with the first song. Now what happens is that if you play the next track & u contract then expand it has the same problem as before. Repeting it self...
would I use this:
if (Number(s.getBytesTotal)==0){
for the other tracks in the timeline. I have 16 frames and in each frame has except frame 2.
Music Layer/Frame 2
if (Number(s.getBytesTotal)>0){
s = new Sound();
s.loadSound("my_music.mp3", true);
currentTrack="my_music";
stopped=false;
paused=false;
stop();
}
Music Layer/Frame's 3/4/5/6/etc....
s = new Sound();
s.loadSound("my_music.mp3", true);
currentTrack="my_music";
stopped=false;
paused=false;
stop();
Music Layer/Frame 2
if (Number(s.getBytesTotal)>0){
s = new Sound();
s.loadSound("my_music.mp3", true);
currentTrack="my_music";
stopped=false;
paused=false;
stop();
}
sorry, Im not sure, Im with you there. Can you please show me how it should be written out?. Or are you saying to replace this line on Music Layer/Frame 2?.
if (Number(s.getBytesTotal)==0){
with
if(!s) {
s = new Sound();
s.loadSound("my_music.mp3", true);
currentTrack="my_music";
stopped=false;
paused=false;
stop();
}
Tonypa, sorry this is what I put in, just in case you thought I didn't do it right.
Music Layer/Frame 2
if (Number(s.getBytesTotal)==0){
s = new Sound();
s.loadSound("my_music.mp3", true);
currentTrack="my_music";
stopped=false;
paused=false;
stop();
}
Music Layer/Frame's 3/4/5/6/etc....
s = new Sound();
s.loadSound("my_music.mp3", true);
currentTrack="my_music";
stopped=false;
paused=false;
stop();
wks for the first track, now the same old problem has jumped to the next track in frame 3 & plays while the 1st song is playing if you skip to the second track.
here is the fla, with the new changes. I hope it would show you what I mean.
Well, as hp3 pointed out, and I trust him on this more then myself, you can probably replace the line
if (Number(s.getBytesTotal)==0){
with much simpler
if(!s) {
like you did in previous post.
But surely you have to add the if statement in every frame. The idea of including sound creation code into if statement, is to check first if such sound already exists (and might be playing) and only if it doesnt, you make new sound. If you have 16 frames, then you need to change code in all 16 frames
something is still funny here, its wking like you said, but only the first song in frame 2.
When "frame 2" is playing the song and I try going to the "next" song. It doesn't play at all or any other after "frame 2". In the "currenTrack" display says "my_music.mp3", which Im guessing its just held up in frame 2. Instead of going to frame 3 to play "my_music_2.mp3" and so on to frame 16.
Is it because my action for my next button needs to be modified for the the new if statement?. I have feeling ur gonna laugh there.
o.k, I got frankienstien'd this tutorial, which I manged to have a wking mp3 player with:
Music Layer/Frame 1/2/3/4....
s = new Sound();
s.loadSound("my_music.mp3", true);
currentTrack="my_music";
stopped=false;
paused=false;
stop();
SO what I wanted to do was to design a expand and contract type of player. Just like itunes when "itunes & winamp" when u minimise the player & maximise.
So the features I added was the expanded part to the design and the grab.
And the rest is history....
All I want to do is open and close the iterface while the selected song is playing, without the prob of playing over another and just play normal as you would expect it should do.
I have been working on my little flash site. And you can see what I mean. But I haven't uploaded any mp3's to the serevr. Maybe it will give you the general idea.
you will see the player in the left side corner. If you click on review and select any review. You can see why its important to contract the player.
Please not this sit is in working progress. Feel fre to comment on the site as well
If you do know a better way how this player should wk, I would love to know
well I got 16 tracks I want to play, I figured that when you select nxt track it will jump from the current frame to the next to start to play the nxt track or if you selct previous, same rule applies.