Jump to content

actionscript music bar positioning problem


ted_chou12

Recommended Posts

Hello, I am having some problem with the music bar position, if you see the example below, the flash music bar is suppose to move all the way back after the music finishes playing, but instead the position button moves to the middle. (You can observe this by dragging the bar to the most right and wait until the music finishes playing) Then you will see the button moves to the center, but it should really be back at the most left.

http://tedchou12.110mb.com/uploads/files/works/music_player.swf

 

Thats the flash, you can click in to check, and if you want to see this part of the code:

onClipEvent (load) {
dragwidth = 90;
top1 = _y;
bottom1 = _y;
left1 = _x;
right1 = left1 + dragwidth;
}
onClipEvent (enterFrame) {
positionofdrag = _x - left1;
positionofsound = _root.soundInstance.position / 1000;
soundlength = _root.soundInstance.duration / 1000;
soundtopercent = positionofsound * (dragwidth / soundlength);
percenttosound = (positionofdrag * soundlength) / dragwidth;
//slidebar to move continously with sound
if (dragging1 != true) {
	//after finish playing:
	if (positionofsound == soundlength) {
		positionofsound = 0;
		trace(positionofsound);
		trace(soundlength);
		trace("shit");
		music_pos = 0;
		this.Position_button._x = 0;
		_root.Play_button._visible = true;
	}
	else {
		this.Position_button._x = soundtopercent;
	}
}
//drag to the sound position
if (dragging1 == true) {
	if (percenttosound == soundlength) {
		_root.Play_button._visible = true;
	}
	else {
		_root.soundInstance.stop();
		_root.soundInstance.start(percenttosound, 0);
		_root.Play_button._visible = false;
	}
}
}

 

Or you can see the source code here:

http://tedchou12.110mb.com/uploads/music_player.fla

 

Please let me know if you dont understand what im talking about:

see the attached picture, the music button is not centered after the music finishes playing.

Thanks,

Ted

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.