项目渲染器更新时遇到问题
我有一个具有 2 个状态的列表 ItemRenderer
。当它初始化时,我将其设置为 1 状态并监听将其切换到状态 2 的事件。
protected function onCreationComplete(event:FlexEvent):void{
currentState = "state1";
addEventListener(CustomEvent.Event1, switcherfunc);
}
protected function switcherfunc(event:FlexEvent):void{
currentState = "state2";
}
这 2 种状态之间的区别在于我隐藏/显示了一些标签。
问题是它不起作用。我仍然看到旧状态的视觉效果,即使我Alert.show(currentState)
,它显示了正确的状态名称。
我尝试在 switch 函数中添加行 invalidateDisplayList();
但仍然没有成功。
protected function switch(event:FlexEvent):void{
currentState = "state2";
invalidateDisplayList();
}
我做错了什么。有什么想法可以让这个 ItemRenderer 真正更新吗?
I have a list ItemRenderer
that has 2 states. When it initializes, I set it to 1 state and listen for an event that switches it to state 2.
protected function onCreationComplete(event:FlexEvent):void{
currentState = "state1";
addEventListener(CustomEvent.Event1, switcherfunc);
}
protected function switcherfunc(event:FlexEvent):void{
currentState = "state2";
}
The difference between the 2 states is that I hide/show some labels.
The problem is that it doesn't work. I still see the visual of the old state, even though if I Alert.show(currentState)
, it shows the correct state name.
I've tried adding the line invalidateDisplayList();
inside the switch function but still no luck.
protected function switch(event:FlexEvent):void{
currentState = "state2";
invalidateDisplayList();
}
What am I doing wrong. Any ideas how I can get this ItemRenderer to really update?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论