Replace FlxSound.onComplete with FlxSound.onFinish#3336
Replace FlxSound.onComplete with FlxSound.onFinish#3336DetectiveBaldi wants to merge 4 commits intoHaxeFlixel:devfrom
FlxSound.onComplete with FlxSound.onFinish#3336Conversation
Geokureli
left a comment
There was a problem hiding this comment.
I also wanna make sure init() can't be called multiple times, I.E. via recycling or something. if it can then we would need to find a way to remove the listener added there, but not any added externally
flixel/sound/FlxSound.hx
Outdated
| /** | ||
| * Signal that is dispatched on sound complete. | ||
| */ | ||
| public var onFinish:FlxSignal; |
There was a problem hiding this comment.
needs to be read only, lets use final
| public var onFinish:FlxSignal; | |
| public final onFinish:FlxSignal; |
and add onFinish.removeAll(); to destroy() to clear up memory
I did some more testing with recycling. I noticed that the callbacks would not be cleared if you killed a sound, and it got recycled. That is fixed with commits I'm pushing now, however I do want to note that some of the line ordering may look a bit inconsistent due to when FlxSound calls certain functions, which might be a problem Also regarding making onFinish a final: It requires me to assign the variable in the constructor compared to in the |
|
Thanks, won't be able to test this for a short while, though |
Adjusts FlxSound to comply with new changes in flixel involving changing a bunch of single callbacks to use FlxSignals instead.