The following post is part of firstborn's mentorship program. For more information and a full table of contents, check out the mentorship main post.

Reading an XML
download: 005_xmlExample.zip

This example teaches you how to load and read from an XML file.


Custom Events
download: 007_customEvents.zip

This example shows you how to extend Events, to create your own custom Events that can pass along important data to the listener. Have a look at the code and you'll see why that makes the developer's life a hell of a lot easier.




2 Responses to “Mentorship Program: loading XML & custom Events”

  1. Isocase:

    I took a look at your DemoEvent class and wanted to ask a question. Is there any benefits in making your color variable a public var and accessing it directly, then if you were to make it private and use a getter method?

    Thanks


  2. Jens:

    Thanks Isocase, that’s a good question. In fact, most of the times a getter method (without setter) will be the cleaner approach, because the variable will be declared in the constructor and will be read-only afterward…

    In this case, I only went with the public variable, because it’s a few lines of code less, which might make it easier to concentrate on and understand the basic thought behind the concept of custom events…


Leave a Reply