Getting Started Tutorial - Basic Article I wrote these tutorials, the purpose is to hope that Flash's enthusiasts can do more, less questions. I will below these tutorials, including the readers of Flash (MX) basic operation knowledge. While watching my tutorial, I hope I can open flash, do it, so your impression will be more profound, and the way I will see my wrong :) AS foundation --------- ------------------------- Flash enthusiasts who have done flash animation know that it is essential to do a Flash animation. Even if only a simple code can play the role of the entire Flash painting dragon. Here I only briefly introduce the basic common sense of AS. First we have to understand where the AS is written, when AS will be triggered. 1. Frame: Write the AS above the keyframe, when the pointer on the time axis comes to this key frame, the AS above this frame is triggered. Common examples have STOP (), etc. written on the frame end of the film. The method of operation is to click on the keyframe and then open the AS panel. 2, buttons: Unlike the AS above the frame, the AS above the button is to have trigger conditions. To write the AS on the button, the operation method is to click the target button and open the AS panel. Even an example can say more. Suppose there is an animation, let it stop at the same time, then, what you have to do is written as stop (); then assume a button, the effect is to press the button to stop playing, then Proceed as follows. Do a button, put it until the main scene, click the button, and open the AS panel. Now if you also write stop () on the button; then, you will be prompted when you output it. Correct should write on (Release) {stop ();} Here you need to move more about the frame: On (Release) {}, the entire code translated is: When (release) {stop} red code representation One of the triggered events of the mouse, this is the common event of Release release, buttons: Release Loosing Releaseoutside External Subsidence Press Press ROLLOVER Mouse Enter button Induction Rollout Mouse Leave button Induction Zone Now clear The AS written on the button is one of this format: ON (Event) {The code to be executed} 3, MC (movie clip) If you understand the above content, write the AS and write on the MC Datong on the button. The operation method is to click the MC and then open the AS panel. Look at an example onclipevent (loading) {stop ();}, the MC requires an event to trigger the implementation of the AS. Translation This code is that when the clip (load) {stop} red code also represents an event. The Event of the MC has the following: LOAD load, executed when the MC appears. That is, unless this MC is uninstalled, the code in the LOAD event is only executed with a unload uninstallation, and each frame exists in EnterFrame when the MC is uninstalled. Each frame exists in the MC is executed. If your scene has 100 frames, a MC starts from 41 frames to 100 frames disappeared, then the code above this MC performs 60 mousedown to press the mouse and count anywhere in the scene. Mousemove moving the mouse and the button is moving, as long as the mouse is moved, the code mouseup loosen the mouse. You have to clear: the code written on the MC must always be this format: OnClipEvent (Event) {code} See here, if You understand what is different from the code on the frame, buttons, and MC. Even if the task is completed ______________________ AS syntax ----------------------- ------------ Next, what I want is the syntax of the AS.
First of all, let you understand that the case of AS syntax is sensitive. For example: gotoandplay () correct gotoandplay () error. The spelling of keywords must be consistent with syntax, it is easy to do, because in the Flash's AS panel, keywords have different color display. Many flash birds may start complaining, can't remember? I have a way here, it is back. Don't let the tears of your grievances, we all came over. You will remember more than two times. Here, we have to develop a good habit of programming from the beginning. If you have a semicolon after each statement, it is possible, try to give a complex statement. An example of the annotation // This is a comment, but only one line / * This is also a comment, you can write a lot of lines * / Next, introduce several types of syntax. 1, several commonly used control scenarios, such as Play (); // Let the timeline of the timeline play STOP (); // Stop the timeline of the timeline to trigger the frame GotoandPlay (); // Let the pointer Jump to a frame, then continue playing gotoistStop (); // Let the pointer jump to a frame, stop in that frame nextframe (); // take a frame down prevframe (); // Go forward The frame above is a method. method? Solution: Take a bit, we call to eat as a method to solve the problem of hungry. We manage STOP () called a method to solve the problem of time axis. We have a few things on the top of the tube to solve the problem of time axis pointer movement. 2, control the syntax of the attribute. There are a lot, I have listed a few _x _y _alpha _width _name ..... The above attribute properties is attribute attribute? Solution: Tell a bit. We manage your height called attributes to identify your height. We manage your body weight attribute, used to identify your quality. We used _X called attributes to identify the X-axis coordinate of the target. We tanal _alpha called attributes, used to identify transparency of the target ... I really rushed, hehe. 3
MyMC Button-> MyBTN Now we assume that the main scene is a house, MC is a table, buttons are books, how do you express houses, tables, books? As follows _root house _Root.mymc house. Table _Root.mymc.mybtn house. Table. Book here _root is the keyword of Flash, indicating the Timeline of the main scene. It is easy to understand right. The houses, tables, books here are "objects" we have to understand. When you find this object, you can do ways to operate the object. For example, I have to clean the house, clean it is a method, but the object is a house, the expression is this: House. Cleaning () If you can't express this object correctly, your cleaning will not be implemented correctly. * Description: Why is this after the cleaning ()? Because the cleaning method is not an object, in order to let Flash know this is a method, we must add (), or it will think that there is "cleaning" in the house. Now we can easily operate everything in the room, such as a house. Cleaning (); house. Wooden table. Corruption (); house. Glass table. Break (); house. Desk. Book. Look ( ); Etc., I believe that you have no problem with "translation" into the as code :) For example, if you want to stop playing, it is _root.stop (); to stop playback, _root.mymc.stop (); Now talk about relative paths. Still the above example. If you give you a command: repair the red chair inside the house. So how do you express it? It is: a house. Red chair. Repair () Where to tell you, you will know which one to repair the chair. But if he said: Repair you are sitting now. Red? Still blue? This will depend on which chair you are sitting. Then the relative expression is what I sit in. Repair (); here is not so written: House. I am sitting chair. Repair () is wrong, because I am sitting in the chair, I said Don't move the chair to the outside of the house, then this expression is wrong, because the chair is not in the house. In exchange, use the Flash example. Now I want to play my MYMC in the home scene, don't play at the beginning, but stop first. So what do you have? I guess the way may be on the frame of this MC in the main scene: _root.mymc.stop (); this is right. But once the name of mymc changes, you have to change this sentence. Is there a way to change this "MC" instance name, will we be found by the same AS? Of course, the premise is that your AS must "sit on this MC". Enter the editing state of the MC, write this.stop () on the first frame of the MC Timeline; this is also the keyword of the flash, this this refers to the Timeline in the AS. No matter where you are, where is this MC? What is named, I don't have, anyway, I will definitely stop. Why, because AS is "sitting on MC". If you write _root.stop (); then it is wrong. why? think carefully. This THIS is one of the keywords of the relative path. You have to understand it carefully. Another keyword is _parent. If you understand this, then _parent is not difficult to understand.