From the course: Adobe Animate CC New Features

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Global JavaScript declaration

Global JavaScript declaration - Adobe Animate Tutorial

From the course: Adobe Animate CC New Features

Start my 1-month free trial

Global JavaScript declaration

- [Instructor] In JavaScript, scope is very, very important. With previous Animate releases, there were a lot of tricks to access global properties, but all were a bit difficult for the novice coder. It's now a simple task to utilize JavaScript code that is applicable to the entire animation. Have a look at this FLA here. You can see that we have a visual layer and an actions layer. Inside the visual layer, we have this little Animate icon and we also have, most importantly, a dynamic text field with an instance name of msg for message. This is going to be very important when we look at our code. So let's open up the Actions panel from Window, Actions, and we can see here that we are on frame one, the current frame, and make sure you choose the actions layer as reflected in this label right here. What we're going to do is set a variable on frame one so var author name equals Joseph Labrecque. There we go. So note that this is added to frame one of our actions layer and what we'll want…

Contents