A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: addEventListener not working on MC

  1. #1
    Member
    Join Date
    Jan 2008
    Posts
    82

    addEventListener not working on MC

    I'm trying to create a small whiteboard and I have a thin framed rectangle as a MovieClip. I want to add mouse event listeners for the drawing.
    I tried testing with the following code since nothing was working and I still get nothing (wh_bd is the MC):
    Code:
    wh_bd.addEventListener(MouseEvent.MOUSE_DOWN,msDown);
    function msDown():void
    {
    trace("down");	
    }
    No trace shows up.
    Anyone know what I might be doing wrong? Thanks in advance.

  2. #2
    Island Boy
    Join Date
    Apr 2006
    Posts
    655
    You are not passing the event into the function. Try using this.

    function msDown(e:MouseEvent):void
    {
    trace("down");
    }

  3. #3
    Member
    Join Date
    Jan 2008
    Posts
    82
    Yeah...I noticed this when I went back and looked at some other button event listeners. Stupid mistake on my part.
    Thanks for the reply nonetheless.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center