Hi Drew,
 That's just type casting. See my email of a few days ago.

 It's actually redundant in the example you provided, because the
compiler already knows that it's a MyTestClass object. You could
replace it with:

var myInst:MyTestClass = new MyTestClass();
myInst.runTest();

If, however, for whatever reason you had some code like this it would
make sense:

var myInst:SomeSuperClassOfMyTestClass = new MyTestClass();
MyTestClass(myInst).runTest();

Assuming runTest() is defined on MyTestClass but not its superclass,
the compiler needs to know that myInst is actually of type MyTestClass
before it'll let you compile the line of code calling runTest().

HTH,
 Ian


On 6/1/06, Drew Shefman <[EMAIL PROTECTED]> wrote:
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

Reply via email to