Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Flex effects component

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to use the Flex effect components, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Flex effect component

Rich Flex effects components are available in Flex. Because Flex effects are a gradual process based on time, all effects have the duration property, which sets the playback time in milliseconds. You can also control the number of times the effect is played and the interval between repeating the effect (in milliseconds) by setting the repeatCount property and the repeatDelay property, respectively. If you want to delay invoking the Flex effect for some time after the trigger is triggered, you can use the startDelay attribute.

1) Resize resizing effect

The Resize effect in the Flex effects component is used to change the size of the component. Similar to the Move effect, the Resize effect can specify the initial size (widthFrom, heightFrom), target size (widthTo, heightTo), and the amount of variation (widthBy, heightBy), and its rules of use are similar to those of the initial position, target position, and amount of movement of the Move effect. The following code demonstrates the use of the Resize effect:

In addition, the hideChildrenTargets attribute is used to hide other sub-items of the Panel container. When we apply the Resize effect to the sub-items in the Panel container, by default, Panel will repeatedly calculate the size and position of the sub-items to adjust the layout. If you set this property to true, you can make the Panel container do not do this calculation when playing the animation until the playback is complete, which can save system resources.

2) Rotate rotation effect

Rotate in the Flex effect component is a rotation effect that rotates the component around a specified point. Rotate can specify the coordinates of the center of rotation (the originX and originY properties) and the starting angle of the rotation (the angleFrom property) and the final angle (the angleTo property). The range of valid values for the starting rotation angle is 0,360, while the final angle can be positive or negative, with a default value of 360. If the value of angleTo is less than the value of angleFrom, the target rotates counterclockwise, otherwise it rotates clockwise. The code is as follows:

There are also times when you need to set the hideFocusRing property to determine whether the effect should hide the focus ring when it starts playing. The default value of this property is true. For components, the focus ring has been automatically hidden. If the Rotate effect is applied to objects that are not targeted by the UIComponent base class, the focus ring must be hidden.

It is important to note that the default value of the hideFocusRing property is false in the Effect-based effect class and true in the MaskEffect-based effect class.

3) SoundEffect sound effect

The SoundEffect effect in the Flex effects component is used to play MP3 audio files. We can specify the MP3 file to be played through the source property, set the URL of the file directly, or embed the Class object of the MP3 file with the Embed keyword.

The properties of the SoundEffect effect include the following.

The lautoLoad property is used to set whether the MP3 file is loaded automatically, and the default value is true.

The lbufferTime property is used to set the buffer time of the sound object. The default value is 1000, in milliseconds.

LisLoading this property is true if MP3 is loaded.

The lloops property is used to set the number of cycles, with a default value of 0.

The lpanEasingFunction property is used to set the ease function for sound equalization.

The lpanFrom and panTo properties are used to set the start and final translation of the sound object, with values ranging from-1.0 to 1.0, where-1.0 indicates that only the left channel is used, 1.0 indicates that only the right channel is used, and 0.0 indicates that the sound is evenly balanced between the two channels.

The lsound property represents the sound object on which the MP3 file is loaded.

The lsource property represents the URL or class of the MP3 file to be played.

The lstartTime property is used to set the start playback time in milliseconds, with a default value of 0.

The luseDuration property indicates whether to stop playback according to the time specified by the duration attribute. If false, the effect will stop after the MP3 finishes playing or looping. The default value is true.

The lvolumeEasingFunction property is used to set the ease function for the volume effect.

The lvolumeFrom property and the volumeTo property are used to set the initial and final volume of the sound object, with values ranging from 0.01mm 1.0 to a default value of 1.

In the example shown in the following code, when the application is created, the sound file starts to play, and the sound transitions from the left channel to the right channel.

Code listing SoundSample.mxml

The above is all the content of this article "how to use Flex effect components". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report