allowDomain doesn't solve cross domain issues
I have tried your instruction about allowDomain but it is not working for me.
I've added allowDomain("*") and compiled the AS3 version with flash develop using flex3 sdk. The AS2 won't compile. I have an html page from domain A loading js from domain A and soundmanager swf from domain B and I'm trying to play mp3 files from domain B.
How can I test if the problem is communicating between js and swf or loading the mp3 files?
Thanks
I've added allowDomain("*") and compiled the AS3 version with flash develop using flex3 sdk. The AS2 won't compile. I have an html page from domain A loading js from domain A and soundmanager swf from domain B and I'm trying to play mp3 files from domain B.
How can I test if the problem is communicating between js and swf or loading the mp3 files?
Thanks
3
people have this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The best answer from the company
-
As of version 2.95a.20090717, I have started to include a cross-domain version of the SWF with the SoundManager 2 download - so you don't have to compile the SWF yourself with the Flex SDK, etc. This uses allowDomain("*") and you should be aware that anyone could script it from the host that you upload it to.
The company says
this answers the question
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?If SM2 is able to initialize without errors (eg. soundManager.onload() fires), then the cross-domain stuff is all good, JS and flash can talk etc. This is the harder of the two problems. If you're seeing errors when loading a remote .swf but a local (same-domain) URL works fine, then the remote .swf is apparently not passing the "allowDomain" test.
SM2 is able to load MP3s from remote domains without issue - I do this from the live demo pages, for example. The only limitation in that case is that ID3 information is not provided unless the remote site has a cross-domain policy file (crossdomain.xml) which Flash can access and is granted permission for that data.
Ah, I think I see where your report stems from: You have allowDomain('*') on a remote SWF, but then cannot access files on the local file system when viewing a page locally/offline, on your hard drive. Maybe you have a slightly-different situation, but again the Flash sandbox prevents remote SWF -> local filesystem access for good security reasons. You can see the specific error messaging for this in the debug output of SM2.
Effectively, the security sandbox for SM2 is:
Local filesystem (fs) SWF -> local fs MP3: OK
Local fs SWF -> network MP3: OK
Remote (network) SWF -> local fs MP3: Denied
Network SWF -> Network MP3 (same-domain or cross-domain): OK* (ID3 note for x-domain)
As a way to work around this, when viewing pages offline (eg. not over HTTP), you can have SM2 use the altURL property, load a local SWF and then it will be able to access remote internet (/network) resources.
When you first view the SM2 demos etc. offline, you will likely have already whitelisted it to work via the flash player security settings panel, eg., "allowing" the path which contains your project and the SM2 code so that JS + Flash can talk to one another.
soundManager.url = 'http://example.com/sm2-swfs/';
soundManager.altURL = './swf/'; // path for when viewing via c:/ or file:// etc.
This way when loading SM2 offline, it will load a SWF from the local path, and when online, it will use the internet SWF and thus you avoid security issues by playing within the rules of the sandbox, per se.
I've never compiled the AS2 source using anything other than MTASC, so your note is interesting. For AS3 I use the mxmlc compiler on both Windows and Mac, without issue.
I’m confident
-
Inappropriate?hi,
Thank you for the detailed explanation.
I work with two web servers so the working offline part is irrelevant to my problem.
Could it be a AS2 vs AS3 issues or new security restrictions in Flash?
I've read somewhere that Adobe don't want to let Flash do the hard work for javascript in the background any more.
I'll write a simple test with debug turned on and post it here or provide a link. -
Inappropriate?I was curious, so I built a flash movie with allowDomain('*') and put it on domain B, then loaded from domain A (and also from disk, eg. "offline") to test. It worked OK, except that as expected I was not able to load files from disk using the remote SWF when viewing a page on disk - only network URLs worked in that case.
I haven't verified the AS2 movie, but I'd expect the same behaviour - I don't believe any recent security changes have affected Flash as used in SM2.
I’m confident
1 person says
this answers the question
-
Inappropriate?Can you please post the test here or send me the files?
The complete test suit html, js ,as and swf will help me to compile it myself and compare the results.
pablo.platt at yahoo. -
Inappropriate?I am very, very interested, a mini-tutorial and a test file possible? because I can not get it.
-
Inappropriate?I'm having the same issue as well.
If a webpage is loaded from domain A and has a script link to domain B's soundmanager.js which loads the swf from domain B. The allowDomain("*") doesn't seem to help. I recompiled with mtasc in AS2.
I'm basically building a widget that is hosted on a different domain than the page that loads it. I'm going to keep working on it, but I'm interested if any of you have been able to get this scenario to work. -
Inappropriate?Actually, the scenario I described above seems to only be problematic in Firefox. It works fine in Safari (Mac) and IE 7. I'll keep trying to narrow down the problem and let you know if I figure anything out.
-
Inappropriate?So after a reinstall of Adobe Flash 10, with the same version (10.0.12.36), it works in Firefox mac as well. I don't understand why it didn't work for me at first, but I'm convinced that the allowDomain("*") does fix the problem.
-
Inappropriate?Please, Ian, you can share a test file
-
Inappropriate?I'm also trying to get it to work across domains: js in A, swf and mp3 in B. Tried allowDomain('*') and recompiled with mtasc, as instructed. No luck.
I’m sad
-
Assuming you're viewing the page online and loading the correct .SWF, things should work. Is SM2 unable to start at all, or just unable to load sounds in certain cases? Network SWFs cannot load local (offline) MP3s due to security restrictions, for example, unless whitelisted.
I was able to start SM2 using both flash 8 + 9 versions compiled with allowDomain("*"); with the HTML + JS on domain A, and the .SWF on domain B. -
Thank you for your reply. It seems that SM2 is able to start. It just does not load the mp3 files, which are online (together with the swf files). In fact, my installation is as follows: I have js (soundmanager2 and inlineplayer) in domain A, html in B, and swf, mp3 and css in C. It's here: http://tinyurl.com/cdu7su -
According to debug output, SM2 is failing when trying to call JS-to-Flash. First flash makes a call to JS, and then JS returns the call to confirm everything is OK. These two things typically either both work or fail together, so it's interesting that Flash can call out to JS, but the second step is failing here.
As a guess, perhaps try disabling high performance mode (soundManager.useHighPerformance = false) and see if that helps anything - also, make sure none of your CSS would be conflicting with the .SWF SM2 uses, hiding or overwriting the flash movie when it's written out to the document. -
Thank you again for your help. I tried both your suggestions (useHighPerformance = false and reverted to the original css) but it seems that nothing changed... Can it be that it is loading soundmanager2_flash9.swf, when I could only attribute (using mtasc) allowDomain("*") to soundmanager2.swf? -
Ah, that would be it. If loading the flash 9 version, you must recompile the AS3/flash 9 (soundmanager2_flash9.swf) source. Given you did version 8 though, you could set soundManager.flashVersion = 8 and your cross-domain issue should be solved, at least. Once you make a cross-domain Flash 9 file, you should see the same results using flashVersion = 9. -
Well, it's now using flash 8, but still no cigar... It seems, tough, that this is no cross domain issue (at least, no security warning appears on the debug output). The difference from a working version is these two lines, that don't appear on mine:
SMSound._onload(): "inlineMP3Sound1" loaded.
SMSound._onid3(): "inlineMP3Sound1" ID3 data received.
Thank you again. -
Inappropriate?Sounds like things are working OK! If your MP3 does not have ID3 data, you won't see an _onid3() event firing. That's OK, it is unrelated to your initial cross-domain question.
I’m happy
-
Inappropriate?As of version 2.95a.20090717, I have started to include a cross-domain version of the SWF with the SoundManager 2 download - so you don't have to compile the SWF yourself with the Flex SDK, etc. This uses allowDomain("*") and you should be aware that anyone could script it from the host that you upload it to.
The company says
this answers the question
Loading Profile...



EMPLOYEE

