# MOUSE\_DOWN, MOUSE\_UP events works only if I set the style to my SkinnableContainer

**URL:** <https://forum.kirupa.com/t/mouse-down-mouse-up-events-works-only-if-i-set-the-style-to-my-skinnablecontainer/322322>\
**Category:** flash\
**Created:** [May 18, 2011, 2:35am UTC](https://forum.kirupa.com/t/mouse-down-mouse-up-events-works-only-if-i-set-the-style-to-my-skinnablecontainer/322322 "2011-05-18T02:35:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpthk](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@cpthk](https://forum.kirupa.com/u/cpthk)\
**Post date:** [May 18, 2011, 2:35am UTC](https://forum.kirupa.com/t/mouse-down-mouse-up-events-works-only-if-i-set-the-style-to-my-skinnablecontainer/322322/1 "2011-05-18T02:35:02Z")

</div>

I am designing a physics container. Don’t worry, my question is not about the physics. Here is my code. Noticed that I have a SetStyle statement there. I realized that if I don’t have that line, the MOUSE\_DOWN, MOUSE\_UP events won’t work. If I do have that line, then those events works fine. Anyone know the reason?

```auto

package components
{
    import flash.events.MouseEvent;
    
    import spark.components.SkinnableContainer;
    
    public class Test extends SkinnableContainer
    {
        
        private var mouseDown:Boolean;
        public function Test()
        {
            super();
            //setStyle("backgroundColor", "0xBBBBBB");
            addEventListener(MouseEvent.MOUSE_DOWN, mouseDownEventHandler);
            addEventListener(MouseEvent.MOUSE_UP, mouseUpEventHandler);
        }
        
        
        private function mouseDownEventHandler(mouseEvent:MouseEvent):void {
            
            mouseDown = true;
        }
        
        
        private function mouseUpEventHandler(mouseEvent:MouseEvent):void {
            
            mouseDown = false;
        }
    }
}

```
