Skip to main content
Known Participant
October 13, 2020
Answered

SecurityError: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.

  • October 13, 2020
  • 1 reply
  • 705 views

SecurityError: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.
at flash.display::Loader/_loadBytes()
at flash.display::Loader/loadBytes()
at Function/<anonymous>()[ANDROIDCARREGARSWFDIMANICO_SWF__fla.MainTimeline::frame1:44]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

    This topic has been closed for replies.
    Correct answer kglad

    you need a loadercontext currentdomain to load swfs with code when using air for mobile.

     

    var ldr:Loader = new Loader();
    var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
    lc.allowCodeImport = true;
    ldr.load(new URLRequest("YOUR_FILE_PATH"), lc);

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    October 13, 2020

    you need a loadercontext currentdomain to load swfs with code when using air for mobile.

     

    var ldr:Loader = new Loader();
    var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
    lc.allowCodeImport = true;
    ldr.load(new URLRequest("YOUR_FILE_PATH"), lc);