Skip to main content
A_Shiyaz
Known Participant
February 19, 2010
Question

Event propagation across TLF?

  • February 19, 2010
  • 1 reply
  • 740 views

Hi,

How to propagate an event through TLF or, how to 'disable' a TLF? I have a MovieClip with click events beneath a dynamic TLF text. How do I propagate events accross to that MovieClip?

Why is any of the following doesn't work on the Sprite which holds the TLF?

tlf_sp.mouseEnabled = false;
tlf_sp.buttonMode = false;
tlf_sp.mouseChildren = false;

Regards,

Shiyaz

This topic has been closed for replies.

1 reply

Inspiring
February 20, 2010

mouseEnabled disables mouse events to the TLF container but not its children so the TextLines will get events unless mouseChildren is false.

mouseChildren false with mouseEnabled true will still let events go to the container and TLF will see those events and find hit locations.

To cause TLF to ignore all mouse events in a container you will want to set them both to false.

buttonMode is kind of interesting - I just ran some tests with it - if TLF has an editManager or a selectionManager it will set its own cursor so buttonMode will be ignored.  If there is no interactionmanager then buttonMode controls the cursor.  Note: in top to bottom text tlf doesn't set the cursor so buttonMode always controls the cursor.  I don't think we investigated buttonMode so how it works is coincidental and may change.

Hope that helps,

Richard

A_Shiyaz
A_ShiyazAuthor
Known Participant
February 22, 2010

Thanks for the pointers Richard, I was able to fix the issue. I did notice my mistake. Earlier, I was applying (false) mouseEnabled and mouseChildren to the Sprite which contains the TLF (the first parameter to the ContainerController). However, I needed to apply them to the Sprite which held the TLF Sprites. Further, the buttonMode = false; was not required, though it is interesting to experiment the behaviour.

Pseudo code below:

textFlow = new TextFlow();
simpleText = someXML;
textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
tlf_sp = new Sprite();
textFlow.flowComposer.addController(new ContainerController(tlf_sp, someWidth, someHeight));
tlf_sp.x = someX;
tlf_sp.y = someY;
textFlow.flowComposer.updateAllControllers();
container_mc.addChild(tlf_sp);

//tlf_sp.mouseEnabled = false;  //-- Did not work
//tlf_sp.buttonMode = false;    //-- Not needed
//tlf_sp.mouseChildren = false; //-- Did not work

//-- Both are needed. Will fail if either one is TRUE.
container_mc.mouseEnabled = false;
container_mc.mouseChildren = false;

Regards,

Shiyaz