This article introduces how to use Actionscript3.0 to operate the computer camera and realize the camera function
The code has been tested by me and is available for reference.
1. Create three layers,
2. Ctrl+L to open the component library, right-click in the blank space, select New Video, name it whatever you want, and select the second video (subject to ActionScript control).
3. Drag the video component into the first layer, find the position, adjust the size, and set the video name to my_video in the properties
4. Insert the following into the first frame of the second layer Code:
//导入类 import flash.display.BitmapData; import flash.filters.BlurFilter; //获取摄像 var cam:Camera = Camera.get(); var my_video:Video; my_video.attachVideo(cam); //设置模糊对象 var blur:BlurFilter = new BlurFilter(10, 10, 2); var myFilters = [blur]; blurbutton.onPress = makeBlur; //定义模糊函数 function makeBlur() { capture(); } //获取截图函数 function capture() { var snap:BitmapData = new BitmapData(my_video._width, my_video._height); snap.draw(my_video); var temp:MovieClip = createEmptyMovieClip("bitmap_mc", 0); temp._x = 200; temp._y = 65; temp._xscale = 100; temp._yscale = 100; temp.attachBitmap(snap, 1); temp.filters = myFilters; } stop();
5. Create a new video clip, drag it to the third layer, and set its instance name to blurbutton
6. Test
This article is written by Provided by PHP Chinese website, the code introduces the outdated flash technology, for reference only
Article address: //m.sbmmt.com/java-article-377109.html
To learn programming, come to PHP Chinese website m.sbmmt.com
The above is the detailed content of How Flash8 calls the camera to realize the photo taking function. For more information, please follow other related articles on the PHP Chinese website!