Mouse Pull Box bulk operation movie Clips

Source: Internet
Author: User
Tags abs array eval range
The mouse demo effect is as follows:

http://www.flash8.net/bbs/UploadFile/2005-7/2005715151821114.swf

Click here to download the source file


This is the test program, so only the effect is displayed, and the following is the as script----------------------------------
Stagel = 0;
Staget = 30;
StageR = Stage.width;
Stageb = Stage.height;
The above is the initialization of the selection range;
var my_mc = new Array ();
Create an array to store the MC;
OnLoad ();
Reload_btn.onrelease = function () {
OnLoad ();
};
function onload () {
For (I=1 i<10; i++) {
Test0.duplicatemovieclip ("Test" +i, I);
}
For (i=0 i<10; i++) {
My_mc.push (eval ("Test" +i));
Tests = eval ("test" +i);
Tests._alpha = 100;
tests._x = Random (200) +100;
Tests._y = Random (200) +100;
}
}
Initialize animation elements;
var mouseobj = new Object ();
Mouse.addlistener (Mouseobj);
Monitor mouse events;
Mouseobj.onmousedown = function () {
if (_xmouse>stagel && _xmouse<stager && _ymouse>staget && _ymouse<stageb) {
box_x = _xmouse;
box_y = _ymouse;
Createemptymovieclip ("BOX_MC", 50);
With (BOX_MC) {
LineStyle (1, 0xff0000, 80);
Beginfill (0xff0000, 10);
MoveTo (0, 0);
LineTo (0, 1000);
LineTo (1000, 1000);
LineTo (1000, 0);
LineTo (0, 0);
Endfill ();
_width = 1;
_height = 1;
}
Box_mc.onenterframe = function () {
This._width = Math.Abs (_xmouse-box_x);
This._height = Math.Abs (_ymouse-box_y);
this._x = _xmouse<box_x? _xmouse:box_x;
This._y = _ymouse<box_y? _ymouse:box_y;
};
}
};
The above is to create a marquee within a selection range;
Mouseobj.onmouseup = function () {
This function is to process the data in the scope of the marquee;
if (box_mc!= undefined) {
If the selection box is constructed to perform the control function;
Control ();
Box_mc.removemovieclip ();
}
};
function control () {
For (i=0 i<my_mc.length; i++) {
if (Box_mc.hittest (My_mc[i])) {
The following procedure is the event to be performed for the operation within the marquee or the MC to which the marquee is contacted;
hits = My_mc[i];
Hits._alpha = 40;
In order to visualize the effect, I will be the selection of all the MC transparency changes.
}
}
}

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.