2

收到此错误:

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 Desktop,但不适用于 Android 设备。我包含了文件夹示例,但它仍然无法正常工作。有任何想法吗?

4

1 回答 1

2

这行得通。但显然应用程序目录中的文件是只读的

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

我创建了一个 xml 首选项文件。但是如果我想在上面写,我必须将它复制到文档目录中......

于 2013-06-18T15:27:00.000 回答