Statement en, for with, I do not know what you flasher is a kind of understanding. In fact, with is theoretically not a very important statement, without with, many functions can still be implemented, because with itself is not responsible for creating, recycling any SWF resources.
However, the presence of with has greatly facilitated the design of our designers. The with in the code allows us to more clearly manage the specific MC.
For example, in a complex logic control to operate on the MC1,MC2,MC3, with a can make the program structure clearer.
With (MC1) {
//....
}
With (MC2) {
//...
}
With (MC3) {
//...
}
And the combination of the with and the method that can return the MC instance simplifies the program, for example
With (Mc0.duplicatemovieclip ("aw", 1)) {
Set the Properties for the Mc-aw
}
However, there is a problem that has been plagued by numerous flasher including mine. That's where this is pointing in with.
In with, you can access the properties of the MC by using _x,_y,_width, but this cannot point to yourself. This is related to the kernel of the WITH statement itself. I used to be depressed for a long time, for example, I want to add a variable to this MC, but can not use This.myvar = xxx; in fact, we do not care about these, because the MC itself according to the properties to find themselves, it is not impossible. Here are two attributes that are easily overlooked: _parent, _name.
Just need to set a handle to point to yourself on it, and we can set it to
Getthis = _parent[_name];
In this way, getthis is equivalent to this. More operations on the MC can be done with getthis, such as adding variables that can be used
GETTHIS.T = 19;
and the direct writing "t=19" is actually to assign this value to the parent of the MC.
Interestingly, using the with and then getthis nesting can still get itself, so that you can write an infinite hierarchy of nesting. Of course, this is only to illustrate the role of getthis, there is no meaning.