Spark 效果:为什么程序代码比触发器更受欢迎? [英] Spark effects: why is procedural code preferred over triggers?
本文介绍了Spark 效果:为什么程序代码比触发器更受欢迎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Flex 3 中,MX 效果可以这样触发:
In Flex 3, MX effects could be triggered like this:
<mx:Resize id="myEffect" />
<mx:Button mouseDownEffect="{myEffect}" />
在 Flex 4 中,Spark 效果是这样触发的:
In Flex 4, Spark effects are triggered like this:
protected function onClick(event:MouseEvent):void {
resizeEffect.end();
resizeEffect.play();
}
...
<s:Resize id="resize" />
...
<s:Button click="onClick(event)" />
使用这种声明性较低且时间较长的方法的原因是什么?我在文档中的任何地方都找不到答案.
What was the reason to use this less declarative and longer approach? I couldn't find the answer anywhere in the docs.
(注意两点:
- mouseDown 触发器和点击事件之间可能存在细微差别,请忽略,这只是一个示例.
- 我不确定触发器是否可以可靠地用于 Spark 效果.也许他们会,但我想官方文档中甚至没有提到这种可能性是有原因的.
)
推荐答案
在当前版本的 spark 中,效果触发器未得到官方支持.您可以在此处跟踪此功能的进度:http://bugs.adobe.com/jira/browse/SDK-19743
Effect triggers are not officially supported in spark in the current release. You can track the progress of this feature here: http://bugs.adobe.com/jira/browse/SDK-19743
这篇关于Spark 效果:为什么程序代码比触发器更受欢迎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文