In the past, I have seen classes used in various projects and have tried to read through multiple classes to try and understand them. I have tried reading books on making classes and have even bought some training videos, but I never really got the hang of it. Well, Lynda.com just made my day. I understand classes now and Im extremely excited!
I followed along with the first couple of tutorials to make a basic class. Everything was actually quite simple and I learned about using “private” and “public” in variables and functions.
The next tutorial focused on attaching a class to a couple of buttons. I was really amazed at how simple the process was and was also excited to see how multiple objects of the same movie clip object were affected by the class.
Below is the result of the tutorial. The function inside the class makes the button roll over possible and is applied to all objects at once. I used to use a strategy just like this, but it wasn't using a class. I used to use something called a “For Loop”, which is a type of function that runs a series of events based on a number or the length of an array (list of items). This method did have a drawback though. I had to make sure everything had an instance name and with this example using classes, the objects didn't have to have an instance name. I think if I combine these methods I will be able to make some great dynamic applications.