读书人

smartinvoke入门系列九窗口类型Fl

发布时间: 2012-12-22 12:05:07 作者: rapoo

smartinvoke入门系列9——窗口类型FlashShell与事件

SmartInvoke使用cn.smartinvoke.gui.shell.FlashShell类管理应用程序打开的窗口,通过该对象,用户可以设置窗口的标题,位置,大小,是否可以,透明度等属性,还可以监听窗口的

CShellEvent.Event_Activated,CShellEvent.Event_Closed,CShellEvent.Event_Deactivated, CShellEvent.Event_Deiconified,CShellEvent.Event_Iconified事件。每个打开的窗口有且只有一个该对象,通过cn.smartinvoke.gui.SIApplication对象的shell属性可以获得该对象的句柄。

比如在First_项目的FirstWin.mxml文件中添加如下代码就可以实现关闭询问对话框的功能:

?

//添加关闭监听器

??????????? ?? this.shell.addShellListener(CShellEvent.Event_Closed,function(evt:CShellEvent):void{

??????????????? ?? Alert.show("do you want to exist!","select dialog",Alert.YES|Alert.NO,this,

??????????????????? ?? this.clickSelectHandler,null,1);

??????????? ?? },this);

?

private function clickSelectHandler(evt:CloseEvent):void{?

??????????????? if(evt.detail==Alert.YES){

??????????????????? this.shell.close();

??????????????? }

??????? ?? }

?

FlashShell类的更多属性请参考API

读书人网 >Flash

热点推荐