2013-03-05 28 views
1

我已經使用externall AS3類文件創建了一個應用程序,並且它在PC桌面上完美工作(導出爲演示文稿文件)。使用Air App爲移動設備創建共享對象

但是,我現在需要移動相同的應用程序才能在移動平板電腦(Android設備)上工作。由於我需要存儲信息(用戶選擇的視頻播放列表),我需要保存播放列表的功能(因爲下次用戶在移動設備上輸入應用程序時,此播放列表必須播放)。我一直在使用該文件。參考txt文檔來保存播放列表,但我不認爲這將工作更多:-(。

我已經做了大量的研究,但最終無法找到這些答案兩個問題

Will shard objects keep saved on Android Tablet device even if the app is closed 
and then restarted ? 

 

If so , how to I create shared Objects specifically for Android tablet ? 

我曾看過http://www.adobe.com/devnet/flash/articles/saving_state_air_apps.html,但它適用於iPhone,並不具體。

我也看着這個:SharedObject not working on AIR mobile但是,再次,並沒有大量的幫助,仍然dosn't回答我關於存儲共享對象時重新打開應用程序的問題。

我無法真正使用SQL數據庫,因爲我不得不重新編寫Flex中的所有內容,這與我已經完成的AS3代碼不同。

我已經做了研究載荷和狩獵具體爲,在Android設備共享對象,但目前還沒有明確的教程等等。也許它這樣的新生事物人們還沒有完全得到解決,以它

所有非常感謝幫助。

回答

3

您可以毫無問題地使用SharedObject。

從這裏你可以看到在空氣中的手機是不支持的:link

+0

感謝磨,併爲感謝鏈接。劑量這也意味着每次應用程序關閉時共享對象都不會從內存中擦除。 – Daragh 2013-03-05 09:58:20

+0

沒有共享對象保存到磁盤。它將在unistall或當您從Android – 2013-03-05 10:00:08

+0

@ Azzy Elvul的應用程序設置中選擇清除數據時被刪除。感謝百萬 – Daragh 2013-03-05 10:13:09

2

檢查出的Adobe幫助頁面 http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html

這裏是一些樣本

private var mySo:SharedObject; 

function test():void 
{ 
    mySo = SharedObject.getLocal("application-name"); 
    mySo.data.savedValue = input.text; 

    var flushStatus:String = null; 
    try { 
     flushStatus = mySo.flush(10000); 
    } catch (error:Error) { 
     trace("Error...Could not write SharedObject to disk\n"); 
    } 

    if (flushStatus != null) { 
     switch (flushStatus) { 
      case SharedObjectFlushStatus.PENDING: 
       trace("Requesting permission to save object...\n"); 
       mySo.addEventListener(NetStatusEvent.NET_STATUS, onFlushStatus); 
       break; 
      case SharedObjectFlushStatus.FLUSHED: 
       trace("Value flushed to disk.\n"); 
       break; 
     } 
    } 
} 

private function onFlushStatus(event:NetStatusEvent):void { 
     trace("User closed permission dialog...\n"); 
     switch (event.info.code) { 
      case "SharedObject.Flush.Success": 
       trace("User granted permission -- value saved.\n"); 
       break; 
      case "SharedObject.Flush.Failed": 
       trace("User denied permission -- value not saved.\n"); 
       break; 
     } 

     mySo.removeEventListener(NetStatusEvent.NET_STATUS, onFlushStatus); 
    } 
+0

感謝您的支持,但是由於這是移動設備,跟蹤語句並沒有真正的幫助。此外,還沒有明確的聲明說,Android設備將關閉後保存共享對象。 – Daragh 2013-03-05 10:12:33

+0

@ user1081830共享對象確實得到保存... – 2013-03-05 10:36:45

+0

非常感謝。我會開始Dev並讓你在Loop中 – Daragh 2013-03-05 11:57:16