Using Flex Image events to show a preloader


Today I wanted to show a simple preloader in an itemRenderer that just contained one Image. The problem was to get the image’s events before it was too late since you just can’t catch the OPEN, PROGRESS or COMPLETE event via MXML (Why did’t they just add the metadata for that?). I have seen quite a few approaches which extended the Image class but I wanted to use a custom Image class (SuperImage) to use it’s caching capabilities. So here is the example, I’m using a normal Image here but you can use any derived class you want, it just has to use the 3 events: (You might use the following as an ItemRenderer)

(Argh! WordPress destroyed the source code, I’ll repost it soon)

That’s it, using states it isn’t too hard to change the UI. If you need cool preloaders go checkout http://www.ajaxload.info – they will generate a gif which you can easily import into the Flash IDE to convert it to swf.

Advertisements
  1. Hey man, this post sounds like what I’m looking for. Any chance you could repost and/or throw me an email?

    Cheers,
    -b

    • Tanzeem Akhtar Bhatti
    • February 17th, 2009

    Great Work
    This is what i was looking for
    Regards
    Tanzeem Akhtar Bhatti
    Software Engineer
    Flex

    • Andrew
    • February 26th, 2009

    Where’s the example?

    • The example just died away when wordpress changed their system, I will try to get it back if I find my sources for that.

  2. Just stumbled upon this post, and I too was looking for some examples. I’ve tried several variations of preloader attempts but none of them work in the ItemRenderer.

    • Arthur
    • February 6th, 2010

    hi i stumbled on your blog concerning “Using Flex Image events to show a preloader” i have been looking for the same solution for years and finally i found it. only that i was too late there is no source code coz word press destroyed it. please please i implore you to send me the solution. am in desperate need. plus am also using the custom component superImage.

  3. Do I know the problem! In my case it was not so worse that one could not fix. Thanks for the good tips!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: