Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075919 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:30:44 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)packages & namespaces
Pages: [1]
Print
Author Topic: packages & namespaces  (Read 593 times)
Klaim
Level 10
*****



View Profile WWW
« on: September 25, 2009, 01:29:35 AM »

Hello!

I'm starting Action Script 3.0 developement for my new job and i'm facing a problem that seem verry stupid but I don't find any clear solution. (I'm from the c++ world but I've read the adobe official docs without success -- i'm using eclipse/flex_builder plugin).

The basis of the problem is that I need three packages with classes that have the same name and I want them to interract together in another class with again the same name.
To simplify, I got (canonic name):

machin.bidule.a.Truc;
machin.bidule.b.Truc;
machin.bidule.c.Truc;
machin.bidule.Truc;

I want to use the 3 first classes in machin.bidule.Truc.
So:

 1. If I understood right, we cannot use a partial/package-relative canonic name? For example if i'm in the code that is in the package machin.bidule, I cannot use the name c.Truc, that is correct? (note: I got an error when I try this so I suppose it's forbidden)


 2. How do I solve this problem of name conflicts in practice? The dirtiest way to fix this would be to change the class names. I'd like to avoid this solution if possible. I don't understand how you do to solve this problem in your applications...


I tried to use namespaces but it don't seem to be the adequate use (and I didn't made the simplests example work anyway : when I do 'use namespace my_ns;' it says it don't find it but I did declare it in another file in the same package... something I don't get?)

So I'm sure I didn't understood something essential but reading several docs on the web didn't help. So I ask here for help.

Thanks for your time!
Logged

http://www.klaimsden.net | Game : NetRush | Digital Story-Telling Technologies : Art Of Sequence
Klaim
Level 10
*****



View Profile WWW
« Reply #1 on: September 25, 2009, 02:21:47 AM »

Ok in fact someone solved my problem: I didn't use any import for the classes...
I didn't understood that an import was needed in all cases. I thougt that using the cannonic name was the same but it isn't v__v;

Problem solved, thanks!
Logged

http://www.klaimsden.net | Game : NetRush | Digital Story-Telling Technologies : Art Of Sequence
grapefrukt
Level 1
*



View Profile WWW Email
« Reply #2 on: September 25, 2009, 04:53:02 AM »

i'm just curious, why four classes with the exact same name?
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic