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.
Description:
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.
Fix1:
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
Fix2:
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);
Thanks! That was exactly what I was looking for!
your site works better then advil..for my actionsript headaches
Adam, Dalton,
I am really happy that I can help. Thanks for the kind words.
Curtis J. Morley
home.addEventListener(MouseEvent.CLICK,homeClick); function homeClick(event:MouseEvent) { loader.source="home.swf"; }It comes up with error 1120 and not sure what is wrong with script
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.