Vladimir
Vladimir

Reputation: 173

Flex custom preloader images loading

I am writing a custom flex preloader which extends the IPreloaderDisplay class. How can I load the images from web in my custom preloader?

Thanks,
Vladimir

Upvotes: 1

Views: 2003

Answers (2)

Lee Probert
Lee Probert

Reputation: 10859

You can't load your preloader images from the web because the framework hasn't loaded. You need to keep preloaders VERY lightweight and don't use any framework code. Just extend Sprite and implement the IPreloaderDisplay methods but embed your images and don't attempt to load them at runtime.

Upvotes: 1

Tony
Tony

Reputation: 19181

Can't you just create an image object and add it to the stage? Can you post your progess so I know which part of this to help you with?

UPDATE

Here is a general solution for the time being:

this.loader = new Loader();
this.loader.load("http://somewebsite.com/image.png");
this.loader.addEventListener(Event.COMPLETE, onLoadComplete);

public function onLoadComplete(event:Event):void {
    var thumbnail:Sprite = new Sprite();
    thumbnail.addChild(this.loader);
}

Upvotes: 0

Related Questions