9 Replies Latest reply on Jan 26, 2009 5:14 PM by Newsgroup_User

    Security Sandbox Violation when loaded swf tries to load sound from library

    CMSTorres Level 1
      I have been having some problems regarding loaded swf files (i'm using SWFLoader). The latest is that, when I load an swf that is supposed to play a sound, flex shouts the following error and the sound does not play:

      *** Security Sandbox Violation ***
      SecurityDomain 'file://c:\app\contents/animation.swf' tried to access incompatible context 'app:/swfplayer.swf'

      I looked inside animation.swf and I found out that it plays a sound by attaching it to a movie clip directly from the library. I also found out that if the sound is placed manually into the movie clip (dragging it from the library), the error doesn't appear.

      The problem is that I need to load any swf file into my app and I do not always have access to the .fla nor the source code for that swf, which means that I cannot forbid the person who created that swf to not use the attachSound method!

      Any ideas on how I can solve this?
        • 1. Re: Security Sandbox Violation when loaded swf tries to load sound from library
          Level 7

          "cmstreg" <webforumsuser@macromedia.com> wrote in message
          news:glkagt$pj0$1@forums.macromedia.com...
          >I have been having some problems regarding loaded swf files (i'm using
          > SWFLoader). The latest is that, when I load an swf that is supposed to
          > play a
          > sound, flex shouts the following error and the sound does not play:
          >
          > *** Security Sandbox Violation ***
          > SecurityDomain 'file://c:\app\contents/animation.swf' tried to access
          > incompatible context 'app:/swfplayer.swf'
          >
          > I looked inside animation.swf and I found out that it plays a sound by
          > attaching it to a movie clip directly from the library. I also found out
          > that
          > if the sound is placed manually into the movie clip (dragging it from the
          > library), the error doesn't appear.
          >
          > The problem is that I need to load any swf file into my app and I do not
          > always have access to the .fla nor the source code for that swf, which
          > means
          > that I cannot forbid the person who created that swf to not use the
          > attachSound
          > method!
          >
          > Any ideas on how I can solve this?

          Try moving the swf and its sound to app\contents

          HTH;

          Amy


          • 2. Re: Security Sandbox Violation when loaded swf tries to load sound from library
            CMSTorres Level 1
            The swf is there. The sound belongs to the animation.swf's library. I can't put it there - i'm not supposed to have access to the swf's fla file.
            • 3. Re: Security Sandbox Violation when loaded swf tries to load sound from library
              Level 7

              "cmstreg" <webforumsuser@macromedia.com> wrote in message
              news:glkjj7$6pm$1@forums.macromedia.com...
              > The swf is there. The sound belongs to the animation.swf's library. I
              > can't put it there - i'm not supposed to have access to the swf's fla
              > file.

              No, just move the swf and the sound (assuming that the swf uses a relative
              path to get at the sound).

              The problem is that Flex sets up just your workspace directory to trusted.
              Once you get outside of there, you need to change compiler arguments to be
              able to access resources.


              • 4. Re: Security Sandbox Violation when loaded swf tries to load sound from library
                CMSTorres Level 1
                I must be misunderstanding something here or i'm sorry if I wasn't clear - I don't have the sound. Therefore, I can't put it there. I just have the swf.

                As for the resources - how do I tell my app that it should allow access to that swf? Is it in the "Additional compiler arguments" in the project's properties? If so, what should I put there? The path where the swf is being loaded from? Or the folder where the app is installed?

                Thanks!

                quote:

                Originally posted by: Newsgroup User

                No, just move the swf and the sound (assuming that the swf uses a relative
                path to get at the sound).

                The problem is that Flex sets up just your workspace directory to trusted.
                Once you get outside of there, you need to change compiler arguments to be
                able to access resources.





                • 5. Re: Security Sandbox Violation when loaded swf tries to load sound from library
                  Level 7

                  "cmstreg" <webforumsuser@macromedia.com> wrote in message
                  news:glkle3$93o$1@forums.macromedia.com...
                  >I must be misunderstanding something here or i'm sorry if I wasn't clear -
                  >I
                  > don't have the sound. Therefore, I can't put it there. I just have the
                  > swf.
                  >
                  > As for the resources - how do I tell my app that it should allow access to
                  > that swf? Is it in the "Additional compiler arguments" in the project's
                  > properties? If so, what should I put there? The path where the swf is
                  > being
                  > loaded from? Or the folder where the app is installed?

                  I think you need to set it to something like use local with network. But
                  this is something that's only going to happen on your local machine during
                  development--it shouldn't happen on the server, according to the paths
                  you've given. So I'm at a loss as to why you say you don't have the sound.


                  • 6. Re: Security Sandbox Violation when loaded swf tries to load sound from library
                    CMSTorres Level 1
                    quote:

                    Originally posted by: Newsgroup User
                    I'm at a loss as to why you say you don't have the sound.

                    I don't have the sound. As I've said before "I need to load any swf file into my app", which means that I don't have access to the library items inside that swf! It was only by chance that I had access to this particular swf's source code and that only allowed me to understand how the sound was being played inside that swf. I'm not loading an swf and loading a sound. I'm just loading an swf that happens to play a sound. And that sound is intrinsic to that swf - to which I don't have internal access.

                    quote:

                    Originally posted by: Newsgroup User
                    I think you need to set it to something like use local with network. But
                    this is something that's only going to happen on your local machine during
                    development--it shouldn't happen on the server, according to the paths
                    you've given.

                    My app is running in the local machine, not in a server.


                    • 7. Re: Security Sandbox Violation when loaded swf tries to load sound from library
                      Level 7

                      "cmstreg" <webforumsuser@macromedia.com> wrote in message
                      news:glkogg$cpv$1@forums.macromedia.com...
                      >
                      quote:

                      Originally posted by: Newsgroup User
                      > I'm at a loss as to why you say you don't have the sound.

                      > I don't have the sound. As I've said before "I need to load any swf
                      > file
                      into my app", which means that I don't have access to the library
                      > items inside that swf! It was only by chance that I had access to this
                      > particular swf's source code and that only allowed me to understand how
                      > the
                      > sound was being played inside that swf. I'm not loading an swf and loading
                      > a
                      > sound. I'm just loading an swf that happens to play a sound. And that
                      > sound is
                      > intrinsic to that swf - to which I don't have internal access.
                      >
                      >
                      quote:

                      Originally posted by: Newsgroup User
                      > I think you need to set it to something like use local with network. But
                      > this is something that's only going to happen on your local machine during
                      > development--it shouldn't happen on the server, according to the paths
                      > you've given.

                      > My app is running in the local machine, not in a server.

                      Well, if you don't actually _have_ the sound on your local machine, that
                      could also cause an error, though I think it would be a different error. If
                      you _do_ have the sound on your machine, either move it for testing purposes
                      to get it within the trusted folder or do the research on what compiler
                      options you're going to need to set to access it where you insist on keeping
                      it.

                      Hope that's more clear.


                      • 8. Re: Security Sandbox Violation when loaded swf tries to load sound from library
                        2345453453 Level 1
                        If I read this correctly I think I'm having a similar issue.

                        The deal is that when making apps/tools we have to expect that the data will be loaded from any location by the end user.

                        I'n my case I'm trying to load a .swf from the app-storage/ directory. I get the same error because "'app-storage:/theFile.swf' tried to access incompatible context 'app:/theApp.swf".

                        Should be noted that in my case I'm making use of the LocalConnection class in order to cummunicate between the app and the loaded swf.

                        The Security Sandbox Violation issue is very confusing - I would love to see someone explain it in plan English :)
                        • 9. Re: Security Sandbox Violation when loaded swf tries to load sound from library
                          Level 7

                          "2345453453" <webforumsuser@macromedia.com> wrote in message
                          news:gll7nr$1t7$1@forums.macromedia.com...
                          > If I read this correctly I think I'm having a similar issue.
                          >
                          > The deal is that when making apps/tools we have to expect that the data
                          > will
                          > be loaded from any location by the end user.
                          >
                          > I'n my case I'm trying to load a .swf from the app-storage/ directory. I
                          > get
                          > the same error because "'app-storage:/theFile.swf' tried to access
                          > incompatible
                          > context 'app:/theApp.swf".
                          >
                          > Should be noted that in my case I'm making use of the LocalConnection
                          > class in
                          > order to cummunicate between the app and the loaded swf.
                          >
                          > The Security Sandbox Violation issue is very confusing - I would love to
                          > see
                          > someone explain it in plan English :)

                          http://livedocs.adobe.com/flex/3/html/help.html?content=05B_Security_01.html