Advanced Instructions
Adding the imageLoader dynamically through ActionScript
1. Drag and drop the imageLoader component onto the stage and then delete it from the stage. This will add the imageLoader component to your library.
2. The following is an example of the ActionScript code that you may add to the timeline, in order to add the imageLoader component dynamically to your movie:
_root.attachMovie("imageLoader", "myImage", 2)
_root.myImage._x=100
_root.myImage._y=100
_root.myImage._xscale=150
_root.myImage._yscale=150
_root.myImage._scaleToFit=true
_root.myImage.loadImage("http://www.yoursite.com/image_to_load.jpg")
The following sample code can be used to create a custom preloader function:
customLoaderHandler = function (image) {
trace(Math.round(image.getImageBytesLoaded/1024)+"kb of image "+image.imageURL+" is loaded");
if (image._percentLoaded==100) {
trace(image.imageURL+" was loaded successfully!");
}
};
This code will display the loading progress in kilobytes in the output window.
This is how you would change the layout of the built-in preloader:
1. Open the library (CTRL+L) and open the imageLoader Assets folder which is located inside the Image Loader folder.

2. Double click on the loader movie clip in order to edit it.
3. You can edit the textfield that is in this movie clip to appear with the desired font, at the desired size.

4. In the AS layer there is a function called "loader". This function defines the behavior of the build-in preloader. This function is called on every onEnterFrame event while the image is loading. The built-in preloader loads according to an X,Y of 0,0 in relation to the imageLoader movie clip.
