恩~很早之前就決定做了~
讓AIR的程式可以自動更新的類別
不過因為眾多理由~
直到這兩天才比較有時間可以做~
來分享一下我遇到的一些問題和解決的部分
我花了一些時間再看她的DOC
不過光看DOC比實作來的複雜~
我還有看一篇 FLEX 的教學
http://www.adobe.com/devnet/air/flex/quickstart/articles/update_framework.html
基本上它的範例是可以用的
但是編譯後會遇到許多的問題
一開始遇到的問題應該是
There was an error downloading the update. Error# 16831
如果你沒改 update-descriptor.xml 的話
我查了一下~這個是說你XML寫的和編譯的xxx-app.xml
<application xmlns="http://ns.adobe.com/air/application/3.1"> 不同
如果你跟我一樣直接改成
3.1
那你就會跟我一樣遇到
There was an error downloading the update. Error# 16815 這個問題
這是說沒有找到對應版本的 AIR
按照參考資料2
把 update-descriptor.xml
<update xmlns="http://ns.adobe.com/air/framework/update/description/2.5">
改成 2.5 那就 OK 了
至少在 FLEX 4.5 SDK 4.6.1下可以正常運行
正常狀況下~
是不會遇到下面的問題
There was an error downloading the update. Error# 16824
如果遇上了~是代表你的 發佈時的 xxx-app.xml 和 update-descriptor.xml
內的 versionNumber 不同~
就算是 2.0.0 和 2.0 這樣的差別 也會發生
最後~如果你遇到了
An unexpected error occurred. Error# 16828
這個問題~恭喜你~
你可能是因為你在 DEBUG下執行~
發佈成AIR 跑
就不會遇上了~
下面是我的從 參考資料1 的範例改成 SDK 4.6.1
可以用的版本
http://dl.dropbox.com/u/11428389/AIRupDateDemo/UpdateSampleFlex.rar 這個是整個 Flex project
http://dl.dropbox.com/u/11428389/AIRupDateDemo/UpdateSampleFlexSer.rar 這個是 我的www內放的東西~基本上根範例一內的資料夾一樣~
剩下的就是一些重複的資料了~
資料參考:
參考資料 1 :http://www.adobe.com/devnet/air/flex/quickstart/articles/update_framework.html
參考資料 2 http://help.adobe.com/zh_TW/air/build/WS9CD40F06-4DD7-4230-B56A-88AA27541A1E.html
參考資料 3 http://forums.adobe.com/message/3401427
2012年1月31日 星期二
2011年11月15日 星期二
[AS3] 單機多重登入檢測
這個是大家都會的~
看在這個BLOG上啥都沒有的分上~
讓我用這個充一下版面
Demo
看在這個BLOG上啥都沒有的分上~
讓我用這個充一下版面
package com.tenchiwang.net
{
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.net.LocalConnection;
import mx.charts.chartClasses.DataDescription;
public class RepeatLoginManage extends EventDispatcher
{
public static const ONLY_LOGIN:String = "onlyLogin";
public static const REPEAT_LOGIN:String = "rePeatLogin";
private var _name:String = 'localhost';
public var _lc:LocalConnection;
public var isRepeatLogin:Boolean = false; // false 沒有重複登入 true 有重複登入
// 檢查是否有重複登入
public function RepeatLoginManage(na:String = null)
{
_name = na?na:_name; // 字定的區隔 金鑰
_lc = new LocalConnection();
try{
_lc.connect(_name);
}catch(e:Error){
isRepeatLogin = true;
}
}
// 傳出 是否登入
public function init():void
{
if(!isRepeatLogin){
this.dispatchEvent(new Event(ONLY_LOGIN));
}else{
this.dispatchEvent(new Event(REPEAT_LOGIN));
}
}
// 結束 登入狀態
public function clearAll():void
{
if(!isRepeatLogin) _lc.close();
_lc = null;
}
}
}
Demo
訂閱:
文章
(
Atom
)