Skip to main content
Inspiring
November 15, 2016
Answered

How do I access variable in movieclip?

  • November 15, 2016
  • 1 reply
  • 548 views

In AnimateCC I've added a clip called myClip and in it I place this code:

var myVar= true;

In te main timeline I want to access that variable so there I use this:

console.log(this.myClip.myVar);

But this keeps showing 'undefined'.

How can I read a variable from within a movieclip then?

The source file can be downloaded at:

https://we.tl/hPJLtuZfAJ

    This topic has been closed for replies.
    Correct answer ClayUUID

    var only declares a private variable for use by the current frame of a movieclip. To store a variable for an entire clip, use this.

    1 reply

    ClayUUIDCorrect answer
    Legend
    November 15, 2016

    var only declares a private variable for use by the current frame of a movieclip. To store a variable for an entire clip, use this.