Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

apache flex - Spark effects: why is procedural code preferred over triggers?

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.

)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...