widows components包含一个可以拖动的form,通常还要有一关闭按钮链接到scrollpane。你可以在其中显示form, movieclip,还有外部的swf文件,它不象scrollpane组件那样可以自动的对其中的内容进行滚动拖动,要想实现此功能,你必须将你要显示的内容放在scrollpane组件中然后在载入到windows components.同时你还要知道的是windows components 组件不能显示通过contentpath属性载入的外部内容的form.
1.新建一个文档,在类型中选择flash form application.
740)this.width=740" border=undefined twffan="done">
2.使用下图做为截图,进行参考布局。
740)this.width=740" border=undefined twffan="done">
3。创建一个新层,上层命名为action.下层命名为component.
4.拖动一个button组件至场景的component层,将其实例名命名为showwindowbutton.并将label设为show window.
740)this.width=740" border=undefined twffan="done">
5.点击如下图所示的+号,加入一个form.默认下为form1.通常在真正的程序编写中我们要为其另外命名。
740)this.width=740" border=undefined twffan="done">
6。单击form1,将其层命名为form content.
740)this.width=740" border=undefined twffan="done">
7.保证form1仍处于选中状态,选择文件导入,导入我们将要显示的文件,本例为loader_content.swf.
740)this.width=740" border=undefined twffan="done">
8.打开属性面板,设置form1的visible属性为false。因为我们要实现的是点击完show window按钮它才是可见的。
740)this.width=740" border=undefined twffan="done">
9.单击左侧的应用程序表单,将windows组件拖至场景的component层上,然后删除,我们只需要让它在库中即可。
10。在应用程序的场景的action层上输入如下代码。
buttonlistener = new object();
buttonlistener.click = function() {
mywindow = mx.managers.popupmanager.createpopup(form1.rootscreen,
mx.containers.window,
false,
{title:"a kitty with an attitude", contentpath:"form1" }
);
mywindow.setsize(320, 240);
};
showwindowbutton.addeventlistener("click",buttonlistener);
11。测试影片。
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器