You can write either
MyClass.foo = bar;
or
MyClass["foo"] = bar;
to set a static property of a class.
Gordon Smtih
Adobe Flex SDK Team
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Amy
Sent: Friday, November 14, 2008 2:28 PM
To: [email protected]
Subject: [flexcoders] Re: Calling functions with optional parameters
--- In [email protected]<mailto:flexcoders%40yahoogroups.com>, Maciek
Sakrejda <[EMAIL PROTECTED]>
wrote:
>
> Amy,
>
> Fotis is right--if you want to specify a param that has a default,
you
> need to specify all parameters to the left of it in the argument
list.
>
> Depending on your function and how many parameters it has, you may
want
> to add a class to represent your function arguments, construct that
> object independently, and pass that to your function. E.g.,
>
> var args:FunctionArgs = new FunctionArgs();
> args.foo = 123;
> args.bar = "baz";
>
> theFunction(args);
>
> This doesn't always make sense, but it can help.
OK, this sort of makes sense...but... I don't want to create a
special class for every place I want to do this. So I thought "I
know, I'll just use a generic object and check to see what properties
it has."
So I am using something like:
for (s:string in paramObj) {
this[s]=paramObj[s];
}
Just one problem...it's a static method. Anyone know the equivalent
syntax to this['thing'] that will work in a static method?
Thanks;
Amy