前台是一个html和一个swf,swf是flex3做的
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle">
<mx:Style source="css/flex_skins.css">
</mx:Style>
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
import mx.controls.Alert;
import flash.external.ExternalInterface; //导入 ExternalInterface 类
[Bindable]
private var dbType:String="0"; //默认是access数据库
private var siteDir:String="http://localhost:4040/";
/**
* createChildren 比 creationComplete 事件更早发生
* */
protected override function createChildren():void
{
super.createChildren();
//提供JS访问的函数名
var _method:String="_SetupCallBack";
//内部函数名
var method:Function=SetupCallBack;
//将函数注册到容器列表
ExternalInterface.addCallback(_method, method);
}
private function GetRoot():void
{
var website:String="";
var rooturl:String=this.stage.loaderInfo.url; //获取路径
var websiteArr:Array=rooturl.split("/");
for (var i:Number=0; i < websiteArr.length - 2; i++)
{
website+=websiteArr[i] + "/";
}
this.siteDir=website;
}
//本地函数,用以供JS调用
private function SetupCallBack(step:String, info:String):void
{
}
private function showAlert(info:String):void
{
var alert:Alert=Alert.show(info, "友情提示", Alert.OK, this);
}
internal function onError(evt:FaultEvent):void
{
showAlert(this.siteDir + "目标地址有误");
this.Panel1.status="";
this.Panel1.enabled=true;
}
private function OnStep1():void
{
GetRoot();
this.Panel1.enabled=false;
this.dbType=this.dbTabs.selectedIndex.toString();
try
{
var service:HTTPService=new HTTPService();
service.url=this.siteDir + "install/step1.aspx";
service.useProxy=false;
service.method="get";
service.resultFormat="e4x";
service.addEventListener(ResultEvent.RESULT, onResultHandler1);
service.addEventListener(FaultEvent.FAULT, onError);
var param:URLVariables=new URLVariables();
param.dbtype=this.dbType;
if (this.dbType == "0") //access数据库
{
this.Panel1.status="正在创建Access...";
param.databasepath=this.txtDatabasePath.text;
}
else //sqlserver数据库
{
this.Panel1.status="正在连接SqlServer...";
param.servername=this.txtServerName.text;
param.databasename=this.txtDatabaseName.text;
param.username=this.txtUserName.text;
param.userpass=this.txtPassword.text;
}
service.send(param);
}
catch (e:Error)
{
trace(e.message);
}
}
internal function onResultHandler1(evt:ResultEvent):void
{
this.Panel1.enabled=true;
this.Panel1.status="";
if (evt.result.toString() != "ok")
showAlert(evt.result.toString());
else
{
Panel1.title='网站初始化';
myViewStack.selectedChild=step2;
}
}
private function OnStep2():void
{
if (this.txtSiteName.text == "")
{
showAlert("请填网站名称");
return;
}
if (this.txtAdminName.text == "")
{
showAlert("请填管理员");
return;
}
if (this.txtEmail.text == "")
{
showAlert("请填邮箱");
return;
}
if (this.txtUserPass.text == "")
{
showAlert("请填前台密码");
return;
}
if (this.txtAdminPass.text == "")
{
showAlert("请填后台密码");
return;
}
this.Panel1.status="正在初始化数据...";
this.Panel1.enabled=false;
this.dbType=this.dbTabs.selectedIndex.toString();
try
{
var service:HTTPService=new HTTPService();
service.url=this.siteDir + "install/step2.aspx";
service.useProxy=false;
service.method="get";
service.resultFormat="e4x";
service.addEventListener(ResultEvent.RESULT, onResultHandler2);
service.addEventListener(FaultEvent.FAULT, onError);
var param:URLVariables=new URLVariables();
param.dbtype=this.dbType;
param.sitename=this.txtSiteName.text;
param.email=this.txtEmail.text;
param.username=this.txtAdminName.text;
param.adminname=this.txtAdminName.text;
param.userpass=this.txtUserPass.text;
param.adminpass=this.txtAdminPass.text;
service.send(param);
}
catch (e:Error)
{
trace(e.message);
}
}
internal function onResultHandler2(evt:ResultEvent):void
{
this.Panel1.enabled=true;
this.Panel1.status="";
if (evt.result.toString() != "ok")
showAlert(evt.result.toString());
else
{
Panel1.title='安装成功';
myViewStack.selectedChild=step3;
}
}
private function OnSuccess():void
{
ExternalInterface.call("function(){window.location.href='" + this.siteDir + "admin/login.htm';}");
}
]]>
</mx:Script>
<mx:Panel id="Panel1"
width="660"
height="400"
layout="absolute"
title="欢迎安装 JumbotCms 4.2 (.NET Framework 2.0/3.x)"
fontSize="14">
<mx:ViewStack id="myViewStack"
borderStyle="none"
width="640"
height="360">
<mx:Canvas id="step"
backgroundColor="#FFFFFF"
label=""
width="640"
height="360"
borderStyle="none">
<mx:Image x="10"
y="10"
source="images/logo.jpg"/>
<mx:Text x="202"
y="20"
text=" 欢迎您选择安装JumbotCms 4.2 (.NET Framework 2.0/3.x)

 本向导将协助您一步步的安装和初始化系统.

 强烈建议您在运行本向导前仔细阅读程序包中的《安装说明》文档, 如果您已经阅读过, 请点击"下一步".
 
