簡體   English   中英

Blackberry Webworks / Phonegap文件瀏覽器

[英]Blackberry Webworks/Phonegap file browser

我正在從Air / Actionscript遷移到WebWorks,並且遇到了一些困難。 我已經嘗試了一些在網絡上找到的Phonegap文件瀏覽器教程和示例,但是它們不適用於Playbook。 我已將access_shared權限添加到配置中。 我有一個,啟動我的應用程序時,應該將目錄和文件加載到中。

我的js如下:

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
window.requestFileSystem(
LocalFileSystem.PERSISTENT,
0, onFileSystemSuccess, fail
);
}

function onFileSystemSuccess(fileSystem) {
// Create some test files
fileSystem.root.getDirectory("myDirectory",
{ create: true, exclusive: false },
null,fail);
fileSystem.root.getFile("readthis.txt",
{ create: true, exclusive: false },
null,fail);
var directoryReader = fileSystem.root.createReader();
// Get a list of all the entries in the directory
directoryReader.readEntries(success,fail);
}

function success(entries) {
var i;
var objectType;
for (i=0; i<entries.length; i++) {
if(entries[i].isDirectory == true) {
objectType = 'Directory';
} else {
objectType = 'File';
}
$('#directoryList').append('<li><h3>' + entries[i].name + '</
h3><p>' + entries[i].toURI() + '</p><p class="ui-li-aside">Type:
<strong>' + objectType + '</strong></p></li>');
}
$('#directoryList').listview("refresh");
}

function fail(error) {
alert("Failed to list directory contents: " + error.code);
}

我發現KitchenSink中的DIR示例向我展示了我需要知道的內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM