DragonBones / DragonBonesAS

DragonBones ActionScript Runtime
MIT License
250 stars 117 forks source link

[Possible BUG] updateFFDTimeline() use FFDTimelineState object before it was inited #71

Closed T1mL3arn closed 8 years ago

T1mL3arn commented 8 years ago

Here AnimationState.as#L343 is object that is initialized later there AnimationState.as#L364

Is may be need to change from this

var ffdTimelineState:FFDTimelineState;
var i:int = _ffdTimelineStateList.length;
var slot:Slot;
while (i --)
{
    ffdTimelineState = _ffdTimelineStateList[i];
    slot = _armature.getSlot(ffdTimelineState.name);
    if (!slot || slot.displayIndex != ffdTimelineState.displayIndex)
    {
        _ffdTimelineStateList.splice(i, 1);
        FFDTimelineState.returnObject(timelineState);

to that ?

var ffdTimelineState:FFDTimelineState;
var i:int = _ffdTimelineStateList.length;
var slot:Slot;
while (i --)
{
    ffdTimelineState = _ffdTimelineStateList[i];
    slot = _armature.getSlot(ffdTimelineState.name);
    if (!slot || slot.displayIndex != ffdTimelineState.displayIndex)
    {
        _ffdTimelineStateList.splice(i, 1);
        FFDTimelineState.returnObject(ffdTimelineState);
Fisa212 commented 8 years ago

i previously never get problem regarding that issue. can u explain what's the problem and when does it happen?

T1mL3arn commented 8 years ago

timelineState is used in FFDTimelineState.returnObject(timelineState); BEFORE its initalization. Here is using AnimationState.as#L343 but initialization is later here AnimationState.as#L364. Seems a null-object is passed back to the pool.

I can't point a real problem when using DB in as3 projects. I am porting DB to Haxe and Haxe does not allow to use variable before its initializing.

akdcl commented 8 years ago

The bug has been fixed :)