Why can't Flash CS3 find the MovieClip base class even after classpath is set (AS3)?

4.6k views Asked by At

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?!!

2

There are 2 answers

1
keyle On BEST ANSWER

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.

1
Rey On

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~