Join Todd Perkins for an in-depth discussion in this video Dispatching events, part of Flash CS4 Professional: Object-Oriented Programming .
Now we are going to look at making our custom Model class dispatch an event…once it's data has been changed. The first thing we will do is create a public…static constant right below the rest of our properties.…So I'm going to create a public static constant called MODEL_CHANGE.…That's going to be a string and I'll set its value right here because remember…whenever you are working with the static constant, you want to set its value…right where you define it. I'm going to have the value be modelChange, and then…I'm going to dispatch an event. It's going to dispatch the string here.…
So we can listen for that modelChange event.…Scroll down and at the bottom of setCurrentIndex, below everything else inside…of there, we are going to dispatch that modelChange event. I'll do that using…the dispatchEvent method. So dispatchEvent. In the parenthesis I'll pass in a new Event…and in the parenthesis we are going to pass in model.MODEL_CHANGE.…Don't forget to close out the parenthesis for both the new Event and…
- 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.