Load online XML problem: Device vs. Device Central
Hi,
I am currently facing some problems loading an online XML file. The strange thing is,
that when I test the project in Adobe Device Central, the XML file DOES get downloaded & parsed,
but when I run the swf on my device, it doesn't.
In the onLoad handler of the XML object, the success-parameter returns "false", even though my device has asked me for a network connection.
-> The publish settings are set to "Access Network only" by the way! :)
the code:
[code]
import mx.utils.Delegate;
var resultXML = new XML();
resultXML.ignoreWhite = true;
resultXML.onLoad = Delegate.create(this, locationFileLoaded);
resultXML.load("http://twitter.com/statuses/user_timeline/16983611.rss");
//resulthandler
function locationFileLoaded(success:Boolean):Void{
if(success){
fscommand2("StartVibrate",800,10,1);
}
}
[/code]
Re: Load online XML problem: Device vs. Device Central
[QUOTE=davyhoskens;576761]Hi,
I am currently facing some problems loading an online XML file. The strange thing is,
that when I test the project in Adobe Device Central, the XML file DOES get downloaded & parsed,
but when I run the swf on my device, it doesn't.
In the onLoad handler of the XML object, the success-parameter returns "false", even though my device has asked me for a network connection.
-> The publish settings are set to "Access Network only" by the way! :)
the code:
[code]
import mx.utils.Delegate;
var resultXML = new XML();
resultXML.ignoreWhite = true;
resultXML.onLoad = Delegate.create(this, locationFileLoaded);
resultXML.load("http://twitter.com/statuses/user_timeline/16983611.rss");
//resulthandler
function locationFileLoaded(success:Boolean):Void{
if(success){
fscommand2("StartVibrate",800,10,1);
}
}
[/code][/QUOTE]
What about crossdomain.xml file , DO u have this file on the server ?? If not, than might be this is the issue . Moreover, i advise u to go through these articles :
[URL="http://www.mmug-dublin.com/blog/?p=26"]Cross Domain File On Flash Lite 3[/URL]
and good hints :
[URL="http://device54.com/blog/2009/01/xml-and-flash-lite-stuff-of-nightmares.html"]XML and Flash Lite Nightmare[/URL]
Hope these articles help u ..;)
Best Regards,
SajiSoft
Re: Load online XML problem: Device vs. Device Central
The problem is the crossdomain policy, which restricts applications to using the API or web UI from Twitter.
A quick cheat would be to create a PHP proxy on your own web server and use that.
Alternatively you will need to use the API, for which they use basic authentication, this requires the ability to base64 encode the username and password as well as use XML.addRequestHeader API. Unfortunately that API is not working in Flash Lite.
I suggest a proxy approach using the API.
Mark
Re: Load online XML problem: Device vs. Device Central
Hi, thanks for the response guys.
But neither of the answers were helpfull. :D The crossdomain xml wasn't the problem, since I used the twitter rss/xml only as an example in this code. I am using a php proxy on my own server to load the actual xml file (so not a twitterfeed), to avoid the crossdomain problems, and extract the necessary data on serverside, instead of in the client FlashLite application...
Doing some various tests, has showed me that compiling the same project in Flash CS3, produces an application that works,
and compiling it in Flash CS4, gave me these troubles...
So I know what to do now, which is continue in Flash CS3 =)
Anyway, thanks for the response!
edit: this didn't seem to be the problem after all. Aaaaargh...
edit2: finally we realised the problem... The device we were testing on, is shipped with FL3, instead of FL2 like we thought... Moving the swf to the Trusted folder, solved the problem... TY guys :)
Re: Load online XML problem: Device vs. Device Central
If you are using a single SWF file on the device then I recommend setting "Network Access only" in the publish settings. Once you've done that you should use the allowDomain("www.yourdomain.com") in the root of your fla. Then you won't need the trusted folder.
The outputs between CS3 and CS4 are identical, so that was never going to be a solution :-)
Mark
[url]www.flashmobileblog.com[/url]
Re: Load online XML problem: Device vs. Device Central
[QUOTE=markadoherty;577825]If you are using a single SWF file on the device then I recommend setting "Network Access only" in the publish settings. Once you've done that you should use the allowDomain("www.yourdomain.com") in the root of your fla. Then you won't need the trusted folder.[/QUOTE]
It was the first thing I tried, setting the "network access only" in the publish settings, and using the allowDomain function. On [url=http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=3&postId=8404]this Adobe page[/url], I found that since I am _also_ using an xml on the device itself, the Trusted folder was needed.
[quote=Adobe page]
If your swf accesses both local and remote data then forget about the publish settings because you can't set both local and remote access for a swf. What you will need to do is install your application into a folder called 'trusted' within the Flash Lite player directory. This will allow your swf to load data from any local or remote destination.
[/quote]
[QUOTE=markadoherty;577825]The outputs between CS3 and CS4 are identical, so that was never going to be a solution :-)[/QUOTE]
I realise this now :D On a friday afternoon, you would blame anything if stuff doesn't work :D
Re: Load online XML problem: Device vs. Device Central
Ah, so in this case you will need the trusted folder. With Flash Lite 3.1 we have eased the security model to enable you to use local files and networking with ease. Feel free to check it out..
[url]http://labs.adobe.com/technologies/distributableplayer/[/url]
Mark
Re: Load online XML problem: Device vs. Device Central
Hi,
Could you please explain clearly how to do "a proxy approach using the API"?
Thanks.