Reputation: 35
I don't know if this has a special name or even possible. Consider this code;
public dynamic class Foo {
public function set (_key:String,_value:*):void {
this[_key] = _value;
trace(this[_key] + " property added.");
}
}
The trace represents some extra work to be done with the property key and/or value. Now we can create any property using the set function.
myFoo.set("prop1",14);
myFoo.set("prop2","test");
etc...
Is there a way to modify this function, so that it will take effect for any property?
myFoo.prop1=14;
myFoo.prop2="test";
I want it to act like a global setter function which takes effect when you create/modify any property of the object. I intend to create a get function in a similar way.
Upvotes: 0
Views: 69