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:
- There might be small differences between mouseDown trigger and the click event, please ignore that, it's just an example.
- 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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…