Introduction to ActionScript learning-movie clip Control

Source: Internet
Author: User
Tags define arithmetic constant copy expression numeric
Control movie clip referred to as MC, in Flash, MC is a very important part of the flexible and reasonable use of the MC, can make your flash animation more exciting, more dynamic! In Flash 5, the MC gives the impression of being an object in the C + + language, it can define its own "private" variable, define its own function, and it can respond to events and handle it, and the MC can pass messages, control and sync with each other, The definition of an MC can be copied into a number of the same characteristics of the MC, although the MC can not be inherited, but I think that the MC called animation object is not too much. The production of MC has been discussed in detail in the previous chapters, in this section we mainly introduce some functions and objects that are related to MC in Flash.

£ functions related to move clip and their general form
duplicatemovieclip (<target>,<new name>,<depth>)
Copy an existing MC, where the target parameter is the name of the existing MC, new name is the name of the MC copied, depth is the depth of the new MC, it is noteworthy that each MC depth can not be the same, otherwise it will cause confusion, Depth large MC will cover depth small MC.
removemovieclip (<target>)
Remove a copy of the MC, where target is copied out of the MC's name. Non-duplicated MC can not be removed. Deletion means erasing both from memory and from the display screen. This action can only be used with duplicatemovieclip pairing.
loadmovie (<url>,<level|target>[, "Get" | " POST "])
Load an MC from a URL address, using an unknown usage.
unloadmovie (<level|target>)
Unload an already loaded MC, it can only match with Loadmovie.
startdrag (<target>[,true| False][,left,top,right,bottom])
Start dragging a mc,target as the name of the MC, the second parameter indicates whether you want the digital pointer to be set to the center of the MC, left,top,right,bottom four parameters indicate that the MC can only be dragged within the boxes defined by these two coordinates. These four parameters can be either a numeric constant or an arithmetic expression.
stopdrag ()
Stop the mouse on the MC drag.
onclipevent (< events >)
MC Event Response statement. Please see the previous introduction.
swapdepths (<target>,<target>)
Exchange two MC depth value, this statement is Flash 5 new statements, the control between the MC more convenient.
telltarget (<target>)
This is a very useful statement. It is used for the mutual control and coordination between MC. For example, an MC can tell another MC when to jump to which frame, an MC can also control when to load another MC, when to show it, when to uninstall it and so on. Reasonable use of telltarget statements, you can make your animation more ornamental.

£ Movie Clip Object
flash 5 provides a movie clip object, and the first 6 functions mentioned above are redefined in this object, and they can completely replace the previous 6 functions. The Movie clip object is defined as follows:
attachmovie (<idname>,<new name>,<depth>)
Binding a movie, resulting in a library of the MC entity, where the idname is the name of the MC in the library, new name is the name of the newly generated MC, depth for depth. Like a constructor function.
duplicatemovieclip (<new name>,<depth>)
Copy the current MC for the new MC, the significance of the parameters ibid.
geturl (<url>,<window>,<method>)
Enables the browser to browse to the specified page. Flash 5 has provided a separate Geturl function, do not know what is the special meaning of encapsulation to here?? Refer to the description of the Geturl function for the meaning of the parameter.
gotoandplay (<frame>)
Jump to the specified frame and play. The frame parameter can be a numeric constant, a string constant, or an arithmetic expression.
gotoandstop (<frame>)
Jump to the specified frame and stop playing. The frame parameter can be a numeric constant, a string constant, or an arithmetic expression.
loadmovie (<url>,<method>)
Introduce an external movie to the specified layer. The URL is a Web address, and method can be empty, get,post one of three.
loadvariables (<url>,<method>)
The Web server specified from the URL address introduces an external variable value. Parameter interpretation Ibid.
nextframe ()
Equivalent to gotoAndStop (Next frame).
play ()
Start playing the current MC from the current frame.
prevframe ()
Equivalent to gotoAndStop (previous frame).
removemovieclip ()
Remove the current MC, and the MC is created with the Duplicatemovieclip function.
startdrag (<true| false>,<left>,<top>,<right>,<bottom>)
Start dragging the current MC. The first Boolean parameter indicates whether the mouse is locked in the center of the current MC, and the Left,top,right,bottom four parameters define a rectangle, and the MC can only be dragged within this rectangular range.
stop ()
Stop the current MC playback.
stopdrag ()
Stop dragging the current MC.
unloadmovie ()
The current movie is unloaded and the current movie must be loaded by Loadmovie.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.