2 Replies Latest reply on Sep 11, 2009 8:43 AM by SPGAnne

    will I be able to get rollover events on text in new TextArea component

    SPGAnne Level 1

      I can't tell from the documentation or forum posts I've looked at if the following will be possible in Flex 4 when it is released.

       

      I want to use a TextArea component and then assign text to the .htmlText property that will contain <a> tags in it.  I want to get roll over events ONLY (not click events) for words/phrases marked with the <a> tag.  Will this be possible?

        • 1. Re: will I be able to get rollover events on text in new TextArea component
          mewk Level 3

          hey spganne,

           

          i don't see an htmlText property for the s:TextArea class.

           

          however, flash recently rolled out the flashx.textLayout.elements package, which includes most of the elements commonly seen in html. The package has been ported into gumbo through the mxml tags <s:a>, <s:br>, <s:p>, <s:div>, etc.

           

          these new elements are supported by s:RichText (and by extension s:TextArea) and some of these elements (like LinkElement aka <s:a>) support events including the rollover event.

           

          more to read @:

          http://www.insideria.com/2009/06/utilizing-flash-text-layout-fr.html

          http://blog.flexexamples.com/2009/08/27/creating-a-linkelement-in-a-spark-richeditabletext -control-in-flex-4/

          http://livedocs.adobe.com/flex/gumbo/langref/spark/primitives/RichEditableText.html

          http://www.airia.cn/FLEX4API/livedocs/flashx/textLayout/elements/package-detail.html

           

          and my own little demo:

           

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/halo"
               minWidth="1024" minHeight="768">
               
               <s:TextArea horizontalCenter="0" verticalCenter="0" editable="false">
                    <s:p>
                    <s:a href="http://www.google.com"
                               rollOver="rot.play([bigBox])" rollOut="rot.stop()">
                         roll over me
                    </s:a>
                     to see the amazing blue ball do its thing.
                    </s:p>
               </s:TextArea>
               
               
               <fx:Declarations>
                        <s:Rotate id="rot" angleBy="10000"  duration="50000" autoCenterTransform="true" 
                        affectLayout="false" suspendBackgroundProcessing="true"/>
               </fx:Declarations>
               <s:Group id="bigBox" horizontalCenter="0" verticalCenter="0" width="450" height="450">
                    <s:Ellipse width="100" height="100"  horizontalCenter="0" top="0">
                         <s:fill>
                              <mx:SolidColor color="blue" alpha=".5"/>
                         </s:fill>
                    </s:Ellipse>
               </s:Group>
          
          </s:Application>
          
          • 2. Re: will I be able to get rollover events on text in new TextArea component
            SPGAnne Level 1

            Thanks very much for all the helpful links and your example too.  A follow on question if you don't mind.  I want my marked up text to be external in an xml file.  Currently, I just read it all in, store it in a string and then assign it like this: myTextArea.htmlText = myString;  Would I be able to do this with the new TextArea like this:  myTextArea.content = myString;  Also, will my mark up have to include the 's' in all the tags?  (i.e. <s:p> instead of just <p>?  Thanks again for your help. P.S.  I have not downloaded the beta of Flex 4 yet because I'm afraid of messing up my development environment, but I have been doing a lot of reading and studying of things so that I am ready to go as much as possible when it is released which I hope will be soon.