3 Replies Latest reply on Sep 7, 2010 2:21 PM by Flex harUI

    HTML and dispatching mouseEvents

    mortene

      Hi

       

      I'm using an mx.controls.HTML element to display webpages in an air-app however i have some problems with dispatching mouseEvents;

       

      I want to be able to manually dispath mouseEvents which flex should process as a usual mouseclick (i.e. when dispatched over a link on a webpage the HTML element should navigate to the link). So far i have not succeeded in doing this; my events can be caught if i listen for them however no interaction with the webpage is happening.

      I have tried dispatching from the HTML element:

       

      myHtmlElement.dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false, localX, localY));

       

      and i have tried using an eventDispatcher:

       

      var eventDispatcher:EventDispatcher = new EventDispatcher();

      eventDispatcher.dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false, localX, localY));

       

      Am i doing something wrong here? Or do any have an idea/solution to my problems?

       

      Regards

      Morten

        • 1. Re: HTML and dispatching mouseEvents
          Flex harUI Adobe Employee

          MouseEvents are notifications.  The underlying player does not process them.

          To navigate to a link, just call navigateToURL.

          • 2. Re: HTML and dispatching mouseEvents
            mortene Level 1

            Thanks for your answer! However I still can't get I right. Maybe I should explain a bit more.

             

            Im developing an air app to run with a multitouch screen. I am using an SDK from the manufactures of the screen that allow me to capture touch events such as MultiTouchEvent.DOWN, MultiTouchEvent.UP etc. These events however are not the native flex touch events.

             

            I want to be able to have users interact (touch links, button and so) with any website shown using the mx.controls.HTML by using these 'custom' touchevents. My initial approach was to redispatch these touchevents as mouseevents, but i guess thats not the way to go. Have you any ideas of how to accomplish this?

             

            Regards

            Morten

            • 3. Re: HTML and dispatching mouseEvents
              Flex harUI Adobe Employee

              You will need to determine the url referenced by the html and call

              navigateToURL or set the source of the control

              1 person found this helpful