3 Replies Latest reply on Feb 4, 2011 11:11 AM by FTQuest

    RichEditableText with embedded images does not handle mouse events reliably

    ozDiGennaro Level 1

      I'm using Flash Builder "Burrito".  downloaded a couple of weeks ago.  Flash Player 10.1.85.3 debug version.


      I have the following MXML object:

       

      <s:Scroller

      width="100%" height="100%"

      xmlns:fx="http://ns.adobe.com/mxml/2009"

      xmlns:s="library://ns.adobe.com/flex/spark"

      xmlns:mx="library://ns.adobe.com/flex/mx"

      skinClass="components.skins.SxScrollerSkin"

      >

       

      <s:Group id="myGroup" width="100%" height="100%">

      <s:RichEditableText id="myRichText" >

      </s:RichEditableText>

      <!--- Do not set the height of the RichEditableText - since it seems to prevent the appearance of the vertical scroll bars -->

      </s:Group>

      </s:Scroller>


      With the following Actionscript to initialize, etc.

                  textContainer = new SxBorderContainer(name);
                  textContainer.dx = dxAvailable;
                  textContainer.dy = dyAvailable;

       

      scroller = new SxScroller();

      scroller.move(dxPadding,dyPadding);

      scroller.dx = dxAvailable

      scroller.dy = dyAvailable;

      textContainer.addElement(scroller);

       

      var richText:RichEditableText;

       

      richText = scroller.richText;

      richText.toolTip = toolTip;

      richText.enabled = true; // required for mouse click capture

      richText.selectable = true; // required for mouse click capture

      richText.width = dxAvailable

       

       

           var textFlow:TextFlow = TextFlowUtil.importFromString(textFlowString, WhiteSpaceCollapse.PRESERVE);

       

            richText.textFlow = textFlow;


      And the following code to catch events:

                      richText.addEventListener(FlowElementMouseEvent.MOUSE_DOWN,userMouseEvent);
                      richText.addEventListener(FlowElementMouseEvent.MOUSE_UP,userMouseEvent);
                      richText.addEventListener(FlowElementMouseEvent.CLICK,userMouseEvent);


      Here's the problem.   If I have embedded images in the TextFlow that is imported into the richText, I only catch "some" mouse clicks.  It's hard to know, but it seems that only mouse clicks into white space (between paragraphs) are caught.  Mouse up and down are caught, but not "click".  Very puzzling.

       

      TextFlow like this:

       

          <TextFlow>
            <div color="#442222" fontFamily="Times New Roman" fontSize="20" paragraphSpaceAfter="15" textIndent="15">
              <p>
                <span>
                  Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do:  once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, `and what is the use of a book,' thought Alice `without pictures or conversation?'
                </span>
              </p>
              <p>
                    <span>So she was considering in her own mind</span>
                    <img source="assets/library/alice/images/White Rabbit.png" height="auto" width="auto" float="left" />
                     <span> (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her.</span>
              </p>

      ...

       

      If there are no embedded imags, I get all clicks exactly.


      Is it a bug?  Am I missing something? 


      Thanks,

      Oz