1 coordinates system of main scene and movie clip element
(1) In the development of flash games, many times the use of flash coordinate systems, such as jigsaw puzzles are also used in the flash coordinate system, which is important for understanding flash.
(2) The main scene coordinate system in Flash is different from the central origin of the coordinate system of the movie clip element, the center of the Home view coordinate system is the upper left corner of the stage work area, as shown in the figure.
(3) The coordinate system origin of the movie clip symbol as shown in the picture, it is the center of the movie clip symbol as the original point of the
2 The relationship between film clip elements and main scene coordinate system
When the movie clip element is dragged into the main scene, a coordinate system relationship is established.
(1) Create a flash animation, the long width is: width=300,height=300. Create a movie clip symbol, and draw one in the movie clip symbol
The long width is a blue square of 100px. Note Be sure to align the midpoint of the Blue square with the center Cross of the movie clip symbol. The coordinate system of the main scene and the film
The clip symbol coordinate system is aligned by the center Cross of the movie clip element.
(2) Back to the animation main scene workspace, drag the movie clip symbol from the library panel to the main scene stage workspace, as shown in the figure.
(3) in the home scene stage workspace, draw two dynamic text boxes that display the value of the "Pointa" variable, and the following text box to display the value of "POINTB" as shown in the figure.
(4) Select the movie clip symbol instance in the home scene, bring up the "Properties" panel, and give the movie clip symbol a name "MC".
(5) Add the following ActionScript script code to the "MC" movie clip symbol instance:
Onclipevent (MouseMove) {
Updateafterevent ();
_root.pointa= "_root.xpos:" Add _root._xmouse Add newline Add "_root.ypos:" Add _root._ymouse;
_root.pointb= "Mc.xpos:" Add this._xmouse Add newline Add "Mc.ypos:" Add this._ymouse;
In the above script, "-root.-xmouse" is to get the mouse position in the home scene, its reference coordinate system is the main scene, through the experiment can see
The upper-left corner of the main scene is "0", which is the coordinate origin.
"This-xmouse" and "This.-ymouse" are obtained by the mouse in the center of the movie clip symbol the cross coordinates are "0", that is, the coordinate origin.
(6) Test movie animation, observe the effect, as shown in the picture
Click here to see the effect
Click to browse the file