Get into a rhythm of efficiently setting up your files so you can smoothly transition into writing code. This video shows you how to set up your script for all the code you'll write from here on out.
After creating an ActionScript file, our next goal is to write the code. So, once all file tasks are done, we can start using that file. Before actually beginning to write code, there are a few basic things one must remember while dealing with programming:
Now, once you complete the code inside the main function, you must save the file in the source folder. The process of saving files in source and deploy folders has already been discussed in previous videos. You can take a quick peek at the previous videos to refresh your memory. One new thing here is that you must save your file with the same name of your main class. Moreover, the first letter of the class name must be in uppercase.
Now, we have two saved files: main.fla and Main.as. Hence, we must create a link between these two files:
Be sure you're in your main.fla file, then (if the properties panel isn't open,) select the window menu and click on the properties option.
When the properties panel is open, you can find the “Class” box. Type in the class name you just created without any extension (aka 'Main').
Finally, click on the small pencil next to the box: if your class editor opens, that means you did everything right. Way to go!
Have a question but don't want to ask it publicly? If you are a prime member just ask right here and we will get back to you within 48 hours. Not prime yet? no worries you can ask publicly below.