User Guide
114 Server-Side ActionScript Language Reference
Parameters
obj An object.
propName A string; the URL to upload variables. The name of the property that exists in
the
obj parameter. Setting attributes on nonexistent properties has no effect.
enumerable One of the following values: true, false, or null. Makes a property
enumerable if
true or nonenumerable if false; a null value leaves this attribute unchanged.
Nonenumerable properties are hidden from enumerations (
for var i in obj).
readonly One of the following values: true, false, or null. Makes a property read-only if
true or writable if false; a null value leaves this attribute unchanged. Any attempt to assign
a new value will be ignored. Typically, you assign a value to a property while the property is
writable and then make the property read-only.
permanent One of the following values: true, false, or null. Makes a property
permanent (nondeletable) if
true or deletable if false; a null value leaves this attribute
unchanged. Any attempt to delete a permanent property (by calling
delete obj.prop) is
ignored.
Description
Method (global); lets you prevent certain methods and properties from being enumerated,
writable, and deletable.
In a Flash Media Server server-side script, all properties in an object are always enumerable,
writable, and deletable. You can call
setAttributes() to change the default attributes of a
property or to define constants.
Example
The following code prevents the __resolve method from appearing in enumerations:
Object.prototype.__resolve = function(methodName){ ... };
setAttributes( Object.prototype, "__resolve", false, null, null );
The following example creates three constants on a Constants object and makes them
permanent and read-only:
Constants.Kilo = 1000; setAttributes(Constants, "Kilo", null, true, true);
Constants.Mega = 1000*Constants.Kilo;
setAttributes(Constants, "Mega", null, true, true);
Constants.Giga = 1000*Constants.Mega; setAttributes(Constants, "Giga",
null, true, true);