Hi Clint,

Yes, I actually did think about putting these constants in their own
class, but I was trying to avoid it...not only for simplicity, but
also to compact the references I would have to make -> i.e. just
refer to it as  LANDSCAPE instead of ClassName.LANDSCAPE...mainly
because there are a lot of constants that I want to store, and I
reference them a lot in the other classes.

BUT, I didn't think about variable naming issues, so I think I will
actually go with dropping them in a class.

Thanks!


Charles


--- In flexcoders@yahoogroups.com, "Clint Modien" <[EMAIL PROTECTED]>
wrote:
>
> Hi Charles... you may find it helpful to break your general
constants up
> into there own classes with their own packages to avoid variable
naming
> issues.
>
> To answer your question though...
>
> If you make the consts you have static as in
>
> public final class com.company.printing.PrintJobOrientation {
>     public static const LANDSCAPE:String = "landscape";
>     public static const PORTRAIT:String = "portrait";
> }
>
> you can then use those constants like so...
>
> imports com.company.printing.PrintJobOrientation
> public class com.company.printing.PrintJob {
>     public layout:String;
>     public function print() {
>         if(this.layout = PrintJobOrientation.LANDSCAPE) {
>              //DO SOMETHING
>         }
>     }
> }
>
>
> Hope that helps.
>
> On 6/2/06, Charles <[EMAIL PROTECTED]> wrote:
> >
> > Hi everyone,
> >
> > This seems like a very simple thing to do, but I can't figure
out why it
> > won't work.  Basically, what I am aiming for is to have a
separate .as file
> > that contains only constants (no classes or functions...just
constants).  I
> > have this ActionScript class, say "ClassOne.as" that uses a lot
of
> > constants.  I have another ActionScript class, say "ClassTwo.as"
that also
> > uses the same constants.  Right now, all of the same constants
are declared
> > twice, once in each class.  But what I want is to make a
seperate file to
> > just hold those constants and then "import" them from both
classes, but I
> > can't figure it out.
> >
> >
> >
> > I know that to "import" external .as files in an .mxml file, you
can just
> > use <Script source="file_name.as"/>.  But, to "import" an
external .as
> > file from within another .as file, I don't know how.  I've tried
using import
> > files.*, but since the file is just a list of constants, and not
a class,
> > it doesn't work.  I've also tried include "files/file_name.as",
but I get
> > an error for having "more than one externally visible
definition"...?
> >
> >
> >
> > Any help would be great...my code is too bloated to stand right
now, with
> > all this redundant code...haha
> >
> >
> >
> > Thanks in advance.
> >
> >
> >
> >
> >
> > Charles
> >
> >
> >  --
> > Flexcoders Mailing List
> > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
> >
> >
> >
> >  SPONSORED LINKS
> >   Web site design development<http://groups.yahoo.com/gads?
t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=
Computer+software+development&w3=Software+design+and+development&w4=M
acromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L
-4QTvxB_quFDtMyhrQaHQ>  Computer
> > software development<http://groups.yahoo.com/gads?
t=ms&k=Computer+software+development&w1=Web+site+design+development&w
2=Computer+software+development&w3=Software+design+and+development&w4
=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig
=lvQjSRfQDfWudJSe1lLjHw>  Software
> > design and development<http://groups.yahoo.com/gads?
t=ms&k=Software+design+and+development&w1=Web+site+design+development
&w2=Computer+software+development&w3=Software+design+and+development&
w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.s
ig=1pMBCdo3DsJbuU9AEmO1oQ>   Macromedia
> > flex<http://groups.yahoo.com/gads?
t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+sof
tware+development&w3=Software+design+and+development&w4=Macromedia+fl
ex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZ
I36cYzBjw>  Software
> > development best practice<http://groups.yahoo.com/gads?
t=ms&k=Software+development+best+practice&w1=Web+site+design+developm
ent&w2=Computer+software+development&w3=Software+design+and+developme
nt&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166
&.sig=f89quyyulIDsnABLD6IXIw>
> >  ------------------------------
> > YAHOO! GROUPS LINKS
> >
> >
> >    -  Visit your
group "flexcoders<http://groups.yahoo.com/group/flexcoders>"
> >    on the web.
> >
> >    -  To unsubscribe from this group, send an email to:
> >     [EMAIL PROTECTED]<flexcoders-
[EMAIL PROTECTED]>
> >
> >    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >    Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> >  ------------------------------
> >
>









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to