CS4, AS3 error codes 1120 and 1061- no solution has worked

  • designer09
  • Born
  • Born
  • designer09
  • Posts: 1

Post 3+ Months Ago

I'm making a flash intro for my Web Site for my senior project (it's a must, despite the inconvenience to users). I'm using Flash CS4, Actionscript 3. I am making links for the intro, and there is an error for each link. Most of them have the error "1120: Access of Undefined Property" and one link has the error "1061:Call to a possibly undefined method."

I've looked into these errors on forums and have not found a solution. Most people have ideas of what it might be, but it appears that my errors are being caused by something else.

things I've tried...
1- putting actionscript in each of the link layers.
2- When I'm in the actions window, I have no errors. But when I debug the movie, an error for each link pops up.
3- button clickhandler and others have been used. neither works.
4- adding actionscript for each button where each button begins to appear

None of these solutions seem to fix my problem. Not even my professor can help me find a solution (she is unfamiliar with CS4.)

Here is my code:

ACTIONSCRIPT Code: [ Select ]
photography.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler3(event:MouseEvent):void{
navigateToURL (new URLRequest(""));}
resume.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler4(event:MouseEvent):void{
navigateToURL (new URLRequest(""));
contact.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler5(event:MouseEvent):void{
navigateToURL (new URLRequest(""));
home.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler(event:MouseEvent):void{
navigateToURL (new URLRequest(""));
graphics.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler2(event:MouseEvent):void{
navigateToURL (new URLRequest(""));
  1. photography.addEventListener(MouseEvent.CLICK, buttonClickHandler);
  2. function buttonClickHandler3(event:MouseEvent):void{
  3. navigateToURL (new URLRequest(""));}
  6. resume.addEventListener(MouseEvent.CLICK, buttonClickHandler);
  7. function buttonClickHandler4(event:MouseEvent):void{
  8. navigateToURL (new URLRequest(""));
  9. }
  12. contact.addEventListener(MouseEvent.CLICK, buttonClickHandler);
  13. function buttonClickHandler5(event:MouseEvent):void{
  14. navigateToURL (new URLRequest(""));
  15. }
  18. home.addEventListener(MouseEvent.CLICK, buttonClickHandler);
  19. function buttonClickHandler(event:MouseEvent):void{
  20. navigateToURL (new URLRequest(""));
  21. }
  24. graphics.addEventListener(MouseEvent.CLICK, buttonClickHandler);
  25. function buttonClickHandler2(event:MouseEvent):void{
  26. navigateToURL (new URLRequest(""));
  27. }

Note: ignore that new URLRequest is empty. The forum wouldn't let me post the links. "graphics.addEventListener" has error 1061. All of the others have error 1120.

Thanks again, hope someone can help me!
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23469
  • Loc: Woodbridge VA

Post 3+ Months Ago

Well, for starters your 1064 error is legit.
In all your listeners you set your function to buttonClickHandler, but you named your functions buttonClickHandler2 (3, 4, etc). for each of your buttons.

ACTIONSCRIPT Code: [ Select ]
graphics.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler2(event:MouseEvent):void{
navigateToURL (new URLRequest(""));
  1. graphics.addEventListener(MouseEvent.CLICK, buttonClickHandler);
  2. function buttonClickHandler2(event:MouseEvent):void{
  3. navigateToURL (new URLRequest(""));

Essentially you've made the same mistake with all of your event listeners. The buttonClickHandler paramater is the same for all your listeners, yet your functions are all different. The function parameter for each listener needs to be the same name as the function you are calling in your listeners.

It's hard to tell you exactly what you are doing wrong but that's a start. An example of a properly coded URLRequest in AS 3 would be more along the lines of this

ACTIONSCRIPT Code: [ Select ]
var link:URLRequest = new URLRequest("http://www.mydomain.com"); //i.e. equate the URL with a variable you can use later.
your_button_instance_name.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
your_button_instance_name.buttonMode = true;
  1. var link:URLRequest = new URLRequest("http://www.mydomain.com"); //i.e. equate the URL with a variable you can use later.
  3. your_button_instance_name.addEventListener(MouseEvent.CLICK, onClick);
  5. function onClick(event:MouseEvent):void
  6.      {
  7.           navigateToURL(link);
  8.      }
  9. your_button_instance_name.buttonMode = true;

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 7 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.