views:

509

answers:

2

Tearing my hair out. I created an as3 class - blah.Foo, which extends MovieClip. it is not in a package, cos Flash CS3 complained about nested packages, so it's a 'bare' class.

And yes it's nested in myproj/as/blah/Foo.as And yes, it imports flash.display.MovieClip at the top of the file.

I also have myproj/fla/main.fla. main.fla is set to publish as AS3 against flash player 9. main.fla has classpath which includes myproj/as/

on frame1 scene1 in main.fla:

import blah.Foo;
var myfoo:Foo = new Foo();
stop();

compiler dies at class definition of Foo in Foo.as:

import flash.display.MovieClip;
class blah.Foo extends MovieClip //<=== dies here
{
    //whatever...
}

It complains that: "1017: The definition of base class MovieClip was not found".

Someone please help! How can it not find one of the most basic classes in AS3?!!

+1  A: 

Actionscript 3.0 doesn't work like AS2

try this

package blah
{
    import flash.display.Movieclip;

    public class Foo extends MovieClip
    {
    ...

have a read

hope this helps.

keyle
thanks keyle... adding the 'path' for the package to the package statement instead of the class definition seems to have gotten Flash CS3 past that hump... yay! So now I have a whole bunch of other errors... will see if, when I clear those up, the issue is truly resolved...
helpless
A: 

Remember:

  • Although private classes have not been yet implemented in ECMAScript, declaring a class outside of a package makes it 'behave' just like one. Hence your problem accessing the class from your main document.

  • Once inside the package, you should specify how you would like the class to be accessed. Declaring your class using the 'public' modifier would allow access to your class from outside of the package.

R~

rey
thanks so much, Rey. I genuinely did not know that about it being equivalent to private...
helpless