This post is about how to use the as3 loader to load images that are in the libary instead of load them externally. For this is desirable to see first the other post Box2D Level Editor XML AS3 Loader for flash. This because the fla file is similar to the one we create in the tutorial, so this fla file is not an empty one.

In this example I have the following elements.

Untitled

 

 

There is the xml of fable, pagina9.xml, and four images also generated by fable, the ones that don’t have the prefix NonRetina_ in this case, pagina9_0.png, pagina9_1.png, pagina9_2.png, pagina9_3.png,

Now for this example we must download the latest version of the loader. This latest version of the loader allows to send an array of Bitmap objects and this prevent the external loading.

The loader can be found here.

Now lets open the fla file

In our fla file we will go to file->import->import to library and import the four images.

We will have something like this.

ff

Now we need to set the AS Linkage, for this we add it to the linkage column in the library, we can use watever name we want for the linkage. In my case I set the same names.

d

Now we go to the frame that contains the code, not the xml, and remove this line

loader.loadImages(xml);

and replace with

var imageArray:Array = new Array;
imageArray.push(new Bitmap(new pagina9_0),
new Bitmap(new pagina9_1),
new Bitmap(new pagina9_2),
new Bitmap(new pagina9_3));
loader.loadImages(xml, imageArray);

 

sdas

If all goes well, that is all you need.

Here are this flash example

Here are the files, Remember this images are protected for copyrigth and I placed here for the sole purpose of this tutorial, You should not use it in any kind of project. :)
Tutorial_2015-05-16.zip

Here are the loaders

Loaders