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

The TimeLine and ENTER_FRAME

Taking a small break from the land of programing to see how frames work in flash. we will create a very simple animation on the time line to illustrate what happens when a frame changes and what it means.

Video Transcript

00:00We're gonna take a small little detour before we actually continue working on our
00:06Event before we continue working on our movie clip
00:11And what I wanted to do is kind of like focus for a second on the timeline
00:14We kind of ran through without really getting into too much and I wanted to make sure that it's kind of
00:20Crystal clear and even though though it's not directly related to programming
00:25It's definitely related to flash and how flash works or how it's just it's more visual. It's easier to work with
00:32So I just created a quick rectangle
00:34And what I want to do is I want to because I know that our movie clip our application right here our FLA
00:41Is running on 24 frames per second, which means it's going to attempt to refresh the screen 24 times a second
00:49Now what I want to do is I want to just create a nice little animation where I'm taking that rectangle and
00:55I'm maybe gonna morph its color just change its look and feel and we're not gonna be too much too detailed about it
01:02One thing is let's say we wanted to be 30
01:05nice round number
01:06Frames per second where you go to our frame 30 and we're going to type f6
01:12To create a keyframe by creating a keyframe that enables us to actually modify our element without changing the original frame
01:21Alright, so I'm just going to modify it a bit
01:23And I'm going to change its color
01:27Alright so we got here a change in color where from red it turns to turquoise
01:33Now if we run our application just right now, it's just going to flicker for a second and go right back
01:39We don't really want that to happen
01:41So the next step is we actually want to make it animate and CS5 the way we would do it a little bit different than earlier
01:47Versions I'm going to right click on the frame itself, and I'm going to select a shape tween
01:53By selecting a shape tween because this is a shape it enables me to then animate through that shape
02:00creating a little motion now
02:02This is not our main topic and we'll probably have now
02:08This is not our main topic and we will probably have different videos going more into detail about
02:13Visually animating and flash, but for now this is all we really needed to just show how we're working with a timeline
02:21So we're not delving too deep, but basically what's happening here
02:24We have your 30 different frames and every single frame and by the way, I'm using the back next
02:32Which is like right after the M the smaller bigger to move between the frames
02:36You'll see that every frame is a little bit different flash
02:39Automatically generated those
02:41Elements as we when we right clicked and we selected to create a shape tween for the shape that we just created and if we run
02:48The application then it will animate through it endlessly never stopping
02:54And why did we want to make this little detour now?
02:56This little detour is really for to kind of grasp that idea where flash basically every frame
03:03re-renders itself and there's actually a lot behind the scenes to enable us to piggy bank onto that system
03:10So every time when flash is ready to re-render an element it dispatches an event which is called an enter frame event
03:19now
03:20Does that mean that it's going to always run 30 times a second? No, absolutely not
03:25It means that it's flash is going to attempt to do that, but it really depends on the processor
03:29It really depends on a million and one factors such as if there's a you know
03:33Right now you're running at 30 frames a second. Everything is fine. Then suddenly you turn on a HD video at the same time
03:40And now flash is barely had you know, it doesn't have enough resources and it just can't
03:46Continue or you're running on a really slow computer or a really fast one and there's a lot of variables that actually change the amount
03:52The frequency of the updates, but when you're saying 30 frames per second, you actually mean that flash is going to attempt to run
03:59at 30 frames per second
04:02Alright, so that's really that detour that I wanted to do and I think we're ready to go back and actually listen to that
04:09event now that we just saw that
04:11visualization of
04:13Enter frame

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!