Spark效应:为什么程序代码优先于触发器? [英] Spark effects: why is procedural code preferred over triggers?

查看:209
本文介绍了Spark效应:为什么程序代码优先于触发器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Flex 3中,可以像这样触发MX效果:

 < mx:Resize id =myEffect/ > 
< mx:Button mouseDownEffect ={myEffect}/>

在Flex 4中,Spark效果是这样触发的:

  protected function onClick(event:MouseEvent):void {
resizeEffect.end();
resizeEffect.play();
}
...
...

使用这种较少声明和较长的方法的原因是什么?我找不到文档中的任何地方的答案。



(需要注意的两点:$ b​​
$ b


  1. 在mouseDown触发器和click事件之间可能会有细微的差别,请忽略它,这只是一个例子。
  2. 我不确定触发器是否可以工作可靠的Spark效果,也许他们会,但我猜有一个原因,为什么这种可能性甚至没有在官方文档中提及。

当前版本中的spark没有正式支持效果触发器。您可以在这里跟踪此功能的进度: http://bugs.adobe.com/jira / browse / SDK-19743

In Flex 3, MX effects could be triggered like this:

<mx:Resize id="myEffect" />
<mx:Button mouseDownEffect="{myEffect}" />

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.

(Two things to note:

  1. There might be small differences between mouseDown trigger and the click event, please ignore that, it's just an example.
  2. I'm not sure whether triggers would or would not work reliably for Spark effects. Maybe they would but I guess there is a reason why this possibility is not even mentioned in the official docs.

)

解决方案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