添加了功能的customcomponent我创建了一个自定义组件(名为customtitlewindow)的代码,其中如下:我怎么叫的柔性
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="vertical" width="400" height="300"
xmlns:comp="components.*"
showCloseButton="true"
keyDown="detectescapekeypress(event)"
creationComplete="this.setFocus();"
close="PopUpManager.removePopUp(this);"
paddingTop="40">
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;
public function detectescapekeypress(event:KeyboardEvent):void
{
if(event.charCode == Keyboard.ESCAPE)
{
PopUpManager.removePopUp(this);
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</mx:TitleWindow>
现在我又创建了一个组件(名为deleteconfirm)的调用上面的一个是这样的:
<?xml version="1.0" encoding="utf-8"?>
<mx:Container xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:components="components.*">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<components:customtitlewindow title="custom title window">
<s:Label>
<s:text>this is the custom text for deleteconfirm.</s:text>
</s:Label>
<s:Button label="ok">
<s:click>
<![CDATA[
Alert.show("Hello world!", "title");
]]>
</s:click>
</s:Button>
</components:customtitlewindow>
</mx:Container>
(主文件)现在上的按钮,我呼吁上述(第二个)的点击如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
]]>
</mx:Script>
<mx:VBox width="100%" height="100%">
<mx:Button label="Delete Record">
<mx:click>
<![CDATA[
var ctd:deleteconfirm = new deleteconfirm();
ctd = deleteconfirm(PopUpManager.createPopUp(this, deleteconfirm, true));
]]>
</mx:click>
</mx:Button>
</mx:VBox>
</mx:WindowedApplication>
我的主要目的是为了向最终用户显示的所有弹出窗口在按下退出键时关闭所有弹出窗口,并在点击标题栏上显示的关闭按钮时关闭所有弹出窗口。
但在“退出键”上按下什么都没有发生。
我该怎么做?
有什么不对?请纠正我以往任何地方错误的地方。
谢谢
感谢您的回答,但我认为您的解决方案会打败我的问题的目的。我不想重复escapekeysequence的代码。 – 2011-04-10 10:47:37