I have proxie class wihch load binary data from server. It's look like image downloader. Some parts of my application ask proxie to load some resources:
PersonalCardMediator.as
listNotificationInterests() : Array { return [ ImageProxy.RESOURCE_LOADED ]; }
handleNotification( note : INotification ) : void { switch ( note.getName() ) { case ImageProxy.RESOURCE_LOADED: { if( firstUID == note.getBody().UID ) ... }
getImage() { imageProxy.getResource( firstUID ); }
---------------------------
MainWindowMediator.as
listNotificationInterests() : Array { return [ ImageProxy.RESOURCE_LOADED ]; }
handleNotification( note : INotification ) : void { switch ( note.getName() ) { case ImageProxy.RESOURCE_LOADED: { var UID = note.getBody().UID; if( secondUID == UID || thirdUID == UID || ... ) ... }
getListImages() { imageProxy.getResource( secondUID ); imageProxy.getResource( thirdUID ); .... imageProxy.getResource( zUID ); }
and more ---------------------------
Problem is: If I send notify when complete load each resource, all my subscribed components must check, is needed resource or not. How I can optimize this? Sorry for my English.
|