Skip to main content
Participant
October 21, 2009
Answered

How to trigger a MouseEvent from TLF, my test doesn't work

  • October 21, 2009
  • 1 reply
  • 1025 views

  Hi,

      I run into a problem while using the Listener of TLF,

      Inside  the  TextFlow,  I have several Paragraphs.

      What I wish to accomplish is to trigger a mouse Event, like ROLL_OVER, ROLL_OUT event , when  my mouse is over a on one of the Paragraphs.

      I used to experiment a while , but never seem to work, just the examples below

      _textFlow.addEventListener(FlowElementMouseEvent.ROLL_OUT,onMouseHandler);

      _textFlow.addEventListener(FlowElementMouseEvent.ROLL_OVER,onMouseHandler);

       ///   which doesn't work.         i need the event response ,so i can manipulate the paragraph

private function onMouseHandler(e:FlowElementMouseEvent):void

{

     trace("onMouseHandler" +  e.type  );

     var para:ParagraphElement = e.flowElement.getParagraph();

     trace(para.textLength);

}  

Thanks  in   advance!!!

This topic has been closed for replies.
Correct answer rdermer

You'll need to call getEventMirror on each child of the ParagraphElement and than add a MOUSE_OVER listener to i the returned EventDisplatcher.  getEventMirror is currently in the tlf_internal namespace.

Hope that helps,

Richard

1 reply

rdermerCorrect answer
Adobe Employee
October 21, 2009

You'll need to call getEventMirror on each child of the ParagraphElement and than add a MOUSE_OVER listener to i the returned EventDisplatcher.  getEventMirror is currently in the tlf_internal namespace.

Hope that helps,

Richard

helxszAuthor
Participant
October 22, 2009

thanks rdermer,   I will try this.

helxszAuthor
Participant
October 22, 2009

  I encountered a error,  which is  Error #1069: Property http://ns.adobe.com/textLayout/internal/2008::getEventMirror not found on flashx.textLayout.elements.ParagraphElement and there is no default value ,  in the position of my code --   paraElement.tlf_internal::getEventMirror().addEventListener(MouseEvent.CLICK, regionClickHandler);

  I could not figure out what is wrong with my code, so confused ' cause i have added two lines like :

import flashx.textLayout.tlf_internal

  use namespace  tlf_internal

  I think it is already enough for this.  but obviously something went wrong !!

  Please give me a hand, my code is in the attach file