AS3 Flash: Controls complex changes to prevent uncertainty of operational behavior from interfering with changes

Source: Internet
Author: User
Tags continue variable

When you interrupt a Variant (tweened motion) in strange ways, it can be tricky to eliminate distractions and continue their subsequent changes. In this example we will show how to get smooth and reasonable feedback from complex changes (multiple tweens). Click here to view the effect in a new window.

Source file Download
control mechanism for changes
See the Timeline code annotation in the Tweencotrol.fla file in the package to see how it manages complex changes by adjusting the relationship between the card movement and the card's response to the mouse. The basic idea is as follows:
        When a change needs to be aborted, the Tween.stop () method must be used.
        Otherwise, events Tweenevent.motion_change and Tweenevent.motion_finish will continue to trigger, This is even after your tween variable is given a new value.
        The listener that eradicated all change events after the stop change. Otherwise, the listener will linger on after the change, and there may be a problem.
        Stores the changed attribute values in a variable for continued smooth change. The

Transparent object will maintain a response to the mouse action
There's a trick in the example that makes you feel useful--it's creating a transparent object that is invisible while maintaining sensitivity to the mouse. The cards on the top line respond to Roll_over and roll_out events. In order for the Roll_out event to be performed neither because of the card rotation nor because of the mouse removal. We put the two front cards into the sprite container of the corresponding size, and we drew a transparent background in those containers. This allows the container to react to the mouse action and be transparent as ever. The listener for Roll_over and roll_out is attached to the container instead of the card. Therefore, the Roll_out event will not be triggered unless the user removes the mouse from the card's area.

AS3 Custom class named Cardrotator
In our example, we used a custom cardrotator class that can be arranged in depth and flip any card on the stage, and this class can also make arbitrary perspective and projection settings. This class is not used to solve the problem of change control, it just gives a good example. This Cardrotator class has been introduced and discussed in our tutorial z-sorting of a 3D card and the projection Center in Flash CS4.

The Blur effect of the object of the objects
you may notice that the edge of the 3D card is less "sharpness" than the corresponding 2D card stored in the library. That's thanks to a well-known 3D object blur effect. This oneSpecial effects can be used to do many articles, and recently we will submit a new version of the Cardrotator class with a clear edge 3D object. This version will be based on the techniques introduced in our Tutorial: Simple and Sleek Solution to blurring of 3D Objects in Flash Player.










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.