Optimization of Flash Platform Technology (5) disabling mouse Interaction

Source: Internet
Author: User

Disable mouse interaction as much as possible.
When interactive objects (such as movieclip or Sprite objects) are used, Flash Player executes the Local MachineCodeTo detect and process mouse interactions. When many interactive objects are displayed on the screen, especially when they overlap, detecting mouse interaction may occupy a large amount of CPU resources. One easy way to avoid this is to disable mouse interaction for objects that do not require any mouse interaction. The following code describes how to use the mouseenabled and mousechildren attributes:
// Disable any mouse interaction with this interactiveobject
Myinteractiveobject. mouseenabled = false;
Const max_num: Int = 10;
// Create a container for the interactiveobjects
VaR container: SPRITE = new sprite ();
For (var I: Int = 0; I <max_num; I ++)
{
// Add interactiveobject to the container
Container. addchild (New sprite ());
}
// Disable any mouse interaction on all the children
Container. mousechildren = false;
Disable mouse interaction as much as possible, which helps your applicationProgramUse less CPU to reduce battery usage.

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.