« Rockstar to Offer Flash Game Counterpart to GTA for Money LaunderingAchron - Meta/Real-time Strategy Game »

14 comments

  1. § Richard Leggett® Email said on :
    I should point out I haven't really used "best practices" in my code snippets throughout but I wanted to keep them brief.
  2. § ekz Email said on :
    This has been extremely helpful.

    I do have a question: I have an AIR app that loads a SWF, and the above worked perfectly; however, that loaded swf in turn needs to load other swfs.

    I am running into issues, the exception thrown is "Loader.loadBytes() is not permitted to load content with executable code." , and I cant use lc.allowLoadBytesCodeExecution , because it is available only in AIR.

    Any ideas?
  3. § Richard Leggett® Email said on :
    I think in your case try using lc["allowLoadBytesCodeExecution"] = true; inside the SWF you are loading, I'm using this technique to utilise the AIR-only parentSandboxBridge property in my regular Flash 10 (web) SWFs.

    Using the array access operators allows for AIR code to be ran in SWFs that are published for the web as the code is not compile-time checked.
  4. § DT Email said on :
    Hi Richard.
    Excellent article!!!
    As a new AIR developer I came across the Security violation stuff when my AIR app (running in desktop mode) tried to load a LOCAL .swf file. (I am using Flex Builder 3 to build my AIR app).

    Question: any suggestion as of how to get around this issue when the.swf file is on the same box as the AIR app itself

    Cheers,
    DTR
  5. § Richard Leggett® Email said on :
    Hi DT,

    I'm not sure I follow. In this case the file is on the same box as the AIR app itself. Do you mean a local server or something else perhaps?

    Did this technique not work in that situation?

    Rich
  6. § DT Email said on :
    Hey Rich,
    Sorry for the radio silence & thx for responding to my
    email.

    WRT your questions:
    1. What i meant by local (on the same machine) was exactly that, i.e. I have the AIR app plus the .swf file on the same machine. When I tried my code, i got a Security violation, hence looking on the net ...
    2. No, i did not your suggested solution. If i try to use your solution for my app, what would be the correct URL syntax for passing to your loader routine? For example, let's say that my AIR app (bar.air) & the swf that is trying to load (foo.swf) are located in the directory/folder C:\myApp. In this case what would be the correct URL for the foo.swf?
    urlLoader.load(new URLRequest("C:\myApp\foo.swf"));
    urlLoader.load(new URLRequest("\myApp\foo.swf"));
    urlLoader.load(new URLRequest("foo.swf"));
    ?

    Again, thx 4 yr help.
    DT
  7. § DT Email said on :
    Modifications to the previous posting:
    I suppose the correct path is:
    urlLoader.load(new URLRequest("app-storage://myApp/foo.swf")). Correct?

    DT


  8. § Richard Leggett® Email said on :
    In most cases it's easier to use the File.applicationStorage.resolvePath("path/to/file.swf").url as that saves you coding the entire path yourself. If the SWF you are loading is in the app-storage directiory this method should work for you (the app storage directory is usually called Local Storage, so the path is relative to that, you don't include anything like the app name. It's also important to set the LoaderContext as described too just in case.
  9. § Arnoud Bos Email said on :
    Hi Richard,

    I'm struggling too with the air sanboxes ;-)
    So the article was a interesting read. What worries me is your advice. The technique you are using is really a security problem. Are you aware that any man in the middle can take over your system this way and that man in the middel attacks are not hard at al (according to adobe security experts).


    So this technique could be a lot saver if:
    - you sign the loaded swf's and validate them before giving them full system access. I don't know if you can sign flash files but with adt you can.
    - load them over a secure channel

    I thought i'd mention this because readers of the blog might be unaware of the man in the middle security risks this technique can lead to.

    cheers!

    Arnoud
  10. § Richard Leggett® Email said on :
    Hi Arnoud,

    Yes, the problem is, without this technique, AIR becomes useless for loading any local SWF that has components in it, I can't see a way to use AIR for many applications if this is not possible. If it's user created content I would not use this however.

    I absolutely agree with your proposals for security on top of this, thanks for adding these here.
  11. § rumori Email said on :
    Hello Richard,
    thanks for the insightful post.

    Did you manage to load any SWF from app-storage into the local-with-network security sandbox?
    The official documentation also mentions this possibility, but I couldn't achieve this regardless if I compile the loaded SWF with -use/network=true or not. It is placed in the localWithFile sandbox in both cases.
    Any suggestions? (I couldn't dig up much information about this topic)

    Thanks
  12. § Stray Email said on :
    Hi Richard,

    thanks for this post. I read it when I was looking into building a modular AIR application, with functional modules loaded at runtime.

    I've now come up with a framework for loading signed and unsigned swfs into different sandboxes. It's all in a nice neat wrapper with user feedback during the installation process as well.

    All the code and testable examples are at http://flair-flash-flex-air.blogspot.com/2009/09/framework-for-modular-air-applications.html

    Thanks for getting me started.
  13. § Richard Leggett® Email said on :
    Hi Stray,

    Yes I remember reading your post a few days ago, I recommend anyone else reading this one to follow the link.

    http://flair-flash-flex-air.blogspot.com/2009/09/framework-for-modular-air-applications.html
  14. § Online Computer Science and IT Degrees Email said on :
    Article to help you find out more about distance learning online.

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
Contact. ©2010 by Richard Leggett. blog software / UK hosts / monetizing.
Design & icons by N.Design Studio. Skin by Tender Feelings / Evo Factory.