A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: HELP! Stupid Question, Security Sandbox!

  1. #1
    Senior Member
    Join Date
    Sep 2007
    Location
    USA................. Posts: 87,683
    Posts
    337

    HELP! Stupid Question, Security Sandbox!

    Hey, so I have this stupid little error I am not able to fix. I know there's a solution, but even after 1 hour searchin on Google I can't find it!

    Alrite it's simple, I have a main movie that runs in flash cs3 when I click "Test Movie". Then that main movie loads a swf from my website. That swf has actionscript and tries calling a function from my main movie. As soon as it attempts that, in my output this pops up:

    PHP Code:
    *** Security Sandbox Violation ***
    SecurityDomain 'http://www.trixmasta.com/...' tried to access incompatible context 'file:///C|/...' 

    I know there's this thing called System.security.allowDomain("*"), which allows any movie to talk to it. And i put it on the swf thats being loaded. But it still doesn't work!

    Anybody know how to do cross domain for local files, like the ones on your desktop? Or solve this problem?

    Thanks
    ...♠♣♦♥::Trickmaster::♥♦♣♠...
    ╔════════════════════╗
    ║------------------------- ║
    ║-- www.Trixmasta.com--- ║
    ║------------------------- ║
    ╚════════════════════╝

  2. #2
    Member
    Join Date
    Sep 2010
    Posts
    73
    you will want to upload a crossdomain.xml script to your website

    in your main movie you would want to something like this.

    Actionscript Code:
    stop();
    System.security.allowDomain("*");
    System.security.allowInsecureDomain("*");
    System.security.loadPolicyFile("http://wiistream.net/crossdomain.xml");
    this.loadMovie("http://wiistream.net/layout/McLayout.swf",4);

    Now every movie you make to add to your website that is being loaded from some other move you would want to add each location of that swf file to your crossdomain.xml

    example
    PHP Code:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy 
      SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
      <allow-access-from domain="http://wiistream.net/swf/McBody.swf" />
      <allow-access-from domain="http://wiistream.net/swf/McFooter.swf" />
      <allow-access-from domain="http://wiistream.net/swf/McHeader.swf" />
      <allow-access-from domain="http://wiistream.net/swf/McLeft.swf" />
      <allow-access-from domain="http://wiistream.net/swf/McRight.swf" />
      <allow-access-from domain="http://wiistream.net/swf/McLogo.swf" />
      <allow-access-from domain="http://wiistream.net/layout/McLayout.swf" />
      <allow-access-from domain="http://wiistream.net/login/McLogin.swf" />
      <allow-access-from domain="http://wiistream.net/friendrequest/McFriendRequest.swf" />
      <allow-access-from domain="http://wiistream.net/search/usersearch.swf" />
      <allow-access-from domain="http://wiistream.net/upload/McUploadPersonalPhoto.swf" />
      <allow-access-from domain="http://wiistream.net/startmenu/Mc_Xml_Startup_Menu.swf" />
    <allow-access-from domain="http://wiistream.net/pictureviewer/McPictureViewer.swf" />
    <allow-access-from domain="http://wiistream.net/upload/McUploadPersonalBackground.swf" />
    <allow-access-from domain="http://wiistream.net/upload/McUploadPersonalPictures.swf" />
    <allow-access-from domain="http://wiistream.net/profile/Mc_persoanl_Profile.swf" />
    <allow-access-from domain="http://wiistream.net/upload/McUploadPersonalMusic.swf" />
    <allow-access-from domain="http://wiistream.net/videoplayer/videoplayer.swf" />
    <allow-access-from domain="http://wiistream.net/ledmessage.swf" />
    <allow-access-from domain="http://www.youtube.com/apiplayer" />
    <allow-access-from domain="http://wiistream.net/newsfeed/NewUsersCommits.swf" />




    <allow-access-from domain="*" />
    </cross-domain-policy>

    You wil also want to add this line to every movie on each main frames frame one actionscript


    System.security.allowDomain("*");
    System.security.allowInsecureDomain("*");


    when you want to find or link some thing from a movieclip use
    trace(this);

    to find your location.
    then you will use that location as the link.
    WiiStream A Social Movie Network Version 0.1.1 Demo Testers Aproved http://wiistream.net/WiiStream.exe

  3. #3
    Member Pepember
    Join Date
    Jul 2001
    Location
    Berlin
    Posts
    886
    crossdomain won't help much, I guess.
    it seems that you are running a flash app on "http" protocol trying to access a file on a hard-coded "file" protocol.
    change whatever "file" references you have to relative references, so that the flash player will look them up relatively to its location.

    for what it's worth, in "Publish Settings" under "Local playback security" you can tell the flash player whether to access local or network data.

    [edit] oh, now I see. either you change the references in the network file to start with "http" so it will look the files up on the net or you pass the file urls to be accessed to the parent and let that one determine what to do?
    Last edited by theTick; 12-19-2010 at 06:55 PM. Reason: stupidity
    Please sign here

  4. #4
    Senior Member
    Join Date
    Sep 2007
    Location
    USA................. Posts: 87,683
    Posts
    337
    FINALLY! Thank YOU!!!

    All I needed to do was put the Security.allowDomain on the MAIN movie, not the one being loaded. Wow. I can't believe I didn't do that.

    I literally tried every other possibility for hours and hours.

    Well, fixed now.

    ...♠♣♦♥::Trickmaster::♥♦♣♠...
    ╔════════════════════╗
    ║------------------------- ║
    ║-- www.Trixmasta.com--- ║
    ║------------------------- ║
    ╚════════════════════╝

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center