02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School

Working with Events

When working in TweenMax in Adobe Flash, you may choose to work with events instead of callbacks. In this lesson, we will learn how to work with TweenMax AS3 Events.

Video Transcript

00:00So throughout the chapter, we said one of the big differences between TweenMax and TweenLight
00:05is that there's a capability of hard typing. We've seen that with creating those TweenMax
00:11variables, which also exists for TweenLight variables. I personally don't use them. I don't
00:16think you should either, but obviously you could. Now, I wanted to talk about events in general. So
00:21we said there's lots of events. So what I'm going to do, I'm going to comment down the
00:25onComplete and instead of that, go to the actual TweenMax that I have and add a new event. Now,
00:31if you don't know what events are, I'm not going to get into it. This is only for the event
00:34savvy people that want to work with events. You don't really need it. The way we're working
00:39with the callback is just about enough, unless you're a gamer or unless there's
00:43you're a developer that prefers this style. And then I'll send the, for onComplete,
00:49I'll send complete as a string as the first parameter. And the second parameter is going
00:54to be the actual, and by the way, a lot of these events exist in the event. So let me just
01:00new event, a lot of these events hard coded, if you like hard coding, you would have the complete,
01:08not all the events are there, but for example, update is definitely there as well.
01:13I believe, no, it's not. So then if you were onUpdate, you would have to type your update.
01:18But in our case, we're going to do complete. Second is we're going to put our function,
01:22which is our onAdd and complete. And all that's left for us to do is to change here,
01:28because it's not going to get the T between max anymore, but instead, that is going to get an event.
01:34So we're going to have to set that TM as a new variable, which is a tween max variable,
01:41we're going to set it to be the E target as a tween max. And once we do that, all the rest
01:46could remain the same. But that's all I'm going to talk about that. And if we're going to run it,
01:51we should still get our application, it should still be working, everything should remain the
01:56same. And I bid you adieu of chapter five. And chapter six is going to be all about the timeline.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!