A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Dynamically choose property

  1. #1
    Junior Member
    Join Date
    Feb 2003
    Posts
    25

    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

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    Code:
    function f(t,p,d) {
    t[p] = d;
    }
    f(this, "_width", 200);

  3. #3
    Junior Member
    Join Date
    Feb 2003
    Posts
    25
    Wicked! Thanks a million

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center