5 Replies Latest reply on Oct 12, 2011 2:54 AM by mushmut

    PreventDefault MouseDown on a mobile IconItemRenderer

    mushmut Level 1

      Hi,

       

      I trying to cancel the mouseDown on custom itemrenderer that extends IconItemRenderer when it's on a certain state.

       

       

       

      I add a state that named 'control'

       

                    _controlState = new State()

                                    _controlState.name = 'control'

                                    _controlOverride = new Array()

                                    var requestAddChild:AddChild = new AddChild(this,_requestIndicator)

                                    var controlAddChild:AddChild = new AddChild(this,_controlLabel)

       

                   

                     var downEventHandler:SetEventHandler = new SetEventHandler(this,MouseEvent.MOUSE_DOWN)

                     downEventHandler.target = this

                     downEventHandler.handlerFunction = controlDownHandler

                     this.states.push(_controlState);

       

      and the controlDownHandler function follow

       

                     protected function controlDownHandler (e:MouseEvent):void {

       

                                              e.preventDefault()

                               e.stopPropagation()

                                              //dispatchEvent(new DataRequestEvents(DataRequestEvents.DATA_REQUEST,true))

       

                               }

       

       

      But the default MOUSE_DOWN event are not stoped. I've also tryed to simply add an EventListener.

       

      I've alos tried to simply add an event listener inside overriden method createChildren:

       

                this.addEventListener(MouseEvent.MOUSE_DOWN,controlDownHandler

       

               

                protected function controlDownHandler (e:MouseEvent):void {

       

                               if (!dragging){

                                    e.preventDefault()

                                    e.stopPropagation()

                                    //dispatchEvent(new DataRequestEvents(DataRequestEvents.DATA_REQUEST,true))

                               }

       

                    }



      But, in this case, i can't drag the list up or down

       

      Is there a way to reach this goal ?

      Thank for helping .