Welcome to flashlibrary.co.uk

Public classes in Actionscript 3

Remember to declare classes public when necessary in Actionscript 3.

If you get an error something like the following you may have neglected to include the public at the start of you class declaration.

ReferenceError: Error #1065: Variable {variable_name} is not defined

This will fail and give you the error above.

package{
    import flash.display.MovieClip;
    /**
     *
     */
    class Temp extends MovieClip{
        /**
         *
         */
        public function Temp(){
            trace('Constructor called');
        }
    }
}

Whilst the following will work fine :)

package{
    import flash.display.MovieClip;
    /**
     *
     */
    public class Temp extends MovieClip{
        /**
         *
         */
        public function Temp(){
            trace('Constructor called');
        }
    }
}
Comment on Page

If anything is unclear or just plain wrong let us know and should ammend it pretty sharpish. If you visited the page with a particular question leave it and if it's flash related I'll try to answer it.