【问题标题】:how to apply tween motion on UIcomponents in flex using actionscript?如何使用动作脚本在 flex 中的 UIcomponents 上应用补间运动?
【发布时间】:2010-11-05 18:27:44
【问题描述】:

你好,我想在 flex 中使用 actionscript 对 UIcomponents 应用补间动画。

我搜索了很多,但没有找到需要的有用帮助。

提前致谢。

【问题讨论】:

  • 有具体的例子吗?

标签: apache-flex actionscript tween


【解决方案1】:

下面的代码为 actionscript 中的按钮创建移动补间。

单击屏幕上的任意位置会将按钮移动到该位置。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" click="moveButton(event)">

    <mx:Script>
        <![CDATA[
            import mx.effects.Move;

            private function moveButton(event:MouseEvent):void {
                var myMove:Move = new Move();

                myMove.target = myButton;
                myMove.xTo = event.stageX;
                myMove.yTo = event.stageY;
                myMove.play();
            }
        ]]>
    </mx:Script>

    <mx:Button id="myButton" />

</mx:Application>

有关更高级的示例,您可以查看 Flex 文档:http://livedocs.adobe.com/flex/3/html/help.html?content=createeffects_3.html

它展示了如何扩展和使用 TweenEffect 类来创建自己的效果类的示例。

【讨论】:

    【解决方案2】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多