5 Replies Latest reply on Mar 21, 2016 12:36 PM by ClayUUID

    Object declared `undefined` when I use the same line to refer to it from within a function

    adumi Level 1

      On the canvas stage I have a hierarchy of objects dragged from the library. objectGrandFather contains objectFather which contains objectSon which in turn contains objectGrandson . Now, on the first frame of the timeline of object Son I have the following code which successfully refers to objectGrandson:

      this.objectGrandson.visible = false;

      But, when I try to insert that very same line of code into a function located in the very same frame and calling that function like so:

      refer_to_objectGrandson() {
        this.objectGrandson.visible = false;
      }
      objectGrandson(); 
      
      
      

      I get an error of object undefined. What am I doing wrong, please?