1 Reply Latest reply on Feb 8, 2008 2:09 PM by robdillon

    using eval

    phil1943 Level 1
      Hello, can someone please tell me how to use eval to access the rotation property of this object:
      _level0.matilda.turret.rotation .
      I successfully attached it using eval as below.

      eval("matilda"+i).attachMovie("turret", "turret"+i, getNextHighestDepth());

      then I try to use eval unsuccessfully:
      eval("matilda"+i).eval("turret"+i)._rotation = 45;

      thanks kindly for any help.
        • 1. Re: using eval
          robdillon Most Valuable Participant
          You don't really want to EVER use eval(). If you have a bunch of "matilda"s then you can access each from its parent: this["matilda" + 1]. If the "matilda"s were inside another movieClip then the reference might look like this: parentClipName["matilda" + 1].

          If you are only attaching one "turret" to each "matilda", you don't really need to give each "turret" a unique instance relative to the movie. You can just name it "turret". Since the turret is inside the matilda clip, it is unique. If that's the case then you could just use:
          this["matilda" = 1].attachMovie("turret","turret",getNextHighestDepth());

          So then to set the value of the rotation property:

          this["matilda" + 1].turret._rotation = 45;