Example of the component effect in flex-the effect of The ActionScript Control Component

Source: Internet
Author: User

 

 

 

Let's take a look at an example:

 

  1. <? XML version = "1.0" encoding = "UTF-8"?>
  2. <Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute" creationcomplete = "createeffect (event);">
  3. <Mx: SCRIPT>
  4. <! [CDATA [
  5. Import MX. effects. Resize;
  6. Private var resizelarge: resize = new resize ();
  7. Private function createeffect (eventobj: Event): void {
  8. Resizelarge.tar get = button2;
  9. Resizelarge. widthto = 200;
  10. Resizelarge. heightto = 60;
  11. Resizelarge. duration= 1000;
  12. }
  13. ]>
  14. </MX: SCRIPT>
  15. <Mx: button id = "button1" label = "OK" Click = "resizelarge. end (); resizelarge. play (); "x =" 128 "Y =" 42 "/>
  16. <Mx: button id = "button2" label = "canel" Click = "button2.width = 100; button2.height = 30" x = "216" Y = "42"/>
  17. </MX: Application>

The resize object is created through ActionScript and the behavior control of a button component is implemented. The target button button2 is well-known through the target attribute of the object. The initialization of the effect object is implemented by loading the monitor creationcomplete. In the Click Event listener of the button component's button1, the following two ActionScript commands are defined and executed: resizelarge. end () is used to control the effect of the previous end. Here it plays the role of state resetting; resizelarge. play () is used for execution. The button component button2 defines the size reset for itself.

 

Running effect:

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.