When working with Flash Player you will come across this error one time or another:
*** Security Sandbox Violation ***
SecurityDomain ‘http://s.ytimg.com/yt/swf/cps-vfl104716.swf’ tried to access incompatible context ‘http://www.youtube.com/v/fXldKmGuPqM &autoplay=0&loop=0&rel=0&showsearch=0&hd=1′
And it may not necessarily be for YouTube (as the above error is).
Now don’t fret because there are ways around this. Flash Player allows you to specifiy “safe” domains from which it shouldn’t complain about security violations. By the way, you can read up about Flash Player security settings here.
So how do we fix it? Well we use the “Security()” class. The following code basically tells Flash Player that we’re allowing SWFs from these locations to access stuff in our SWF:
1 |
And this will (hopefully) stop your warnings appearing.
However, most of the time, the warnings stem from Actionscript 2, and then you’ll need to put the allow domain code in your Actionscript 2 SWF, using code similar to:
1 |




Hi Ahmed,
Posted: July 13, 2009 at 8:34 pm;Thanks for this.
I’m using System.security.allowDomain(‘www.youtube.com’);
The youtube videos are playing when I test my website online. However when I test the movie in Flash itself, I keep getting the Security Sandbox violations, while the videos do play. Should I solve that some other way or is that not much to worry about?
Hi Jerome,
It’s a bit of a hack, are you using AS2 or AS3?
Posted: July 14, 2009 at 9:04 am;Great resource and list, will certainly be bookmarking this page.I’m glad everyone is finding this useful,Thank For Post….
Posted: July 20, 2009 at 9:47 am;