Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-28-2012, 02:12 PM   #1
Registered User
Join Date: Jun 2012
Posts: 2
Default Problem with namespaces at package level.

Hi, people.
I come to you because I have a very weird problem with namespaces.

I have tried two SDKs, and Flashdevelop before and after update.
I have also tried to target different Flash player versions.

I declare a simple namespace in a file, at package level, and try to import it on another file.
Although the "import" line doesn't bring an error, the compiler throw an error as soon as I try to use the namespace (in a "use" or in a function declaration), claiming that it cannot be found.

To be sure I have build a simple project with some code from an online tutorial:
ActionScript Code:
But I get the same problem as for my test:
"Namespace was not found or is not a compile-time constant. mynamespace var myna:int;"

I have tried to declare it on the same File as a class, as it is done here:
ActionScript Code:
But I get a message:
"A file found in a source-path can not have more than one externally visible definition."
I know that to be true for classes, but I thought you could declare namespaces that way.

I have tried to target a few Flash player versions with no luck.
I'm running out of ideas.

Here is the simple test project.
ActionScript Code:
Can somebody test it for me, please?
Just tell me if it compiles?

Many thanks.
Sorry for the badly shaped links.
This 50 post minimum to post a link is kinda lame, whatever the reason.

Precision, the namespace references are colored in blue by Flashdevelop.
So the syntax must be okay.
Attached Files
File Type: zip Test namespace.zip (10.1 KB, 29 views)
Horsetopus is offline   Reply With Quote
Old 06-28-2012, 04:14 PM   #2
Registered User
Join Date: Jun 2012
Posts: 2

Ok, someone helped me on another forum.
As for classes and interfaces, namespaces must be in a file matching their names.
Horsetopus is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 05:22 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.