You won't need to "load" them, they are embedded. You just have to instantiate the images. It's a good idea to have one class that manage shared ressources, as such:
public class TextureAssets
{
[Embed(source = "../lib/ball1.png")]
private static var Ball1:Class;
[Embed(source = "../lib/ball2.png")]
private static var Ball2:Class;
public static var ball1Texture:BitmapData;
public static var ball2Texture:BitmapData;
public static function init():void
{
ball1Texture = (new Ball1() as Bitmap).bitmapData;
ball2Texture = (new Ball2() as Bitmap).bitmapData;
}
Then you would call TextureAssets.init()
once (in the Main.as for example)
and when you need the bitmapData: use new Bitmap(TextureAssets.ball1Texture)
This way your program needs uses only memory required for one bitmapData instead of having many which ends up being the same.
If you need to perform operations on a bitmapData while keeping the original you can use:
var modified:bitmapData = TextureAssets.ballTexture.clone();
Also, if you are instantiating all balls images from within one class it's a good idea to drop static access and instead initialise the bitmapDatas in the constructor, create a new TextureAssets() and call the textures through the variable
(Static field access is slower than direct (.) access : http://jacksondunstan.com/articles/1690)