# onComplete Not Working

**URL:** <https://forum.kirupa.com/t/oncomplete-not-working/332414>\
**Category:** flash\
**Created:** [May 30, 2014, 5:19pm UTC](https://forum.kirupa.com/t/oncomplete-not-working/332414 "2014-05-30T17:19:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottiescotsman](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@scottiescotsman](https://forum.kirupa.com/u/scottiescotsman)\
**Post date:** [May 30, 2014, 5:19pm UTC](https://forum.kirupa.com/t/oncomplete-not-working/332414/1 "2014-05-30T17:19:19Z")

</div>

Initially when I started coding the AS/PHP/XML mp3 player, the onComplete has never worked.  
Some one suggested it might be the list click that is stopping it from working? But all the code is fine and works fine until end of mp3 and just sits there lol.  
[AS]  
function onPlaybackComplete(event:Event) {  
TweenMax.killAll(false, true, false);  
songInfo.scrollingText.x = 0;  
pos = 0;  
if (trackNumber \< tracksInDirectory) {  
channel.stop();  
trackNumber += 1;  
snd = new Sound(new URLRequest(dir+trackNumber+".mp3"));  
channel = snd.play();  
} else {  
channel.stop();  
trackNumber = 1;  
snd = new Sound(new URLRequest(dir+trackNumber+".mp3"));  
channel = snd.play();  
}  
var currentTrackPlaying = new Array(trackNumber-1,trackNumber-1);  
list.selectedIndices = currentTrackPlaying;  
list.scrollToIndex(trackNumber-1);  
var tick:String = list.getItemAt(trackNumber-1).label;  
wide = tick.length \* size;  
songInfo.scrollingText.tf.width = wide;  
songInfo.scrollingText.width = wide;  
songInfo.scrollingText.tf.text = tick;  
TweenMax.to(songInfo.scrollingText, speed, {x:-(wide+150), y:0, ease: Linear.easeNone, repeat:-1});  
}  
[/AS]  
Any help would be appreciated.

Thanks  
Steven :genius:
