顯示具有 flex / air 標籤的文章。 顯示所有文章
顯示具有 flex / air 標籤的文章。 顯示所有文章

2010年3月8日 星期一

Flex HttpService Cache 資料問題

最近因為Flex HttpService Cache困擾了很久
因為Cache的關係, 在Flex第一次 load 之後, 就不會再到後端 Server load 資料
會以第一次取回的資料做處理
目前找到比較好的解決方法
暫時在Url裡傳入一個隨機產生變數

Ex.
var _random:String=(Math.floor(Math.random()*10000000*10)>>0).toString();
        
authService = new HTTPService();
authService.url = "UserInfoAction.action";
authService.method = "POST";
authService.useProxy = false;
authService.resultFormat = "e4x";
var parameters:* =
{
  "random": _random
}      
authService.addEventListener(ResultEvent.RESULT, handleResult);      
authService.send(parameters); 
這樣子基本上可以先暫時解決 HttpService Cache 的問題

2010年1月29日 星期五

關於 asSQL 顯示中文的問題

昨天玩了一下 Flex AIR , 使用 asSQL 連接 MySQL DB 取資料時發現中文的部份
會出現亂碼, 經查證是 com.maclema.mysql.ResultSet 裡的Code有問題












internal function initialize(charSet:String):void {
        charSet = charSet;
        ....
}

以上是Source Code的部份, 這樣子是無法將外部定義的charSet傳入
需將 Code  修改為



internal function initialize(charSet:String):void {
        this.charSet = charSet;
        ....
}

然後在MXML中使用MysqlService時, 需定義charSet="utf8"


<assql:MySqlService id="service"
                hostname="localhost"
                username="root"
                password="smile69"
                database="smilelight"
                autoConnect="true"
                charSet="utf8"
                connect="handleConnected(event)"
                sqlError="handleError(event)" />


中文字才會顯示正常