Here's the next tutorial on Fusekit.
As promised, here's another way to do a callback, the lazy way.
tempMC.slideTo("0",380,1,"easeInQuart",0,function(){
tempMC.alphaTo(0,1,"linear");
});
As you can see, I literally dumped the whole function inside, instead of writing a new function on its own. Now take note, doing this has its downside. When you try to refer to tempMC, you cannot use this. Try tracing this in the function, and you will get wherever the script is. Like for example, if your code is in the main timeline, you'll get _root.
That's basically what I know about callbacks. Perhaps if I missed out something, a pro can add on in the comments? Thanks! Hope this is helpful for everyone.
Edit: Check out the comments to see what a pro has to say! =P
flashmech says:
this comment is written for the syntax ZigoEngine.doTween().
There’s basically 3 types of callbacks:
start
Before the tween is being started, this function will fire off first.
update
Upon every pulse of the tween (enterframe as some will call it), this function will be fired.
end
At the end of the tween, this function will fire off.
Coupled together with these callbacks, you can also specify the scope of function to be called. Which means that even when you’re calling the tween on the parent scope, you can redirect the callback to a child scope.
Here’s a sample syntax:
In the above example, here’s the arguments:
Hope I did not complicate things, but yeah, that’s basically how you are able to do complex callbacks and scoping with Fuse.
Hope that helps!
July 31, 2007 at 10:57 am