I’m rusty on programming and don’t understand the difference between loading internally and externally. With a game made with Flash Develop, all of my assets will be in the package. There are not a lot of them (20 images and small mp3 ~2 MB). What are the problems with loading my assets with the code below? Or why would I have to create a URL loader with a wait timer? Any comments would be appreciated.
public class ImageLoader
{
private var alImages:Array = new Array;
public function ImageLoader()
{
[Embed(source = "../lib/greenbutton.png")]
var imgGreenButton:Class;
alImages.push(["imgGreenButton", imgGreenButton]);
[Embed(source = "../lib/tray.jpg")]
var imgTray:Class;
alImages.push(["imgTray", imgTray]);
}
public function getBitmap (search:String):Bitmap {
// Create Cyan square for load fails
var tempData:BitmapData = new BitmapData(40, 40, false, 0x000FFFF);
var tempBitmap:Bitmap = new Bitmap (tempData);
for (var i:int = 0; i < alImages.length; i++) {
if (alImages[i][0] == search) {
tempBitmap = new alImages[i][1];
}
}
return tempBitmap;
}
}
when you will add any assets (means) MovieClip/Image as a Part of Design time Flash Library of *.Fla file. It’s called Internal Assets.
If you will load any content in the your compiled swf using ActionScript from outside of the Swf file, it’s called external assets.
For Internal Assets:
1. It will be compiled at the time of your Fla file compilation.
2. your swf file become a big with comparison of external assets.
3. initial loading time will be high with comparison of external assets.
For External Assets:
1. It will be not compiled at the time of your Fla file compilation.
2. your swf file become a small with comparison of internal assets.
3. initial loading time will be low with comparison of internal assets.