It can also be useful when you're working on code someone else wrote
that doesn't use classes at all (everything is a generic object,
grumble grumble...) and you need to do lots of work on that object.
Like if you have to set a whole lot of values in the object.

So, it can make your life a bit easier when you're forced to deal with
code that isn't particularly good. :)

 -Andy

On 1/3/07, T. Michael Keesey <[EMAIL PROTECTED]> wrote:
On 1/3/07, Kalani Bright <[EMAIL PROTECTED]> wrote:
>
>
> its just so you dont have to do myObject.duration = 5.5 etc...
>
> I've never used with.  It's one of the most useless constructs.

I agree. If you find yourself wanting to use "with", you should
seriously considering making another function in the class you're
using. (Or, if it's not your class, extend it and make a new function
in the subclass.) E.g., instead of:

var myObject:MyClass;
with (myObject) {
    duration = 5.5;
    start();
    ping("test.com");
}

... do something like this:

// In the class file:
class MyClass {
    //...
    public function doTest(newDuration:Number, url:String):Void {
        duration = newDuration;
        start();
        ping(url);
    }
    //...
}
// Elsewhere:
var myObject:MyClass;
myObject.doTest(5.5, "test.com");

--
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
--
The Dinosauricon: http://dino.lm.com
Parry & Carney: http://parryandcarney.com
ISPN Forum: http://www.phylonames.org/forum/
_______________________________________________
[email protected]
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

_______________________________________________
[email protected]
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