It looks like a singleton, all be it a weird way of making one. Usually you
would have the instance variable as private & access it with a getter
function like:

class MyTestClass
{
        private var _instance: MyTestClass;

        public function getInstance():MyTestClass{
                if(_instance == null){
                        _instance = new MyTestClass();
                }
                Return _instance;
        }
        private function MyTestClass() {trace ("Created")}
        public function runTest(){trace("running test")}
}
///////////////////////

MyTestClass.getInstance().runTest();

This is a well used design pattern that I am sure you can find a tutorial on
in google. Basically they are used where you will only ever need one
instance of a class say a timeline.

Hth
Jim

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Drew Shefman
Sent: 01 June 2006 18:08
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Weird OOP ability... Need a description of why,or at
least some documentation

I ran across this really bizarre method access while reviewing someone
else's work.

I would like to look up some documentation for this syntax (it doesn't
have to be AS, it could be some other OOP language - if this is a standard
option that I haven't seen before)... or at least get a description of
why/how it works (other then the obvious - that it does).

Also, can anyone give any good reason to use this syntax?

I'm just confused by it.

Thanks!
Cheerio!
Drew Shefman
[EMAIL PROTECTED]

Notice that it does NOT use static's

////////////////////////
class MyTestClass
{
        function MyTestClass() {trace ("Created")}
        public function runTest(){trace("running test")}
}
///////////////////////
var myInst:MyTestClass = new MyTestClass();
MyTestClass(myInst).runTest();



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to