如何使用Adobe Air保存和加載?這一直是我需要知道的。以前我問過這個問題,但是我已經給了要使用的東西,但不知道如何使用它。我保存第59幀中的狀態,關閉並結束應用程序。那麼當我擊球時,我怎樣才能回到第59幀?請請幫忙!保存並加載狀態AS3 + Adobe Air
回答
1.Always寫你的當前幀的共享對象或文件
ex. onEnterFrame(ev:Event){ //write current frame somewhere }
2,當應用程序starte首先檢查文件或共享對象最後保存的幀數。如果默認情況下沒有找到它是第一幀,否則gotoAndPlay(frame_saved);
對不起,但在這個論壇上,沒有人會爲你寫的應用程序。你必須更多地努力完成解決方案。
我不明白! – user1666767
@ user1666767:你看看Lee Burrows的鏈接嗎? – puggsoy
是的,我知道如何使用SharedObjects,但我將如何保存和加載!它是如何檢測哪一幀的! – user1666767
假設你剛纔的根時間軸,你不要重複第一幀,那麼你的應用程序的第一幀上使用此代碼:
//the shared object to store the state
var stateSO:SharedObject = SharedObject.getLocal("saveState");
if (stateSO.size > 0 && stateSO.data.lastFrame && stateSO.data.lastFrame != undefined) {
//the shared object exists and has a valid value, so lets skip to that frame
gotoAndPlay(stateSO.data.lastFrame);
}
//this function runs every frame
function saveState(e:Event = null):void {
stateSO.data.lastFrame = this.currentFrame; //assign the current frame number to the shared object
stateSO.flush(); //save the cookie (shared object)
}
addEventListener(Event.ENTER_FRAME, saveState);
- 1. Adobe AIR 3.2 for Android AS3
- 2. Adobe AIR加載問題
- 3. Adobe Air自定義狀態欄
- 4. Adobe Air Flex附加並保存到XML文件
- 5. Adobe Air Browser
- 6. Adobe Air和Dropbox
- 7. Adobe Air多國下載
- 8. Adobe AIR截圖
- 9. Adobe Air - window.nativeWindow undefined
- 10. Adobe Air 4.0 Mobile As3 - StageText限制
- 11. AS3 Adobe AIR:返回xml字符串
- 12. localToGlobal Adobe AIR
- 13. Adobe Air - 內存問題
- 14. Adobe AIR,內存泄漏
- 15. Adobe air http auth
- 16. Adobe Air - Analytics
- 17. Adobe AIR readLine
- 18. Adobe Air for iPhone
- 19. Adobe AIR鎖定
- 20. Adobe Air Mobile啓動
- 21. Adobe AIR - RTMFP錯誤
- 22. Adobe Air父框架橋
- 23. Adobe Air SQLite同步
- 24. Adobe AIR鼠標滾輪
- 25. Adobe Air和PHP
- 26. Adobe Air的DeviceOrientationEvent
- 27. Adobe Air和.NET
- 28. Adobe Air with Iphone
- 29. Adobe Air Javascript API
- 30. Adobe AIR&PHP + MySQL
此外,這是對移動。 – user1666767
您可以使用SharedObjects在會話之間存儲數據(例如幀號) - 請參閱http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html – 2013-04-13 16:18:32
您是否發現瞭解決你的問題?如果是這樣,請分享它,或接受現有的答案。 – BadFeelingAboutThis