2 Replies Latest reply on Feb 11, 2011 11:37 AM by -skitch-

    mx:Image questions


      I have a couple questions about the mx:Image component, I was wondering if anyone could answer.


      I currently have a tile list ranging in size from 800 - 1200 items.  The item renderers all have image components.  When the user swipes down the list, I am seeing lots of calls to our frame server.  I have setup a caching mechanism to hold up to 200 bitmaps which gets populated on the Image loader complete method.  So when setting the source of my image, it first looks to my cache for a stored bitmap.


      1) Does the mx:Image component (inherited from SWFLoader) load every URL request you make?

           - I am using fire bug and I see alot of requests being made when the user swipes down the list.


      2) Does the image component stop or unload the currently loading source if a new source has been set?


      3) If the first two are true, anyone have a direction to how I can stop previous requests from happening when a new source is set?




        • 1. Re: mx:Image questions
          Flex harUI Adobe Employee

          1 yes

          2 yes


          Look into using SuperImage from quietlyscheming.com

          • 2. Re: mx:Image questions
            -skitch- Level 1

            Thank you for the answers.  Seems like I was actually caching the loader somehow rather than the Bitmap.


            By the way, I tested out SuperImage and found some issues with the way it works when exceeding the cache limit.

            I usually got a "Loader never completed" exception that would crash my UI, but the error never had a reference to the Loader itself.


            Since it works on the basis that it caches loaders and bitmaps, I would get exceptions when having alot of images and exceeding my cache limit.  This is because SuperImage performs delete's on the cached items when it does the cache size check.  The loader never actually unloads and stops.  So if it's still loading and gets deleted, it might get some funky errors.


            Exerpt from ContentCache.as (SuperImage project component):

                    private function checkLimit():void
                        if(_maximumSize <= 0 || _mruList.length <= _maximumSize)
                        //xace("dropping " + (_mruList.length - _maximumSize) + " items");
                        for(var i:int = _mruList.length;i>_maximumSize;i--)
                            var node:ContentCacheNode = ContentCacheNode(_mruList.pop());
                            delete _caches[node.url];