Tutorial by Examples

Constructor overloading is not available in As3. In order to provide a different way to retrieve an instance of a class, a public static method can be provided to serve as an alternative "constructor". An example for that is flash.geom.Point, which represents a 2D point object. The coor...
To ensure encapsulation, member variables of a class should be private and only be accessible to public via public get/set access methods. It is a common practice to prefix private fields with _ public class Person { private var _name:String = ""; public function get name():S...
Packages are bundles of classes. Every class must be declared within a package using the package statement. The package statement is followed by the name of your package, or followed by nothing in the case of adding classes to the top-level package. Sub-packages are created using dot (.) delimitatio...
When you extend a class, you can override methods that the inherited class defines using the override keyword: public class Example { public function test():void { trace('It works!'); } } public class AnotherExample extends Example { public override function test():void ...
Getters and setters are methods that are behaved like properties. it means they have function structure but when used, they are used same as properties: Structure of getter functions: they should have get keyword after function keyword and before function name, with no argument, a return type spec...

Page 1 of 1