새 프로젝트의 값 개체에서 데이터로드 및 액세스에 문제가 있습니다. 자산 파일의 제목 및 위치가 포함 된 서비스를 통해 XML 파일을로드합니다. 제목을 지정하고 값 객체에서 그것을 retrieiving하여 자산 파일의 위치에 액세스 할 수 있어야합니다 .. 나는 Robotlegs 프레임 워크를 사용하고, 여기에 XML의 예 : - 다음값 개체에서 데이터 채우기 및 액세스
<?xml version="1.0" encoding="utf-8" ?>
<files id ="xmlroot">
<file title="css_shell" location = "css/shell.css" />
<file title="xml_shell" location = "xml/shell.xml" />
<file title="test" location= "test/location/test.jpg" />
<file title ="shell_background_image" location = "images/shell_images/background_image.jpg" />
</files>
내가 이 데이터를 사전 해시 값 개체로 푸시합니다 .. 잘하면
//----------- populate value objects ------------------------------------
var xml:XML = new XML(xml);
var files:XMLList = xml.files.file;
for each (var file:XML in files) {
var filePathVO:DataVO = new FilePathVO([email protected](),
file.location.toString()
);
filePathModel.locationList.push(filePathVO);
filePathModel.locationHash[filePathVO.title] = filePathVO;
}
보기 구성 요소에서 액세스를 테스트했습니다.
// accessing from another class -----------------
var _background_image_path:String = String(filePathModel.locationHash['shell_background_image']);
그것은 어떤 아이디어라도 반환합니까? 당신은이 라인에 위치 속성의 @
을 잊어