AppModelLocator MODEL


/ Published in: ActionScript 3
Save to your folder(s)

###PACKAGE### replace -> com.yourdomain.model
###CLASSFILENAME### replace -> AppModelLocator


Copy this code and paste it in your HTML
  1. package ###PACKAGE### {
  2.  
  3.  
  4. import com.adobe.cairngorm.model.ModelLocator;
  5. import mx.logging.ILogger;
  6.  
  7.  
  8.  
  9. [Bindable]
  10. public class ###CLASSFILENAME### implements ModelLocator {
  11.  
  12. private static var model : AppModelLocator;
  13.  
  14. public function AppLocator() : void {
  15. if ( AppModelLocator.model != null )
  16. throw new Error( "Only one ModelLocator instance should be instantiated" );
  17. }
  18.  
  19. // singleton: always returns the one existing static instance to itself
  20. public static function getInstance() : AppModelLocator {
  21. if ( model == null )
  22. model = new AppModelLocator();
  23. return model;
  24. }
  25. }
  26. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.