MC events are described as follows:
Load: This event occurs when MC is loaded in.
EnterFrame: This event occurs when MC is detached.
MouseDown: This event occurs when the left mouse button is pressed.
MouseUp: This event occurs when the left mouse button is released.
MouseMove: This event occurs when the mouse moves.
Keydown: This event occurs when the keyboard button is pressed.
Keyup: This event occurs when the keyboard button is released.
Data: Use the loadVariable or loadMovie action. This event occurs when Data is received.
MovieClip (object)
The MC object method specifies some standard actions to operate the MC object. In addition, additional functions other than the standard actions listed in the Action panel are provided. When you call the method of the MC object, you do not need to call the constructor first. Instead, you can use the following syntax to directly reference the MC object name.
AnyMovieClip. play ();
AnyMovieClip. gotoAndPlay (3 );
MovieClip object method list:
Method description
AttachMovie binds a segment of movie in the library.
DuplicateMovieClip copies the specified movie clip.
GetBounds returns the maximum, minimum, and Y coordinate values of Movie in the specified coordinate space.
GetBytesLoaded returns the number of bytes loaded in the specified MC.
GetBytesTotal returns the total number of bytes of the specified MC.
GetURL executes the URL request.
GlobalToLocal converts the pointer object from the coordinate system in the home scene to the local coordinate system of the specified MC.
GotoAndPlay jumps to the specified frame in MC and starts playing the animation.
GotoAndStop jumps to the specified frame in MC and stops playing the animation.
HitTest returns true if the range of the specified MC is different from that of the target MC.
LoadMovie loads the specified animation into MC.
LoadVariables loads variables from URLs or other locations to MC.
LocalToGlobal transfers the pointer object from the local coordinate system of MC to the coordinate system in the home scene.
NextFrame plays the next frame of MC.
The MC specified by play
PrevFrame plays the previous frame of MC.
RemoveMovieclip deletes the MC generated by the duplicateMovieClip action or the attachMovie method from the time line.
StartDrag specifies a MC that can be dragged and starts to drag the MC.
Stop stops playing the current animation.
StopDrag Stops any MC currently being dragged.
SwapDepths swaps the specified MC with the MC where the specified depth value is located.
UnloadMovie deletes the animation loaded with loadMovie.
MovieClip. attachMovie
Syntax:
AnyMovieClip. attachMovie (idName, newname, depth );
Parameters:
The name of the Movie in the library to bind the idName. This is the identifier name entered in the Linkage Properties dialog box of the element.
Newname is the entity name bound to MC and must be unique.
Depth is an integer used to specify the depth of MC.
Note:
Method; generates a new object for the animation in the library and binds it to the specified anyMovieClip. You can use the removeMovieClip or unloadMovie action or method to delete the bound animation.
PLAYER:
Flash 5 or later.
Refer:
RemoveMovieClip
UnloadMovie
MovieClip. removeMovieClip
MovieClip. unloadMovie
MovieClip. duplicateMovieClip
Syntax:
AnyMovieClip. duplicateMovieClip (newname, depth );
Parameters:
Newname: the unique identifier used by MC to copy data (that is, the object name ).
The depth of the MC where depth is copied.
Note:
Method. A new object of the specified MC is generated during the animation operation. The produced MC always starts playing at the first frame, regardless of the frame of the original MC When the MC is copied. The variables in the original MC will not be copied to the newly generated MC. If the original MC is deleted, the MC copied by it will also be deleted. The MC generated by duplicateMovieClip can be deleted using the removeMovieClip action or method.
PLAYER:
Flash 5 or later
Refer:
RemoveMovieClip
MovieClip. removeMovieClip
MovieClip. getBounds
Syntax:
AnyMovieClip. getBounds (targetCoordinateSpace );
Parameters:
The target path of the coordinate system used by targetCoordinateSpace as the conversion reference point.
Note:
Returns the range of x and y coordinates in the target coordinate system specified by MC in the parameter. The returned object contains the following attributes: {xMin, xMax, yMin, yMax}. Use the localToGlobal and globalToLocal methods of the MC object to convert the local coordinate system and the coordinate system of the main scenario.
PLAYER:
Flash 5 or later
Example:
In the following example, getBounds is used to obtain the coordinate range of the myMoviceClip object in the coordinate system of the main scenario:
MyMovieClip. getBounds (. _ root );
Refer:
MovieClip. globalToLocal
MovieClip. localToGlobal
MovieClip. getBytesLoaded
Syntax:
AnyMovieClip. getBytesLoaded ();
Parameters:
None
Note:
Method; returns the number of bytes loaded by the specified MC object. Because the internal MC is automatically loaded, When the MC object is an internal MC, the return value of this method is the same as that of MovieClip. getBytesTotal. This method is especially used in loading animations. You can compare getBytesLoaded and getBytesTotal to know the percentage of external animation loads.
PLAYER:
Flash 5 or later
MovieClip. getBytesTotal
Syntax:
AnyMovieClip. getBytesTotal ();
Parameters:
None
Note:
Returns the total number of bytes of the specified MC object. For external MC (actively drawn or loaded to a target MC or MC in the layer), the returned value is the size of the SWF file.
PLAYER:
Flash 5 or later.
MovieClip. getURL
Syntax:
AnyMovieClip. getURL (URL [, window, variables]);
Parameters:
The URL request to be executed.
Window: an optional parameter that specifies the window name or frame name of the URL response. You can also use the following target name: _ self uses the current frame in the current window, _ blank specifies a new window, And _ parent specifies the parent window of the current frame, _ top specifies the top-level window of the current window.
Variables: an optional parameter that specifies the method for passing a variable. If no variable is passed, this parameter is ignored. Otherwise, the method for passing a variable is GET or POST. The GET method adds the variable to the end of the URL, which is usually used when there are few variables. POST transmits variables in an HTTP header separated by variables, which is usually used for a long time.
Note:
Method; execute a specific URL response in a specific window. The getURL method can also be used to pass variables to another application defined by the URL, through the GET or POST method.
PLAYER:
Flash 5 or later
MovieClip. globalToLocal
Syntax:
AnyMovieClip. globalToLocal (point );
Parameters:
Point: an Object with x and y coordinates as attributes (this is a pointer Object for the time being). This Object is obtained by generating a new generic Object.
Note:
Method to convert the pointer object from the coordinate system of the main scenario to the local coordinate system of MC.
PLAYER:
Flash 5 or later
Example:
In the following example, a pointer object containing the x and y coordinates of the main scenario is converted to the local coordinates in MC.
OnClipEvent (mouseMove ){
Point = new object ();
Point. x = _ root. _ xmouse;
Point. y = _ root. _ ymouse;
GlobalToLocal (point );
_ Root. out = _ xmouse + "=" + _ ymouse;
_ Root. out2 = point. x + "=" + point. y;
UpdateAfterEvent ();
}
Refer:
MovieClip. localToGlobal
MovieClip. getBounds
MovieClip. gotoAndPlay
Syntax:
AnyMovieClip. gotoAndPlay (frame );
Parameters:
The frame position to be set for the frame playback header (that is, the frame position to start playing ).
Note:
Method. The animation is played at the specified number of frames.
PLAYER:
Flash 5 or later.
MovieClip. gotoAndStop
Syntax:
AnyMovieClip. gotoAndStop (frame );
Parameters:
The position of the frame to be moved from the frame playback header.
Note:
Method; jump to the specified frame and stop playing the animation.
PLAYER:
Flash 5 or later.
MovieClip. hitTest
Syntax:
AnyMovieClip. hitTest (x, y, shapeFlag );
AnyMovieClip. hitTest (target );
Parameters:
X coordinates of the click area in the home scene.
Y coordinates of the click area in the home scene.
The x and y coordinates are defined in the coordinate system of the main scenario.
Target determines the target MC to which the anyMovieClip object is located. This target is usually represented as a button or a text box.
ShapeFlag is a Boolean value. When it is a (true) value, it is determined based on the shape of the object. When it is a (false) value, then, it is simply determined according to the range box of the object (that is, according to the upper, lower, and lower range of MC. This parameter is only used in the first form.
Note:
Method to Determine whether the specified anyMovieClip is overlapped with another MC or a vertex specified by x. y.
The first method is to compare the shape or range frame of the specified object (set by shapeFlag) with the x and y coordinates. If shapFlag is true, the actual shape of the object is compared. If any vertex in the object goes through (x, y), the return value of this method is true. This is useful when determining the specified click area (hot zone) of MC.
The second method is to determine whether the range boxes of the specified object and target are cross. The crossover of any vertex will result in the return value being true.
PLAYER:
Flash 5 or later
Example:
The following example checks whether your MC entity yourmc goes through the point (100,200 ):
If (yourmc. hitTest (100,200, false); // (100,200) coordinates of the points you determine
The last parameter: false indicates whether the value of the range box (upper and lower left) of yourmc passes through the (100,200) Point.
True: determines whether the actual shape of yourmc goes through (100,200) points.
The following example uses the hitTest, x_mouse, and y_mouse parameters to determine whether the mouse passes through the range of the target MC:
If (hitTest (_ root. _ xmouse, _ root. _ ymouse, false); (Put It In The onClipEvent (enterFrame) event of MC; otherwise, the effect will not be displayed)
The following example checks whether the MC object ball matches the square of another MC object:
If (_ root. ball. hittest (_ root. square )){
Trace ("ball intersects square ");
}
Refer:
MovieClip. localToGlobal
MovieClip. globalToLocal
MovieClip. getBounds
MovieClip. loadMovie
Syntax:
AnyMovieClip. loadMovie (url [, variables]);
Parameters:
Url to the absolute or relative URL path of the SWF file to be loaded. The relative path must be connected to the SWF file. The URL path must be in the same subdomain of the current animation path. When FLash Player or Test-mode is used in FLash, all SWF files must be placed in the same directory, and the file name cannot contain the folder name and drive name.
Variables: an optional parameter. It specifies the method used to associate variables when loading an animation. This parameter must be a string of "GET" or "POST ". If no variables are associated, ignore this parameter. Otherwise, the method for loading variables is GET or POST. The GET method adds the variable to the end of the URL, which is usually used when there are few variables. POST transmits variables in an HTTP header separated by variables, which is usually used for a long time.
Note:
Method; when the flash player is not disabled, play the attached animation. Generally, flash players play a single animation (SWF file ). The loadMovie method allows you to play multiple animations at a time or jump between animations without any HTML requests.
Use the unloadMovie action to delete an animation loaded with the loadMovie action.
Use the loadVariables method to keep the current animation, and update some variable values to new values.
PLAYER:
Flash 5 or later
Refer:
MovieClip. loadVariables
MovieClip. unloadMovie
MovieClip. loadVariables
Syntax:
AnyMovieClip. loadVariables (url, variables );
Parameters:
The absolute or relative url path of the URL external file. The Host Name of the URL must be in the subdomain of the current animation.
Variables return the variable method. The GET method adds the variable to the end of the URL, which is usually used when there are few variables. POST transmits variables in an HTTP header separated by variables, which is usually used for a long time.
Note:
Method; read data from external files and set the animation or MC variables. This external file can be a text file generated by CGI, ASP, and PHP programs, and can contain any number of variables.
This method can be used to update the variable value of the current animation to a new value.
This method requires that the URL-connected text must be in the standard MIME format:
Application/x-www-urlformencoded (CGI program format ).
PLAYER:
Flash 5 or later
Refer:
MovieClip. loadMovie
MovieClip. localToGlobal
Syntax:
AnyMovieClip. localToGlobal (point );
Parameters:
Point: an Object with x and y coordinates as attributes (this is a pointer Object for the time being). This Object is obtained by generating a new generic Object.
Note:
Method to convert the pointer object from the local coordinate system of MC to the coordinate system of the main scene.
PLAYER:
Flash 5 or later
Example:
In the following example, the X and Y coordinates of the pointer object from the local MC are converted to the coordinate system of the main scenario. The local X and Y coordinates are obtained using xmouse and ymouse.
OnClipEvent (mouseMove ){
Point = new object ();
Point. x = _ xmouse;
Point. y = _ ymouse;
_ Root. out3 = point. x + "=" + point. y;
_ Root. out = _ root. _ xmouse + "=" + _ root. _ ymouse;
LocalToGlobal (point );
_ Root. out2 = point. x + "=" + point. y;
UpdateAfterEvent ();
}
Refer:
MovieClip. globalToLocal
MovieClip. nextFrame
Syntax:
AnyMovieClip. nextFrame ();
Parameters:
None
Note:
Method; set the MC playback header to the next frame.
PLAYER:
Flash 5 or later
MovieClip. play
Syntax:
AnyMovieClip. play ();
Parameters:
None
Note:
Method; dial MC.
PLAYER:
Flash 5 or later.
MovieClip. prevFrame
Syntax:
AnyMovieClip. prevFrame ();
Parameters:
None
Note:
Method; set the playback header to the previous frame and stop playing.
PLAYER:
Flash 5 or later.
MovieClip. removeMovieClip
Syntax:
AnyMovieClip. removeMovieClip ();
Parameters:
None
Note:
Method; Delete the MC object, which is generated by the duplicateMoviceclip action or the attachMovie method of the MC object.
PLAYER:
Flash 5 or later.
Refer:
MovieClip. loadMovie
MovieClip. attachMovie
MovieClip. startDrag
Syntax:
AnyMovieClip. startDrag ([lock, left, right, top, bottom]);
Parameters:
Lock a Boolean value. When it is (true), the detachable MC will be locked in the center of the mouse; when it is (false, the detachable MC will be locked at the position where the user clicks this MC for the first time. This parameter is an optional parameter.
Left, top, right, and bottom are optional parameters that limit the range of MC constraints to be dragged.
Note:
Method. You can drag the specified MC. This MC will remain drag-and-drop until the stopDrag method is executed, or other MC will be set to drag-and-drop. At the same time, only one MC can be dragged.
PLAYER:
Flash 5 or later
Refer:
MovieClip. stopDrag
_ Droptarget
MovieClip. stop
Syntax:
AnyMovieClip. stop ();
Parameters:
None
Note:
Method to stop the current MC.
PLAYER:
Flash 5 or later.
MovieClip. stopDrag
Syntax:
AnyMovieClip. stopDrag ();
Parameters:
None.
Note:
Method. After a MC executes the startDrag method, the MC retains the drag State until the stopDrag method is executed or other MC is set to the drag state. At the same time, only one MC can be dragged.
PLAYER:
Flash 5 or later.
Refer:
_ Droptarget
MovieClip. startDrag
MovieClip. swapDepths
Syntax:
AnyMovieClip. swapDepths (depth );
AnyMovieClip. swapDepths (target );
Parameters:
Target is a MC object. Its depth value is exchanged with the depth value of the entity specified by anyMovieClip. The two entities must have the same parent MC.
Depth specifies the depth value to be placed in anyMovieClip.
Note:
Exchange the z value or cascade Order (depth) between the target or depth MC specified by the same object parameter ). The two entities must have the same parent MC. The purpose of exchanging the depth value of an object is to place an object before or after another object. If MC is performing a transition when converting the depth, the transition of MC stops. (After testing, the current MC transition action is stopped, rather than the internal transition action of the MC .)
PLAYER:
Flash 5 or later
Refer:
_ Level
MovieClip. unloadMovie
Syntax:
AnyMovieClip. unloadMovie ();
Parameters:
None
Note:
Method; Delete the MC loaded using the loadMovie or attachMovie method.
PLAYER:
Flash 5 or later
Refer:
MovieClip. loadMovie
MovieClip. attachMovie