Flex 3 UIComponent 宽度属性不起作用
我有一个 Flex 3 应用程序,我在其中绘制自己的 UI。它是一个播放器风格的应用程序,因此它有一个随着媒体播放而填充的栏。我使用以下代码执行此操作:
bgRect=new UIComponent();
bgRect.graphics.lineStyle(0);
bgRect.graphics.beginFill(0xFFFFFF,1);
bgRect.graphics.drawRect(0,0,399,20);
bgRect.graphics.endFill();
bgRect.addEventListener(MouseEvent.MOUSE_DOWN,mouseDown);
bgRect.addEventListener(MouseEvent.MOUSE_UP,mouseUp);
bgRect.addEventListener(MouseEvent.MOUSE_MOVE,mouseMove);
mainCanvas.addChild(bgRect);
leftRect=new UIComponent();
leftRect.graphics.beginFill(0x999999,1);
leftRect.graphics.drawRect(0,1,20,19);
leftRect.graphics.endFill();
bgRect.addChild(leftRect);
我收到点击通知,但是当我尝试使用此代码更改 UIComponent 的宽度时:
var position:Number = event.stageX;
leftRect.width = new Number(position);
没有任何反应。
有什么想法吗?
I have a flex 3 application in which I draw my own UI. It is a player-style app, so it has a bar that fills as the media plays. I do this with this code:
bgRect=new UIComponent();
bgRect.graphics.lineStyle(0);
bgRect.graphics.beginFill(0xFFFFFF,1);
bgRect.graphics.drawRect(0,0,399,20);
bgRect.graphics.endFill();
bgRect.addEventListener(MouseEvent.MOUSE_DOWN,mouseDown);
bgRect.addEventListener(MouseEvent.MOUSE_UP,mouseUp);
bgRect.addEventListener(MouseEvent.MOUSE_MOVE,mouseMove);
mainCanvas.addChild(bgRect);
leftRect=new UIComponent();
leftRect.graphics.beginFill(0x999999,1);
leftRect.graphics.drawRect(0,1,20,19);
leftRect.graphics.endFill();
bgRect.addChild(leftRect);
I am getting notificataions for clicks, but when i try to change the UIComponent's width with this code:
var position:Number = event.stageX;
leftRect.width = new Number(position);
nothing happens.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定,但可能调用“updateDisplaylist/validateDisplayList”之类的方法可以解决该问题。
I am not sure but may be a call to something like 'updateDisplaylist/validateDisplayList' will solve the issue.