Skip to content
This repository has been archived by the owner on Sep 18, 2018. It is now read-only.

SequenceGroup stop() error #3

Open
ghost opened this issue Apr 2, 2013 · 4 comments
Open

SequenceGroup stop() error #3

ghost opened this issue Apr 2, 2013 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 2, 2013

calling stop() on a ClassSequence with nested SequenceGroups causes a null object reference on _current. Tracing through the code execution, calling stop() on a SequenceGroup causes serve() to get called, which after iterating through all the _current objects will automatically call end(). This causes _current to be set to null before the stop() function can finish executing. Additionally, there's a redundant end() being called inside the stop() function.

If I rewrite the stop function to read:

    internal function stop():void {
        for (var i:int = 0; _current && i < _current.length; i++) {
            _current[i].stop();
        }
        //end();
    }

then the code will execute without throwing an error, and appears to be behaving as expected.

@ghost
Copy link
Author

ghost commented Apr 2, 2013

I take back what I said, it is not working as expected. Based on the behavior of BasicTween, stop() should act as a pause() function that will resume on start().

@ghost
Copy link
Author

ghost commented Apr 2, 2013

The root of this problem seems to be an implementation confusion of the intent of MotionEvent.ENDED. Is this event supposed to be fired when the tween has run through it's entire duration, or when the tween stops?

Personally, I would expect it to be when the tween has run through it's entire duration because if a tween is stopped preemptively, it has to have been caused by an external call. Am I right?

@ghost
Copy link
Author

ghost commented Apr 2, 2013

It seems that all events in the desuade motion package share similar event strings... this is likely the root cause of confusion in the system. If I give each event class unique event strings, the sequence functionality fails to complete... which likely means that a MotionEvent listener was being triggered by a dispatched TweenEvent.

@andrewfitz
Copy link
Owner

The behavior of BasicTween stop() is not to resume, it's to end. Tween does implement resume however. The ended event should work as expected, not being called when stopped with Tween, but called when stopped with BasicTween. There was no purpose in firing a different event when a tween is paused, because that will always be called in a script, so you know when it's called and don't need to be notified about it because you're calling it, right?

Tween wont fire the ended event unless it's marked as completed, which it wont do if stopped in the middle of a tween. endFunc gets called when the Primitive 'dies', however this prevents it in Tween if not completed (BasicTween will fire it always since it doesn't support pause/resume):

protected override function endFunc($o:Object):void {
        if($o.property != undefined){
            if($o.target[$o.property] == $o.value){
                _completed = true;
            }
        }
        super.endFunc($o);
    }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant