#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Netherlands
    Posts
    458
    Rep Power
    13

    small piece of code help please


    Hi, I have to following snippet:

    _root.MyMovie0._y -= 10;
    _root.MyMovie1._y -= 10;
    _root.MyMovie2._y -= 10;
    _root.MyMovie3._y -= 10;
    _root.MyMovie._y -= 10;

    I want to replace the "MyMovie"-values with an array. I did the following but it doesnt work.

    for (i=0; i<Descriptions_length; i++) {
    _root.this["MyMovie" + i]._y -= 10;
    )
    Anyone an idea?

    cheers
    Patrick
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    2
    Rep Power
    0
    If your movie instances are really in the root, try to do it in the more reliable two-step way:

    for (i=0; i<Descriptions_length; i++) {
    newIns = eval("_root.MyMovie"+i);
    newIns._y -= 10;
    }

    or, after declaration of newIns variable in the root: var newIns = null;, do the following:

    for (i=0; i<Descriptions_length; i++) {
    _root.newIns = eval("MyMovie"+i);
    _root.newIns._y -= 10;
    }
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Netherlands
    Posts
    458
    Rep Power
    13
    Thanks!
    I'll have a go at it

    Patrick

IMN logo majestic logo threadwatch logo seochat tools logo