Flash to realize the simulation straw eyedropper function animation

Source: Internet
Author: User
C continued before the softening feel that the bitmapdata function to do a lot of the effect before, especially in the production of artboards need the eyedropper tool, here as long as a line of functions can get the color we want. That's convenient.
Click to browse the file

MovieClip.prototype.smoothImageLoad = function (img) {//Soft picture
var m = this.createemptymovieclip ("MC", This.getnexthighestdepth ());
var listener = new Moviecliploader ();
Listener.onloadcomplete = function (mc:movieclip) {
Mc.onenterframe = function () {
var bitmap = new Flash.display.BitmapData (this._width, this._height);
Bitmap.draw (this);
This.attachbitmap (bitmap, 1, true, true);
This.smoothimageloadcomplete ();
Updateafterevent ();
}
};
Listener.loadclip (IMG, m);
};

MovieClip.prototype.pickColor = function () {//Get picture color
var bitmap = new Flash.display.BitmapData (this._width, this._height);
Bitmap.draw (this);
if (bitmap!= undefined) {
var mycolor = Bitmap.getpixel (This._xmouse, this._ymouse);
Return "0x" + mycolor.tostring. toUpperCase ();
}
}
This.createemptymovieclip ("MC", 0);
Mc.smoothimageload ("doggy.jpg");
Mc._xscale = mc._yscale=300;
This.onmousemove = function () {
MyColor = Mc.pickcolor (); Get the color function of the picture
var colortansform = new Flash.geom.ColorTransform ();
Colortansform.rgb = MyColor;
ColorMc.transform.colorTransform = Colortansform;
Colortxt.text = MyColor;
Updateafterevent ();
}

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.