如何在Flex中的代码中绑定效果
我想在flex4中动态地将组件添加到Viewstack
中。就像下面的代码
for(var i:int = 0; i < 3; i++)
{
var canvas:NavigatorContent = new NavigatorContent();
canvas.label = "XXX";
// here I want to add effect to canvas.
// var effect:Fade = new Fade(canvas);
// effect.duration = 2000;
viewStack.addChild(canvas);
}
,但是注释中的代码没有起到效果。我该如何实施? canvas有没有hideffect或者showeffect可以Bind?
谢谢
I want to add a component into a Viewstack
dynamically in flex4. Like code below
for(var i:int = 0; i < 3; i++)
{
var canvas:NavigatorContent = new NavigatorContent();
canvas.label = "XXX";
// here I want to add effect to canvas.
// var effect:Fade = new Fade(canvas);
// effect.duration = 2000;
viewStack.addChild(canvas);
}
But the code in comment doesn't play the effect. How can I implement it? Does the canvas have any hideffect or showeffect to Bind?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 NavigatorContent 的
hideEffect
和showEffect
属性。FlexExamples 有一个很好的示例如何使用 Actionscript 设置这些属性。
You can use the NavigatorContent's
hideEffect
andshowEffect
properties.FlexExamples has a good example on how to set these properties using Actionscript.
好吧,我认为问题是他在函数内创建效果对象。一旦离开这个函数,我认为画布对象就不再有对效果对象的引用,并且 GarbageCollection 会清理它。尝试显式保存对效果对象的引用。
Well I think the problem is he is creating the Effect Object inside the function. As soon as this function is left, I think there is no reference from the canvas object to the effect object and the GarbageCollection cleans it up. Try explicitly saving a reference to the effect object.