Flex Button 在 itemRenderer 类中缺少其外观
我尝试在 itemRenderer 元素实例内创建 Button 类的实例,但按钮实例显示时没有其外观。 有人可以解释一下:
- 为什么会发生这种情况?
- 如何修复它?
- 我这样做对还是不对?
override protected function createChildren():void { super.createChildren(); btnControl = new Button(); btnControl.x = 2; btnControl.y = 22; btnControl.minHeight = 18; btnControl.minWidth = 50; btnControl.height = 18; btnControl.width = Number( undefined ); btnControl.label = "контрол"; btnControl.addEventListener( MouseEvent.CLICK, onBtnControlClick ); }
I have tried to create an instance of Button class inside an itemRenderer element instance, but the button instance appears without its skin.
can someone explain me :
- Why does it happends ?
- How to fix it ?
- Am I doint it right or not ?
override protected function createChildren():void { super.createChildren(); btnControl = new Button(); btnControl.x = 2; btnControl.y = 22; btnControl.minHeight = 18; btnControl.minWidth = 50; btnControl.height = 18; btnControl.width = Number( undefined ); btnControl.label = "контрол"; btnControl.addEventListener( MouseEvent.CLICK, onBtnControlClick ); }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我从您的代码中可以看出,您没有将按钮添加到显示列表中。 添加
如果这是您要扩展的 Spark 组件,请在末尾 ;如果它是 mx 组件使用
As far as I can tell from your code you're not adding the button to the displayList. Add
at the end if this is a Spark component you're extending; if it's an mx component use