Jump to content


LoaderMax & AIR 1.5?

Recommended Posts

Hi All,


Has anyone tried to use the LoaderMax Beta to load a SWF from localhost or a remote server using LoaderMax Beta & AIR 1.5?


It works great in Flash Player 10, but there is a security error when I compile with AIR.


I'm getting this security error:

[sWF] loaderAIR.swf - 38638 bytes after decompression

SecurityError: Error #2142: Security sandbox violation: local SWF files cannot use the LoaderContext.securityDomain property. app:/loaderAIR.swf was attempting to load http://localhost/assets/myContent.swf.

at flash.display::Loader/_load()

at flash.display::Loader/load()

at com.greensock.loading.core::CommonLoader/_load()[C]

at com.greensock.loading::SWFLoader/_load()[C]

at com.greensock.loading.core::LoaderCore/load()[C]

at loaderAIR_fla::MainTimeline/frame1()[loaderAIR_fla.MainTimeline::frame1:15]

at runtime::ContentPlayer/loadInitialContent()

at runtime::ContentPlayer/playRawContent()

at runtime::ContentPlayer/playContent()

at runtime::AppRunner/run()

at global/runtime::ADLEntry()


I'm just using the code from the sample:

import com.greensock.*;
import com.greensock.loading.*;
import flash.events.*;

var loader:SWFLoader = new SWFLoader("http://localhost/assets/myContent.swf", {


//fade the swf in as soon as it inits
function initHandler(event:Event):void {
TweenLite.from(event.target.content, 1, {alpha:0});

//Or you could put the SWFLoader into a LoaderMax. Create one first...
var queue:LoaderMax = new LoaderMax({

//start loading

//pause loading

//resume loading

function progressHandler(event:ProgressEvent):void {
trace("progress: ");

function completeHandler(event:Event):void {
trace(event.target + " is complete!");

function errorHandler(event:ErrorEvent):void {
trace("error: " + event.text);


I also have a crossdomain.xml file:

<?xml version="1.0" encoding="utf-8"?>


Any thoughts, comments or smart remarks are welcomed! Thanks!

Link to comment
Share on other sites

What version of LoaderMax are you using? Did you download it today? If not, please do and let us know if it resolves the issue.

Link to comment
Share on other sites

Would you mind downloading the latest one and trying again please?

Link to comment
Share on other sites

Downloaded the latest build. Now I'm getting a new error: 1120: Access of undefined property AVM1Movie.


LINE 260 of SWFLoader.as

if (!_scriptAccessDenied && _loader.content is AVM1Movie) {


My content is a simple AS3 SWF. I've attached my sample files.

Link to comment
Share on other sites

Ha ha - silly me. I had copied/pasted something between CommonLoader and SWFLoader right before uploading and forgot to add the import at the top of SWFLoader. My apologies - please download the latest version and you should be good to go. It seemed to compile/work fine for me when I tried your sample FLA.

Link to comment
Share on other sites

No worries! Its beta software ;) Works like a champ locally (within the same folder)!




I'm still getting a Security Sandbox error when I load the SWF from my localhost or remote server. The SWF loads now, BUT when I click on the it to scroll, its throws this error:

[sWF] loaderAIR.swf - 38908 bytes after decompression

LoaderMax 'mainQueue' is complete!

LoaderMax 'mainQueue' is complete!

[sWF] /assets/myContent.swf - 48204 bytes after decompression

*** Security Sandbox Violation ***

SecurityDomain 'http://localhost/assets/myContent.swf' tried to access incompatible context 'app:/loaderAIR.swf'

SecurityError: Error #2070: Security sandbox violation: caller http://localhost/assets/myContent.swf cannot access Stage owned by app:/loaderAIR.swf.

at flash.display::Stage/requireOwnerPermissions()

at flash.display::Stage/addEventListener()

at com.shinedraw.controls::IPhoneScroll/on_mouse_down()


Perhaps this is a limitation of AIR???

Link to comment
Share on other sites

Hmm...I tried your example locally and on a server and wasn't able to see any errors - could you explain how I can reproduce the error? It seems like the swf is falling back to the restricted mode because it's loading from another domain and there's no crossdomain.xml file in place or something for you (again, I wasn't able to reproduce that though).


EDIT: Nevermind, I was able to figure out how to reproduce the issue. Looking into it...

Link to comment
Share on other sites

K. FYI... I do have a very generous crossdomain.xml file setup.


<?xml version="1.0" encoding="utf-8"?>

Link to comment
Share on other sites

Yep, it does indeed appear to be an AIR issue where it will burp when your subloaded swf has code that references the stage (or stuff outside itself). Maybe change your stage references to root?

Link to comment
Share on other sites

No worries. You are the man Jack! Thanks for the opportunity to beta test this new product!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.