Hi Jesse. The answer is no, you can't do that.  When you try and use a
class, method, global variable, flex needs to know where to go to find
the definition of that variable.  Exhaustively searching every file in
your classpath would be prohibitively expensive. Instead, we impose the
rule that definitions visible outside of the file they're defined in
must match the path/file name they're defined in, so the compiler can
find them easily and quickly.  That means that in your example below,
even though your definitions aren't visible outside the package, they're
still visible outside the file, which means, for performance reasons,
they need to be defined in a file whose path/name matches their
package/name.

 

The only time you can violate this rule is when you're declaring things
that are only used within the file itself.

 

Ely.

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Tuesday, June 05, 2007 10:28 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Package Level Funtions

 

Did you have any public thing in that file?  Maybe hack up one public
thing

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jesse Hallam
Sent: Tuesday, June 05, 2007 7:50 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Package Level Funtions

 

Reading over: 
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhel
p.htm?context=LiveDocs_Book_Parts&file=03_Language_and_Syntax_160_05.htm
l 

I got the distinct impression that each .as file could only export one
publicly visible definition (i.e. one public class, or one public
method, etc...), but it could define any number of internal definitions
accessible to the package. 

I was hoping to do this:

package MyPackage {
   internal method1() : void {

   }
   internal method2() : void {

   }
}

To be able to create a single file with a number of related,
package-level functions, and not have to wrap them as static methods of
a class. I didn't need them publically accessible, just accessible to
the package. However, after running into "Error: A file found in a
source-path must have an externally visible definition." repeatedly, I'm
under the impression I can't do that -- I'd have to put each method in
its own file. 

Am I correct?

Thanks for any input!

-- 
Jesse Hallam
University of Waterloo Junior

"For scarcely for a righteous man will one die: yet peradventure for a
good man some would even dare to die. But God commendeth his love toward
us, in that, *while we were yet sinners*, Christ died for us. " (Romans
5:7, 8) 

 

<<image001.jpg>>

<<image002.jpg>>

Reply via email to