Go Back   kirupaForum > Flash > ActionScript 3.0

Reply
 
Thread Tools Display Modes
Old 11-22-2009, 04:39 PM   #1
damonlee3
Registered User
SWF Slowing Down Over Time / Having GC Issues

Hi all,

I have a main movie in which I load two types of external movies, pages and themes.

My main swf slows down which each click of one of the menu items. I've tried garbage collecting by doing and unloadAndStop for the external swf's but that does even put a dent in the flash player memory usage as shown by System.totalMemory trace.

A theme will load in an empty movie clip(acting as a container) on the stage, then a page will load in another empty movie clip on the stage.
For example, pageContiainer movie clip will receive page1.swf. themeContainer will receive themeNeutral.swf.

I'm thinking this should not be an issue, as each movie clip simply receives an external swf, which is then replaced by another external swf upon a given load command.

But I can't seem to get the looaded SWF(s) out of memory and the System.totalMemory just keeps going up and up.

Here are my loaders:

Code:
var themeLoader:Loader=new Loader();
themeLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, themeLoaded);
var mcTheme:MovieClip;

function themeLoaded(e:Event):void
{
	containerTheme.addChild(themeLoader);
	mcTheme = themeLoader.content as MovieClip;
}

var pageLoader:Loader=new Loader();
pageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, pageLoaded);
var mcPage:MovieClip;

var pageExitAnimTimeLine:TimelineLite = new TimelineLite({paused:true});

function pageLoaded(e:Event):void
{
	containerPage.addChild(pageLoader);
	mcPage = pageLoader.content as MovieClip;
	//animation in for loaded page
	pageExitAnimTimeLine.append(TweenLite.from(mcPage, 1, {y:100, autoAlpha:0, ease:Back.easeOut}));
	pageExitAnimTimeLine.play();
}
On the home page are two buttons, when the user clicks one, a theme must load and so must a page. However, I don't want the page to load until the theme is loaded, hence I add an event listener within the load function:

fun
Code:
ction loadAboutUsAfterNeutralThemeLoad(e:MouseEvent):void
{
	themeLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, delayLoad);
	
	function delayLoad():void
	{
               //remove listener	
	        themeLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, delayLoad);
		pageLoader.load ( new URLRequest( "ccgiAboutUs.swf" ) );
	}
}
Incidentally, themes must load depending on what the user clicks once inside the main site.

Yes, I could place all the themes in the main.swf, and just externally load the pages, but that would significantly increase the kb of main and I don't see, with all of AS3's capabilities, why I should have to do that.

I think my code is causing a substantial memory leak that I can't seem to plug...any help would be appreciated

p.s. here is a memory display function, you may be able to use it in the future:

Code:
var memTimeline:TimelineMax = new TimelineMax({repeat:-1, repeatDelay:0.7});
memTimeline.append( TweenMax.to(this, 0.1, {onComplete:showMemUsedByFlashPlayer}));

function showMemUsedByFlashPlayer():void 
{
	trace(int((System.totalMemory/Math.pow((1<<10),2))*100)/100); //shows MB rounded to two decimal places
}
damonlee3 is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:28 AM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com