kaikai0428

SWFLoaderVars Context Problem

Recommended Posts

Hi

I got problem when I want to dispose a SWFLoader

 

when I use SWFLoaderVars to set context

 

then I can't dispose external SWF

but if I don't set the context everything's right!
 

like this:

var vars:Object = {name:"test", onComplete:onComplete};
var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, SecurityDomain.currentDomain);
var swfVars:SWFLoaderVars = new SWFLoaderVars(vars);
swfVars = swfVars.context(context);//marked this everything's right
var swfLoader:SWFLoader = new SWFLoader("resource/test.swf", swfVars);
swfLoader.load(true);

is there anything wrong?
 

please help me, thx!

Share this post


Link to post
Share on other sites

If you set a context without using SWFLoaderVars does the same problem happen? In other words just define the context directly in the SWFLoader constructor.

 

  • context : LoaderContext - To control things like the ApplicationDomain, SecurityDomain, and whether or not a policy file is checked, define a LoaderContext object. The default context is null when running locally and new LoaderContext(true, new ApplicationDomain(ApplicationDomain.currentDomain), SecurityDomain.currentDomain) when running remotely in order to avoid common security sandbox errors (see Adobe's LoaderContext documentation for details and precautions). Please make sure that if you load swfs from another domain that you have a crossdomain.xml file installed on that remote server that grants your swf access rights (see Adobe's docs for crossdomain.xml details). Again, if you want to impose security restrictions on the loaded swf, please define your own LoaderContext.

 

https://greensock.com/asdocs/com/greensock/loading/SWFLoader.html

 

 

According to this post http://greensock.com/forums/topic/12032-release-memory-when-unload-swfs-using-swfloader-loadermax/

the user mentioned something about setting the application domain to null when trying to dispose(). Not really sure if that applies here.

 

 

We'd love to help you more if necessary but please keep in mind that the ActionScript tools have been sunset (no longer actively maintained), as the market made it very clear that it preferred HTML5/JS solutions and we're focusing our efforts there to help the largest portion of our user base.

Share this post


Link to post
Share on other sites

Hey Carl,

 

First,thanks for replying me.

 

I know as3 is going to die,but my company still have some products need to maintain so...

 

Anyway, I have done lots of tests.

 

I think it's not the SWFLoaderVars's problem,even I use the AS3 Loader got the same problem too.

 

so i use FlashBuilder's "Flash Profile", i found the external class I have loaded was located at a method called "[execute-queued]"

here's some detail about it https://forums.adobe.com/thread/432052?tstart=0

I think it can not be control.

 

so I change it like this, and i'm glad it works.

 

it's the best solution i think..
 

var context:LoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain), SecurityDomain.currentDomain);
var vars:Object = {name:"test", context:context, onComplete:onComplete};
var swfLoader:SWFLoader = new SWFLoader("resource/test.swf", vars);
swfLoader.load(true);

thanks again.

Share this post


Link to post
Share on other sites

Thanks for posting your results. I'm sure it will help others some day.

Share this post


Link to post
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.