var retVal:stuff = new stuff();
with(retVal)
{
    a = 1;
    b = 2;
    c = 3;
}
trace("retVal.a == " + retVal.a);
trace("retVal.b == " + retVal.b);
trace("retVal.c == " + retVal.c);
internal class stuff
{
    public var a:int;
    public var b:int;
    public var c:int;
    public function stuff():void{}
}
//output:
/*
retVal.a == 1
retVal.b == 2
retVal.c == 3
*/
Not sure I find this useful.
Saves typing, but I am not sure how I feel about debugging code written like this.
Also, intellisense in flashDevelop doesn't appreciate it.
Maybe I will use the with keyword... Depends on how much typing I need to save
and what makes things more readable.
Friday, November 2, 2012
using the WITH keyword in ActionScript AS3
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment