-
Dynamically choose property
hi, I'm trying to make a versitile function that will make an object move a direction or change size. The function has two parameters, "target" and "property"
so the idea is if I wanted to set, _root.bar._width = "20";
I would call the function and set the perameters, target="20", property="_width"
so far I am having trouble with the syntax to set the property, I was thinking (when property="_width") it would be something like this:
_root.bar.[property] = target;
Any ideas??
thanks in advance
-Noah
-
Code:
function f(t,p,d) {
t[p] = d;
}
f(this, "_width", 200);
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|