开发者

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

开发者 https://www.devze.com 2022-12-10 04:47 出处:网络
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.

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
{
    开发者_如何学C//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?!!


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.


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~

0

精彩评论

暂无评论...
验证码 换一张
取 消