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 create a Flex behavior

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

Share

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

This article mainly introduces how to create a Flex behavior, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Flex behavior is a combination of a trigger and an effect. A trigger is an activity, such as a mouse click on a component, a component gaining focus, or a component being visible.

Use Flex behavior

AdobeFlex behavior allows you to add animation and motion to your application to respond to user and programming activities. Flex behavior is a combination of a trigger and an effect. A trigger is an activity, such as a mouse click on a component, a component gaining focus, or a component being visible. The Flex effect is a change in visibility or audibility on the target component, measured in milliseconds. Examples of effects include fading, size change, or component movement.

This section will teach you how to add behaviors to the Flex user interface. The details include how to use MXML to create behaviors, how to invoke an effect from different components, and how to combine multiple effects to produce a composite effect.

Create a Flex behavior

You plan to create a Flex behavior that turns green when the button is clicked by the user, and after a second and a half, turns light green when you leave the button to indicate that it has been clicked.

1. Select the Lessons project in the navigation view, select File > New > MXMLApplication, and create a file called Behaviors.mxml.

two。 Set Behaviors.mxml as the default file to be compiled and select SetAsDefaultApplication from the context menu.

3. In MXML editor source mode, define the green Flex effect after the tag:

The green Flex effect is plump at first, then gradually becomes transparent, but not completely transparent. Turn light green to indicate that the button has been clicked.

4. In design mode, drag a panel container from the component view onto the layout and set its corresponding properties:

Width:200Height:300 X:10 Y:10

5. Drag a button control from the component view onto the panel and set its corresponding properties:

ID:myButtonLabel:View X:40 Y:60

6. In the properties view, click Category View / CategoryView in the toolbar to view the properties, and then find the effect category / Effectscategory. A classified list of triggers corresponding to the button control.

The 7.Flex behavior assigns a green gradient to the mouseUpEffect trigger by typing the ID of the effect in wavy parentheses as the value of the trigger, like this:

MouseUpEffect: {buttonGlow}

Wavy parentheses ({}) are necessary because effects are assigned to their triggers using data binding. In source code mode, the tag looks like this:

8. Save the file and run it after compilation. The result is as follows: invoke a Flex effect from different components

Instead of component triggers, you can also use Flex events to invoke effects. This allows the same effect to be called by different components.

Thank you for reading this article carefully. I hope the article "how to create a Flex behavior" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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