Using a For loop to detect multiple MC

Source: Internet
Author: User
The loop first looks at the effect.
Click to browse the file
Then copy the following code to the first frame, out of effect.
_root.createemptymovieclip ("M", 0);
With (m) {
Beginfill (0xff0000);
MoveTo (50, 0);
For (i=math.pi/180 i<=math.pi*2; i = math.pi/180) {
LineTo (50*math.cos (i), 50*math.sin (i));
}
Endfill ();
_visible = 0;
}//first draw a circle.
For (I=1 i<=7; i++) {
m = M.duplicatemovieclip ("M" +i, I);//Multiple replication
M.tempo = 0;//Set the initial value of the variable in each replicated MC
m._x = Location of the MC stage.width/40+i*70;//copied
m._y = STAGE.HEIGHT/2;
M.onenterframe = function () {
if (This.hittest (_xmouse, _ymouse, True)) {//For each MC, if the mouse is detected
New Zoomopen (this). Jumpskal (100,. 9,. 6);

The elastic method is invoked, where an instance of the object is created
} else {
New Zoomopen (this). Jumpskal (30,. 6,. 5);
}
};
}
function Zoomopen (MC) {//constructed an object
THIS.MC = MC;
}
ZoomOpen.prototype.jumpSkal = function (obj, Besch, friktion) {

Add an elastic method to an object
This.mc.tempo + = (obj-this.mc._xscale) *besch;
This.mc.tempo *= friktion;
This.mc._xscale = This.mc._yscale + = This.mc.tempo;
};
Complete.

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.