Third, the use of custom functions
Adding the concept of function may be Flash5 of the ActionScript language to improve in most flash content of the fans excited. Because in the old version of FAS, in order to achieve trigonometric functions like function, Flash animators have a lot of the set had a lot of instructions and commands among the roaming call, not to facilitate the implementation of efficient and low, and often in order to avoid hell, "200,000 lines" limit (this limit be eliminated in Flash5) and their brains tricks. Now, with the function, my friends, what we are afraid!
May be some familiar with the Java or C / C + + programming flashers have to say, and the concept of function is not very common thing in, what good talk. Actually not that simple. As I put it separately brought out to be a long introduction, we will certainly have an unusual between. Here we take a look at what it has mystery. In order to highlight key points, this section just talk about the use of custom functions, system function and pre-defined command object member functions for later revisit.
1, the custom function in the form and function
In accordance with Flash5 ActionScript orthodox interpretation of the online help, self-defined function expression of known function and unknown function is divided into two types. As follows:
function functionname ([argument0, argument1, ... argumentN]) (
statement (s)
)
function ([argument0, argument1, ... argumentN]) (
statement (s)
)
One well-known function can be used as a general sense, the function or a custom object constructor; unknown function specifically designed for the custom object loading methods (ie member functions). The following examples of these three functions:
(1) for general functions (features: You can return to the values):
function add10 (x) (
return x +10;
)
trace (add (10));
(2) as a constructor function (features: use of targeting members of this assignment, this is required):
function box (l, t, r, b) (
this.left = l;
this.top = t;
this.right = r;
this.bottom = b;
)
(3) used as a method of loading custom objects (features: in the constructor name added. Prototype that load method, which is required):
box.prototype.area = function () (
return (this.right-this.left) * (this.bottom-this.top);
)
Recommended links:
Overcome stage fright interview the 10 candidates recruited nirvana
PICK up phone 2
OGM Converter
Wang Wenjing's plan and action
Dealers Sustained growth Quartet
"Grey Dove" Into A Small Penguin Confuse Users Into A "chicken"
IDC Perspective
MOV to MP4
Report Languages Education
E-cology In The Pan Micro Series 54
Brief Science - Screen Savers
SWF to MP4
Sold 250 million shares of Stone would definitely quit Sina Sina
No comments:
Post a Comment