Now we need to perform the drag operation on C with the mouse. So that it can be moved freely in Area A, but since C is contained in Area B, it can only be moved in Area B when startdrag () and stopdrag () are used, but cannot exceed the boundary of B.
If we want C to move in a, we should use an attribute named clipcontent.
The following is the definition of this attribute:
Whether to apply a clip mask if the positions and/or sizes of this container's children extend outside the borders of this container.
Its Chinese meaning is roughly:
Whether to apply a clipping mask if the position and/or size of the sub-item of the container expand beyond the border of the container.
Clipcontent value:
True: when the sub-project boundary exceeds this container, the sub-project is not displayed in this container.
Flase: when the sub-project boundary exceeds this container, the sub-project is displayed in this container.
Clipcontent is a public propertie in the iner. Therefore, some container controls commonly used in Flex are as follows:
This attribute can be used by accordion, box, canvas, form, formitem, layoutcontainer, panel, tile, and viewstack.
That is, in B, we set clipcontent = false to achieve the desired effect. When C is moving, if D is encountered, it will be under D. What is the problem?
Because in the coding structure, the Z-index of D is higher than that of B, so when C moves, it will be blocked by D (although C can be moved anywhere in)
So let's make the following settings:
Place the Z-index of B on the Z-index of D. The method we use is setchildindex (this method is very common, so I will not repeat it here .)
Therefore, in a complicated nested container, if you want to move one of the sub-containers in the outermost container, you should make the following settings:
1. The parent container of the sub-container to be moved (of course there may be parent containers on top of this parent container) should be displayed at the top of the container to be moved.
Example: A → B → C → D → e
F → G → H
If you want to move e to A, you need B to be on F, that is, use setchildindex to reset the positions of B and F.
2. Set clipcontent of the d container to false.
Above, I hope it will be helpful to you :)