PDA

View Full Version : compile error, type not found



stilllearning
March 16th, 2010, 05:55 PM
Hi,

I am an actionscript newbie, and I am trying to do something seemingly simple.

I have an actionscript file with a class defined, and I am trying to define an object for that class in another actionscript file but I keep getting a compile error that says type not found.

Here is what my code looks like

ABC.as

package{
......
public class ABC{

....
....
}

Paint.as

import ABC

package{
....
public class Paint extends Movieclip{

var abc:ABC; // throws an error

}
....
}

If someone could point me in the right direction that would be great.

Thank you,
Amrita

Krilnon
March 16th, 2010, 06:07 PM
Are ABC.as and Paint.as in the same folder?

stilllearning
March 16th, 2010, 06:16 PM
Yes, both files are in the same folder.

Maqrkk
March 16th, 2010, 07:06 PM
Try moving the import statement after the package line, like this:

Paint.as

package{

import ABC

stilllearning
March 16th, 2010, 07:36 PM
Thank you. I figured it out.

It looks like my as file and my class have to have the same name ? Correct me if I am wrong.

Krilnon
March 16th, 2010, 07:47 PM
Correct.