san*_*ndy 0 apache-flex actionscript-3
我想在页面加载时连续旋转图像.代码在页面加载时可以正常旋转1次但是为了连续地实现相同的效果,我将.play()语句包含在无限循环中,如下所示.但它会导致页面挂起而没有任何显示.
while (i == 1)
{
if (rotEff.isPlaying != true)
{
rotEff.play();
}
}
Run Code Online (Sandbox Code Playgroud)
关于如何实现这种效果的任何指示都会有很大的帮助
尝试将对象的repeatCount属性设置Effect为0,以便无限重复:
<fx:Declarations>
<s:Rotate id="rotate" target="{image}" angleBy="360" duration="1000" repeatCount="0" autoCenterTransform="true"></s:Rotate>
</fx:Declarations>
Run Code Online (Sandbox Code Playgroud)
[UPDATE]
回应沙滩的评论:
感谢taurayi ...设置repeatCount解决了这个问题.但是从一个完整的360轮到另一轮的转换滞后有一点点......是否可以摆脱它...?
将easer属性设置为null,如下所示:
<fx:Declarations>
<s:Rotate id="rotate" target="{image}" angleBy="360" duration="1000" repeatCount="0" autoCenterTransform="true" easer="{null}"></s:Rotate>
</fx:Declarations>
Run Code Online (Sandbox Code Playgroud)