Re: [flexcoders] Re: use runtime image more than once

2008-01-08 Thread Frederico Garcia
joshuagatcke escreveu:
> We thought about having a flash assets file or something along those lines, 
> but we really 
> can't have this stuff in a compiled file as the types of icons changes all 
> the time on a per user 
> basis. It would be nearly impossible to track all the changes and update the 
> assets file to 
> meet requirements. Not to mention that it would be impossible for our users 
> to accomplish 
> that. 
>
> We are going to just rely on the browser cache for now until we have the 
> resources to write 
> something custom if possible. The idea would be that you could create an 
> image class that 
> you could use repeatedly from a runtime image source. I have a feeling I 
> might be asking for 
> too much though. 
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
>
>
>
>
> __ NOD32 2769 (20080107) Information __
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   
Hi,

What if you had a buffer, implemented by an array (or arraycollection) 
of Assets, beeing an Asset something like:

public class Asset {
   private var _source:BitmapData;
   private var _name:String;
   private var _url:String;

   public function Asset() {

   }

   public function set url(value:String):void {
  //load data
   }

   public function get url(value:String):void {
  return _url;
   }

   //getters and setters for name

   //getters and setter for bitmap
}


and the buffer something like:

public class Buffer {
   private var buffer:ArrayCollection = new ArrayCollection();
  
   public function getBitmap(url:String):void {
  //traverse buffer
  //if url is loaded (there is an Asset with that url) return 
buffer[i].bitmap
  //else create asset (asset:Asset = new Asset(); asset.url = 
url) and add to buffer;
   }
}

being Buffer a singleton.

Everytime you needed a image you requested (by url or by name) to the 
Buffer and your image would be loaded only once. Ofcourse you have the 
overhead of traversing the buffer looking for the image, but I think it 
would take an extremely large number of images to make this traversing 
slower than the network time needed to load an image.

Let me know what you think,

Regards,

Frederico Garcia



[flexcoders] Re: use runtime image more than once

2008-01-08 Thread joshuagatcke
We thought about having a flash assets file or something along those lines, but 
we really 
can't have this stuff in a compiled file as the types of icons changes all the 
time on a per user 
basis. It would be nearly impossible to track all the changes and update the 
assets file to 
meet requirements. Not to mention that it would be impossible for our users to 
accomplish 
that. 

We are going to just rely on the browser cache for now until we have the 
resources to write 
something custom if possible. The idea would be that you could create an image 
class that 
you could use repeatedly from a runtime image source. I have a feeling I might 
be asking for 
too much though. 



Re: [flexcoders] Re: use runtime image more than once

2008-01-07 Thread Frederico Garcia
joshuagatcke escreveu:
> Hello Thanks for the feedback. I did see the super image by Eli. 
>
> Yes the cache does handle this. It's not too bad, but I thought it might be 
> possible to make 
> this better and faster. Also, my logs show huge amounts of requests for those 
> images even 
> though they are suppose to be coming out of the browser cache after the first 
> request, so I'm 
> not sure. 
>
>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
>
>
>
>
> __ NOD32 2769 (20080107) Information __
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   
Hi,

Did you consider having a singleton like AssetsController wich you 
filled with your assets and then bind to them?

Regards,

Frederico Garcia


[flexcoders] Re: use runtime image more than once

2008-01-07 Thread joshuagatcke
Hello Thanks for the feedback. I did see the super image by Eli. 

Yes the cache does handle this. It's not too bad, but I thought it might be 
possible to make 
this better and faster. Also, my logs show huge amounts of requests for those 
images even 
though they are suppose to be coming out of the browser cache after the first 
request, so I'm 
not sure.