Whenever you want to load an asset you will need to create a Loader object. You can use it to load another flash movie .swf or a bitmap.
Here is my LoadImage.as file:
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;
public class LoadImage extends Sprite
{
public function LoadImage()
{
init();
}
private function init():void
{
var loader:Loader = new Loader();
addChild(loader);
loader.load(new URLRequest("/path/to/image/myimage.gif"));
}
}
}
hi there, I hadnt seen images loaded like this before, but it is a very nice way of doing it.
My only question – once you’ve loaded the image, how do you have access to it: so you can like change smoothing, or change its size and so on? I thought maybe you can get access to it through the loader var, but i havent had any luck.
Thanks.
Hi Eamonn,
I decided to write up a constructor for you, you can view it in today’s post:
http://manewc.com/2008/05/15/manipulate-an-loader-object/
Let me know if this helps, if not I can look into more what you are trying to accomplish
Morgan