手边近期有一个项目(薪酬系统)要开工,开始用Flex Air打理框架
1、Flex Air 依然作为本地前台;
2、中介语言不再采用php(amfphp),java(lds)或c#(FluorineFx)来搞了,直接采用assql;
3. 数据库采用远程数据库Mysql
[Note]
1.由于涉及远程数据库,所以用C++编辑Mysql联机参数,再采用[url=http://www.covergraph.com/blog/archives/alchemy_0.5_setup.exe]Alchemy[/url]编译成swc来封装
//MySqlService.cpp
//主程式运用
2.由于项目又要涉及windows的相关操作,如调用.dll([url=http://aperture.fluorinefx.com/]FluorineFx Aperture framework[/url])等并且还有考虑到以后软件的自动更新,所以在前期得将程序以exe包形式发布,由于air官方不支持exe包的自动更新,所以采用了[url=http://code.google.com/p/nativeapplicationupdater/]nativeApplicationUpdater[/url]来处理,这样既兼顾了自动更新,也兼顾了与本地系统的API的交互;
3.每一个控制单元仍然采用module来处理,本想采用常态的模式*.mxml来作界面,as编写操练,写了两三个模块单元,每次切换到Design模式,Adobe他爷爷,哇卡卡,最后还是把这个转换成全as,本想偷点懒,不想,还更花时间和精力。以后再也不想用尝试mxml(界面)+as(操纵)的方式,还有继续用全as来实现。卡死我了!
4.Tlf这么久了,还没有明显进步,[url=http://blogs.adobe.com/tlf/]Text Layout Framework Team[/url],why!!!!!!!!!!!!,难道非得要第三方来编写TableElement,CodeElement,MediaElement吗?
1、Flex Air 依然作为本地前台;
2、中介语言不再采用php(amfphp),java(lds)或c#(FluorineFx)来搞了,直接采用assql;
3. 数据库采用远程数据库Mysql
[Note]
1.由于涉及远程数据库,所以用C++编辑Mysql联机参数,再采用[url=http://www.covergraph.com/blog/archives/alchemy_0.5_setup.exe]Alchemy[/url]编译成swc来封装
//MySqlService.cpp
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "AS3.h"
AS3_Val GetMysqlArg(void* self, AS3_Val args)
{
char* val = NULL;
//本机
AS3_Val localconn = AS3_Object("host:StrType,port:StrType,username:StrType,password:StrType,database:StrType","127.0.0.1","3306","xxxxx", "xxxx","xxxxx");
//网络
AS3_Val netconn = AS3_Object("host:StrType,port:StrType,username:StrType,password:StrType,database:StrType","xxx.xxx.xx.xx","3306","xxxxx", "xxxx","xxxx");
AS3_ArrayValue( args, "StrType", &val );
if(val == NULL)
{
return localconn;
}
return netconn;
}
int main()
{
AS3_Val cMethod = AS3_Function( NULL, GetMysqlArg);
AS3_Val result = AS3_Object("GetMysqlArg: AS3ValType",cMethod);
AS3_Release(cMethod);
AS3_LibInit( result );
return 0;
}
//主程式运用
var cppMySqlService:CLibInit=new cmodule.mysqlservice.CLibInit;
var mysqlArgObj:Object=cppMySqlService.init();
//与远程数据库联机
var mysqlServie:Object=mysqlArgObj.GetMysqlArg("net");
SQLGlobal.set_mysql_host(mysqlServie.host);
SQLGlobal.set_mysql_port(int(mysqlServie.port))
SQLGlobal.set_mysql_username(mysqlServie.username)
SQLGlobal.set_mysql_password(mysqlServie.password)
SQLGlobal.set_mysql_database(mysqlServie.database)
2.由于项目又要涉及windows的相关操作,如调用.dll([url=http://aperture.fluorinefx.com/]FluorineFx Aperture framework[/url])等并且还有考虑到以后软件的自动更新,所以在前期得将程序以exe包形式发布,由于air官方不支持exe包的自动更新,所以采用了[url=http://code.google.com/p/nativeapplicationupdater/]nativeApplicationUpdater[/url]来处理,这样既兼顾了自动更新,也兼顾了与本地系统的API的交互;
protected function isNewerFunction(currentVersion:String, updateVersion:String):Boolean
{
if (currentVersion == updateVersion)
{
trace("版本一样,直接进入平台")
DoShowLogin()
}
else
{
trace("版本不一样")
//提示用户是否更新
Alert.show("软件有新的更新:版本(" + updater.updateVersion + ").下载安装更新吗?", "提示信息", 3, null, versionCloseHandler, null, 3)
}
return true;
}
private function versionCloseHandler(event:CloseEvent):void
{
if (event.detail == Alert.YES)
{
trace("更新");
doGoUpdate()
}
else
{
//客户不更新,直接登陆界面
DoShowLogin()
}
}
protected function doGoUpdate():void
{
doCreateDownloadingView()
updater.addEventListener(DownloadErrorEvent.DOWNLOAD_ERROR, updater_downloadErrorHandler);
updater.addEventListener(UpdateEvent.DOWNLOAD_COMPLETE, updater_downloadCompleteHandler);
updater.downloadUpdate();
}
private function doCreateDownloadingView():void
{
//清空对象,创建下载更新包自定义界面
MainAppContainer.removeAllChildren();
var viewHGroup:HGroup=new HGroup();
viewHGroup.setStyle("horizontalCenter", 0)
viewHGroup.setStyle("verticalCenter", 0);
viewHGroup.setStyle("verticalAlign", "top");
MainAppContainer.addChild(viewHGroup)
var bitmapImg:BitmapImage=new BitmapImage();
bitmapImg.source='/assets/system_upgrade.png';
viewHGroup.addElement(bitmapImg)
var viewVGroup:VGroup=new VGroup();
viewVGroup.percentWidth=100;
viewVGroup.setStyle("horizontalAlign", "center")
viewHGroup.addElement(viewVGroup)
var infoLabel:Label=new Label();
infoLabel.text="更新说明:"
viewVGroup.addElement(infoLabel)
var richTxt:RichText=new RichText();
richTxt.text=updater.updateDescription;
viewVGroup.addElement(richTxt);
var prgBar:ProgressBar=new ProgressBar();
prgBar.label="下载中... %3%";
prgBar.source=updater;
viewVGroup.addElement(prgBar);
}
protected function updater_errorHandler(event:ErrorEvent):void
{
Alert.show(event.text);
}
protected function updater_initializedHandler(event:UpdateEvent):void
{
trace("初始化毕,执行检查")
updater.checkNow();
}
protected function updater_updateStatusHandler(event:StatusUpdateEvent):void
{
if (event.available)
{
event.preventDefault();
}
else
{
Alert.show("Your application is up to date!");
}
}
private function updater_downloadCompleteHandler(event:UpdateEvent):void
{
trace("下载完成")
updater.installUpdate();
}
private function updater_downloadErrorHandler(event:DownloadErrorEvent):void
{
Alert.show("下载更新安装包出错,请稍候再试!");
}
/******************************************************************************/
public function DoShowLogin():void
{
trace("显示登陆界面")
this.stage.nativeWindow.visible=false
var logoWin:LoginWindow=new LoginWindow()
logoWin.open(true)
logoWin.nativeWindow.x=Capabilities.screenResolutionX / 2 - logoWin.width / 2;
logoWin.nativeWindow.y=Capabilities.screenResolutionY / 2 - logoWin.height / 2;
}
3.每一个控制单元仍然采用module来处理,本想采用常态的模式*.mxml来作界面,as编写操练,写了两三个模块单元,每次切换到Design模式,Adobe他爷爷,哇卡卡,最后还是把这个转换成全as,本想偷点懒,不想,还更花时间和精力。以后再也不想用尝试mxml(界面)+as(操纵)的方式,还有继续用全as来实现。卡死我了!
4.Tlf这么久了,还没有明显进步,[url=http://blogs.adobe.com/tlf/]Text Layout Framework Team[/url],why!!!!!!!!!!!!,难道非得要第三方来编写TableElement,CodeElement,MediaElement吗?