03.17.08
AS3 Error 1120
ActionScript 3 Error #1120: Access of undefined property myButton_btn.
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:
Good Example:
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);
This should help you fix Flash Error #1120.
As Always, Happy Flashing
Curtis J Morley
Adam said,
July 8, 2008 at 3:56 pm
Thanks! That was exactly what I was looking for!
A.
dalton said,
July 9, 2008 at 6:58 am
your site works better then advil..for my actionsript headaches
Curtis J. Morley said,
July 9, 2008 at 7:02 am
Adam, Dalton,
I am really happy that I can help. Thanks for the kind words.
Curtis J. Morley
Scott said,
August 5, 2008 at 3:07 pm
This still did not work for me Curtis. I have “FilmsBtn” in my instance name but it still says 1120: Access of undefined property FilmsBtn.
The code I am using is below. I am VERY new at this. Thanks.
stop();
FilmsBtn.addEventListener(MouseEvent.CLICK, FilmsPge);
function FilmsPge(event:MouseEvent):void {
gotoAndStop(61);
}
Brigs said,
August 17, 2008 at 11:57 pm
Hi There, great site, really straight forward to use. I’m not sure if you can help me but I have this error 1120 and my code looks like this:
about_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest(”about.html”),_self);
}
I promise you that I have named my instance properly but I am a novice. What I am trying to achieve is flash buttons (navigation) that link to html pages but open in one browser window. Do you know where I’ve gone wrong?
Cheers, Brigs
Curtis J. Morley said,
August 18, 2008 at 4:14 pm
Brigs,
I believe you when you say that you have the button named correctly. In this case the error is coming from the argument _self. As written, the code is expecting a variable named _self instead of the string “_self” just add the quotes and you will be fine.
navigateToURL(new URLRequest(”about.html”),”_self”);
Thanks,
Curtis J. Morley
Brigs said,
August 19, 2008 at 8:21 pm
Hi Curtis,
Thanks for your quick reply much appreciated. Unfortunately I haven’t quite achieved what I hoped.
I’ll try and explain myself better. I’ve been testing my pages in Firefox, Opera and Safari and Safari opens every html page in a new browser window while Firefox uses tabs in one window.
What I was hoping to do is is avoid tabs and have only one browser window for all html page to appear in? Have I created a problem by using my own flash buttons to link to Dreaweaver html pages?
Cheers, Brigs
Keith said,
August 20, 2008 at 7:32 am
Thanks Curtis
I was pulling out what little hair I do have left!
I cannot believe I forgot to name instance!
Much appreciated
Keith
Curtis J. Morley said,
August 20, 2008 at 12:09 pm
Keith,
You’re welcome. Glad I could help. It is always the little things that get overlooked.
Thanks,
Curtis J. Morley