Skip navigation
xhdreamlover
Currently Being Moderated

Why can't two class in different packages have the same name in as2?

May 21, 2012 12:07 AM

Tags: #actionscript_2

When I do this, I go the compiling error message says something like "the leaf node ... has been decode to ...", then what the package are using for ?

 
Replies
  • Currently Being Moderated
    May 21, 2012 4:24 AM   in reply to xhdreamlover

    You should include the actual entire error message, not something like it.  Why would you want to have two classes with the same name in the same file?  I can see how the compiler would have an issue picking which to use in that scenario?

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2012 9:08 PM   in reply to xhdreamlover

    I think the problem is that you are trying to use import statements for both of them?

     

    The import statement doesn't actually "import" anything. It just makes a shortcut for refering to the class.

     

    So

     

    import p1.CA;

     

    Allows you later to do this:

     

    var myCA:CA = new CA();

     

    But when you import both p1.CA and p2.CA Flash doesn't know what to resolve the second one to since the "shortcut" for CA is already used.

     

    If you need to do this then you can use the full package name each time:

     

    var myCA1:p1.CA=new p1.CA();

    var myCA2:p2.CA=new p2.CA();

     

    Of course I'm guessing this is just an example? If it really is this simple of a structure why do you need two CA classes?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points