Jump to content


Intermittent crashes with LoaderMax and a large swf

Recommended Posts



I am attempting to load a large relatively complicated swf (300mb) into a parent swf to then be given to the client as an exe.


It is for a touchscreen application. It was all working fine then after a few hours of use there were crashes. I tried to track down any memory leaks, all event listeners were set to weak and I am using gSkinners Janitor class to watch and remove any listeners.


I was testing in the debug version, which I have since learned does not give good reports of memory usage and doesn't show any GC. This was a major blow as I had spent a week basing all my tweaks on these results, but when i tried in the regular player the memory (as monitored with SWFProfiler) was being managed well (it was going down rather than constantly up)


So I am now using LoaderMax to load and unload the swf to just make sure that there are no leaks by completely removing the swf and reloading it. I know this is not the best way to do things but given this whole AS3 project has been a transition from AS2 I have not approached it in an OOP fashion. Instead went for the old school AS2 all code on the first frame with a variety of includes.


The problem I am having is when i start to stress test. I have set up a mouse macro that performs the same actions over and over to simulate multiple users and pauses.


There is a timeout in the child swf that checks for mouse movement, if there is none it starts a countdown and then sends a call to the parent to unload and reload after performing the Janitor/Destroy tasks.


This works fine, the child swf is being marked for garbage collection and eventually gets removed and a new one reloaded.


But after a period of time, sometimes 10 minutes, sometimes 45 there will come a point when the child swf will not load again and the user is left with a black screen. I am also unable to manually trigger function with a keyboard press (for dev purposes, the terminals do not have keyboards)


I am not getting an error message from the error handler, it is like it is not being triggered at all. My error txt on stage (as i have to test in a exe on a pc) ends on loadIWM.


And when i manually trigger "unloadSWF" it runs up until that point.


Is there a way to check that the loader still exists, if not to create another one on the stage? I think what is happening is the computer has a bit of a disk fart sometimes and interrupts the load causing it to fail.


I have just done a test where i manual led called unloadSWF 20 times and it worked.


I hate bugs like this.


Fingers crossed.


stage.addEventListener(KeyboardEvent.KEY_UP, displayKey, false, 0, true);
var mcExternal:MovieClip;

function displayKey(keyEvent:KeyboardEvent)
var keyPressed:String = "";
keyPressed = keyEvent.keyCode.toString();
if (keyPressed=="186")
var loader:SWFLoader = new SWFLoader("assets/allpress_main_fs.swf", { onComplete:swfIn, onError:errorHandler, onProgress:progressHandler});
function loadIWM() {
//add the ContentDisplay to the display list even before raw content is loaded.
error_mc.textBox.text = "loadIWM";

function errorHandler(event:LoaderEvent):void {
trace("error occured with " + event.target + ": " + event.text);
error_mc.textBox.text = "LOADERERROR" + event.target + ": " + event.text;


function progressHandler(event:LoaderEvent):void {
//trace("progress: " + event.target.progress);
//error_mc.textBox.text = "progress: " + event.target.progress;

var error_mc:MovieClip = new errorText();
error_mc.textBox.text = "started";

function swfIn(e:Event):void {

error_mc.textBox.text = "swfIn";
mcExternal =  loader.rawContent;

var myInterval:uint;

function unloadSwf() {
error_mc.textBox.text = "unloadSwf";
loaderBG.alpha = 0;

function hiDad() {
trace("hi dad");

function timedLaunch() {
error_mc.textBox.text = "timedLaunch";
myInterval = setInterval(loadIWM, 1000);


Link to comment
Share on other sites

I had a hard time understanding exactly what the issue is - you're saying that the child swf doesn't load and there are no LoaderEvent.ERROR events dispatched? And yet you're sure that it doesn't load? Are you sure that the problem isn't related to it not being displayed? Like maybe you have code in place that sets its visible or alpha?


I'd recommend adding some code to your sub-swf that outputs text to the screen or something so that you can see when it loads (don't make the display in itself - call a method in the parent that handles the display so that you can rule out display issues with the swf itself).


Without doing a lot of digging into your actual files and running tests, it's pretty tough to troubleshoot. And we don't generally provide free consulting like that here in the forums (not because we don't want to - it's just that it takes a lot of time and focus and we've got limited resources). If you think this is a bug in LoaderMax, we'd be happy to look at any evidence you can provide and do our best to resolve things. I'm not aware of any outstanding bugs that could be causing this.

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.