We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Posted By

1man on 07/03/08


Tagged

class actionscript extend as3


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

taboularasa
t3flexdev


Basic Package and Class Creation / Extend


Published in: ActionScript 3 


How to create a basic class in AS3 and extend it if needed.

  1. //In myBaseClass.as
  2. package {
  3. public class myBaseClass {
  4. public function sayHello():void {
  5. trace("hello");
  6. }
  7. }
  8. }
  9. //In mySubClass.as
  10. package {
  11. public class mySubClass extends myBaseClass {
  12. public function sayGoodbye():void {
  13. trace("goodbye");
  14. }
  15. override public function sayHello():void{
  16. trace("This is a trace!");
  17. }
  18. }
  19. }

Report this snippet 

You need to login to post a comment.