Results 1 to 14 of 14
  1. #1
    Ridill
    Join Date
    Aug 2004
    Posts
    12,275
    BG Level
    9
    FFXIV Character
    Septimus Atumre
    FFXIV Server
    Gilgamesh
    FFXI Server
    Bahamut

    Flash Security Sandbox: Preventing you from doing what you want to do since version 7.0

    I figure with the people who peruse our forums, someone may possibly be able to answer this Actionscript 2.0 question for me.

    I am working on a project for a client, he wants me to be able to load advertisements into a video player that I created for him. When I try to load the external SWFs I am running into a problem where it doesn't want to even begin to load them when deployed to the web. After a while of fiddling I made a text box that read the details from the onLoadError() command- I got the following: "errorCode = 'URLNotFound': httpStatus =0".

    Since this works in the in the flash testing environment, but does not work when deployed to the web, and I know that this file does exist at the address by loading it directly into my browser, this means that the Security Sandbox is once more working overtime to ruin my fucking day.

    So any thoughts as to why Flash deems a simple SWF too naughty to even try to load even with System.security.allowDomain(*source domain*); before i try to load the file? I am seriously sick of this security sandbox being filled with cat shit for me. >_<

  2. #2
    Nidhogg
    Join Date
    Mar 2006
    Posts
    3,954
    BG Level
    7

    You wouldn't happen to be doing any masking on that external SWF, would you?

    edit: Also, to load an external SWF file into the main SWF, you must have an empty movie clip on a layer higher than the other content in the FLA of your movie player.

    I used to be a Flash developer for FisherPrice.com but that was almost 3 years ago, so I'm not sure how much Flash has changed since Adobe bought out Macromedia.

  3. #3
    Ridill
    Join Date
    Aug 2004
    Posts
    12,275
    BG Level
    9
    FFXIV Character
    Septimus Atumre
    FFXIV Server
    Gilgamesh
    FFXI Server
    Bahamut

    Quote Originally Posted by Norelco View Post
    You wouldn't happen to be doing any masking on that external SWF, would you?

    edit: Also, to load an external SWF file into the main SWF, you must have an empty movie clip on a layer higher than the other content in the FLA of your movie player.

    I used to be a Flash developer for FisherPrice.com but that was almost 3 years ago, so I'm not sure how much Flash has changed since Adobe bought out Macromedia.
    I am dynamically masking the SWF, but only after it is loaded.

    And the edit is interesting, I will give that a shot. But I still don't understand why would it work in the testing environment.

  4. #4
    Melee Summoner
    Join Date
    Oct 2006
    Posts
    48
    BG Level
    1

    What IDE are you using?

    What type of loader class are you using?

    Are you using any components?

    Are these external .swf's located on the same domain as the main .swf you are trying to load them to?

    If not: Have you checked your crossdomain.xml file on the servers that are hosting the external .swfs?

    If so: Check your file pathing is correct, relative pathing, whatever pathing.


    Or you know you could host the files some where and I can just see what you are doing.

    I don't feel like sharing my credentials, so you'll just have trust a random person on the net that you've never met or talked to before. And for heavens sake stop writing in AS 2.

  5. #5
    Bagel
    Join Date
    Jan 2006
    Posts
    1,428
    BG Level
    6

    Flash hasn't changed too much (AS2-wise) in the past three years I don't think... of course I don't do movies all too much with it. I'm one of those sad pandas that's stuck writing in AS2 since that's what the project started in and would be a bitch and a half to convert it.

    Otherwise I haven't worked much with movies/loading other swfs, so no help from me


    edit: just did a test, loader swf referencing a direct path swf while being hosted on two different domains and servers... working fine for me, don't even need to do an allowDomain. (which I thought I'd have to according to documentation even)

  6. #6
    Ridill
    Join Date
    Aug 2004
    Posts
    12,275
    BG Level
    9
    FFXIV Character
    Septimus Atumre
    FFXIV Server
    Gilgamesh
    FFXI Server
    Bahamut

    Quote Originally Posted by Errors View Post
    What IDE are you using?

    What type of loader class are you using?

    Are you using any components?

    Are these external .swf's located on the same domain as the main .swf you are trying to load them to?

    If not: Have you checked your crossdomain.xml file on the servers that are hosting the external .swfs?

    If so: Check your file pathing is correct, relative pathing, whatever pathing.


    Or you know you could host the files some where and I can just see what you are doing.

    I don't feel like sharing my credentials, so you'll just have trust a random person on the net that you've never met or talked to before. And for heavens sake stop writing in AS 2.
    IDE is Flash CS3 Ptofessional

    I have tried using MovieClip.loadMovie();, MovieClipLoader.loadClip();, and now loadMovieNum();.

    I am using my own components because I am not thrilled with how bloated some of the Flash UI ones are. (The radio button one was like 40k, which is terrible when your movie is 50k to begin with.) I have components that load pictures correctly (but I cannot apply filters or masks to them), however it hates loading SWFs.

    I think that the SWFs will be on the same domain when all is said and done, but the guy is being vague so I need it to be as flexible as possible. Since the project is on my testing domain trying to load from the final domain, it should be covered under crossdomain.xml.

    This is the crossdomain.xml file:

    Code:
    <cross-domain-policy>
    <allow-access-from domain="*"/>
    </cross-domain-policy>
    It should work. It allows me to load php files as xml fine, but it has a hatred for the SWF files.

    The pathing is correct, it works in the IDE testing environment (you know, control+enter), but it throws a fit if I try to open the file locally and will not display if I try to open it from my web site.

    If you cannot provide any insights I can rig up something to show you what is going on- and I don't care about your credentials if you can make this work. lol And I have thought about learning Actionscript 3.0, but everything that I have seen so far is a letter from Adobe that reads:

    Dear casual developer with no CS background,

    Go fuck yourselves.

    XXX, 000,
    Adobe.

  7. #7
    Nidhogg
    Join Date
    Mar 2006
    Posts
    3,954
    BG Level
    7

    No luck yet?

  8. #8
    Bagel
    Join Date
    Jan 2006
    Posts
    1,428
    BG Level
    6

    Btw, if you do a good share of work with .as files instead of graphics for your flash work, I'd recommend the FlashDevelop project to edit code files. Uses MTASK to compile the code and injects it into the .swf which is a LOT faster than compiling through flash's horrible IDE everytime.

  9. #9
    Nidhogg
    Join Date
    Mar 2006
    Posts
    3,954
    BG Level
    7

    Quote Originally Posted by Zhais View Post
    Btw, if you do a good share of work with .as files instead of graphics for your flash work, I'd recommend the FlashDevelop project to edit code files. Uses MTASK to compile the code and injects it into the .swf which is a LOT faster than compiling through flash's horrible IDE everytime.
    I thought flash code was interpreted. Has something changed recently?

  10. #10
    Bagel
    Join Date
    Jan 2006
    Posts
    1,428
    BG Level
    6

    Nothing's really changed, but compiling a good 50+ code files with a big component library with the flash IDE is painful at best.

    I only have to compile the .fla in the main IDE when I make a component/graphics change now, otherwise I just use flash develop for code changes and it compiles in <5 seconds compared to a couple minutes. (compiling fonts is also partly to blame for this)

    When I first started on this project, I was on a crappy crappy computer.. took 15+ minutes to compile


    That and the MTASK compiler seems to catch compile errors better in my opinion.

  11. #11
    Ridill
    Join Date
    Aug 2004
    Posts
    12,275
    BG Level
    9
    FFXIV Character
    Septimus Atumre
    FFXIV Server
    Gilgamesh
    FFXI Server
    Bahamut

    Beflashed, Bothered and Bewildered

    OK, I have noticed that there are two different issues here.

    I talked to one of my contacts and he said that he was able to see the ads on his computer, which made me curious. I checked on IE and I was able to see it. (Although it did not center properly, but that is a different issue.) I checked on Netscape on my laptop, but it did not work; it did work on my laptop's IE. It worked on IE and Firefox on my roommate's laptop. This leads me to believe that part of the problem may be from the Flashblock that I installed on both of my computers. (Or perhaps NoScript is doing it.)

    Then we get to the second problem. I found out that it would not properly center with the MovieClip.loadMovie(); method because when it attempted to load the SWF, MovieClip.getBytesLoaded() and MovieClip.getBytesTotal() would return undefined when the SWF finished loading when the application was viewed in a browser. (And thusly it would not call the next function that did the centering. This problem does not happen in the Flash IDE testing environment.) I switched to the MovieClipLoader() constructor since it has an error reporting function and onLoadComplete() method which should bypass that silly little getBytesLoaded() undefined problem. Sadly, this method will not even load the movie outside of the Flash IDE. Out of sheer frustration, I will place the code below...

    Code:
    #initclip
    Advertisement.prototype = new MovieClip();
    function Advertisement() {
        this.init();
    }
    Advertisement.prototype.init = function() {
        this.defaultAd_mc._visible = false;
    };
    Advertisement.prototype.setVars = function(a, u) {
        if (u == null || u == "default") {
            this.URL = "http://www.septimusprime.com/";
        } else if (u == "none") {
            this.URL = null;
        } else {
            this.URL = u;
        }
        if (a == null || a == "default") {
            this.defaultAd_mc._visible = true;
            this.activateButton();
        } else {
            this.pic = a;
            var picSplit:Array = this.pic.split('.');
            this.picType = picSplit[picSplit.length-1];
            this.createEmptyMovieClip("pic_mc",this.getNextHighestDepth());
            var mclListener:Object = new Object();
            mclListener.onLoadStart = function(target_mc:MovieClip) {
                //target_mc._visible = false;
                target_mc._parent.status_txt.htmlText = "<p>Starting load for "+target_mc+".</p><p>Target URL ="+target_mc._url+".</p>";
            };
            mclListener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void  {
                target_mc._parent.status_txt.htmlText += "<p>"+bytesLoaded+" bytes of "+bytesTotal+"</p>";
            };
            mclListener.onLoadComplete = function(target_mc:MovieClip) {
                target_mc._parent.checkLoad();
                target_mc._parent.status_txt.htmlText += "<p>Finishing load for "+target_mc+"</p><p>Target URL ="+target_mc._url+".</p>";
            };
            mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String, httpStatus:Number) {
                target_mc._parent.status_txt.htmlText += "<p>Error loading for "+target_mc+"</p><p>Error code '"+errorCode+"': http Status ="+httpStatus+".</p><p>URL: "+target_mc._parent.pic+"</p>";
            };
            var pic_mcl:MovieClipLoader = new MovieClipLoader();
            pic_mcl.addListener(mclListener);
            pic_mcl.loadClip(this.pic,this.pic_mc);
        }
    };
    Advertisement.prototype.checkLoad = function() {
        //this.pic_mc.setMask(this.ma_mc);
        this.centerPic();
        this.finishLoad = true;
        this._parent._parent.reportLoad();
        this.activateButton();
    };
    Advertisement.prototype.centerPic = function() {
        if (this.intervalCounter != undefined) {
            clearInterval(this.intervalCounter);
        }
        if (this.picType != 'swf') {
            if (this.pic_mc._width>this.back_mc._width) {
                this.pic_mc._width = this.back_mc._width;
            }
            if (this.pic_mc._height>this.back_mc._height) {
                this.pic_mc._height = this.back_mc._height;
            }
            this.pic_mc._x = (this.pic_mc._width/-2);
            this.pic_mc._y = (this.pic_mc._height/-2);
        } else {
            this.pic_mc._x = this.back_mc._x;
            this.pic_mc._y = this.back_mc._y;
        }
        if (this.pic_mc._x == 0 || this.pic_mc._y == 0) {
            this.intervalCounter = setInterval(this, "centerPic", 500);
        } else {
            //this.pic_mc._visible = true;
        }
    };
    Advertisement.prototype.activateButton = function() {
        if (this.URL.length>0 && this.URL != null && this.URL != "none") {
            this.back_mc.onRelease = function() {
                getURL(this._parent.URL, "_self");
            };
        }
    };
    Object.registerClass("Advertisement",Advertisement);
    #endinitclip
    Let it be known that I jumped from Flash MX to Flash CS3, so a few things annoy and bedevil me, like not being able to use -1 to target the last item in an array. (Every time I tried to do "this.picType = picSplit[-1];" it would result in "undefined".) Also, I am none too happy about these case-sensitive variable shenanigans they threw in there as well.

    If you wish to see this in action, here is a link to the small demo that I made. Any help would be appreciated.

    (P.S. And after this is resolved, can someone please explain to me why exactly I should switch to ActionScript 3.0 other than masochism?)

  12. #12
    Ridill
    Join Date
    Aug 2004
    Posts
    12,275
    BG Level
    9
    FFXIV Character
    Septimus Atumre
    FFXIV Server
    Gilgamesh
    FFXI Server
    Bahamut

    Ha ha ha! Shameless bump.

    Seriously, anyone know anything that can help? This is pissing me off.

  13. #13
    Ridill
    Join Date
    Aug 2004
    Posts
    12,275
    BG Level
    9
    FFXIV Character
    Septimus Atumre
    FFXIV Server
    Gilgamesh
    FFXI Server
    Bahamut

    Really now? No one knows anything?

    I guess I will post it in the Adobe site where people will know the answer, but will be too good to answer. >_>

  14. #14
    Bagel
    Join Date
    Jan 2006
    Posts
    1,428
    BG Level
    6

    Sorry, got busy with stuff ;;

    I need to install the new flash IDE since I can't open your files in Flash 8 it seems, I think I can look at it tonight/tomorrow

Similar Threads

  1. What's there to do in Philadelphia?
    By Telamond in forum General Discussion
    Replies: 55
    Last Post: 2012-01-31, 12:10
  2. BG Australia: What's there to do in Melbourne?
    By Taruru in forum General Discussion
    Replies: 11
    Last Post: 2012-01-18, 13:16
  3. What possess people to do this shit?
    By blister1 in forum General Discussion
    Replies: 12
    Last Post: 2007-02-27, 06:09
  4. (Because you don't have anything better to do...)
    By 2D in forum General Discussion
    Replies: 8
    Last Post: 2005-07-05, 11:37