Welcome, Guest. Please login or register.
Did you miss your activation email?
11 Mar 2010, 08:26:37 UTC
Forum home
+  flexdeveloper.eu Forum
|-+  Flex and ActionScript 3.0
| |-+  Flex 3 Framework (Moderators: JMWhittaker, Jan K, thewarpedcoder, James)
| | |-+  URL for local xml file using HTTPService?
« previous next »
Pages: [1] Print
Author Topic: URL for local xml file using HTTPService? (Read 22400 times)
PhilC
Guest
« on: 03 Aug 2006, 15:17:53 UTC »

Other than the default bin directory, when a swf file is executed and tries to load a local xml file, e.g.

<mx:HttpService url="test.xml" ...


If you then move the files from the bin directory (including the test.xml file) to another directory and try to execute the swf there, the xml file then fails to load.

Do anyone know what the correct URL format would be so a specific directory does not have to be specified?  :-?


PhilC.
Logged
Elsa
Guest
« Reply #1 on: 03 Aug 2006, 17:23:12 UTC »

Not sure this is the answer as you seem to have kept the same structure  but might be helpful to others.

Quote
Tip: Ensure that you deploy the data file to the correct location. The URL that you specify for the HTTPService control is relative to the location of the HTML file that loads in your Flex application, not relative to the location of your Flex application's SWF file.

from Adobe Quick Starts
« Last Edit: 03 Aug 2006, 17:23:37 UTC by Elsa » Logged
Elsa
Guest
« Reply #2 on: 06 Aug 2006, 15:22:49 UTC »

Ok I had some problems with viewing a local XML file I tried this and it worked for me:
Quote
Try adding this compiler option in your project settings (right-click on
your project-->properties-->Flex Compiler-->under additional compiler
arguments):

-use-network=false
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg32674.html
« Last Edit: 21 May 2008, 10:43:54 UTC by flexy » Logged
bb1234_00
Guest
« Reply #3 on: 18 Aug 2006, 10:55:10 UTC »

I am encountering the same problem. Ah Elsa, I tried your suggestion setting -use-network=false but still not working.  Cry
Logged
Elsa
Guest
« Reply #4 on: 18 Aug 2006, 14:29:28 UTC »

Perhaps it is the way you are refering to the file. :-/
If you refer to the file relatively rather than absolutely does it work?

e.g.  
Code:
<mx:HttpService url="test.xml" ...

rather than  
Code:
<mx:HttpService url="http://localhost/test.xml" ...

you'll still need to use the "-use-network=false" though.
« Last Edit: 18 Aug 2006, 14:30:46 UTC by Elsa » Logged
Corkman
Newbie FD
*
Posts: 3



« Reply #5 on: 26 Nov 2006, 22:09:41 UTC »

I am encountering the same problem and setting the parameter in the compiler doesn't work for me either. Any suggestions?
Logged
flexy
flexdeveloper.eu
Guru/Addict FD
*****
Posts: 2,842


Recovering Coffee Addict & Adobe Expert


WWW
« Reply #6 on: 27 Nov 2006, 12:31:42 UTC »

As well as adding the additional line to your compiler arguments, you should also check that you're allowing Flash Player access to a local resouce - it fails silently. Check your player security settings.

« Last Edit: 21 May 2008, 10:45:47 UTC by flexy » Logged

Corkman
Newbie FD
*
Posts: 3



« Reply #7 on: 27 Nov 2006, 20:18:25 UTC »

The HttpService I am calling is already located on a server. When I open the flex application in a HTML wrapper (all located in the bin directory) the HttpService works fine. However if I move the swf, the HTML wrapper file and other files to any other location on my pc and open the html wrapper file in a browser, the HttpService doesn't work. It doesn't work in any browser but if I open it in Firefox, I get a message in the status bar saying that it is waiting for the server. The URL of the HttpService is defined absolutely.

I know you mentioned about the security settings in flash, but I dont think that is the problem, as the HttpService does work if the files are located in my bin directory. I may be wrong.

Thanks
Logged
flexy
flexdeveloper.eu
Guru/Addict FD
*****
Posts: 2,842


Recovering Coffee Addict & Adobe Expert


WWW
« Reply #8 on: 27 Nov 2006, 23:10:05 UTC »

You're right, you're wrong!

The bin directory behaves differently to any other directory; Flash player allows SWFs running in this directory to access network resources (like a call to a remote HTTPService). Once you move these files outside of this directory, Flash player will stop the player accessing any external resources, unless you specifically allow the player to do so.

Open a SWF in your browser, right-click and select advanced settings. This will take you to Adobe.com, but will show you a page with your FP setting embedded in it. Select the 'Global security settings' option and then add the location your SWF is being moved to (i.e. c:\mylocation). Close down all instances of Flash Player, then try again. (You can access your player settings here)

You should find that provided you do all of this, and don't have the -use-network compiler argument (as you're calling a resource across the network), everything should work.
« Last Edit: 21 May 2008, 10:47:11 UTC by flexy » Logged

Corkman
Newbie FD
*
Posts: 3



« Reply #9 on: 28 Nov 2006, 21:46:12 UTC »

i found the problem.....the problem was i did not have a crossdomain.xml file on the server.

Thanks for your help
Logged
flexy
flexdeveloper.eu
Guru/Addict FD
*****
Posts: 2,842


Recovering Coffee Addict & Adobe Expert


WWW
« Reply #10 on: 29 Nov 2006, 13:15:21 UTC »

Ah! The one thing we didn't mention! Well I'm glad you've sorted your problem, it can be really frustrating when you've done everything you think can be done!

So, in summary:

1) Ensure you add the compiler argument -use-network=false if you're planning to load in a local XML file.
2) Make sure your Global Security Settings in Flash Player allows local access to the directory your SWF/XML is running from.
3) If you're loading in XML from a remote sever that isn't hosting the SWF too, make sure you create a crossdomain.xml policy, and put it on the root.
« Last Edit: 21 May 2008, 10:48:13 UTC by flexy » Logged

Pages: [1] Print
« previous next »
Share this on: Twitter Twitter Del.icio.us del.icio.us Digg Digg
Jump to:

©2006-2010 Flexdeveloper.eu/Jodie O'Rourke. All rights reserved.
Adobe®, Adobe® Flash™, Adobe® AIR™ and Adobe® Flex™ are registered trademarks of Adobe Systems Incorporated in the United States and other countries. All rights reserved.

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC