1 Reply Latest reply on May 21, 2012 4:38 AM by Ned Murphy

    I have a weird problem.


      I have a problem that I just can't fix and/or find on the internet.I used to be able to just add an event listener but now I always get this error.

      **1120: Access of undefined property click_mouse.

      I started a new simple code to show you what I mean.This is my simplified code.

      **stage.addEventListener(MouseEvent.CLICK, click_mouse);

      I also tried it with SEVERAL other words.I have also tried

      **new MouseEvent(click_mouse);

      **var click_mouse:MouseEvent;

      **import flash.events.*

      I ensured that I was publishing it in as3 but other than that I dont know what to say.Oh in my other games where it worked....I typed the same code like for example in one of my games it said

      **Button7.addEventListener(MouseEvent.CLICK, clickbutton7);

      and I retyped it under it and I got no errors but when I changed it to

      **Button7.addEventListener(MouseEvent.CLICK, clickbutton1);

      it gave me the same previous error.

        • 1. Re: I have a weird problem.
          Ned Murphy Adobe Community Professional & MVP

          For the code you show, click_mouse and clickbutton1 need to be functions, not variables or properties.  Based on what you show of their use otherwise it looks like you are not using them properly.  What it should involve would be something like...


          // an event listener

          stage.addEventListener(MouseEvent.CLICK, click_mouse);


          // the event handler function for the listener

          function click_mouse(evt:MouseEvent):void {

                 // do stuff


          1 person found this helpful