Let's take a look at an example:
- <? XML version = "1.0" encoding = "UTF-8"?>
- <Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute" creationcomplete = "createeffect (event);">
- <Mx: SCRIPT>
- <! [CDATA [
- Import MX. effects. Resize;
- Private var resizelarge: resize = new resize ();
- Private function createeffect (eventobj: Event): void {
- Resizelarge.tar get = button2;
- Resizelarge. widthto = 200;
- Resizelarge. heightto = 60;
- Resizelarge. duration= 1000;
- }
- ]>
- </MX: SCRIPT>
- <Mx: button id = "button1" label = "OK" Click = "resizelarge. end (); resizelarge. play (); "x =" 128 "Y =" 42 "/>
- <Mx: button id = "button2" label = "canel" Click = "button2.width = 100; button2.height = 30" x = "216" Y = "42"/>
- </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: