Let Flash listen: flash and microphone interaction

Source: Internet
Author: User
Tags modify
This tutorial is the interaction of flash and microphone. Hopefully, you'll get better inspiration by learning this microphone interactive tutorial.

First look at this example, click Allow[Allow] and make a sound with the microphone, the effect is as follows:

OK, here we will step by step to achieve the above flash function:

1. Turn on flash and create a new 300*200 scene

2. Draw a medium circle in the scene with the drawing Circle tool in the toolbar

3. Turn this circle into a component and set it as a movie clip--Select the circle you just painted, click F8, or click [Modify][modify]-[to convert to symbol][convert to symbol], select [Movie clip][movie Clip] in the dialog box, click [OK] [ Ok

4. After completing the previous step, we click on the component in the scene and enter Circle in the [Instance Name] in the properties panel

5. Now we can write our ActionScript commands in the first frame of the timeline-click the first frame in the Timeline panel, click F9 or [Window][window]-[action] [Development Panels-action], Enter the following program into the action panel:

Code:

m = Microphone.get (); Attachaudio (m); M.setuseechosuppression (FALSE); Onenterframe = function () {Circle._xscale = Circle._yscale = m.activitylevel+50;};
6. By completing the above steps, you will be able to preview the--[file in your Web page]-[release preview]-[html]. Let's explain the meaning of each line of code for you:

Code:
m = Microphone.get ();
Let the Flash program connect to the signal entered by the microphone

Code:
This line of command connects audio to the _root so that each object can communicate with ' m '

Code:
M.setuseechosuppression (FALSE);
Prevents the echo from being affected by the code:
Onenterframe = function () {Circle._xscale = Circle._yscale = m.activitylevel+50;             };
The function of this code is to use the sound to control the size of the graphics we set, and the Activitylevel is to return a value of 0-100 from the input of the sound.

OK, this tutorial is over, we can practice more, may have unexpected effect!

Don't translate well, please refer to me just as there are errors please PM me



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.