0
votes

is there a way to create a class inside the main .fla file of a flash application? If I try to define a class directly in the action layer of the .fla, I get the error: "classes must not be nested". Alternatively, if I try to define a package and the class inside, I get "packages must not be nested".

I know I can reference an external .as file as the "Document class" but I was wondering if there was a way to put the class directly into the .fla.

Thanks!
Zoltan

2

2 Answers

1
votes

Classes must be defined with a package in .as files with the exact filename as the class

// Filename: MyClass.as
package {
    public class MyClass {
    }
}
0
votes

You can not create a class in the timeline. The Flash compiler treats the timeline as a class itself and you can not nest classes within classes.