One of the big mistakes that beginners make when they’re making their first Flash projects is importing all the graphics and making movieclips with tons of frames, resulting in a Flash file that is huge. The bigger the .swf, the longer it will take to load. The simplest way to fix this is to load larger files externally. Loading files is pretty easy in ActionScript 3 so I’m not going to show you how, I’ve just made this ExternalLoader class that does the job and I use it a lot at work. And to use it is the same as loading anything else in AS3. Just download the zip file and put the class wherever you save your custom classes.
To use it, you just need three lines of code:
1 2 3 4 5 | import com.atomicrobot.ExternalLoader; var image:ExternalLoader = new ExternalLoader("externalfile.blah"); addChild(image); |
And you’re good to go. You can use it as many times as you need in your project and it will help keep down your file size.