public static function getInstance():ApplicationModel {
if ( applicationModel == null )
applicationModel = new ApplicationModel();
return applicationModel;
}
}
ApplicationModel.getInstance().doThat();
Straight from my Cairngorm app model, hope it helps. :)
-Riku Räisänen
--- In [email protected], "Doug Arthur" <[EMAIL PROTECTED]>
wrote:
>
> I need to find a simple tutorial or example of implementing a
getInstance
> method in a class, and then invoking it.
>
> Here's what I have so far, but it is not working.
>
>
> var asdf:Blah = Blah.getInstance();
> var a = Blah.getInstance().geta();
> mx.controls.Alert.show(a);
>
>
> package
> {
> public class Blah
> {
> public var a:String = null;
>
> public function Blah() {
> // constructor
> seta('a');
> }
>
> private static var _self:Blah = null;
>
> public static function getInstance():Blah {
> if(_self = null) _self = new Blah();
> return _self;
> }
>
> public function seta(b:String):void {
> a = b;
> }
>
> public function geta():String {
> return a;
> }
> }
> }
>
>
> I get the following error: Cannot access a property or method of a
null
> object reference.
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

