/ Published in: ActionScript 3
                    
                                        
###PACKAGE### replace -> com.yourdomain.model
###CLASSFILENAME### replace -> AppModelLocator
                ###CLASSFILENAME### replace -> AppModelLocator
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
package ###PACKAGE### {
import com.adobe.cairngorm.model.ModelLocator;
import mx.logging.ILogger;
[Bindable]
public class ###CLASSFILENAME### implements ModelLocator {
private static var model : AppModelLocator;
public function AppLocator() : void {
if ( AppModelLocator.model != null )
throw new Error( "Only one ModelLocator instance should be instantiated" );
}
// singleton: always returns the one existing static instance to itself
public static function getInstance() : AppModelLocator {
if ( model == null )
model = new AppModelLocator();
return model;
}
}
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                