dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] MouseEvent Problem over Static Text

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Location
    Baltimore
    Posts
    18

    resolved [RESOLVED] MouseEvent Problem over Static Text

    Hi, I am just confounded at the moment with such a fundamental problem. Hoping some smart person out there on the interweb can help out a poor soul (such as myself )

    Setup: I have a Movie clip, 3 layers: (Whose class is ChangeShadow)
    Layer 3 --> a box MC with 0 alpha that covers the entire area. MC instance name: sense
    Layer 2 --> 1 word of static text,
    Layer 1 --> Background,

    Now I attach this to a parent and try to click. Which works *so long as I don't click on the static text* which then causes the button to malfunction. Why!!!????

    One other word -- I added the 3rd layer after experiencing the problem with just layer 1 and 2 -- figured it would solve the problem.... (although I honestly don't understand why it behaves this way with 2 layers either, since I am calling my MouseEvent on the reference to the ENTIRE clip.... not just the background (or was... ie changeShadow.addEventListener(.....) is what I used previously and exhibited same behavior)

    For Example:

    Code:
    import ChangeShadow // my "button class"
    	public class SkillLine extends MovieClip {
    		
    		private var csPointer:ChangeShadow;
    .
    .
    .
    .
    		private function addChange(myEvent:MouseEvent):void {
    			var changeShadow:ChangeShadow = new ChangeShadow(); // create new button
    			changeShadow.x = skillName.x;
    			changeShadow.y = skillName.y;  // position button
    			csPointer = changeShadow;  // save button reference for later
    			this.addChild(changeShadow); // add to display list
    			changeShadow.sense.addEventListener(MouseEvent.MOUSE_UP, executeChange);  // here's the problem! event listener only fires when not clicking on the static text in layer 2 of changeShadow
    			
    		}
    		
    		private function removeChange(myEvent:MouseEvent):void {
    			if (csPointer) {
    				csPointer.sense.removeEventListener(MouseEvent.MOUSE_UP, executeChange);
    				this.removeChild(csPointer);
    				csPointer = null;
    			}
    		}
    .
    ..
    .
    etc.
    -----------------------------------------------------------
    My Flash Games are at:
    http://www.tommygameco.com

  2. #2
    Junior Member
    Join Date
    Apr 2010
    Location
    Baltimore
    Posts
    18

    Solved

    There is nobody better at solving my problems than me -- and usually only after I've shown the world what an idiot I am.

    So -- here is what is wrong:

    I am using MOUSE_OVER instead of ROLL_OVER so the button is being added over and over while the cursor is moving over the button causing the strange behavior.

    Sorry
    Tom
    -----------------------------------------------------------
    My Flash Games are at:
    http://www.tommygameco.com

  3. #3
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Haha, I do that all the time.

    Mess around with my code for 2 hours, get sick of it, post a question, go back after posting and find out what's wrong.

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