这是一个简单的演示,完整代码见附件。
application.xml
<?xml version="1.0" encoding="UTF-8"?> <application xmlns="http://ns.adobe.com/air/application/1.0"> <id>test</id> <version>0.1</version> <filename>test</filename> <initialWindow> <content>test.html</content> <!--不需要系统边框--> <systemChrome>none</systemChrome> <!--窗口透明--> <transparent>true</transparent> <visible>true</visible> <width>434</width> <height>400</height> <x>200</x> <y>200</y> <minSize>434 400</minSize> <maxSize>434 400</maxSize> </initialWindow> </application>
test.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja" id="abroad-widget">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="AIRAliases.js" charset="utf-8"></script>
<title>Adobe air 实现简单的不规则窗口</title>
<style>
body { cursor:defaulte; font-size:x-small; font-family: "Lucida Grande", "Verdana", "新宋体", Sans-Serif; margin:0; width:434px; height:330px; background:url(images/default.png) no-repeat 0 0;}
img { border:0; }
#layout { z-index:101; margin:0 21px 0 22px;}
#header {cursor: pointer;cursor: hand;}
#header .logo {font-size:18px;font-weight:bold; position:absolute; top:-7px; color:#365077;}
#ctrl-btn{margin:0; padding:0; position:absolute; top:10px; right:17px; list-style:none; }
#ctrl-btn li{float:right; margin-right:5px;list-style:none;}
#ctrl-btn li a { display:block; float:left; width:13px; height:13px; font-size:1px; text-indent:-9999px; }
#ctrl-btn li.close a { background-image:url(images/close.png);}
#ctrl-btn li.minimize a { background-image:url(images/minimize.png); }
</style>
</head>
<body οnlοad="var pos = ABROADWidget.editor.read("window.txt");alert(pos);if(pos) { pos = pos.split(","); window.nativeWindow.bounds = new air.Rectangle(pos[0],pos[1]);}">
<div id="layout">
<div id="header" οnmοusedοwn="window.nativeWindow.startMove();" οnmοuseup="var w = window.nativeWindow; ABROADWidget.editor.write("window.txt",[w.x,w.y,w.width,w.height].join(","));">
<ul id="ctrl-btn">
<li class="minimize"><a href="#" rel="minimize" οnclick=" window.nativeWindow.minimize(); return false; " title="最小化">最小化</a></li>
<li class="close"><a href="#" rel="close" title="关闭" οnclick=" window.nativeWindow.close(); return false;">关闭</a></li>
</ul>
<p class="logo">A-920 不规则窗口测试</p>
</div>
</body>
</html>