openfl / dragonbones

Runtime support for DragonBones skeletal animation
http://www.dragonbones.com
Other
41 stars 14 forks source link

playing animation on COMPLETE event, START never gets dispatched issue/fix #7

Closed MatseFR closed 6 years ago

MatseFR commented 6 years ago

Hi, Not sure if that's intended or not, but if you listen for COMPLETE event on an armature and immediately play another animation on that armature, the START event never gets dispatched.

This is because the animation sends the event to the Armature, which is still processing events and clears the events list afterwards so any added event gets lost (did not check for a memory leak in that case but fore sure the event never gets pooled)

https://github.com/openfl/dragonbones/blob/118e5e22ebc461a329277cf8064bb2a35169444e/dragonBones/Armature.hx#L479

simply commenting out that line and putting something like

for (i in 0...l)
{
     _events.shift();
}

solves the problem

MatseFR commented 6 years ago

fixed with today's merge https://github.com/openfl/dragonbones/pull/11