I had a problem loading and accessing data from a value object in my new project. I upload an XML file through a service that contains the header and location of the asset files, I need to be able to access the location of the asset file by specifying the header and getting it from the value object. I am using Robotlegs framework, here is an xml example:
<?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>
Then I put this data in the value object as a dictionary hash.
var xml:XML = new XML(xml);
var files:XMLList = xml.files.file;
for each (var file:XML in files) {
var filePathVO:DataVO = new FilePathVO( file.@title.toString(),
file.location.toString()
);
filePathModel.locationList.push(filePathVO);
filePathModel.locationHash[filePathVO.title] = filePathVO;
}
I checked access to this from the view component.
var _background_image_path:String = String( filePathModel.locationHash['shell_background_image']);
it returns vague .. any ideas?
source
share