Jump to content
Search Community

LoaderMax & AIR 1.5?

donaldleegraham test
Moderator Tag

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:


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


//LOADER
var loader:SWFLoader = new SWFLoader("http://localhost/assets/myContent.swf", {
name:"mainSWF", 
container:this, 
x:0, 
y:0, 
onInit:initHandler, 
estimatedBytes:36000
});

loader.load();

//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({
name:"mainQueue", 
onProgress:progressHandler, 
onComplete:completeHandler, 
onError:errorHandler
});

//start loading
queue.load();

//pause loading
queue.pause();

//resume loading
queue.resume(); 

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

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

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.
×
×
  • Create New...