Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by ccollomb

  1. It seems to me that a better caching code interface would benefit both use and resources. For example what happens if I load twice the same URL through BinaryDataLoader? I saw some code to pseudo-cache the bitmap with ImageLoader, but could not find the equivalent with BinaryDataLoader. And even the BinaryDataLoader creates a new bitmap reusing the bitmapdata. So basically from a caching mechanism I would expect two identical successive calls to automatically return the same loader. imageLoader1 = new ImageLoader( "assets/pic.png", { name: "test", onComplete: onCompleteImage1 } ); imageLoader2 = new ImageLoader( "assets/pic.png", { name: "test", onComplete: onCompleteImage2 } ); Would only download the image once but would also only create ONE bitmap. I know this behavior might need variations (some people might want 2 different bitmaps), but the idea is all the work is the internals of ImageLoader would handle the work. And same for other resources. For example for Binary data here is an example of what I am doing if I want to get access to the callback of the loaded resource. mBinaryDataLoader = LoaderMax.getLoader( urlAmf ); if ( mBinaryDataLoader == null ) { mBinaryDataLoader = new BinaryDataLoader( urlAmf, { name: urlAmf, onComplete: onCompleteAmf } ); queue.append( mBinaryDataLoader ); } else if ( mBinaryDataLoader.status == LoaderStatus.COMPLETED ) { onCompleteAmf( null ); } else { mBinaryDataLoader.addEventListener( LoaderEvent.COMPLETE, onCompleteAmf ); } Am I doing something wrong, or is there a recommended way to handle those cases? Thanks for your help, Cedrick