ted_chou12 Posted October 27, 2008 Share Posted October 27, 2008 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] Quote Link to comment https://forums.phpfreaks.com/topic/130222-actionscript-music-bar-positioning-problem/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.