Actionscript 3 Flex中的简单效果
我想在Flex应用程序中显示一些隐藏的文本,并让它在几秒钟内淡出 我已经研究过Flex中的延迟和暂停效果,但是还没有看到一个如何实现这种实际简单效果的示例 现在有人知道怎么做或者有好的资源吗Actionscript 3 Flex中的简单效果,actionscript-3,apache-flex,Actionscript 3,Apache Flex,我想在Flex应用程序中显示一些隐藏的文本,并让它在几秒钟内淡出 我已经研究过Flex中的延迟和暂停效果,但是还没有看到一个如何实现这种实际简单效果的示例 现在有人知道怎么做或者有好的资源吗 谢谢。如果我理解正确,您希望文本在显示几秒钟后自动淡出吗 我可能会这样做:(还没有测试代码,所以可能有打字错误。) 导入flash.utils。*; var fadeTimer:计时器=新计时器(2000);//2秒 addEventListener(“计时器”,fadeTimerTickHandler)
谢谢。如果我理解正确,您希望文本在显示几秒钟后自动淡出吗 我可能会这样做:(还没有测试代码,所以可能有打字错误。)
导入flash.utils。*;
var fadeTimer:计时器=新计时器(2000);//2秒
addEventListener(“计时器”,fadeTimerTickHandler);
//调用此选项以显示隐藏的文本。
函数showTheText():void{
theTextField.visible=true;
fadeTimer.start();
}
//每次计时器“滴答”时(2秒)都会调用此函数
函数fadeTimerTickHandler(eventArgs:TimerEvent){
fadeTimer.stop();
fadeTimer.reset();
theTextField.visible=false;
}
此外,您需要确保嵌入字体,否则效果将无法在文本上工作。有关更多信息,请参阅
<mx:Script>
import flash.utils.*;
var fadeTimer:Timer = new Timer(2000); // 2 seconds
fadeTimer.addEventListener("timer", fadeTimerTickHandler);
// Call this to show the hidden text.
function showTheText():void{
theTextField.visible = true;
fadeTimer.start();
}
// This gets called every time the timer "ticks" (2 seconds)
function fadeTimerTickHandler(eventArgs:TimerEvent){
fadeTimer.stop();
fadeTimer.reset();
theTextField.visible = false;
}
</mx:Script>
<mx:Fade id="hideEffectFade" alphaFrom="1.0" alphaTo="0.0" duration="900"/>
<mx:Text id="theTextField" text="The Text" hideEffect="{hideEffectFade}"/>