actionscript 3 - Why do extended classes have to re import in as3? -


let's have base class parentclass includes import statements.

import flash.events.*; 

if have child childclass extends parentclass , want event

public class childclass extends parentclass{     public childclass():void{         addeventlistener(event.added_to_stage, childfunction);     } } 

it doesn't work unless add import statement in child class:

import flash.events.*;  public class childclass extends parentclass{     public childclass():void{         addeventlistener(event.added_to_stage, childfunction);     } } 

why? if child class extending functionality of parent, why need re-import classes parent required?

one reason import statements exist actionscript 3 classes can have same name other classes, provided exist in different packages. import statements tell compiler of these classes trying use.

for example, if whatever reason, had made class called event in this/is/an/example package, compiler need see either import flash.events.event statement or import this.is.an.example.event statement know event class using. same rule applies child classes.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -