So, how do we write a class over several files in action script 3?
In C# there’s the “partial” keyword.
In C++ it’s natural (you just “#include …” all files).
In Flex 3, in a component, you add this tag: <mx:Script source="myfile.as"/>.
How do I split the following class into several files;
package package_path
{
public class cSplitMeClass
{
public function cSplitMeClass()
{
}
public function doX():void
{
// ....
}
public function doY():void
{
// ....
}
}
}
For example I want to have the doX() and doY() functions implemented in another “.as” file.
Can I do this?
And please, don’t tell me something like “a good practice is to have them in one file” 🙂
As per your request, I’m sparing you the “best practices lecture”. So, I’ll just say there’s an include directive in AS 3.0, which could help you out here.
Basically, you can do:
And then in “the_file_where_doX_and_doY_live.as”