2012-08-13 57 views
2

收到此錯誤:AIR引發ArgumentError:錯誤#2004年: - 安卓

ArgumentError: Error #2004: One of the parameters is invalid. 
    at Error$/throwError() 
    at flash.filesystem::File/set nativePath() 
    at flash.filesystem::File() 
    at TestingRandomSound_fla::MainTimeline/GetContents()[TestingRandomSound_fla.MainTimeline::frame1:22] 
    at TestingRandomSound_fla::MainTimeline/frame1()[TestingRandomSound_fla.MainTimeline::frame1:47] 
    at runtime::ContentPlayer/loadInitialContent() 
    at runtime::ContentPlayer/playRawContent() 
    at runtime::ContentPlayer/playContent() 
    at runtime::AppRunner/run() 
    at AppEntryCommon/run() 
    at global/runtime::AndroidMobileDeviceAppEntry() 

從這個代碼:

import flash.desktop.NativeApplication; 
import flash.events.Event; 
import flash.display.Sprite; 
import flash.display.StageAlign; 
import flash.display.StageScaleMode; 
import flash.filesystem.File; 
import flash.ui.Multitouch; 
import flash.ui.MultitouchInputMode; 

    var myDocuments:File = new File(File.applicationDirectory.nativePath+"\\sample"); 

它適用於我的AIR桌面,但不與Android設備。 我包括文件夾示例,但它仍然無法正常工作。 任何想法?

回答

2

這是有效的。但很顯然,文件到應用程序目錄ONLY

var prefsFile:File = File.applicationDirectory; 
prefsFile = prefsFile.resolvePath("assets/xml/preferences.xml"); 

我創建了一個XML文件的偏好被讀取。但是,如果我想寫上它,我必須將其複製到文檔目錄中...

相關問題