Re: [flexcoders] Package Level Funtions

2007-06-05 Thread Ralf Bokelberg

I haven't tried it with packages, but if you want to declare a class, which
is visible to the current public class only, you have to define it outside
of the package.
Maybe the same works for package functions?

package mypackage
{
public function myFunction()
{
   myHelper();
}
} //package closed

function myHelper()
{
}

Cheers,
Ralf.
On 6/5/07, Jesse Hallam [EMAIL PROTECTED] wrote:


  Reading over: 
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Partsfile=03_Language_and_Syntax_160_05.html


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)
 





--
Ralf Bokelberg [EMAIL PROTECTED]
Flex  Flash Consultant based in Cologne/Germany
Phone +49 (0) 221 530 15 35


RE: [flexcoders] Package Level Funtions

2007-06-05 Thread Alex Harui
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_Partsfile=03_Language_and_Syntax_160_05.htm
l
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhe
lp.htm?context=LiveDocs_Book_Partsfile=03_Language_and_Syntax_160_05.ht
ml 

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) 

 



RE: [flexcoders] Package Level Funtions

2007-06-05 Thread Ely Greenfield
 

 

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_Partsfile=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.jpgimage002.jpg