search
HomeJavajavaTutorialHow Flash8 calls the camera to realize the photo taking function

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: http://www.php.cn/java-article-377109.html

To learn programming, come to PHP Chinese website www.php.cn

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool