I think that with should be avoided, it greatly reduces the
readability of your code and makes maintaining it more difficult.
On Nov 5, 2007, at 8:53 AM, Brent Dearth wrote:
var o:Object = {a: 20, b: "twenty"};
trace (o.a + " " + o.b);
with (o) {
a = 40;
b = "forty";
}
trace (o.a + " " + o.b);
On 11/5/07, Samuel Colak <[EMAIL PROTECTED]> wrote:
Not quite what i mean - not to call the function but referring to
properties inside the object - your demo implies a static object
"Math" with functions cos and sin.
inside the "object" i have a getter and setter for the property "x".
Regards
Samuel
On Nov 5, 2007, at 10:56 AM, Edward Yakop wrote:
I'm not sure what u meant, but [with] statement does exists.
For example, taken from the flex doc:
<code>
var a:Number, x:Number, y:Number;
with (Math) {
a = PI * pow(r, 2);
x = r * cos(PI);
y = r * sin(PI / 2);
}
</code>
where pow, cos and sin are static method of Math.
Regards,
Edward Yakop
On Nov 5, 2007 10:45 AM, Samuel Colak <[EMAIL PROTECTED] >
wrote:
> Guys,
>
> am i going nuts and that there is no with construction for objects
> (such like....)
>
> object.x = 20 (x is a number)
>
> or
>
> WITH (object) {
> .x = 20
> }
>
> Just wondering....
>
> Samuel
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/
flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
> Yahoo! Groups Links
>
>
>
>