Join Todd Perkins for an in-depth discussion in this video Working with getter and setter methods, part of Flash CS4 Professional: Object-Oriented Programming .
It's considered a best practice to keep all class properties private. You can…access those properties through public methods. Let's take a look here.…I'm go to TV.as and work with the private property channel. I'm going to expand…my working area here, and I'm going to make this method getChannel public.…I nstead of returning void, I'm going to return a positive integer, the same…data type as the channel. All this method is going to do is return the channel.…
So we can access this private property through a public method. Save the file,…so File > Save, back to the FLA file, go to the code in the Timeline and…instead of tracing tv_mc.channel, we'll trace tv_mc.getChannel, and now we get three. …So we've protected the private property and we can expose it using the public method.…Now, of course, we can also perform other operations inside of this method.…
If you wanted to manipulate the channel in some way or notify some other elements…of this class in another way, we can do that. I'm not going to do it here,…
- Loading external text, images, and XML files
- Creating essential properties for a View class
- Defining a Model class
- Building and implementing interfaces and designs
- Debugging projects
- Building applications with Controller-class buttons
Skill Level Intermediate
1. ActionScript 3.0 Essentials
2. Advanced ActionScript Techniques
3. Object-Oriented Programming Fundamentals
4. The Model View Controller Design Pattern
5. Building a Model Class
6. Building a View Class
7. Building a Controller Class
8. Improving and Debugging the Application
9. Moving Forward
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.