1120 Access of undefined property _.

You are attempting to access an undefined variable. For example, if the variable huh has not been defined, a call to it generates this error:

huh = 55;

This error can appear only when the compiler is running in strict mode.

ActionScript error #1120 means that an object “property” within Flash or Flex is not defined. But this doesn’t really help you fix it. One main reason for this AS3 Error is that you haven’t given the MovieClip or Button an instance name when you placed it on the stage in Flash. Another reason is that the reference is not correct.

Give your instance the proper instance name

Bad Example:

Flash properties dialog without an instance name Flash properties dialog without an instance name

Good Example:

Flash Properties Dialog with Instance Name Flash properties dialog with MovieClip instance name

Check that your reference is the proper instance name
Bad Code:

    myButon_btn.addEventListener(MouseEvent.CLICK, someFunction);

Good Code:

    myButton_btn.addEventListener(MouseEvent.CLICK, someFunction);

About Judah

Please note in the comments if this has helped you or not.
This entry was posted in Compiler. Bookmark the permalink.

5 Responses to 1120 Access of undefined property _.

  1. Adam says:

    Thanks! That was exactly what I was looking for!

  2. dalton says:

    your site works better then advil..for my actionsript headaches

  3. Curtis J. Morley says:

    Adam, Dalton,

    I am really happy that I can help. Thanks for the kind words.

    Curtis J. Morley

  4. Alex says:
    function homeClick(event:MouseEvent)

    It comes up with error 1120 and not sure what is wrong with script

    • Judah says:

      It could be a number of things. “home”, “loader”, “source” could all be properties that are not defined. You can possibly check using trace(home), trace(loader), trace(loader.source) etc at various locations before the lines of code and see if the value is “null” in the console or not. You can also do a check to see if a object has a property with code like this:

      trace("has property source? " + ("source" in loader));

      or more variations:

      if ("source" in loader)
      if (loader.hasOwnProperty("source")) 
      if ("loader" in this) 
      if (this["loader"]) 

      and so on…

      usually it’s something is spelled wrong in the code or your object is null and so trying to access the property on a null object is causing it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Highlight your code before posting code:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">