如何让PopUpManager正确显示基于spark TitleWindow的自定义组件?
我使用此代码创建并显示 MessageWindow:
var newTitleWindow:MessageWindow = PopUpManager.createPopUp(contextView,MessageWindow, true) as MessageWindow;
newTitleWindow.text = message;
PopUpManager.centerPopUp(newTitleWindow);
MessageWindow 源代码:
<?xml version="1.0"?>
<s:TitleWindow title="Something gone wrong" width="200" height="130" xmlns:mx="http://www.adobe.com/2006/mxml"
close="closeMe()" resize="centerMe()" xmlns:s="library://ns.adobe.com/flex/spark" >
<mx:Script><![CDATA[
import mx.managers.PopUpManager;
[Bindable]
public var text:String;
private function closeMe():void {
PopUpManager.removePopUp(this);
}
private function centerMe():void {
PopUpManager.centerPopUp(this);
}
]]></mx:Script>
<s:VGroup top="0" bottom="0" left="0" right="0">
<s:Label id="lbl" left="10" right="10" textAlign="center" text="{text}"/>
<s:Button id="btn"/>
</s:VGroup>
</s:TitleWindow>
运行应用程序时没有显示嵌套组件。
调试器显示它们已创建且可见。
让我感到“有趣”的是,当我用 mx:TitleWindow 替换 s:TitleWindow 时,会显示组件。
我真的很想使用 Spark TitleWindow。 有什么技巧可以解决这种行为吗?
I use this code to create and show a MessageWindow:
var newTitleWindow:MessageWindow = PopUpManager.createPopUp(contextView,MessageWindow, true) as MessageWindow;
newTitleWindow.text = message;
PopUpManager.centerPopUp(newTitleWindow);
MessageWindow source code:
<?xml version="1.0"?>
<s:TitleWindow title="Something gone wrong" width="200" height="130" xmlns:mx="http://www.adobe.com/2006/mxml"
close="closeMe()" resize="centerMe()" xmlns:s="library://ns.adobe.com/flex/spark" >
<mx:Script><![CDATA[
import mx.managers.PopUpManager;
[Bindable]
public var text:String;
private function closeMe():void {
PopUpManager.removePopUp(this);
}
private function centerMe():void {
PopUpManager.centerPopUp(this);
}
]]></mx:Script>
<s:VGroup top="0" bottom="0" left="0" right="0">
<s:Label id="lbl" left="10" right="10" textAlign="center" text="{text}"/>
<s:Button id="btn"/>
</s:VGroup>
</s:TitleWindow>
There is no nested components displayed when I run my app.
The debugger shows they are created and visible.
To my "amusement" the components are shown when I replace s:TitleWindow with mx:TitleWindow.
I really want to use spark TitleWindow.
Is there any trick to fix this behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试用
fx:Script
替换mx:Script
Try replacing
mx:Script
withfx:Script