The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Page 1 of 2 12 LastLast
Results 1 to 15 of 23

Thread: ReferenceError: Error #1065: Variable is not defined.

  1. #1

    ReferenceError: Error #1065: Variable is not defined.

    Good people of Kirupa.
    Please help me out with this error message.
    No matter how simple my class is Flash gives me this error message :
    "ReferenceError: Error #1065: Variable is not defined."

    In fact, it happens even if I don' have any variables at all. It won't even run a simple "hello world" trace from the constructor method.

    From what I've learned from other people, this could often be caused by not declaring your classes public, but I have that.

    Any ideas on what causes this?

  2. #2
    Not sure

    Anyway try this...

    package  {
    	import flash.display.Sprite;
    	public class SimpleClass extends Sprite  {
    		public function SimpleClass()  {
    			trace("Hello world");
    See if you can at least run this as a document class.

  3. #3
    Thanks for your reply Michael, but I'm afraid the problem still occurs. It's very annoying and the error message doesn't really provide me with any valuable information (or maybe it does, only I'm not smart enough to figure it out..)

    Anything in particular I should be careful about the document class referencing?


  4. #4
    (1) You're not using Flex, right?

    (2) Is the class file in the same directory as the Flash file?

    (3) Also have a look at this link

  5. #5
    1. I'm not using Flex.
    2a. The FLA file resides in: VirtualZoo / src /
    2b. The .as files reside in: VirtualZoo / src / zoo /
    (Yes, I am following the Essential ActionScript 3.0 book by O'Reilly )
    3. Thanks for the link. I was aware of his post, but it unfortunately didn't clarify things. I'll try to get in touch with him as well

    Really appreciate all your help, Michael.

  6. #6
    Try this..... Publish Settings > Actionscript 3.0 Setting > Check "Automatically Declare Stage Instances"

  7. #7
    You need to declare your class Public

  8. #8

    same error but with FLEX

    ReferenceError: Error #1065: Variable is not defined.
    Notice there is a blank for the variable name. I have some classes imported, could it be the imported Classes? the classes being used are the flexmdi.

  9. #9
    i had totally the same error while public class declared etc all same setting.

    let me explain, and also the specific way i fixed it (might be specific for my project so sorry if it doesn't help you).

    so my setting was:
    - i was using Flex SDK swc file in FlashIDE source path, in order to use Flex [Embed] tag in my FlashIDE project.
    - i was embedding different fonts with the [Embed] tag

        import flash.display.Sprite;
        import flash.text.Font;
        public class MyCustomFonts
            [Embed(source="assets/Verdana.ttf", fontName="_Verdana", fontWeight = "normal", mimeType="application/x-font-truetype")]
            public static var _Verdana:Class;
            trace("_Verdana LOADED");
            [Embed(source = "assets/Verdana Bold.ttf", fontName = "_Verdana", /*fontWeight = "bold", */mimeType = "application/x-font-truetype")]
            public static var _VerdanaBold:Class;
            trace("_VerdanaBold LOADED");
    - okay thats the setting. Very specific and maybe you have different one.


    Now when the error occured and when not:

    - error did occur when - IN THE Document FLA file, i specified "MyCustomFonts" as Document class.

    - error didn't occur when - IN THE Document FLA file, i did NOT specify ANY Document class, but rather used actionscript and instantiated instance of that class using:
    var f:MyCustomFonts = new MyCustomFonts(); - that worked as expected;


    so i just described behavior, but from perception it seems there was some issue with the Document class connected with the FLA itself.

    Im just glad it works now, but if you find the true reason of the issue let us know!

    PS: one more thing to note: at some point, when the error was occuring, i started running some other FLA files that worked well before, and THE SAME ERROR WAS POPPING UP IN EACH ONE OF THEM . So i unplugged the flex swc, recompiled, same error in all files still (persistent biach). Restarted FlashIDE, with swc plugged in, recompiled - the other files were now working correctly, the MyCustomFonts was still displaying the error (weird!).
    Last edited by watcher; March 3rd, 2009 at 10:54 AM.

  10. #10

    Same Error Fixed

    Found the same Error.
    with lots of RnD my issue solved by changing the flash player requirement version in Flex Compiler. Try this out if you are working on Flex.
    - Right Click on the Project folder -> Properties -> Flex Compiler -> Require Flash Player version

    set it to 10.0.12 or any latest one.

  11. #11

    Found a fix for error #1065

    I ran into this error on a project recently, and actually managed to find a fix.
    Basically any file you are loading with the Loader class should have a constructor and if
    the file you are loading extends another class, it should have a super call in the constructor. Hope this helps some people that run into the same issue i had.

  12. #12
    Just posting in case some people run into a similar problem.
    I was building a project that used 'getDefinitionByName' runtime to find one of several possible classes and got the 'Error #1065' error.

    I had already instantiated a 'dummy' for each class in the class (so that the IDE would find the classes to be instantiated at runtime, otherwise it does not include them).

    But still I got the same error, what was the problem?
    It's quite a big project so the classes are all ordered in separate packages (different maps).
    So when I used the 'getDefinitionByName' it was not enough to just pass the classname, but I had to include the whole package-path, so:

    import myObjects.Client;
    private var dummy:Client;
    function makeObject(className:String):void{
      var class:Class = getDefinitionByName(className) as Class;
      var object:Object = new class(); 
    The first call to 'makeObject' would not work, but the second one would as my 'Client-class' was placed in the 'myObjects-folder'.

    I was building this project in the Flash IDE (not Flex), so that might have been the cause.
    Anyway hope it helps someone.

  13. #13
    Found this error when trying to use the flash.ui.MouseCursor that is only supported in FP10. I had my FLA publish settings at FP9. Also this swf was to be loaded into a higher level swf that had settings to FP9. Had to up that container to FP10 as well to get rid of the error.

  14. #14
    Animator / Actionscripter
    Quote Originally Posted by Jamal Soueidan View Post
    You need to declare your class Public

    This worked for me! ^.^ Thnx!

  15. #15
    I was getting this error... It took me 4 frustrating hours to find the problem. I had about 20-30 classes in my project. All the main ones seemed to be listed as "public", but a small minor one was missing the "public" statement and it caused an error for every single clip in my library and NOTHING would work.

    public class ListboxItem extends MovieClip { ...
    Extremely frustrating!! So check ALL your classes to make sure they're public! Hope this helps someone!


Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012