AS3 for Noobs (Part 4): Garbage collection

January 4th, 2008

So maybe you’ve heard of this whole garbage collection thing and you’re wondering what it is and why should you care. I’m going to give you a simplified description of what it is and the best practices I’ve found to deal with it. Basically in AS2 when you removed an object like a movieclip or something, you no longer had to worry about it, it was gone. It either was there on stage or it didn’t exist. For instance in my gallery application are a lot of photos get loaded at one time and I had to limit how many displayed at a time because the more that were on stage the slower flash would get. So I would display 100 then when I wanted to display another 100 I would just remove the first 100 and everything would work just fine.

Well now since display objects don’t live and die on the stage, you can remove a clip from the stage but it still exists. It’s just waiting “back stage” in case you need to use it again. This is great for some things but like in my gallery example above it causes a real problem. I can remove the first 100 thumbnails from the stage but they are still there hogging up memory. If you remove an object from stage and you don’t use it again for a long time, the flash player will mark it for removal so that it actually will disappear from memory. This process is called “garbage collection”. The problem is that if any other object references it then it won’t ever be marked for removal because flash still thinks it’s needed.

Continue reading this entry »

AS3 for Noobs (Part 3): The _root problem

September 18th, 2007

When I tried to switch to AS3 and suddenly _root and _global were just gone. And it wasn’t that they just got renamed something else, they were gone and nothing that I could find had replaced them. Needless to say I was extremely confused. Why were they gone? How am I supposed to write applications without them? Obviously other people are getting along without it so what am I missing here?

Continue reading this entry »

AS3 for Noobs (Part 2): Learn the lingo

September 12th, 2007

Another thing that is initially very intimidating about learning a new skill is all the terminology that people throw around and expect you to know. I’m going to break down some of these terms in a way that hopefully everyone can understand so you know what they mean and why you should care. I know these articles seem like they deal mainly with classes and not AS3 but we are building up to it. This is all fundamental stuff you’ll need to understand if you want to get far with AS3 at all so just stick with me on this one.

Continue reading this entry »

AS3 for Noobs (Part 1): A class on classes

September 9th, 2007

Alright so I’ve had some time to calm down from my initial AS3 adventures and things are going much better now. Once I finally got over the hump of trying to compare AS3 to AS2 and just thought of it as something completely different (even though it’s not completely) I’ve actually been enjoying the experience. Now that I’ve been working with it for long enough, I can tell you that I’ve joined the OOP fan-club and got a cool t-shirt that says I heart OOP.

NOTE: The point of this article is not really to teach you how to use classes, but more to help you understand what classes are and why you should use them, because to me knowing “why” and “when” was much harder then learning the “how”. If you want to know how to use them check out the help file that came with flash because it gives a lot of good examples. Also I’ll be oversimplifying what classes are and do in this article because at the moment we are just taking some baby steps hence the “AS3 for Noobs” title.

Continue reading this entry »

Download the halo 2 game tracker

August 31st, 2007

I’ve had a lot of requests from people wanting to the halo 2 game tracker on their sites so I’ve decided to make it available to download. I know I should have done it a long time ago, and yes I know halo 3 comes out in about 25 days. But if you still want to use it, then here it is.

http://www.test1labs.com/projects/halo2/halo2_gametracker.zip

Of course I’d appreciate it if you left some link or credit to me on there but let’s be honest either your going to or your not and I can’t stop you, so do whatever you want with it. All the source files should be in the zip folder. If you want to change the default gamertag that loads up look in the index file and change “gamertag=Test1″ to whatever you want. Also I added the two new maps to it now so those thumbs should be showing up.

Sorry I haven’t been able to work on this anymore but I’ve been really busy working on SnapPages lately. Who knows I might do something for halo 3.