Rob Romanek 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
Cat.as should contain the class Cat which should have a constructor
called Cat.
Package is not required but helps group your classes into families
(directories).
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
I do all my work in Eclipse but I think that the root of your classes is
your classpath which you will set somewhere in the Flash IDE
The following would be a good directory structure for your
documentation, sources and test specifications (there could be lots of
other directories but the main one is the source directory
myproject
docs
src //root of classpath
com //start of package names
manbus //com.manbus makes your packages unique
testproj // one of your projects so that package
names are unique within your company
animals // individual package directory
animal.as
cat.as //sources
dog.as
view // another package
listanimals.as //source in the ...view package
testspec_dir // jsut another project folder - no concern
to Flash
.
.
.
src would be the root of my classpath
Cat.as would start
package com.manbus.testproj.animals
import com.manbus.testproj.animals.animal //interface definition for
all animals
class Cat implements Animal{
private name:String
public function Cat(name){this.name=name;}// Constructor for Cat
}
Dog.as would start
package com.manbus.testproj.animals
import com.manbus.testproj.animals.animal //interface definition for
all animals
class Dog implements Animal{
private name:String
public function Dog(name){this.name=name;}
}
I hope that this helps.
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