"
width="408"
height="217"/>
<mx:Button x="520"
y="280"
label="下一步"
click="Panel1.title='环境要求';myViewStack.selectedChild=step0;"/>
</mx:Canvas>
<mx:Canvas id="step0"
backgroundColor="#FFFFFF"
label=""
width="640"
height="360"
borderStyle="none">
<mx:Image x="10"
y="10"
source="images/logo.jpg"/>
<mx:Text x="202"
y="20"
text=" 整个网站目录必须具有写入和删除权限.

 如果已确定有读写权限, 可以直接点击"下一步", 否则按要求配置.

 a.如果您是虚拟主机用户, 则需要联系空间服务商.

 b.如果是自己的服务器, 操作方法如下: 选择整个目录->右键属性->安全->添加, 在"输入对象名称来选择"中输入"Network Service",点击"确定".选择"组或用户名称"中"Network Service"用户组,在下面 "Network Service"的权限中勾选"修改"的"允许"复选框,点击"确定"后再次重新刷新本页面继续.

"
width="428"
height="217"/>
<mx:Button x="520"
y="280"
label="下一步"
click="Panel1.title='配置数据库';myViewStack.selectedChild=step1;"/>
</mx:Canvas>
<mx:Canvas id="step1"
backgroundColor="#FFFFFF"
label=""
width="640"
height="360"
borderStyle="none">
<mx:Image x="10"
y="10"
source="images/logo.jpg"/>
<mx:Button id="btnStep1"
x="520"
y="280"
label="开始安装"
click="OnStep1();"/>
<mx:Label x="198"
y="32"
text="请选择数据库类型, 并进行配置."/>
<mx:TabNavigator id="dbTabs"
width="421"
height="213"
x="198"
y="63">
<mx:Canvas label="Access"
width="100%"
height="100%">
<mx:Label x="23"
y="21"
text="数据库地址:"/>
<mx:Label x="23"
y="51"
text="注意: 请使用.config后缀,勿使用.mdb后缀"
color="#FF0000"/>
<mx:TextInput x="108"
y="20"
width="288"
text="~/_data/database/jcms.config"
id="txtDatabasePath"/>
</mx:Canvas>
<mx:Canvas label="SqlServer"
width="100%"
height="100%">
<mx:Label x="23"
y="21"
text="服务器名或IP地址:"/>
<mx:TextInput x="162"
y="21"
width="201"
text="(local)"
id="txtServerName"/>
<mx:Label x="23"
y="52"
text="数据库名称:"/>
<mx:TextInput x="162"
y="52"
width="201"
text="jumbotcms4"
id="txtDatabaseName"/>
<mx:Label x="23"
y="83"
text="数据库用户名称:"/>
<mx:TextInput x="162"
y="83"
width="201"
text="sa"
id="txtUserName"/>
<mx:Label x="23"
y="114"
text="数据库用户密码:"/>
<mx:TextInput x="162"
y="114"
width="201"
text="123"
displayAsPassword="true"
id="txtPassword"/>
</mx:Canvas>
</mx:TabNavigator>
</mx:Canvas>
<mx:Canvas id="step2"
backgroundColor="#FFFFFF"
label=""
width="640"
height="360"
borderStyle="none">
<mx:Image x="10"
y="10"
source="images/logo.jpg"/>
<mx:Button id="btnStep2"
x="520"
y="280"
label="确定保存"
click="OnStep2();"/>
<mx:Label x="224"
y="39"
text="网站名称:"/>
<mx:TextInput x="325"
y="39"
width="190"
text="将博网"
id="txtSiteName"/>
<mx:Label x="224"
y="70"
text="网站管理员:"/>
<mx:Label x="523"
y="101"
text="不可更改"
color="#FF0000"/>
<mx:Label x="523"
y="70"
text="默认为创始人"
color="#FF0000"/>
<mx:TextInput x="325"
y="70"
width="190"
text=""
id="txtAdminName"/>
<mx:Label x="224"
y="132"
text="前台密码:"/>
<mx:TextInput x="325"
y="132"
width="190"
text="123456"
id="txtUserPass"
displayAsPassword="true"/>
<mx:Label x="224"
y="163"
text="后台密码:"/>
<mx:TextInput x="325"
y="163"
width="190"
text="123456"
id="txtAdminPass"
displayAsPassword="true"/>
<mx:Label x="224"
y="101"
text="管理员邮箱:"/>
<mx:TextInput x="325"
y="101"
width="190"
text="@"
id="txtEmail"/>
</mx:Canvas>
<mx:Canvas id="step3"
backgroundColor="#FFFFFF"
label=""
width="640"
height="360"
borderStyle="none">
<mx:Image x="10"
y="10"
source="images/logo.jpg"/>
<mx:Button id="btnStep3"
x="520"
y="280"
label="安装完成"
click="OnSuccess();"/>
<mx:Text x="202"
y="20"
text=" 安装完成,可以删除install目录.

 登录后台, 在"前台更新"页面进行逐个更新才能保证前台运行正常.

"
width="428"
height="217"/>
</mx:Canvas>
</mx:ViewStack>
</mx:Panel>
</mx:Application>
[责任编辑:jumbot]