0
나는 QuizMaker라는 게임을 만들고 있습니다.
게임의 퀴즈는 QuizMaker가 내 클래스 QuizXML을 통해 가져올 외부 .xml 파일입니다. 모든 퀴즈에는 해답이 포함 된 질문이 포함되어있을 수 있습니다. 어쩌면 이미지 형식 일 수도 있고, 텍스트 형식 일 수도 있습니다. 플레이어는 QuizMaker에서 "My Quizzes"폴더를 탐색 할 수 있어야합니다.
그렇게하려면 해당 폴더에 파일 목록이 필요합니다.
다음은 완료되지 않은 getter 함수이며 내 질문은 다음과 같습니다. 파일 목록을 얻으려면 어떻게해야합니까?AS3 - XML 파일 가져 오기, 만들기 및 저장
//returns an array of paths to folders and/or .xml files from the folder "My Quizzes"
public function getFolders():Array {
var folders:Array = new Array();
//if .xml or a folder is the file looking at, add the file path to folders
return folders;
}
//returns an array of .xml file paths from an array consisting of file paths
//if a folder, which contains .xml files, is encountered from the array, add the .xml file paths to an array
public function getQuizzes(folders:Array):Array {
var validXML:Array = new Array();
for(var curPath:uint=0;folders.length>curPath;curPath++) {
//if folders[curPath] is a folder
//somehow look through the folder's content
//if .xml is the file looking at, add the file path to validXML
//else if .xml is the file looking at, add the file path to validXML
}
return validXML;
}
내 두 번째 질문은 내가 폴더를 "내 퀴즈 '에서 XML 파일을 절약 할 수있는 방법이다? 내 질문을 읽기위한
//creates new folders inside "My Quizzes" from an array, which contains the folders' names as strings
//if a folder with the same name is encountered, don't override that folder
public function setFolders(folderNames:Array):void {
for(var curPath:uint=0;folderNames.length>curPath;curPath++) {
//if a folder exists as folderNames[curPath]
//do nothing
//else create a folder called folderNames[curPath]
}
}
//creates new .xml files from an array, which contains XML objects, inside a folder from a string
//if an .xml file with the same name as an XML object's nameFile is encountered, don't override that .xml file
public function setQuizzes(outputPath:String,objectsXML:Array):void {
for(var curXML:uint=0;objectsXML.length>curXML;curXML++) {
//if an .xml file exists as objectsXML[curXML].nameFile
//do nothing
//else create objectsXML[curXML] as an .xml file
}
}
감사 :
다음은되지 않은 세터 기능입니다.
안전하게 AIR를 사용한다고 가정 할 수 있습니까? – shaunhusain