[ This post has been moved to here ]
In your example, I don’t think you will get a very good display unless you configure some dataGridColumns inside the data grid and assign data fields for them. I also think that for any but the simplest data you will need to do a bit more work to massage the result data into useful shape in the ArrayCollection.
Thanks for the comment Andrew,
However the code was to demonstrate loading data and doing something with it, it was by no means designed to present it in the best looking way.
Hi, I’m always the one who experiences the wacky behavior, and this is just the latest episode…I am using a HTTPService to retrieve the contents of an external XML file and load it into a datagrid object, which is being displayed in a dashboard application. As the dashboard is loading, I get some error messages (something about null objects or null values). The application has been working without incident for weeks, and this just occurred the other day. The source file does get updated on an hourly basis. Since the design of the dashboard.swf hasn’t changed, I concluded it must be an issue with data. In the XML file, I found a few records which had at least one empty field. In particular, the field [being filtered by the first column in the datagrid] was empty in these records, which were created very recently. As a test, I added a value to this particular field for the applicable records, and the error messages disappeared. Interestingly, some records still had empty fields, but the error messages did not return. Perhaps it’s noteworthy that the field which *seemed* to be problematic was the one being filtered by the *first* column in the datagrid.
Has anyone else ever heard of anything like this? Does this seem like feasible behavior? Clearly, the program didn’t *like* the first-column field being empty in the source data, but I have no idea why. I’m fairly new at this, so any feedback whatsoever would be very valuable to me.
Thanks and Regards,
From what you have described it sounds like you need some code to catch a null value and handle it. You could maybe give a default value to or skip over that node, I used to encounter this a lot when writing Flash based web applications pulling in XML data sources. The behavior sounds like I would expect when parsing a file and coming across an unknown value which would cause problems since it has no ‘ok do this instead’ code.
I get an error:
Error: Error #2148: SWF file file://localhost/…blahdeblah…/_workspace/HTTPService example/bin-debug/main.swf cannot access local resource data/sampledata.xml. Only local-with-filesystem and trusted local SWF files may access local resources.
New to Flex so sorry if this is obvious.
is the xml file in the /data folder inside bin-debug? I’m guessing it is but have to start with the obvious first. I have not had that problem so let’s work through together
Pete — thanks. That was it and thanks for the rapid response.
Great news Mark!
Thanks for letting us know.
But if there is a error in that XML node how do you tell flex to skip over it and continue processing the data?
A good question to which I do not have an answer, sorry.
I make sure that my XML is well formed before I start doing anything with it, mainly due to the fact that I handle the error event and do not parse if the return is bad or considered a fault which is why I place the function
private function faultHandler(event:FaultEvent):void
Alert.show(“Error: ” + event.fault.faultString, “Application Error”);
Even if I plan to do nothing with it, although I would suggest you some how log the problem if this is in a production environment.
It seems no matter what my HTTP service will not launch, I added event listers for activate, onresults, onfault, etc and they dont even do anything. Is there something im missing? I have a crossdomain.xml file already
The way I normally go about finding a problem is putting a trace statement in my functions/methods to be sure they are getting called. Many a time I have missed calling a function to start a web service call, maybe try that and be sure everything is firing up as expected.
Hope this helps,
[…] more at: https://grfxguru.wordpress.com/2008/09/07/tutorial-httpservice-with-flex-3/ This thing was constructed by admin. You can follow comments through the RSS 2.0 feed. You can […]
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.