3 Replies Latest reply on Jan 17, 2011 8:28 AM by kglad

    Problems Defining Variables from a Separate Timeline

    Kwangle Level 1

      HI All,

       

      I'm having a strange problem setting variables in movie clips from another (parent timeline). I run the following code from the parent movie clip to target child movie clips it contains.

       

      setVars = function (clip, value) {

        clip.val1 = value;

        clip.val2 = 0;

        clip.onEnterFrame = function() {

          trace ("function working");

          trace("Value 1 = "+val1);

          trace("Value 2 = "+val2);

          };

      }

       

      I am trying to set variables in a movie clip targetted by the 'clip' argument in the setVars function but they are being traced as undefined. However, setting the function works fine. I have also tried manually defining the variables in the movie clip and am still unable to change them externally from the setVars Function.

       

      What am I doing wrong here? Any help would be greatly appreciated.