Here is a good article on class/package syntax and structure:

http://probertson.com/articles/2006/07/28/one-file-many-as3-classes/

It turns out that one class per package is a Flex limitation.

On 3/26/07, elibol <[EMAIL PROTECTED]> wrote:

Hi Rob,

The ability to define multiple classes in a single package was removed as
of Flex 1.5. It was removed with the class modifier *private*. There is
still a way to do it though.

First you need to change your file name to match the main class that is
being defined. The main class is the class that is within the package block.
You can then define any additional classes *outside* of the package block.
Classes outside of the package block cannot have any modifiers. The classes
are scoped to the classes within the .as file; no class outside of the .as
file can access these classes.

On 3/26/07, Rob Romanek <[EMAIL PROTECTED]> wrote:
>
> Hi Ron,
>
> Thanks for the suggestion but still no luck on my end.
>
> It seems that on my set up I need to have a constructor named the same
> as
> the .as file and that constructor has to be initiated prior to any of
> the
> other classes being initiated. So I set up
>
> public class MyPackage{
>         public function MyPackage{
>         }
> }
>
> and then can either do an import or set up the .as file as my document
> class and after that I can access HelloWorld or MyClass. This seems to
> follow the examples that came with the Flash 9 alpha, which all use the
> document class approach and none of the .as files has more than one
> class
> in them, even though you can put more than one class inside. So I'm
> still
> a bit flummoxed as to how the package is working for Jason and not me,
> ah
> well. Probably something stupid I'm doing and the light will go in a few
> days.
>
> Just to complete this I've also tried creating a folder called MyPackage
>
> and putting the .as files in there and again without the constructor
> named
> the same as the .as file it did not work
>
> My understanding of 'package' is that the dot path that occurs after it
> is
> the path to the .as file so if the MyPackage.as is sitting in the same
> directory as your .fla then I would only have 'package' at the top of
> the
> file, if it were in a directory called MyPackage then the syntax would
> be
>
> package MyPackage
>
> thanks for ideas,
>
> Rob
>
> On Sat, 24 Mar 2007 09:26:10 -0400, Ron Wheeler
> <[EMAIL PROTECTED]> wrote:
>
> > Something to try
> >
> > change
> > import MyPackage.*;
> > to import myPackage.HelloWorld
> >
> > import myPackage.MyClass
> >
> >
> > See if the errors change.
> >
> > Ron
> >
> > Merrill, Jason wrote:
> >> I dunno, that's how I have it set up and it works fine for me -
> Perhaps
> >> your Flash 9 Preview Alpha is messed up.  I assume your publish
> settings
> >> are all correct, - I don't know why it would do that.
> >>
> >> Jason Merrill
> >> Bank of America  GT&O Learning & Leadership Development
> >> eTools & Multimedia Team
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to