Jump to content
Search Community

SWF looping when on server [SOLVED]

nitech test
Moderator Tag

Recommended Posts

Hi Jack and fellow Greensocks.


This is my first project with LoaderMax and SWFLoader. I make a banner that consists of a loader and a content file.


When I test the project locally in FlashDevelop it works fine. When on server, the content-file never displays. The flashlog.txt-file shows me that the completeHandler fires repeatedly.


Any idea why? See attached sample (of the loader).

Link to comment
Share on other sites

It's not actually "looping" when you put it on the server - it's throwing errors because it looks like you used the exact same class/package signature in your "Main" class for both swfs, but you have different code in them. Since the child swf loads into a child ApplicationDomain by default (as is normal in Flash), the child sees that the parent already has a "Main" class defined and uses that one (not good if you have completely different code that's trying to reference different objects in each "Main" class). The reason it didn't show this behavior when you tested it locally is because you were loading the swf from a remote server while running the parent swf locally - that forces the ApplicationDomain to be segregated because of of different SecurityDomains. So there was no conflict, but if you try loading that child swf locally too, you'll see the same problem. And by the way, this isn't a LoaderMax thing - it's a Flash thing (you'd have the same issue if you used Adobe's Loader class directly).


There are two solutions you can choose from:


1) Define a custom, segregated ApplicationDomain by using the "context" special vars property like this:

new SWFLoader("http://www.avento.no/sbm/BSU768x150v/BSU768x150v.swf", {context:new LoaderContext(true, new ApplicationDomain()), name:"banner", estimatedBytes:700000, container:this, autoPlay:true})




2) Don't use the same class/package signature for multiple swfs. You could either use different class names ("MainParent", "MainChild") or different packages ("no.avento.containers.Main", "no.avento.banners.Main") or both.


Read up on ApplicationDomains here: http://help.adobe.com/en_US/FlashPlatfo ... ntext.html

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...