ActionScript 3 class over several files - how?

Posted by Poni on Stack Overflow See other posts from Stack Overflow or by Poni
Published on 2010-05-05T18:06:09Z Indexed on 2010/05/11 2:04 UTC
Read the original article Hit count: 386

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" :)

© Stack Overflow or respective owner

Related posts about actionscript

Related posts about actionscript-3