A guide to the summarization and 2006_flash of volcanic basic development habits

Source: Internet
Author: User
General Description: Everyone playing flash after a period of time, will certainly form their own set of development habits. Good habits can avoid low-level mistakes and unnecessary problems as much as possible, thus speeding up the development process and improving the quality of development. Although the volcano is now amateur, but two years of accumulation, coupled with the "Volcano House" development, but also naturally formed a volcanic characteristics of the development habits. These habits in some way reflect my current level of development, so it is basically around the small, fast, process-oriented development model, many places are very naïve. However, with the continuous improvement of my ability, as well as the learning of object-oriented programming ideas, it must be constantly updated and perfected.

→ library Folder classification habits:
1, sound, picture each put into separate folders, put to the bottom of the library.
2,MC is categorized into different folders according to the columns.
3, the general use of graphics components.

→ time axis management habits:
1, the top level is as layer, if the as layer more than three layers, then create a special as Layer folder. Multilayer as layers need to be aware of the sequence of code execution.
2, the second layer is the label layer.
3, the home view of other layers by column folder classification, but a MC in general only for a column, do not classify.
4, the same nature and the impact of small elements of a layer, the other independent layering, and according to the visual effects of the upper and lower layers.
5,loading, transition animation, feature pages are divided into different scenes.

→ Component naming habits:
1, the name of the component in the library:In Chinese name, add the suffix of a specific component, such as I have a "navigation" component, the button is named: "Navigation Btn", the movie clip is named: "Navigation MC." Sounds and pictures are named directly using the navigator.
2, the three-step unity of the name: The name of the component in the library, the instance name in the scene, and the name of the layer to be consistent as much as possible. For example, a component in the library name is: "Navigation MC", it is in the scene of the instance name is "DAOHANG_MC", it is located in the layer name "navigation." In this way, when the number of components is very large, the amount of code written is very high, you can effectively save the naming and lookup time, while avoiding reference errors.
3, text field naming: If there is only one dynamic text field in an MC, it is named "Wenben_txt" with the variable named "Wenben_var". If there are more than two dynamic text fields, they are named according to their capabilities.

→ Architectural Habits:
1, three layer separation: Main scene data layer, animation layer, code function layer to separate. Because the data load completes, will cause the short animation to be not fluent, therefore I generally in the loading scene loads the data to complete together, then enters the animation scene. A large number of time axis animation will cause confusion in the project structure, so I usually will be the animation also processed as a stand-alone scene, the animation of the last one to copy, and then create a new feature scene and paste, all the core code is concentrated in the functional scene.
2,MC structure: Because each MC basic and quite a separate small SWF, so its structure also as far as possible to follow the "three-layer separation" of the idea.
3,MC Double-Ching: Each MC is kept two-jeong. Although most of the cases can be used to complete the task of a Zhen, but I will be dedicated to a chastity, for the possibility of chastity data refresh room.
4, the component nesting structure is generally not more than three layers, in the case of compelling, but also to ensure that the code is not written in the three-layer components.
5, the external invocation SWF is all defined: _lockroot = True.
6, the external invocation of the SWF will never use _level0, unless specifically required.

→ Volcanic Chinese pinyin oriented process structured code writing habits:
One, the code distribution: All the code is written on the timeline, generally in the first chastity, components do not write code. The code on the main scene is responsible for the initial setup of the entire system, and the code on each MC timeline is integrated into one.
Second, code structure: (in the Code Editor from top to bottom in order)
1, System initialization:
① interface initialization: Includes encoding settings, stage settings, component visibility, usability, and so on.
② variable initialization: The timeline or global variable initialization.
③ Array initialization: An array that is initially required and is assigned using loops.
④ Object initialization: All initially needed objects, and registers the listener.
2, Code logic structure: Here is the entire code logic structure, generally through a series of function calls to make a variety of functions organically combined.
3, function block: Generally define each function block in the order of logical structure and encapsulate it into function.
Third, the naming habit: all use Chinese pinyin whole spelling.
1, variable naming: using "var" for the timeline variable declaration, and the use of Chinese all desperately name, the first letter capitalized, example: Var liuyan= "";
2, array and object naming: Using the full spelling of the corresponding suffix, example: var shuzu_array=new array (); var liuyan_lv=new loadvars ();
3, the function of the local variable name: Using the full spell "FC" suffix, example: function Fanye (ANNIU_FC);
4, external communication variable name: external to the flash variable, add the corresponding suffix:
Example: TXT passed to flash variable use: liuyan_txt,asp is: liuyan_asp.
Flash is passed to external variables plus "flash" suffix, example: Yeshu_flash.
Four, the annotation habit:
1, the position of the note: I am generally used to write notes in front of the code. Which is to annotate and then code first.
2, the annotation frequency: basically is the line-by-row annotation, is also the function-by-feature annotation at least.
3, annotation structure:
Module-level code is delimited by "===============".
The functional level code is delimited with "——————".
General comments are made directly with "//".

★ Nagging two sentences:
Today can think of so much, since is the first time to think of, certainly is my deep-rooted habit, later thought of, and then fill up. In fact, I send this post mainly has three intentions: first, self-consolidation and improvement; second, after nothing, I may write a tutorial, this thing will be convenient for beginners to understand my source files; third, hope Rich development experience of the predecessors also talk about their habits, good to us these younger generation refers to road!
In addition, this article is written in fact are some of the most basic operating habits outlined, there are a lot of advanced or special habits and a lot of details, here is not to write, or will be the integrity of the article, and hurry, a sentence of two must also be written. specific to which project concrete analysis of specific issues:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.