views:

34

answers:

1

I have an instance of an object that starts and stops tweens for sub-movieclips. However I want to do stuff when the tween is finished.

So I would like to assign a calling object to events; such as the attach() function does. However when using the attach() function on events it is called right away with the correct object, but when the event is triggered it is called with the object that executed the event (in my case the sub-movieclip).

If that's not possible; something similar to how Mouse events and MouseListeners work would also fit my needs Mouse.addListener(this). By adding a listener for specific events to the current object, then when these events are called they are called on our own object.

I also saw some clever solutions that I do not really enjoy since they are not very nice:

var myObject = this;
myMovieClip.onTweenComplete = function() {
    myObject.doStuff();
}

Is there something nicer than this?

+1  A: 

1) I'm not aware of an attach() function in Actionscript 2.

2) There are some useful tips here on how to use the onMotionFinished event.

3) Nice or not, you can use onTweenComplete by importing the MCTween library.

Hope this helps.

Richard Inglis