1

I'm writing mp3 player in flash for my website. It needs first to load xml file(from external source) with .mp3 info then .mp3 file. I use URLLoader.load to load xml file.

When i run my .swf in a browser(from local source) it throws SecurityException so i have to edit Global Security Settings adding the path to file and it works.

When i upload it on the server, and run from server, it also throw SecurityError but I can't figure out if editing Global Security Settings will help(or rather why it's not working. I tried adding every possible path and it doesn't work).

Is there any solution? Cheers

taskinoor
  • 45,586
  • 12
  • 116
  • 142
f1ames
  • 1,714
  • 1
  • 19
  • 36

2 Answers2

2

If placing a cross domain file on the remote server isn't an option, then you will need to use a proxy script (e.g. PHP) that you call on your server. It can then load the XML without worrying about Flash's security sandbox, and Flash thinks the XML it has received has come from your server.

shanethehat
  • 15,460
  • 11
  • 57
  • 87
1

You need to set up a cross-domain-policy file. Please check the security chapter from programming as3. From the left panel select Programming ActionScript 3.0 -> Flash Player security -> Loading data.

taskinoor
  • 45,586
  • 12
  • 116
  • 142
  • The thing is external source is not mine www so I can't put crossdomain.xml there. So I assume that this type of action is allowed in local-www communication and not allowed in www-www communication? So the solution could be proxy in other programming language? No solutions in flash/as3? – f1ames May 15 '11 at 13:29
  • What do you mean? There are a number of flash games which communicates with server. Is this type of loading data you are looking for? – taskinoor May 15 '11 at 13:35
  • I mean that when my .swf is embedded on the www site it can't download .xml file from another www(not mine) without crossdomain.xml(with permissons) on that site? – f1ames May 15 '11 at 13:56
  • Can you post the URL that you are trying to load? – taskinoor May 15 '11 at 14:40
  • The .xml http://silvan15.wrzuta.pl/xml/plik/aaFrf78SaIk/unknown/undefined/95252 I see they have crossdomain.xml which says "get your hands off my files", but I'm still wondering why it(my .swf) works from browser as local file but doesn't work from server... – f1ames May 15 '11 at 20:18
  • I am afraid that you may need to use the method as suggested by shanethehat. – taskinoor May 16 '11 at 05:10
  • It works in your local sandbox because you are in the localhost domain and as such you will get a warning but will still be allowed to use the files. Where as once its published to your server it is now out of the local sandbox and all security rules apply. – The_asMan May 16 '11 at 18:42