3D Hand flash Organ effect using AS3 to create images

Source: Internet
Author: User
Tags copy

Original: http://www.flashandmath.com/flashcs4/leo/index.html

Let's introduce a custom AS3 class, Imageaccordion, to fold and unfold the picture like an accordion. We use the 3D method of FlashPlayer10 native, and the effect is very realistic. When clicked, the picture is folded or expanded in the form of a motion tween.
Next, let's discuss the Imageaccordion class, which is the core of the effect.

Using the Imageaccordion class

What did you see in the show above? Two Imageaccordion class instances, one instance per image.
The Imageaccordion class extends from Sprite. Its constructor has four parameters, one required, and three optional

    1. New Imageaccordion (bd:bitmapdata,df:number=0.5, lf:number=0, sl:int=10)
Copy Code The first parameter is the BitmapData object of the picture, you can import the picture into the library and use the AS3 link, either through Flex or at runtime (loading).

The values of
"DF" and "LF" are passed to the "Darkedgefactor" and "Lightedgefactor" properties in the class. These values determine the darkness of the bottom edge and the brightness of the top edge. "DF" preferably between 0-1, the greater the DF value is darker. Likewise "LF" is preferably also between 0-1. The larger the number, the brighter it is. The default setting corresponds to a picture with a good luminance. The last parameter is the number of folds of the accordion.





in the sample FLA file, we use the graph in the library, which establishes the link through AS3, and the class name is Leonardo and Monalisa respectively. Then we create two imageaccordion, one for each image. Here is the code for creating the first instance on the timeline (the Flashandmath folder in the Zip package is in the same folder as your FLA file so that the Imageaccordion class can be found)
    1. Import flashandmath.as3.ImageAccordion;
    2. var accordion:imageaccordion=new imageaccordion (New Leonardo (224,350), 0.5,0,14);
    3. This.addchild (accordion);
    4. accordion.x=160;
    5. accordion.y=235;
Copy Code

We rotate the first instance-30 degrees, Z coordinates to 100, so it becomes smaller and clearer.

Next we do the same thing with the Mona Lisa, just put her on the right and rotate it 30 degrees.

The text you see on the stage is written dead in Flash. Of course, you can also use dynamic text to load other content from the outside at run time. The Imageaccordion class has two public properties: Tweendownduration and Tweenupduration. They default to 50 and 40. You can easily change their values, such as setting:

accordion.tweenupduration=20;










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.