Flash production with keyboard keys to control animation examples

Source: Internet
Author: User
Direction | control

Today for everyone to make a keyboard with the key to control the animation, animation effect you can directly point to animation, and then press the keyboard on the arrow keys can see the effect! I hope you like it.

Click here to download the source file

1. Create a flash document of 250x190 size. Then import the prepared picture footage into the stage. Then press Ctrl+f8 to create a new component, type movie Clip, and then add a layer named: Images and script, as shown in the following illustration:

  

2. Then put the MC on the stage, click with the mouse, and then name an instance square:

3. Below we add action instructions to the script layer of the movie clip var speed = 5 Use a variable, click the arrow keys can move 5px, and then use This.onenterframe = function () {} to determine which key was pressed!

4. Then add the code for the identification key:

5. Set the change distance of coordinate, namely speed.

6. The final code is as follows:

7. Finally put the imported pictures into the images layer inside! This tutorial is very simple, the main to let beginners a simple understanding of ActionScript code! I hope you like it! Please continue to pay attention to this site! Thanks for reading.



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.