Flex 3 - Image cache
        Posted  
        
            by BS_C3
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by BS_C3
        
        
        
        Published on 2010-06-11T14:59:14Z
        Indexed on 
            2010/06/11
            15:02 UTC
        
        
        Read the original article
        Hit count: 300
        
Hello Community.
I'm doing an Image Cache following this method: http://www.brandondement.com/blog/2009/08/18/creating-an-image-cache-with-actionscript-3/
I copied the two as classes, renaming them CachedImage and CachedImageMap.
The thing is that I don't want to store the image after being loaded a first time, but while the application is being loaded.
For that, I've created a function that is called by the application pre-initialize event. This is how it looks:
private function loadImages():void
        {
            var im:CachedImage = new CachedImage;
            var sources:ArrayCollection = new ArrayCollection;
            for each(var cs in divisionData.division.collections.collection.collectionSelection)
            {
                sources.addItem(cs.toString());
            }
            for each(var se in divisionData.division.collections.collection.searchEngine)
            {
                sources.addItem(se.toString());
            }
            for each( var source:String in sources)
            {
                im.source = source; 
                im.load(source); 
            }
        }
The sources are properly retrieved. However, even if I use the load method, I do not get the "complete" event... As if the image is not being loaded... How is that?
Any help would be appreciated.
Thanks in advance. Regards,
BS_C3
© Stack Overflow or respective owner