Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now I'm going to explain how to use functions that are built into the Flash player. If you want to follow along and I'm in Using_Functions.fla in the chapter 3 folder. Here, I have a very simple animation with a motion guide. If I test the movie, see how it works. Now you're already familiar with functions if you've used Script Assist at all or any form of ActionScript. You've probably used stop actions to stop your movie. Well stop is actually a function. So let's write the stop function in our code.
I'll click the Insert layer button to create a new layer and I'm going to call it actions. The very last frame of the animation, I'm going to select it and then press F7 on my keyboard to insert a blank keyframe. If you'd like to insert the keyframe using the Window menu, you go to Insert - Timeline and then select Blank Keyframe. Select that frame, make sure it is highlighted, it should be black. And then open up the Actions panel by pressing Option F9 on the Mac or F9 on the PC.
Inside of my Actions window, I'm just going to type stop(); Test the movie again and the animation plays once and stops. Running this function is exactly the same as in the last movie when we clicked the run function button. The stop function just simply stops a movie from playing, and we're running it by calling it here. We say the name of the function, which is stop, and an open and close parentheses and then a semicolon to end the statement.
Let's run one more function that you're familiar with already and then we'll move on. I'm going to select stop and delete it, and I'm going to type goto, all lowercase, And with a capital A, and then Stop with a capital S. Notice that it turns blue. Then I'm going to type (2); The reason I'm going to frame 2 and stopping is because the boarder doesn't appear on the screen until frame 2, so we'll just to see it loop once and then he'll appear back on the screen.
Press Cmd+Return or Ctrl+Enter to test the movie. Watch it play once and it ends at the beginning of the movie. And so there's a little overview of how to use functions that you already know. So in the next movie I'll explain how to write your own custom functions.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101843 Viewers
61 Video lessons · 88593 Viewers
71 Video lessons · 72413 Viewers
56 Video lessons · 104107 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.